Skip to content

Commit 0601c2a

Browse files
test(sync): compare positron shadow parity
Positron is shadow-compared on this branch, so the migration needs source-level evidence that provider observation still matches the legacy parser path sync currently trusts. Cover a workspace-backed JSONL source through ObserveProviderSource and compare session output, messages, and data-version planning against ParsePositronSession. Validation: go test -tags "fts5" ./internal/parser ./internal/sync -run 'TestObserveProviderSourceMatchesPositronLegacyParser|Test(DiscoverPositronSessions|PositronProvider|SyncPathsPositron|SyncAllPositron|SyncAllSincePositron)' -count=1; go test -tags "fts5" ./internal/parser ./internal/sync -count=1; go fmt ./...; go vet ./...; ./custom-gcl run --config .golangci.nilaway.yml ./internal/parser/... ./internal/sync/...; git diff --check
1 parent 4889ae1 commit 0601c2a

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package sync
2+
3+
import (
4+
"context"
5+
"path/filepath"
6+
"testing"
7+
8+
"github.com/stretchr/testify/assert"
9+
"github.com/stretchr/testify/require"
10+
11+
"go.kenn.io/agentsview/internal/parser"
12+
)
13+
14+
func TestObserveProviderSourceMatchesPositronLegacyParser(t *testing.T) {
15+
root := t.TempDir()
16+
sessionID := "positron-shadow"
17+
hashDir := filepath.Join(root, "workspaceStorage", "workspace-hash")
18+
chatDir := filepath.Join(hashDir, "chatSessions")
19+
sourcePath := filepath.Join(chatDir, sessionID+".jsonl")
20+
writeProviderShadowSourceFile(
21+
t,
22+
filepath.Join(hashDir, "workspace.json"),
23+
`{"folder":"file:///Users/alice/code/positron-app"}`,
24+
)
25+
writeProviderShadowSourceFile(t, sourcePath, vscodeCopilotShadowFixture(sessionID))
26+
27+
provider, ok := parser.NewProvider(parser.AgentPositron, parser.ProviderConfig{
28+
Roots: []string{root},
29+
Machine: "devbox",
30+
})
31+
require.True(t, ok)
32+
sources, err := provider.Discover(context.Background())
33+
require.NoError(t, err)
34+
require.Len(t, sources, 1)
35+
36+
legacySession, legacyMessages, err := parser.ParsePositronSession(
37+
sourcePath, "positron-app", "devbox",
38+
)
39+
require.NoError(t, err)
40+
require.NotNil(t, legacySession)
41+
42+
observation, err := ObserveProviderSource(context.Background(), provider, ProviderObserveRequest{
43+
Source: sources[0],
44+
Machine: "devbox",
45+
})
46+
require.NoError(t, err)
47+
require.Len(t, observation.Results, 1)
48+
legacySession.File.Hash = observation.Fingerprint.Hash
49+
50+
assert.Equal(t, *legacySession, observation.Results[0].Session)
51+
assert.Equal(t, legacyMessages, observation.Results[0].Messages)
52+
assert.Equal(t, []string{legacySession.ID}, observation.Planned.DataVersionSessionIDs())
53+
assert.Empty(t, observation.Planned.Diagnostics)
54+
}

0 commit comments

Comments
 (0)