Repository navigation
Keep tackroom.yaml formatting when a command edits it - #293
Conversation
|
Sorry @yourconscience, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 1 day and 6 hours by commenting |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Reviewer's GuideImplementationPreserve explicitly written empty plain-list values during typed merges, avoid adding empty-list keys that were absent, and retain comments when replacing values.
Reconcile re-encoded YAML with the original text so unchanged data keeps its formatting and changed stretches retain edge blank lines, while validating that the result preserves the re-encoded data.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
What and why
tackroom.yamlis a hand-edited file kept in git. Any command that edited it (skill sources add,mcp addandremove,config set,setup, the web view's edits) re-serialised the whole file, so the diff showed far more than the change:hooks: [], was deleted together with the comment above it;agents: []was added to hook and MCP entries that did not have the key.Found in the pre-release test of the 3.0 line; 2.8.0 behaves the same.
After this change a command touches only the lines of the entry it adds, changes or removes. One file changes,
internal/app/config_document.go:[]read back the same; pointer fields (packages,ui) behave as before. A comment on a replaced value is kept.keepFileFormat). The old and new text are compared line by line. A changed stretch whose old text decodes to the same YAML data gets its old text back, and a stretch that really changed keeps the blank lines around it. CRLF line endings and a missing final newline follow the original. Every candidate is checked against the decoded data of the re-encoded output, and the function falls back to the re-encoded text when they differ, so formatting can never change the data written.The web view's raw save is unchanged and stays byte-exact.
Side effect: a fresh
tackroom setupnow writes the startertackroom.yamlas it ships, with the detected agents filled in. It keepshooks: [], its blank lines and the# populated by tackroom setupcomment, and no longer addsmcp_servers: [], which the old writer added by accident.Not covered, and the same as before:
|block scalar becomes|-and a missingenabledis written out. That is a data change in YAML terms, so the text pass keeps it.The 3.0 release note for this comes with the docs PR that collects the notes for the pre-release fixes.
How I checked it
go build,go vet,go test ./...pass; lint reports 0 issues. No test was deleted.mainand one from this branch, in throwaway homes.config printread back by themainbinary is identical in every case, andconfig validateaccepts every result:mainconfig set hooks/lint/enabled falseconfig set hooks/notify/enabled falsemcp add web --command ...skill sources add --all --no-sync file://...mcp remove docsconfig set hooks/lint/enabled true(no change)Running each command a second time leaves the file byte-identical.
On the file from the test report,
skill sources addnow changes only theexternal_skillsblock, and# Hooks live here (none yet)withhooks: []stays.CRLF files, a file with no final newline, and a write to
tackroom.local.yamlwere exercised by the worker's case runner with the same result.Not run: the web view's edit path in a browser (it uses the same code as
config set), andmcp import.go test ./...andgo vet ./...passI can explain this change without an AI tool
Summary by Sourcery
Preserve tackroom configuration formatting and comments while limiting command-generated diffs to the data that actually changes.
Bug Fixes:
Enhancements: