Repository navigation
Conversation
kit_render_install_toml was handed src == dst under README Option 2 (clone to ~/.claude/dwarves-kit, install from there). The shell truncated dst before awk opened src, so one install run reduced a 160-line, 9-section kit.toml to a 12-line header stub -- awk reading back the header echo had just written into the same file. Every non-[modules] key then fell through to caller defaults, silently: no error, no warning. Render to $dst.tmp.$$ and mv into place. Every existing case in test-install-modules.sh installs from the checkout into a temp HOME, so src != dst and the bug was invisible to CI. Adds an NC in-place layout case (6 checks) that reproduces the documented user layout; verified to fail 6/6 against the unfixed install.sh. Proof: docs/verification/install-toml-self-clobber.md Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Context: this PR fixes bug 1 of the three reported in #359 — all three share the same |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
install.shsilently reduces the kit-rootkit.tomlfrom 160 lines / 9 sections to a 12-line header stub — on the layout README Option 2 documents.kit_render_install_toml "$KIT_DIR/kit.toml" "$KIT_TOML"(L672) gets the same path twice when the kit is cloned to~/.claude/dwarves-kitand installed from there:KIT_DIRis$CLAUDE_DIR/dwarves-kit. The shell truncates> "$dst"beforeawkopenssrc;echowrites the header into the now-empty file;awkopens the same path, reads back that header, and passes it through its catch-all{ print }— which is why the stub carries the header twice from a single run.Fallout: every non-
[modules]key stops resolving.kit_config_get mega.wave_cap→ empty instead of2,gate.understanding_gate→ empty instead oftrue. Nothing errors, because each caller passes its own default — the config layer just quietly stops existing.Fix
Render to
$dst.tmp.$$, thenmvinto place, so truncation cannot precede the read. The comment above the function says why the indirection is load-bearing, so nobody "tidies" it back.Why CI missed it
Every existing case in
tests/test-install-modules.shinstalls from this checkout into a tempHOME:so
src != dstand the truncation is harmless. The one shape never exercised was the shape the README tells users to use.This PR adds an
NC in-place layoutcase that copies the kit into$H5/.claude/dwarves-kitand installs from there, asserting:[modules][ledger][mega][gate][features][sync]) surviveskit_config_get mega.wave_capstill resolves to2[modules]is still recomputed from this run's--with, not merely copied throughVerification
Full run-table in
docs/verification/install-toml-self-clobber.md.tests/test-install-modules.shwith fixinstall.shstashed to the buggy versiontest-install-compat.sh/test-install-contract.sh/test-install-clis.shPASS=4 FAIL=0/ all 20 passedtest-config.sh/test-reserved-config-guard.sh/test-sync-cron-install.shThe negative control is the load-bearing row: against the unfixed
install.shall 6 new checks fail with the exact clobber signature (160 -> 12 lines,header ... got 2,mega.wave_cap=<unset>), so the test cannot pass vacuously.tests/test-config-registry.shreports 17/19 both with and without this change (0 orphans on the live tree,TIER4_CLOSE strips the annotation) — pre-existing on a clean1f7209c, not touched here.Note for anyone already affected
kit.tomlis tracked, so a clobbered install repairs without a reinstall:git -C ~/.claude/dwarves-kit checkout -- kit.tomlFound on macOS, kit
892d25c(v2.0.0); reproduced on1f7209c.🤖 Generated with Claude Code