Skip to content

fix(#802,#808): doctor.sh git-toplevel fallback, deflake fast-run duration test - #810

Merged
fdaviddpt merged 2 commits into
mainfrom
fix-802-808
Sep 26, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix-802-808

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

What

Closes #802
Closes #808

Testing

  • RED (pre-fix): 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.
  • GREEN (post-fix): same command -- 4 passed in 0.48s.
  • test_a_fast_run_logs_its_duration_but_stays_quiet_in_the_session flakes on a slow Windows runner #808: no production code changed, so no red/green in the traditional sense; python3 -m pytest tests/test_session_start_duration_706.py -q after the edit -- 3 passed in 0.90s.
  • Adjacent/regression (not the full suite): 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. Full pytest was not run locally; CI is the gate.

Self-review

  • Explore reviewer found stale prose (a comment and a WARN message) that still said "the current directory" after the fix changed the fallback to prefer git-toplevel -- fixed in a follow-up commit.
  • oss:auditor flagged (informational, unranked) that tests/test_doctor_pwd_root_802.py is 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-toplevel under 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]

fdaviddpt and others added 2 commits September 26, 2026 23:49
…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]>
@fdaviddpt
fdaviddpt merged commit 04e9a4c into main Sep 26, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix-802-808 branch September 26, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant