fix: doctor false-positive on managed-block hooks, setup output polish#110
Merged
Conversation
#102, #105, #106) - doctor(#102): compare only the managed block portion of on-disk hooks instead of the full file; user content above/below the klasp block no longer triggers a spurious schema-drift FAIL for Codex installs - setup(#106): emit --dry-run banner before gate-count line so it's clear no I/O will happen before any output is printed - setup(#105): call render_plan_no_next in setup so the "Next: klasp init" footer doesn't appear after setup already ran init Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Contributor
Author
Code reviewSummary: Three targeted bug fixes with regression tests. No new abstractions beyond what the fixes require.
Critical: none Suggestions: none Verdict: 🟢 all-green |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Author
Review remediationStep 10 (triage-followups) skipped — code-review returned 🟢 all-green with zero validated findings. No deferred issues. No fixes required. |
This was referenced May 10, 2026
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.
Summary
check_hookpreviously compared the full on-disk hook file byte-for-byte againstrender_hook_script, which always returns a fresh-install layout (shebang + blank + managed block). When a user already had content in.git/hooks/pre-commit,installcorrectly appended the managed block after that content — butdoctorthen flagged schema drift because the full files don't match. Fix: extract only the managed block portion from bothactualandexpected(by scanning forMANAGED_START/MANAGED_ENDmarkers) and compare those. Byte-equality is still tried first for surfaces without managed blocks (Claude Code).--dry-run modeprintln before theklasp setup — detected N gate(s)line so users immediately know no I/O will occur.render_planwas called in setup, which appends a "Next:" footer suggestingklasp init— but setup already ran init. Switched torender_plan_no_next(added in this workspace) for the setup code path.Test plan
cargo test --package klasp -- doctor_codex_hook_with_user_content_above_block_exits_0— previously failed, now passescargo test --package klasp— 501 passed, 0 failedcargo test --package klasp --test setup— 12 passedcargo test --package klasp --test doctor— all doctor tests pass🤖 Generated with Claude Code