Commit Graph
1 Commits
Author SHA1 Message Date
ggbdpq 71f26a600f library: a save drops an empty applied entry (#4247)
What changed: a sync that only looked at an agent — its hooks, its
subagents, its MCP file, with nothing of the library's to give it —
still took an empty applied entry into library.json, one per agent,
growing at every start ({"claude":{}}, then {"claude":{},"codex":{}}).
The syncs make the entry the moment they look (l.applied(id)), and the
step's save wrote it out. A save now drops an entry with nothing in it,
and keeps every entry that holds something. A file otherwise unchanged
is left alone by the write under it (edit.WriteAtomic), so a sync with
nothing to give anyone no longer writes library.json at all — the
single write a field-showing command of the CLI's was seen to bring
into the HOME a test held, red once on Linux (TestEveryAgentFieldName
WritesNothing).

Run:
- go test -tags nogui ./internal/library -run 'TestSaveDropsEmptyApplied|TestSyncAloneLeavesNoEmptyApplied' -count=1
- go test -tags nogui -count=1 -timeout 45m ./internal/cli ./internal/agent ./internal/library
- go vet ./... and GOOS=linux/windows go vet -tags nogui ./...; builds for the three
  systems (linux and windows with -tags nogui)

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-01 10:22:56 +08:00