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
This commit is contained in:
Willie
2026-10-05 15:51:40 +08:00
committed by GitHub
parent 72ed5ba0fb
commit 8879d445ab
2 changed files with 18 additions and 1 deletions
+3 -1
View File
@@ -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
+15
View File
@@ -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")
}
}