Skip to content

Move README reference sections to docs/ and stop the Windows badge overclaiming coverage - #521

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/505
Sep 4, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/505

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

#505 -- move README's 6 reference sections to docs/

README.md was 934 lines because it doubled as a reference manual after ## Data files. Six sections -- Computing the slug outside bash, Reading the transcript path the host hands us, Configuration, Measuring lock hold times, External storage mode, Running tests -- move verbatim to docs/<slug>.md, each replaced in README by a one-line pointer under a new ## Reference heading. README.md is 438 lines now.

Every internal markdown anchor link that crossed a section boundary during the move is repointed at its new file -- README -> moved section, moved section -> README, and moved section -> a different moved section. Two existing tests that pinned text out of the Configuration table (tests/test_config_contract.py, tests/test_prompt_stamp_301.py) now read docs/configuration.md instead of README.md. tests/test_readme_reference_move_505.py pins the move: all six headings gone from README, a ## Reference section pointing at all six docs files, a distinctive verbatim sentence and every interior heading from each original section surviving in its new file, and no README-internal anchor left dangling.

#507 -- the OS badge overclaimed Windows test coverage

#497 measured the windows-latest CI legs reporting success while 1201 of 1960 collected tests skip -- roughly 61%, from a sys.platform == "win32" blanket-skip pattern. Recomputed on this tree rather than trusted: 107 of 174 test modules now blanket-skip on win32 (up from #497's own count of 92), and 9 modules (not counting the helper) use the resolve_bash() route that was supposed to retire that pattern.

A one-line caveat now sits next to the README's OS badge. A new scripts/report_windows_skip_floor.py module, wired into the existing pytest_terminal_summary hook in conftest.py (alongside the #510 duration reporter, in its own try/except), prints the current run's own skip ratio on every pytest invocation -- local or any leg of the CI matrix, no extra flag needed -- and annotates with a ::warning:: GitHub Actions command when a Windows leg crosses a recorded 10% skip floor (the issue's own suggested starting point).

Judgment call, argued rather than looked up: this is deliberately a report, never a build-failing gate -- the same choice #510 already makes for its own reporter. Today's actual ratio is already far past 10%, so failing the build on it would redden every future Windows leg until the modules behind it migrate to resolve_bash() (#432), a separate and much larger effort #497 tracks on its own and which this lane was explicitly told not to attempt. No .github/workflows/tests.yml change was needed -- the hook fires automatically on the bare pytest invocation that step already runs.

Verified without a live Windows CI run (reasoned, not observed, nobody on this project has a Windows box): the pure analyze()/format_report()/ github_actions_warning() functions are unit-tested directly with paired positive/negative controls, and two integration tests call conftest.py's real pytest_terminal_summary with a monkeypatched sys.platform and a hand-built fake terminalreporter to drive the real stats-extraction wiring end to end (monkeypatching sys.platform inside a nested pytest session was tried first and rejected -- it breaks pytest's own internal Windows-console workaround, which reads sys.platform during that nested session's own startup, observed directly as an AttributeError on a non-Windows host).

Self-review

Two spawned reviewers (Explore and oss:auditor, independently, plus one permitted re-spawn of the auditor after its first return was classified referred-not-stated) found five real defects in the first commit, all fixed in the second:

  1. docs/running-tests.md dropped a subsection heading (### Measuring the warm path) during the splice -- its body silently reattached under the wrong heading, contradicting the "moved verbatim" claim. Restored; the file is now byte-identical to the pre-move README section except for the one deliberately-inserted new subsection.
  2. tests/test_readme_reference_move_505.py only checked 2 of 6 moved sections' content -- exactly why finding 1 passed clean. Strengthened to check all 6, plus a stronger interior-heading-survival assertion, confirmed red against a reintroduction of finding 1's bug.
  3. tests/test_conftest_skip_floor_hook_507.py never drove the real Windows branch end to end. Added two tests that call the real hook directly with a monkeypatched platform and fake stats.
  4. conftest.py's total computation double-counted any test with a separately-erroring teardown, diluting the reported skip ratio. Fixed to count distinct nodeids; verified against a live reproduction (33.3% true ratio vs. 20% under the old, diluted count) and pinned with a regression test.
  5. Two stale comments referenced "README.md's transcript-path section" / "README.md's own documented config key" after those sections moved to docs/. Repointed both.

Closes #505
Closes #507

…erclaiming coverage

a manual after `## Data files` -- computing the slug outside bash, reading
the transcript path the host hands us, configuration, measuring lock hold
times, external storage mode, and running tests. Each moves verbatim to
docs/<slug>.md, replaced in README by a one-line pointer under a new
`## Reference` heading. Every internal anchor link that crossed the move
(README -> moved section, moved section -> README, and moved section ->
a different moved section) is repointed at its new file; two tests that
pinned text out of the Configuration table -- test_config_contract.py and
test_prompt_stamp_301.py -- now read docs/configuration.md instead of
README.md. README.md is 438 lines now.

of 1960 collected tests skip -- roughly 61%, from a sys.platform == "win32"
blanket-skip now on 107 of 174 test modules (up from #497's own count of 92,
recomputed here rather than trusted). The README's OS badge said "tested on
Linux | macOS | Windows" with nothing distinguishing that from full
coverage. A one-line caveat now sits next to the badge, and a new
pytest_terminal_summary hook (scripts/report_windows_skip_floor.py, wired
into conftest.py alongside the existing #510 duration reporter) prints the
current leg's own skip ratio on every pytest run -- local or any leg of the
CI matrix, no extra flag -- annotating with a ::warning:: GitHub Actions
command when a Windows leg crosses a recorded 10% skip floor (the issue's
own suggested starting point). Deliberately a report, not a build-failing
gate, the same choice #510 already makes for its own reporter: today's ratio
is already far past 10%, so failing the build on it would redden every
future Windows leg until the modules behind it migrate to resolve_bash()
(#432), a separate and much larger effort #497 tracks on its own -- no
change to .github/workflows/tests.yml was needed, since the hook already
runs on the bare `pytest` invocation that step makes.

Closes #505
Closes #507

Co-Authored-By: Max <noreply>
… checks, stale prose

Both spawned reviewers (Explore and oss:auditor, independently, against commit
7255d48) found the same real defects in that commit:

1. docs/running-tests.md dropped the `### Measuring the warm path
   (`tests/env_cache.py`)` subsection heading during the #505 move -- its
   body silently reattached under the new "### The Windows leg's own skip
   ratio" heading instead, contradicting the commit's own "moved verbatim"
   claim. Restored the heading; the section is now byte-identical to the
   pre-move README except for the one new subsection deliberately inserted
   ahead of it.

2. tests/test_readme_reference_move_505.py only asserted content equality
   for 2 of the 6 moved sections, which is why finding 1 passed cleanly.
   Added a distinctive verbatim sentence per section (all 6 now) plus a
   stronger check: every ###/#### interior heading each section carried
   before the move must still be a heading (not just present as reattached
   text) in its new file -- this is what actually catches finding 1's shape
   of regression, confirmed red against a reintroduction of the bug and
   green against the fix.

3. conftest.py's #507 block computed `total` by summing each
   `terminalreporter.stats` category's report *count*, which double-counts
   any test whose teardown errors separately from its call-phase outcome (a
   passing test with a failing teardown produces both a "passed" and an
   "error" stats entry for the same nodeid) -- silently diluting the
   reported skip ratio below the true one, the exact failure mode #507
   exists to prevent, reproduced inside its own arithmetic. Now counts
   distinct nodeids instead. Verified against a live pytest run with a
   teardown-erroring fixture (33.3% true ratio vs. 20% under the old,
   diluted count) and pinned with two new tests in
   tests/test_conftest_skip_floor_hook_507.py that call conftest.py's real
   `pytest_terminal_summary` directly with a monkeypatched `sys.platform`
   and hand-built fake reports -- driving the actual `is_windows == "win32"`
   wiring end to end for the first time, rather than only the pure
   `analyze()` function with hand-fed integers (the previous version of this
   file also carried an unused `monkeypatch` parameter on one test,
   suggesting an intended Windows-branch test had been dropped; removed the
   unused parameter and added the two tests that should have used it).
   Monkeypatching `sys.platform` inside a nested nested-pytest-session
   (`runpytest_inprocess`) was tried first and rejected: it breaks pytest's
   own internal `_windowsconsoleio_workaround`, which reads `sys.platform`
   during that nested session's own startup, on a non-Windows host --
   calling `pytest_terminal_summary` directly with a fake terminalreporter
   avoids starting a second pytest session altogether.

4. tests/test_transcript_path_trust_431.py and
   tests/test_predictable_tmp_429.py still said "README.md's
   transcript-path section" / "README.md's own documented config key" --
   both sections moved to docs/ in the #505 commit these files were not
   part of. Repointed both.

All fixes verified red-before/green-after where the defect was regression-
testable (findings 1 and 3); the two test-adequacy findings (2 and the
monkeypatch gap in item 3) are closed by the strengthened tests themselves.

Co-Authored-By: Max <noreply>
@fdaviddpt
fdaviddpt merged commit 718a10f into main Sep 4, 2026
13 checks passed
@fdaviddpt
fdaviddpt deleted the fix/505 branch September 4, 2026 07:01
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