Skip to content

Fix #1002 round 3: real wscript.exe evidence for v0.42.3, stall-regression cache with TTL, latency-sized watchdog - #1010

Merged
fdaviddpt merged 10 commits into
mainfrom
fix/1002-real-wscript-evidence
Oct 10, 2026
Merged

fdaviddpt merged 10 commits into
mainfrom
fix/1002-real-wscript-evidence

Conversation

@fdaviddpt

@fdaviddpt fdaviddpt commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Continuation of the real-wscript evidence work tracked under the ongoing, multi-round issue referenced below. This PR is intentionally left open-ended across rounds and does not end that tracker item on its own.

  • Vendored the byte-for-byte v0.42.3-tagged shape of the Windows detach scripts and ran it against a real wscript.exe on windows-latest CI, confirming -- for the first time on a real host rather than only reasoned -- both trap.d fragments filed against the shipped version: (A) WSH's own argv parser corrupts the embedded literal quote in v0.42.3's own c_script, so the save silently never runs even though the caller sees RC=0; (B) with WSH disabled, the shipped shape backgrounds wscript.exe with a trailing & and unconditionally returns 0, so the nohup fallback never fires -- a genuine silent skip in production.
  • The path-with-a-space case additionally surfaced test pollution in an existing, unmodified test (a file landing in the CI job's own working directory instead of under tmp_path) -- fixed.
  • Fixed a stall regression in the current code: a host where WSH is disabled used to pay the full watchdog bound on every single PostToolUse call, forever. Added a TTLed (1h) "hidden route unusable" verdict cache, mirroring detect-tools.sh's own #668 convention, keyed on $PATH plus a timestamp so a host that later recovers is not stuck forever.
  • Measured real healthy-path latency on windows-latest CI (hidden-route max 0.422s, nohup max 0.250s over 5 runs each) and sized the watchdog bound down from sleep 10 to sleep 5 against that number -- roughly 10x margin.
  • Self-reviewed with two spawns (Explore + oss:auditor) against the committed diff; both findings about the missing TTL were fixed, a missing-coverage finding was fixed with two new tests, and a pre-existing test-isolation leak the review surfaced was fixed across six call sites. A second, narrower review pass covered the fix commits themselves per review-return.md and found two stale "10s" comments, now fixed.
  • Two non-blocking self-review findings were logged rather than fixed, since both are judgment calls for the maintainer: missing .gitattributes protection for the vendored fixtures against CRLF rewrite, and job-id citations in docs/trap.d that point at the first (contaminated) CI run rather than the later clean confirming run on the same PR head. Both are in trap.d/1002.round-3-self-review-gitattributes-and-citation.md.
  • Pushback: the brief asked to fix a claimed docs/windows.md description of a timeout-binary bound; checked the file's full git history and found no such description ever existed on this branch -- the doc already described the bash-watchdog mechanism accurately, just without the bound number or the cache, both now added.

Test plan

  • pytest tests/test_windows_hidden_detach_1002.py tests/test_windows_real_wscript_1002.py tests/test_windows_real_wscript_v0_42_3_1002.py tests/test_windows_skip_triage_497.py tests/test_locale_ranges_695.py tests/test_scanner_shapes_source_898.py tests/test_case_divergence_298.py -q --no-cov -- 466 passed, 9 skipped, locally (macOS, bash 3.2)
  • CI: 19/19 checks green across windows/mac/linux legs and the oss changelog check
  • Real windows-latest CI run confirmed both v0.42.3 traps on a real host (xfail(strict=True)-pinned with job ids)
  • Real windows-latest CI run measured healthy-path latency used to size the new watchdog bound
  • Full repo-wide suite: not run locally (per this repo's own CLAUDE.md -- CI is the matrix gate, not a local run)

This PR binds no closing keyword to the tracker item it continues -- it is one round of an ongoing, multi-round effort.

Part of #1002.

[AI-generated]

fdaviddpt and others added 10 commits October 10, 2026 10:45
Removes the embedded-quote argv entry (lib-detach-pidwrap.sh now takes
OUTFILE as its own argv and redirects itself) and runs wscript.exe in the
foreground so a launch failure (e.g. WSH disabled) reaches the caller
instead of being silently swallowed by an unconditional return 0.

Adds tests/test_windows_real_wscript_1002.py, which drives the real
wscript.exe on windows-latest CI (never stubbed, never skipped there):
plain path, path with a space, WSH disabled via the registry, and a
positive control for the marker-and-poll mechanism itself.

Updates docs/windows.md, both #1002 trap.d fragments (pending CI
confirmation) and adds a changelog.d fragment.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
tests/windows_skip_triage_497.py's AST scanner matches any module-level
pytestmark = pytest.mark.skipif(...) call whose segment contains the
substring "win32", regardless of the condition's direction -- it caught
the new test_windows_real_wscript_1002.py (which skips when NOT win32,
the inverse of the usual blanket-skip pattern this doc tracks) on every
non-Windows CI leg. Adds the module's row.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…oolUse)

Live finding from this PR's own CI: the WSH-disabled case hung the
windows-latest pytest/hook-tests-compiled legs for 40+ minutes instead of
failing. WSH disabled by policy is not guaranteed to fail wscript.exe
silently -- it can surface as a blocking UI prompt that never resolves on
a headless runner, which would hang the real PostToolUse hook identically.

scripts/lib-detach.sh now wraps the foreground wscript.exe call in
`timeout 10`; a missing `timeout` binary falls back to nohup rather than
risking the old unbounded call. Also adds timeout-minutes: 30 to both
CI jobs that run the real-wscript tests, and widens the WSH-disabled
test's own subprocess timeout to 30s so a still-hanging call fails that
one test fast rather than re-stalling the whole job.

The previously-cancelled run (5 legs stuck at the same step for 40+
minutes) is the evidence this was a real hang, not a slow leg.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Two more live findings from this PR's own CI:

1. `timeout` (coreutils) is on the real Windows target's own PATH, but
   is NOT installed on GitHub's bare macos-latest image -- every stub
   test in tests/test_windows_hidden_detach_1002.py went from RC=0 to
   RC=1 on that leg, since `command -v timeout` failed there and the
   function always fell through to its own "unavailable" return. Replaced
   with a plain bash background-job-plus-watchdog pair (`wait`/`kill`,
   both builtins, no external dependency at all).

2. The watchdog subshell's own stdout/stderr were not redirected away
   from whatever the caller inherited. A caller reading that inherited
   pipe for EOF (this repo's own test harness, via subprocess.run) kept
   blocking on it for as long as the watchdog's `sleep` was still alive,
   even once wscript.exe had already exited and the function had
   already returned the right value -- a positive-control test timed
   out at exactly the watchdog's own bound despite RC=0 already sitting
   in the buffered output. Redirected to /dev/null, the same way the
   wscript.exe call itself already is.

Local run: 19/19 passed in 3.2s (down from a 42s run hitting three
10-second subprocess timeouts before this fix).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Both resolved with OBSERVED evidence from PR #1010's own windows-latest
CI legs (run 38046309588): all four real-wscript cases
(plain path, path-with-a-space, WSH-disabled-via-registry, nohup
positive control) passed cleanly on 4 separate legs (pytest 3.9, 3.11,
3.12, hook-tests-compiled). The 3.10 leg's single failure was an
unrelated pre-existing test_clones_badge_workflow.py flake.

Also records the real complication the fix itself hit along the way:
the WSH-disabled case hung CI for 40+ minutes before lib-detach.sh's
foreground wscript.exe call grew a bounded wait.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…able-route verdict, latency measurement

v0.42.3 shipped with the ORIGINAL hidden launcher (backgrounded wscript.exe,
embedded-quote -c script, unconditional return 0) -- round 2 fixed the code
based on reasoning and observed the NEW shape on real Windows Script Host,
but never ran the OLD, shipped shape against real WSH. This vendors the
exact v0.42.3 bytes (tests/fixtures/v0_42_3/) and drives them through a new
test module so that question is finally settled by observation rather than
reasoned about.

It also fixes a real stall regression round 2's own watchdog introduced:
with WSH disabled, every _remember_detach_windows call paid the full 10s
watchdog bound before falling back to nohup, on every PostToolUse call,
forever. scripts/lib-detach.sh now caches the "hidden route unusable"
verdict after the first failure, keyed on $PATH like detect-tools.sh's own
#668 tool-verdict cache, so later saves skip straight to nohup.

tests/test_windows_real_wscript_1002.py gains a healthy-path latency
measurement (hidden route vs nohup, N runs) to size the watchdog bound
against an observed number rather than a guess, and docs/windows.md and
docs/windows-skip-triage.md are updated to match.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…nce from live CI

The first CI round observed all the expected v0.42.3 evidence (both traps
confirmed on a real Windows host for the first time) but also surfaced two
self-inflicted problems: 1) the new-shape latency test shared $TMPDIR with
an earlier test that deliberately caches the "hidden route unusable"
verdict, so it incorrectly inherited that cache; 2) WSH's own quote
corruption against the v0.42.3 shape turned an absolute OUTFILE path into
a garbled relative filename that landed in the repo checkout instead of
under tmp_path, tripping the suite's repo-mutation guard.

Both fixed by passing an explicit cwd (and, where relevant, a per-test
TMPDIR) to every bash subprocess.run call in both real-wscript test
modules. The three v0.42.3 cases that genuinely failed against real WSH
are now pinned xfail(strict=True) with the observed job ids and failure
as the reason; docs/windows.md and both trap.d fragments are updated with
the concrete observed evidence.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…IR isolation

Both the Explore and oss:auditor self-review spawns independently flagged
the same real bug: the new "hidden route unusable" cache had no expiry,
keyed only on $PATH -- but WSH's own enablement is a registry policy
setting unrelated to PATH, so a host whose WSH got re-enabled would stay
stuck on the slower nohup fallback indefinitely, with nothing to notice
or self-correct it. scripts/lib-detach.sh now carries a 1-hour TTL on the
cached verdict, verified against real bash 3.2 as well as the sandbox's
own bash 5.

The same review found zero test coverage for the cache's own load/publish
functions. tests/test_windows_hidden_detach_1002.py gains two dedicated
tests (short-circuit on an identical PATH, and TTL expiry on a stale
entry) and every existing stub test that calls _remember_detach_windows
now isolates its own TMPDIR, so the suite no longer writes a real cache
file into the host's actual temp directory on every run -- a leak the
unconditional-publish-on-failure wrapper introduced for every test in that
file, not only the new ones.

Two further non-blocking auditor findings (no .gitattributes pinning the
vendored v0.42.3 fixtures against CRLF rewrite; the xfail reasons citing
the CI run that also had the two isolation bugs rather than the clean
confirming run) are logged to trap.d/ for /oss:curate rather than fixed
here.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…hy-path cost

PR #1010's own windows-latest CI (run #38054376838, job #114219715609 and
siblings) measured the real hidden-route-vs-nohup cost:
hidden-route max 0.422s, nohup max 0.250s, over 5 runs. Per the maintainer
instruction ("take the smallest value that the healthy path reliably
beats"), the watchdog bound is reduced from 10s to 5s -- roughly 10x
margin over the measured cost, while halving the worst-case stall a host
with WSH genuinely disabled pays. docs/windows.md and the latency test's
own sanity bound (now 2.5s, half the new watchdog) are updated to match.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
…-pass review

Per fix_commit_scope.py's needs-second-pass verdict on the self-review fix
range (9 files touched), a lightweight follow-up review found the watchdog
bound still described as "10s"/"sleep 10" in two comments after it was
reduced to 5s earlier in this round. Both corrected; no behavior change.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fdaviddpt
fdaviddpt marked this pull request as ready for review October 10, 2026 14:45
@fdaviddpt fdaviddpt changed the title Windows: real-wscript evidence for #1002 round 2 (trap A/B) Fix #1002 round 3: real wscript.exe evidence for v0.42.3, stall-regression cache with TTL, latency-sized watchdog Oct 10, 2026
@fdaviddpt
fdaviddpt merged commit 3aa72fd into main Oct 10, 2026
19 checks passed
@fdaviddpt
fdaviddpt deleted the fix/1002-real-wscript-evidence branch October 10, 2026 15:04
fdaviddpt added a commit that referenced this pull request Oct 10, 2026
…e-save race it can trigger (#1012)

* Fix #1002: widen the watchdog bound and close the double-save race it could trigger

main HEAD (PR #1010 squash) was RED on windows-latest/3.10: the 5s watchdog
bound round 3 sized off a 5-run sample (max 0.422s) did not hold under a
loaded CI runner. The same PR's own job (#114242348418) shows a healthy
hidden-route call taking 5.13s (passed) next to a sibling taking 6.03s and
getting killed (RC=137) -- OBSERVED, confirming the watchdog-kill hypothesis
rather than a genuine wscript.exe hang.

Raised the bound to 15s (REASONED margin over those two data points). More
importantly, a watchdog kill is no longer risky on its own:

- post-tool-hook.sh's nohup fallback now checks whether PID_FILE already
  names a live pid before launching a second, independent save -- closing
  a double-save race: WshShell.Run detaches the real command from
  wscript.exe's own process, so a watchdog kill of wscript.exe does not
  stop a save that already started.
- lib-detach.sh's hour-long "hidden route unusable" cache no longer treats
  a watchdog kill (RC=137) the same as a structural failure (missing
  wscript.exe/cygpath, RC=1) -- one slow call now costs exactly that call,
  not an hour of every save going through the slower nohup fallback.

tests/test_windows_hidden_detach_1002.py adds direct coverage for both,
using a stubbed wscript.exe and a new _REMEMBER_DETACH_WIN_WATCHDOG_SECS
override that lets the suite force a real watchdog kill in well under a
second. Confirmed red against the pre-fix post-tool-hook.sh (nohup fired
unconditionally, double save reproduced) before restoring the fix.

docs/windows.md and a changelog.d fragment record round 4.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Self-review: throttle persistently-slow hosts, narrow the double-save fix, fix a test platform idiom

Three findings from the Explore reviewer and one from oss:auditor against
590de9e, addressed before handoff:

- The rc=137 cache exception (never cache a watchdog kill) reopened the
  "stalls every single save, forever" pathology the TTL cache exists to
  remove, for a host that is persistently -- not just transiently -- slower
  than the watchdog bound. A watchdog kill now gets its own short-lived
  "slow" cache verdict (5 minutes) instead of either extreme: the structural
  failure's full hour, or no caching at all.
- The post-tool-hook.sh PID_FILE-liveness check now fires only when the
  detach call's own return code is specifically 137. A genuine structural
  failure (missing wscript.exe/cygpath) never changes PID_FILE during the
  call, so re-trusting it there risked a rare pid-reuse false positive that
  would silently DROP a save rather than merely race one -- worse than the
  bug being fixed.
- Code comments, docs/windows.md and the changelog fragment now say the
  double-save fix narrows the race rather than closes it: a pidwrap chain
  that is itself what is slow may not have written PID_FILE yet when the
  bound expires, in which case the old race still occurs.
- tests/test_windows_hidden_detach_1002.py's own _pid_alive helper used
  os.kill(pid, 0), which on Windows maps to CTRL_C_EVENT (a process-group
  broadcast, not a liveness probe) rather than a clean existence check --
  the same idiom this repo already retired once in
  test_session_end_log_names_488.py. Replaced with the same tasklist-based
  probe, since this test's own windows-latest CI leg is not skipped.

The rewritten test_detach_windows_watchdog_kill_caches_as_slow_not_unusable
exercises the new throttle directly: a watchdog kill publishes VERDICT=slow
(not unusable), a second call shortly after is short-circuited rather than
re-attempted, and a stale "slow" entry still expires and re-attempts, same
technique as the existing cache-ignores-stale-entry test.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Fix #1002 CI: probe MSYS pid liveness with bash kill -0, not tasklist

The two Windows pytest legs failing on PR #1012
(test_post_tool_fallback_skips_when_hidden_route_claimed_a_live_pid)
asserted "PID_FILE's pid is not actually alive" even though the stub had
just written a live pid there. Root cause: the pid is bash's own "$!"
(an MSYS/Cygwin pid), but the test's _pid_alive probed it with tasklist,
which only resolves WINPIDs -- an MSYS pid there always reads as dead.
Confirmed by reading what each side actually does: the stub's wscript.exe
backgrounds a job inside bash and captures "$!"; the product
(post-tool-hook.sh) checks PID_FILE liveness with a plain "kill -0 $pid"
run inside the same MSYS bash that wrote it, so the product was already
self-consistent -- only the test's liveness probe used the wrong
namespace.

Fixed both _pid_alive probes that check an MSYS-pid PID_FILE through
tasklist: the new #1002 round-4 test in
tests/test_windows_hidden_detach_1002.py, and the sibling in
tests/test_session_end_log_names_488.py, whose save-session.pid is
written the same way ("echo $! > ...") by session-end-hook.sh -- same
instance of the bug class, previously silent because it only gated a
wait loop rather than an assertion. Both now shell out to the resolved
MSYS BASH and run "kill -0 $pid" instead of asking a native Windows tool
to resolve an MSYS pid.

Verified the product side does not make this mistake anywhere: every
PID_FILE read in post-tool-hook.sh is checked via "kill -0" inside bash,
never against a WINPID-based tool.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
fdaviddpt added a commit that referenced this pull request Oct 10, 2026
…allowlist, document the Windows skip

Rebasing fix/913 onto main (after #1010/#1012's Windows detach watchdog and
rc=137 double-save guard) surfaced a real regression on CI that neither the
targeted local run nor lane_setup's guard sweep could see:
tests/test_hot_path_cost_pin_330.py's own #353/#395 sidecar-trust pins failed
on every leg, because the #913 cooldown-before-scan reorder had nested the
WHOLE #353 "last saved position" lookup (and the DELTA it feeds) inside the
same `if IN_COOLDOWN=false` block that gates the new incremental scan -- not
just the scan itself. Since test_hot_path_cost_pin_330.py's own fixture
always leaves a recent save-cooldown marker set, IN_COOLDOWN was always true
in that fixture, so the #353 branch (and its own regression tests) never ran
at all under it.

Fixed by scoping the `if [ "$IN_COOLDOWN" = false ]` wrapper to just the scan
(through the SCAN_SIDECAR write) again, restoring the #353 lookup and the
final DELTA assignment to run unconditionally as they did before #913 ever
touched this file. The sidecar's own upper-bound sanity check now skips
itself (rather than comparing against a never-computed CURRENT_LINES of 0)
when the scan was skipped, via one added `[ "$IN_COOLDOWN" = false ] &&`.
#913's own win (incremental, not whole-transcript, line counting) and the
cooldown-skips-the-scan behaviour (#1011's own motivation) are both still
intact; only the accidental, broader skip is undone.

Re-pinned tests/test_locale_ranges_695.py's ALLOWLIST line numbers for the
two shifted ASCII-only basename-sanitiser ranges (860->868, 955->970).

Documented the new tests/test_post_tool_incremental_scan_913.py's win32
blanket-skip in docs/windows-skip-triage.md (not-convertible: same
bash-hook-subprocess shape as test_post_tool_fast_path_350.py, plus a
spawn-counting assertion measured only against macOS system bash) -- CI's
own tests/test_windows_skip_triage_497.py was failing on every leg for its
absence.

Re-measured tests/test_post_tool_fast_path_350.py's own
FAST_PATH_SPAWN_MEASURED: already stale at 6 before this PR (an earlier,
separate #913 PR had removed the slug/cygpath fork this constant's comment
still described, without updating the number); corrected to the measured 5.

Closes #913.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
fdaviddpt added a commit that referenced this pull request Oct 10, 2026
…can under save-cooldown (#1013)

* Fix #913: make post-tool-hook's transcript line count incremental, not O(session length)

`wc -l < "$TRANSCRIPT"` used to read the whole transcript on every tool
call, so the hook got slower every turn of a long session. This stores a
(byte offset, line count) sidecar keyed by the transcript's own basename
and reads only the bytes appended since the last call via `tail -c
+OFFSET`, whose own leading byte doubles as a validator against a shrunk
or rewritten transcript -- a shorter read, or a first byte that is not the
expected newline, falls back to a full recount. A half-written last line
(no trailing newline yet) is never counted and never advances the offset.

The cooldown check that decides whether a save can fire at all now runs
BEFORE this scan rather than after it, so a tool call inside the
post-save cooldown window skips the scan entirely -- a fork avoided here
on an affected Windows 11 25H2 build (#1011) is a kernel Token object
that never leaks, not merely latency saved. Which saves fire, and at
what threshold, is unchanged.

Measured on macOS bash 3.2.57, the shared fast-path fixture
(tests/test_post_tool_fast_path_350.py) with cooldown active: before 5
spawns (head, ls, wc, mv, date), after 4 (head, ls, mv, date) -- wc is
gone entirely. Without cooldown, below the save threshold: before 4
(head, ls, wc, mv), after 4 (head, ls, tail, mv) -- same fork count, now
O(delta) instead of O(session length).

tests/spawn_counting.py's shared COUNTED list gains `tail`, which it did
not carry before this change -- a tail-based fix would otherwise have
passed every existing fork-count assertion while the harness itself
stayed blind to the fork it claims to measure.

tests/test_post_tool_incremental_scan_913.py pins the new mechanism and
its named edge cases: incremental reads only the appended bytes, the save
decision is unchanged across several incremental calls, a half-written
last line is not counted until complete, a shrunk transcript falls back
to a full recount, a rewritten transcript (same offset, different
content) falls back too, and cooldown skips the scan entirely.

tests/test_locale_ranges_695.py's ALLOWLIST is re-pinned to the shifted
SESSION_ID bracket-range checks and gains one entry for the new sidecar
key's own sanitiser (same ASCII-only charset, same reason).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Fix #913 self-review: validate the scan sidecar's two fields as a pair

A self-review spawn found that a write interrupted between OFFSET and
LINES (OOM, disk full, a kill mid-printf) can leave a syntactically valid
OFFSET -- a real prior scan position, so the newline-validation in
_pt_scan_lines passes -- paired with a missing/empty LINES field. The
per-field validation defaulted only the missing field to 0, silently
pairing a real byte offset with a wrong line count, undercounting every
line that existed before it. Both fields are now invalidated together on
any parse failure, forcing the same full recount an absent sidecar
already gets.

tests/test_post_tool_incremental_scan_913.py gains a regression test that
reproduces the exact partial-write shape (a real OFFSET, a truncated
LINES field) and asserts the sidecar recovers the true count rather than
reporting zero.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* trap(#913): log auditor finding on tail exit-status masking in scan fallback (non-blocking)

Self-review's oss:auditor spawn found that `_pt_scan_lines`'s
fallback-to-full-recount branch cannot distinguish a genuine
shrink/rewrite from a transient `tail` read failure, because the
command substitution's exit status is masked by the trailing `printf`
needed to preserve a trailing newline through `$()`. Ranked non-blocking
and self-healing (next call recounts fully); left for the curator.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Fix #913 CI round: restore #353 sidecar-trust under cooldown, re-pin allowlist, document the Windows skip

Rebasing fix/913 onto main (after #1010/#1012's Windows detach watchdog and
rc=137 double-save guard) surfaced a real regression on CI that neither the
targeted local run nor lane_setup's guard sweep could see:
tests/test_hot_path_cost_pin_330.py's own #353/#395 sidecar-trust pins failed
on every leg, because the #913 cooldown-before-scan reorder had nested the
WHOLE #353 "last saved position" lookup (and the DELTA it feeds) inside the
same `if IN_COOLDOWN=false` block that gates the new incremental scan -- not
just the scan itself. Since test_hot_path_cost_pin_330.py's own fixture
always leaves a recent save-cooldown marker set, IN_COOLDOWN was always true
in that fixture, so the #353 branch (and its own regression tests) never ran
at all under it.

Fixed by scoping the `if [ "$IN_COOLDOWN" = false ]` wrapper to just the scan
(through the SCAN_SIDECAR write) again, restoring the #353 lookup and the
final DELTA assignment to run unconditionally as they did before #913 ever
touched this file. The sidecar's own upper-bound sanity check now skips
itself (rather than comparing against a never-computed CURRENT_LINES of 0)
when the scan was skipped, via one added `[ "$IN_COOLDOWN" = false ] &&`.
#913's own win (incremental, not whole-transcript, line counting) and the
cooldown-skips-the-scan behaviour (#1011's own motivation) are both still
intact; only the accidental, broader skip is undone.

Re-pinned tests/test_locale_ranges_695.py's ALLOWLIST line numbers for the
two shifted ASCII-only basename-sanitiser ranges (860->868, 955->970).

Documented the new tests/test_post_tool_incremental_scan_913.py's win32
blanket-skip in docs/windows-skip-triage.md (not-convertible: same
bash-hook-subprocess shape as test_post_tool_fast_path_350.py, plus a
spawn-counting assertion measured only against macOS system bash) -- CI's
own tests/test_windows_skip_triage_497.py was failing on every leg for its
absence.

Re-measured tests/test_post_tool_fast_path_350.py's own
FAST_PATH_SPAWN_MEASURED: already stale at 6 before this PR (an earlier,
separate #913 PR had removed the slug/cygpath fork this constant's comment
still described, without updating the number); corrected to the measured 5.

Closes #913.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
fdaviddpt added a commit that referenced this pull request Nov 1, 2026
…irming CI run (#1080)

* Fix #1070: pin v0.42.3 fixtures against line-ending rewrite, cite the clean confirming CI run

Two carried self-review findings from the v0.42.3 release audit (#1002
round 3), still true as of HEAD.

1. tests/fixtures/v0_42_3/ (lib-detach.sh, lib-detach-pidwrap.sh,
   windows-hidden-run.vbs) must stay byte-for-byte identical to the tagged
   release forever, but nothing pinned that. The three tests against them
   are xfail(strict=True), which only needs *a* failure to stay green, not
   the *documented* one -- so a checkout silently rewriting their line
   endings could pass unnoticed. Add .gitattributes (-text) to pin the
   three paths against line-ending rewrite on any checkout, and a new
   tests/test_v0_42_3_fixture_integrity_1070.py with two independent
   checks: a committed sha256 of each fixture's bytes (catches corruption
   directly, on every platform), and a direct check that the
   .gitattributes pin is wired via `git check-attr` (catches the mechanism
   breaking even before the bytes do).

2. docs/windows.md and the three xfail reason= strings in
   tests/test_windows_real_wscript_v0_42_3_1002.py cited only CI run
   #38049234152 as OBSERVED evidence for the v0.42.3 traps -- a run that
   also carried two unrelated test-isolation bugs fixed on a later commit
   of the same PR (#1010). Both now also cite the clean confirming run on
   the same PR head, #38051416393 (verified via gh-run: 15/15 green,
   confirming the xfails fired as documented with neither bug present).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Self-review #1070: drop dangling trap.d cross-reference

The Explore reviewer found that the new test module's docstring cited
trap.d/1002.round-3-self-review-gitattributes-and-citation.md, which was
already deleted by the curation commit that turned it into issue #1070
(0288a85, which landed before this lane's base commit). No functional
effect -- nothing opens that path -- but a dangling reference nonetheless.
Point at the issue instead.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant