返回 DeepSeek-Reasonix
historical_reconciliation_visibility_test.go
根目录 / desktop / historical_reconciliation_visibility_test.go
1 package main
2
3 import (
4 "path/filepath"
5 "reflect"
6 "testing"
7 )
8
9 func TestHistoricalCompletedReceiptIndexPreservesVersionEvidence(t *testing.T) {
10 ledger := desktopMigrationLedger{Records: map[string]desktopMigrationRecord{
11 "complete": {Status: "completed"},
12 "version:review:fingerprint": {Status: "completed"},
13 "interrupted": {Status: "pending", PreviousCompletion: &desktopMigrationReceipt{TargetSessionID: "old-target"}},
14 "unfinished": {Status: "pending"},
15 }}
16 want := map[string]bool{"complete": true, "version": true, "interrupted": true}
17 if got := historicalCompletedReceiptKeys(ledger); !reflect.DeepEqual(got, want) {
18 t.Fatalf("receipt identities: %v", got)
19 }
20 }
21
22 func TestHistoricalUnavailableHeadHiddenByBothSidebarAdapters(t *testing.T) {
23 isolateDesktopUserDirs(t)
24 path, _, head := migrationSingleDAGFixture(t)
25 app := newHistoricalLifecycleApp(t)
26 installSessionCatalogForTest(t, app, filepath.Dir(path), "global", "")
27 key := desktopSourceKey(path, head)
28 c := &app.historicalImports
29 c.mu.Lock()
30 c.initialize(t.Context())
31 c.sources[key] = historicalSource{path: path, head: head, format: "legacy", scope: "global"}
32 c.unavailableSources[key] = true
33 c.mu.Unlock()
34 req := ProjectTopicPageRequest{Scope: "global", Limit: 50}
35 page, err := app.ListProjectTopics(req)
36 if err != nil || len(page.Items) != 0 {
37 t.Fatalf("lazy adapter advertised unavailable head: %+v %v", page.Items, err)
38 }
39 page, err = app.unadoptedLegacyTopics(req, map[string]bool{}, map[string]bool{})
40 if err != nil || len(page.Items) != 0 {
41 t.Fatalf("materialized adapter advertised unavailable head: %+v %v", page.Items, err)
42 }
43 }
44
44 lines GO