fix(doctor): do not block init on unresolvable inject executable - #251
Merged
Conversation
checkInjectRuntime reported 'fail' with needsAttention=true when the configured PreToolUse hook executable was not resolvable from PATH (ENOENT). This caused init's final doctor step to exit 1 in any CI environment that had not installed commitlore system-wide, making tests that assert a clean exit intermittently flaky. The fix: checkInjectRuntime now overrides needsAttention to false for the ENOENT case after evaluateInjectRun returns, preserving the 'fail' status (so standalone doctor still surfaces the finding for actionability) while preventing init from treating a missing system binary as a blocking finding. This is analogous to how checkRefspec overrides needsAttention for 'no remote': an incomplete environment, not a misconfiguration. Closes #221, closes #192. Limit: checkInjectRuntime ENOENT does not block init Record-Id: r-flake221fix Ruled-out: downgrade evaluateInjectRun to warn | doctor.test.ts integration test asserts status=fail for ENOENT Ruled-out: remove trailers from init.test.ts repoWithRemote | weakens inject-probe test coverage without addressing the semantic defect Blast: local
CommitLore — record lintTrailers: clean — 1 commit in Active constraints for the paths this PR touchesLimits (55)
Ruled out (100)
Warnings (41)
Trailer violations fail this check. Active constraints are informational — they are what the repository already decided, not a verdict on this PR. |
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
Fixes #221 and #192 — one defect, two symptoms.
Both tests in
test/init.test.tsthat fail intermittently in CI have the same root cause:checkInjectRuntimeindoctor.tsreportedfailwithneedsAttention=truewhen the configured PreToolUse hook executable (commitlore) was not resolvable from PATH (ENOENT). This causedinit's final doctor step to exit 1 in any CI environment where the test's temporarycommitlorescript was not found byspawnSync's PATH resolution.The fix
checkInjectRuntimenow overridesneedsAttentiontofalsefor the ENOENT case afterevaluateInjectRunreturns. This preserves:failstatus (so standalonedoctorstill surfaces the finding)While preventing
initfrom treating a missing system binary as a blocking finding that the user must fix before the repository is usable.This is semantically analogous to how
checkRefspecoverridesneedsAttentionfor the 'no remote' case: an incomplete environment rather than a misconfiguration.Verification
runIniton a repo with recorded paths but nocommitloreon PATH → before fix exits 1, after fix exits 0test/init.test.ts+test/doctor.test.tspasstsconfig.json,bench/tsconfig.json)