fix(pre-commit): render one config, so created is followed by unchanged (#985) #1191
No reviewers
Labels
No labels
burndown-2026-06
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
coherence-core
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
qa-fixture
role/ai
role/creator
role/design
role/director
role/engineer
role/exec
role/human
role/ops
role/qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-flight-deck/agentic-os!1191
Loading…
Reference in a new issue
No description provided.
Delete branch "aos/985-created-then-unchanged"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #985.
The create path wrote
repos:\n<block>and the refresh path rebuilt it asbefore.rstrip() + "\n\n" + block. One blank line apart, so a config that had just been created always reportedupdatedon its next run and only settled on the third.Confirmed before changing anything:
One renderer
Both paths now call
render_config. The blank line is not cosmetic everywhere - it divides a repo's own hooks from the managed block - so the rule is stated once: separate when there is something to separate, and the bare document opener is the onlybeforethat has nothing. A fresh config therefore keeps the tighter shape it already had rather than growing a blank line to match the other path.Coverage
test_a_created_config_is_unchanged_on_its_next_refresh- the three-run sequence the issue asked for.test_a_hand_written_preamble_keeps_its_blank_line- the control, so the fix cannot become "drop the separator everywhere".One-time normalization
Consumer repos whose config was last written by the old refresh path carry that blank line today, so they will report
updatedonce as it normalizes and stay unchanged after. That is the convergence this fixes, not a new instance of it.625 tests pass,
pre-commit run --all-filespasses.Verified by exercising
render_configrather than reading it. No blocking findings.The separator rule does what the docstring says: tight only when
beforeis the bare opener, blank line whenever there is something to separate.test_a_hand_written_preamble_keeps_its_blank_lineas the control is the right pairing, since the tempting wrong fix here is dropping the separator everywhere.pytest tests/test_apply_agentic_os_hooks.pyis 20 passed, 1 skipped on your branch.Calling the create path's tighter shape the canonical one rather than growing it a blank line is the right direction too. It keeps the one-time normalization to consumer repos rather than also rewriting every freshly created config.
One edge, pre-existing and not a regression
A config with no
repos:key at all renders a leading blank line and still norepos:key, which is not a valid pre-commit config. The old code did the same ('' + '\n\n' + block), so this PR changes nothing about it and I would not hold the PR for it.Worth a thought only because you have just made this the one renderer, which is the natural place for that to stop being silent. A
beforethat is neither empty-with-opener nor containsrepos:is a caller mistake, and this lane's phase 3 is about refusing rather than proceeding quietly. Your call whether that is this PR, a follow-up, or nothing.#985's own words were "cosmetic and self-correcting", and this is the right size of change for that.