From 8879d445ab847bf350594e601384e57f2bd0d17b Mon Sep 17 00:00:00 2001 From: Willie Date: Mon, 5 Oct 2026 15:51:40 +0800 Subject: [PATCH] fix(status): require a source fingerprint for extension outputs (#416) Extension outputs were matched to an agent by stem alone. A plain copy that sync tracked before the target enabled an extension (reviewer.md) passed for the converted output, so status, doctor, diff and the Sync tab reported the target in sync while the next sync would write reviewer.toml and prune the copy. Only a transform records a source fingerprint, so an output without one is no longer counted as converted. Outputs written before fingerprints existed (before 0.24.5) show as pending until the next sync, which is what they were already reported as before #392. Refs #415 --- internal/sync/agent_sync.go | 4 +++- internal/sync/filelink_test.go | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/internal/sync/agent_sync.go b/internal/sync/agent_sync.go index ab77e45a9..8ce26957a 100644 --- a/internal/sync/agent_sync.go +++ b/internal/sync/agent_sync.go @@ -325,7 +325,9 @@ func ExtensionOutputStatus(targetDir string, agents []resource.DiscoveredResourc continue } rel := filepath.FromSlash(key) - if copies.owns(rel) && copies.sourceMatches(rel, a.AbsPath) { + // Only a transform records a source fingerprint; a tracked plain + // copy left from before the extension was enabled has none. + if _, converted := copies.m.Sources[key]; converted && copies.owns(rel) && copies.sourceMatches(rel, a.AbsPath) { used[key] = true synced[i] = true break diff --git a/internal/sync/filelink_test.go b/internal/sync/filelink_test.go index 2d3d1f2c4..dc3665dae 100644 --- a/internal/sync/filelink_test.go +++ b/internal/sync/filelink_test.go @@ -415,3 +415,18 @@ func TestExtensionOutputStatus_ReportsOrphanOutputs(t *testing.T) { t.Errorf("orphans = %v, want [tutor.toml]", orphans) } } + +// Refs #415: a plain copy tracked before the extension was enabled has no +// source fingerprint, so it must not pass for a converted output. +func TestExtensionOutputStatus_PlainCopyIsNotConverted(t *testing.T) { + src, tgt, agents := agentFixture(t) + if _, err := SyncAgents(agents, src, tgt, "copy", false, false, ""); err != nil { + t.Fatal(err) + } + + synced, _ := ExtensionOutputStatus(tgt, agents) + + if synced[0] { + t.Error("tracked plain copy tutor.md counted as a converted output") + } +}