Repository navigation
Conversation
…ss (#330) #329's substring guard in test_case_divergence_298.py checks for three literals; #330 named vectors that reintroduce #298/#299's per-tool-call cost while staying green against it -- a git wrapper spelled through a variable or `command`, and an extra file read or loop that spawns nothing at all. tests/test_hot_path_cost_pin_330.py adds the measured pin the issue asked for: a spawn budget (reusing the existing harness) plus a new bash-builtin-`read` count via `bash -x` tracing, proven non-vacuous against scratch reproductions of each named vector, with the pure-compute boundary neither pin can see stated rather than hidden. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
's substring test Self-review findings: the reviewer flagged that #298's substring-test docstring still read as the whole story on hot-path coverage, with no pointer to the new cost pin that closes its gap -- cross-referenced both ways. The auditor flagged that _is_read_builtin only matched the literal word "read", so a rewrite from a `while read` loop to `mapfile`/`readarray` (same file, same cost, zero new spawns) would silently evade the new pin -- widened the match set and named the one vector that remains genuinely unreachable (`x=$(< file)`, invisible to xtrace itself, confirmed locally) in the module docstring instead of leaving it undiscovered. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
…in_330.py (#330) CI (macos-latest, 3.11/3.12) went red on the new file's own positive control: "the injected read spawned a process", with a spawn list that was pure cold-path signature (python3 -V, git rev-parse, jq -s, the trap-stripping sed, the temp sweep). ubuntu and windows legs stayed green. Established rather than guessed: the fixture wrote config.json with a plain write_text() instead of tests.env_cache.write_config(), and never verified warmth with EnvCacheProbe. scripts/lib-env-cache.sh refuses its own cache unless it is `-nt` every config layer, and macOS's system bash 3.2.57 -nt compares whole SECONDS (confirmed via tests.env_cache.nt_granularity() == "second" on this platform) -- so a config written in the same wall-clock second as the cache publish TIES rather than loses, the cache is rejected, and every "warm" measurement in this file was silently re-resolving instead. Reproduced deterministically by forcing the tie by hand: identical spawn signature to the CI failure. This is the exact #303 defect class this repo's own tests.env_cache module exists to prevent, already used by the sibling file this one is modeled on (test_post_tool_fast_path_350.py) -- this file simply never adopted it. Fixed with the established pattern rather than a platform skip, since warmth is genuinely reachable everywhere once the race is closed: config.json now goes through write_config() (backdated past any second boundary), and every measured (non-priming) run goes through a new _measure() helper that brackets it with an EnvCacheProbe and fails loudly -- naming which run went cold and why -- instead of silently reporting a cold-path count as the warm one this file claims to pin. Verified stable across repeated local runs on this machine's bash 3.2.57 (matching macOS CI) after the fix; the x=$(< file) boundary this file already names is untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FLHVEH4aeVK93939UYnfFP
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
#329 replaced a byte-identity check on
scripts/post-tool-hook.shwith three substring assertions (the code must not mentionlib-case-divergence,case_divergence, orgit). #330 pointed out that substring check can be walked around while staying green: agitcall spelled through a variable (GIT=git; "$GIT" -C ...) orcommand, an extra subprocess spawn of something that isn't git, or an extra bash builtin file read or loop -- the last two aren't even in the substring vocabulary.This PR does not touch
scripts/post-tool-hook.sh-- the hot path is already clean (#329 verified that). It adds one new test file,tests/test_hot_path_cost_pin_330.py, that measures the property #299 actually cares about: cost.tests/test_post_tool_fast_path_350.py'sFAST_PATH_SPAWN_BUDGET).read/mapfile/readarrayinvocations, counted viabash -x(xtrace) parsed from stderr -- no ptrace-level tooling needed, portable to every platform this repo's CI runs.GIT=gitvariable wrapper, a quotedcommand "git"wrapper (quoted specifically so it does not trip the old substring check, unlike a barecommand git), and a 5-iteration builtin-read loop with no new spawn and no new literal.x=$(< file).Closes #330
Self-review
Spawned an
Explorereviewer and anoss:auditor, foreground, in parallel, against the first commit. Both returned real findings, both fixed in a follow-up commit:tests/test_case_divergence_298.py's own docstring ontest_the_per_tool_call_path_is_not_touchedstill read as though its substring check were the whole story on hot-path cost, with no pointer to the new file. Cross-referenced both ways._is_read_builtinonly matched the literal wordread; a rewrite from awhile readloop tomapfile/readarray(bash >= 4, same file, same cost, zero new spawns) would have evaded the new pin silently. Widened the match set to includemapfile/readarray, and named the one genuinely unreachable vector (x=$(< file), confirmed to leave no trace line underbash -xat all) as a stated boundary rather than an undiscovered gap. Below-bar item, not filed: the$(< file)blind spot cannot be closed by an xtrace-based harness at all -- the read happens with no subprocess and no traceable simple command, so catching it would need a different mechanism entirely (ptrace/strace, unavailable in this repo's CI), and The per-tool-call hot path lost its byte-identity pin and the replacement can be walked around #330 explicitly allows "this cannot be made robust" as a valid outcome for whatever a cost pin does not cover.Tests
python3 -m pytest tests/test_hot_path_cost_pin_330.py tests/test_case_divergence_298.py::test_the_per_tool_call_path_is_not_touched tests/test_post_tool_fast_path_350.py -v-- 21 passed. Full suite not run: change is confined to test files, no shared module (spawn_counting.py) or production code touched, no cross-cutting guard matched byscripts/lane_setup.py --lane.Red/green evidence lives in the report at
reports/fix-330-<timestamp>.jsonundertests.red/tests.green-- iterating on the harness itself surfaced two real bugs before it was correct (anexec 2>>hook-errors.logredirect on the fast path silently swallowing xtrace output for everything after it, and acommand git -C ...fixture that accidentally spelled the literal substring it was meant to evade), both documented in the file's own comments so a future reader does not rediscover them by trial and error.