Skip to content

Fix #1007: doctor.sh's below-floor FAIL Python line now names the floor - #1062

Merged
fdaviddpt merged 3 commits into
mainfrom
oss/1007-detect-tools-floor
Oct 31, 2026
Merged

fdaviddpt merged 3 commits into
mainfrom
oss/1007-detect-tools-floor

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Follow-up from the review of #1005 (fixes #1003): when every Python on PATH is
below the supported floor, scripts/detect-tools.sh's FATAL: below the floor this plugin supports: text names each rejected candidate's version but never the floor
those versions were measured against, and scripts/doctor.sh relayed that text
unchanged in its FAIL Python: line -- so a user reading either one could not tell
which version to install without reading the source.

detect-tools.sh itself is left unchanged (beyond two stale comments fixed in
self-review, see below): it is inlined into every compiled hook, and #1005 left only
37 bytes of budget under the 122,880-byte compiled-hook-script cap (#1006), so growing
its own FATAL message was not an option. doctor.sh is not inlined, so the fix lives
there instead: on the FAIL path it now re-sources detect-tools.sh in lazy mode
(REMEMBER_LAZY_PYTHON=1) inside a throwaway $(...) subshell purely to recover the
_REMEMBER_PY_FLOOR_MAJOR/_MINOR constants, then appends
" need Python X.Y+ -- install a newer Python." under the existing FAIL line, once a
^[0-9]+\.[0-9]+$ regex confirms the recovered value looks like a real floor.

Closes #1007

Verified

  • Byte budget: built the real release tree with
    .github/scripts/build_release_tree.py, then ran
    .github/scripts/check_release_tree.py against it -- session-start-hook.sh is
    exactly 122843 bytes (unchanged from the documented pre-detect-tools FATAL for a below-floor Python does not name the floor (3.9) #1007 baseline), no FAIL
    line for it. Comment-only changes to detect-tools.sh are fully stripped by the
    real build pipeline.
  • TDD: red (1 failed, 1 passed with the doctor.sh fix stashed out -- the failure
    named the exact missing floor/install text), green (2 passed in 0.93s), plus
    adjacent regression (tests/test_detect_tools_floor_1003.py +
    tests/test_doctor_consolidation_1003.py + the new file together: 15 passed).
  • python3 .oss/assemble_changelog.py --check passes.

Self-review

Two commits beyond the core fix, both from spawned self-review:

  • A reviewer (Explore) found two stale comment blocks in scripts/detect-tools.sh
    that wrongly claimed only session-start-hook.sh ever sets
    _REMEMBER_LAZY_PYTHON=1 -- made false by this fix's own FAIL-path lookup. Fixed.
  • A second reviewer (oss:auditor) flagged that the new test file's blanket
    win32 skip was not yet triaged in docs/windows-skip-triage.md per this repo's
    own convention. Fixed by adding the row.
  • The auditor separately flagged a pre-existing, repo-wide gap (17 of 18
    tests/test_doctor_*.py files carry a blanket win32 skip even though
    windows-latest CI legs run shell: bash) that is out of this one-issue diff's
    footprint and is left for its own issue/PR rather than fixed here.

Test plan

  • python3 -m pytest tests/test_doctor_fatal_floor_1007.py -q --no-cov (red then
    green, both reproduced by a reviewer independently welcome)
  • python3 -m pytest tests/test_detect_tools_floor_1003.py tests/test_doctor_consolidation_1003.py tests/test_doctor_fatal_floor_1007.py -q --no-cov (no regression)
  • python3 -m pytest tests/test_windows_skip_triage_497.py -q --no-cov
  • Full CI matrix (not run locally per this repo's own CLAUDE.md convention --
    CI is the gate)

🤖 Generated with Claude Code

[AI-generated]

fdaviddpt and others added 3 commits October 31, 2026 18:19
detect-tools.sh's FATAL text for every-candidate-below-floor named each
rejected candidate's version but never the floor those versions were
measured against. doctor.sh relayed that text unchanged in its "FAIL
Python:" line, so neither surface told a user which version to install.

detect-tools.sh cannot grow the message itself -- it is inlined into every
compiled hook and #1005 left only 37 bytes of budget under the compiled
session-start-hook.sh size cap (#1006). doctor.sh is not inlined, so the
fix lives there instead: it re-sources detect-tools.sh in lazy mode (skips
the candidate probe and its `exit 1`, needing only the floor constants
that file sets as plain variables) to recover the floor and append
"need Python X.Y+ -- install a newer Python." to the FAIL line, the same
convention as doctor's existing below-floor WARN for the cache-hit
backstop (#1003).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The self-review of f11dddd flagged two comment blocks in detect-tools.sh
(the USAGE header and the "Lazy mode (#662)" block) that enumerated which
sourcers set _REMEMBER_LAZY_PYTHON=1 and said only session-start-hook.sh
does -- no longer true, since doctor.sh's new FAIL-path floor lookup also
sets it, inside its own throwaway `$(...)` subshell. Note both spots that
doctor.sh's main execution still uses the real, eager probe, and that the
new use is a second, unrelated purpose scoped to that subshell alone.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
tests/test_doctor_fatal_floor_1007.py (added in f11dddd) carries a
module-level pytest.mark.skipif(sys.platform == "win32", ...), the
pattern docs/windows-skip-triage.md requires a row for in the same
commit as the convention it violated. Caught by the audit's platform-band
check plus tests/test_windows_skip_triage_497.py itself, which already
fails without this row.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fdaviddpt
fdaviddpt merged commit b3828ca into main Oct 31, 2026
19 checks passed
@fdaviddpt
fdaviddpt deleted the oss/1007-detect-tools-floor branch October 31, 2026 18:27
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