Repository navigation
fix(#802,#808): doctor.sh git-toplevel fallback, deflake fast-run duration test - #810
Merged
Merged
Conversation
…n duration test scripts/doctor.sh resolved CLAUDE_PROJECT_DIR with a raw $PWD fallback at both the --json and human-readable report sites when the variable was unset. A `cd` into a subdirectory earlier in the same shell call made the report silently resolve project root as that subdirectory instead of the real top level -- the same shape #743 fixed in write-handoff.sh. Both sites now prefer `git rev-parse --show-toplevel`, falling back to $PWD only outside a git repo. tests/test_session_start_duration_706.py's "a fast run stays quiet" assertion depended on the real session-start hook finishing under the default 5s threshold. A loaded CI runner (observed on windows-latest) can exceed it, making the hook correctly surface the duration and flaking the test. The test now pins the threshold high (600s) instead of relying on wall-clock speed, matching the pattern its own positive control already used. Adds tests/test_doctor_pwd_root_802.py (subdirectory + positive-control cases for both doctor.sh report paths) and a windows-skip-triage.md row for it. Closes #802 Closes #808 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Self-review finding (Explore reviewer): the comment above the fallback and the WARN line's own wording still said "the current directory" after the fix started preferring the git top level there. The resolved value was already correct; only the description of it had gone stale. Fixed to say "the git top level (or the current directory...)" in the comment and drop the now-inaccurate "the current directory" phrase from the WARN text. Co-Authored-By: Claude Sonnet 5 <[email protected]>
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.
What
scripts/doctor.shresolvedCLAUDE_PROJECT_DIRwith a raw$PWDfallback at two sites (the--jsonreport path and the human-readable report path) whenCLAUDE_PROJECT_DIRwas unset -- the same shape release-audit: write-handoff.sh roots resolution at stale PWD when CLAUDE_PROJECT_DIR is unset, notes land where SessionStart never reads them (fails-to-preserve, observed in scratch) #743 fixed inwrite-handoff.sh. Both sites now prefergit rev-parse --show-toplevel, falling back to$PWDonly outside a git repo. Deliberately uses the simpler pre-write-handoff.sh's git-root fallback (#743) conflicts with subdirectory-project support (#754), sending handoffs to the wrong store #776 shape rather thanwrite-handoff.sh's full write-handoff.sh's git-root fallback (#743) conflicts with subdirectory-project support (#754), sending handoffs to the wrong store #776 session-id-hint disambiguation, since that refinement is specific to picking between two candidateREMEMBER_DIRs on write and doesn't apply todoctor.sh's read-only diagnostic role.tests/test_session_start_duration_706.py's fast-run "stays quiet" test relied on the real session-start hook finishing under the default 5s threshold to prove "fast" -- flaky on a loaded CI runner (observed failing on windows-latest, PR curate: 8 trap.d fragments -- 1 promote, 1 merge, 6 decline #807, job 108485346624). Fixed by pinningsession_start_slow_threshold_sto 600 in that test's own config, matching the pattern its own positive control already used. No production code changed for test_a_fast_run_logs_its_duration_but_stays_quiet_in_the_session flakes on a slow Windows runner #808.Closes #802
Closes #808
Testing
python3 -m pytest tests/test_doctor_pwd_root_802.py -q-- 2 of 4 failed, project_dir resolved to the subdirectory instead of the git root.python3 -m pytest tests/test_session_start_duration_706.py -qafter the edit -- 3 passed in 0.90s.test_doctor.py,test_doctor_json_408.py,test_doctor_oversized_store_348.py,test_doctor_cap_disabled_360.py,test_doctor_last_save_forgery_727.py,test_doctor_session_end_370.py-- 44 passed.test_windows_skip_triage_497.py-- 2 passed. Fullpytestwas not run locally; CI is the gate.Self-review
tests/test_doctor_pwd_root_802.pyis skipped on win32, so the new coverage doesn't run on the windows-latest CI leg. Assessed as inherited repo convention (every sibling doctor.sh bash-subprocess test has the identical gap), not introduced by this diff, and left below-bar rather than expanded into converting the whole windows-skip-triage.md backlog.git rev-parse --show-toplevelunder Git Bash returns forward-slash paths and doctor.sh already normalizes separators elsewhere (_remember_forward_slash, Bash's glob never splits on backslash: 7 more REMEMBER_DIR sweeps/checks silently miss on Windows (same class as #487) #517, unchanged here), so there's no reasoned basis to call this fix itself separator-unsafe -- only that CI doesn't currently prove it either way on that platform.🤖 Generated with Claude Code
[AI-generated]