Repository navigation
fix(#951): fast-path tests now carry positive mktemp evidence - #961
Merged
Merged
Conversation
tests/test_autonomous_log_retention_487.py's fast-path tests previously asserted only the sweep's outcome, never that `_remember_auto_ref` was actually built by the real `mktemp` on the runner, so a test named after the fast path could pass just as well if the fallback silently ran instead. Added a `MKTEMP_SHIM_LOG`-based marker to the 4 relevant tests. Windows CI then exposed a second bug this change's own evidence mechanism needed to not be red: both PATH-prepending helpers in this file built the subprocess PATH as env["PATH"] = os.pathsep.join(...) with native, drive-lettered directories, and bash's own colon-based PATH splitting shreds a C:\...;C:\...-style value on the drive letter's own colon -- independent of slash direction. Added _bash_path_prepend(), which converts each prepended directory to MSYS-posix form (/c/...) and injects it into the generated bash script text via export PATH=... instead of through the env block, applied at both PATH-prepending call sites in the file. Verified on windows-latest CI across both the pytest and compiled-hook legs: all 5 legs green, the raw job log shows no failing assertion, and the fix was reached by locally reproducing bash's own colon-splitting behavior on a non-Windows machine rather than by assumption alone. Split out of the original combined #951/#952/#953 PR (#960): this part is done and verified; the macOS-only #952/#953 regression in a different file is a separate, still-open investigation and should not block this fix from shipping. Closes #951 Co-Authored-By: Claude Sonnet 5 <[email protected]>
This was referenced Oct 7, 2026
fdaviddpt
added a commit
that referenced
this pull request
Oct 7, 2026
…ck (#962) * fix(#952,#953): close three reconcile regressions, 3-state rebase check hooks.d/after_save/60-git-reconcile.sh: - #952 item 1: pass --no-autostash on every git rebase call -- without it, a dirty tracked write from another slug sharing REPO_ROOT gets silently autostashed when the rebase starts, and rebase --quit (unlike --abort) never re-applies the stash. The rebase now refuses to start while that write is present, with no stash created. - #952 item 2: the scoped abort restore no longer assumes every commit a rebase could replay is confined to $SLUG/ -- a shared REPO_ROOT's ahead/behind commit set can span other slugs too. The restore scope is now computed before the rebase starts, as the union of this run's own ahead commits and the remote's behind commits diffed against their merge-base, and covers every one of those paths on abort. - #952 item 3: before rebase --quit discards it, read git's own record of which branch the rebase started from (rebase-merge/head-name). When it differs from the configured branch, refuse the symbolic-ref switch and report the mismatch instead of silently moving HEAD. - #953: _grc_rebase_in_progress now returns a distinct could-not-tell state (rc=2) when the underlying git rev-parse --git-path check itself fails, rather than collapsing that into "not in progress". All 5 call sites branch on the 3-state result explicitly. tests/test_git_reconcile_903.py: regression tests for all of the above, 23/23 passing. Split out of the original combined #951/#952/#953 PR (#960) by the maintainer: #951's fix (Windows-only, test-only) is done and verified and was shipped separately in #961; this PR carries the still-open #952/#953 investigation, which continues to fail on macOS CI only (not locally reproducible so far -- see trap.d/951.pr960-macos-reconcile-903-not-reproducible-locally.md and the open comment on #952 documenting the same). Closes #952 Closes #953 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(#962): avoid bash 4.0+ mapfile in the git-reconcile scoped restore 60-git-reconcile.sh's scoped-abort restore (#952/#953) used `mapfile` to populate _GRC_TOUCHED_PATHS and _grc_existing. mapfile is a bash 4.0+ builtin, absent from this repo's documented floor (bash 3.2, stock macOS /bin/bash) -- exactly what GitHub Actions' macos-latest runner resolves plain `bash` to. There it fails as "command not found", silently leaving both arrays empty, so the scoped checkout/prune restored nothing: a real conflict left the file with merge markers, another slug's upstream-only change was never restored, and no notice or log was written -- the six macOS CI failures on PR #962. Reproduced directly against this machine's own stock /bin/bash 3.2.57 (identical interpreter to the CI runner's), both via a minimal mapfile probe and by running the hook's own conflict-abort scenario end to end; confirmed red before the fix (6 failed under a PATH forcing `bash` to resolve to the floor interpreter, matching CI exactly) and green after. Replaced each mapfile call with a while-IFS=-read loop into the array, which works on every bash version this repo supports. Adds a static guard (tests/test_git_reconcile_mapfile_floor_952.py) so no shipped shell script reintroduces mapfile/readarray, plus the same floor-bash behavioural reproduction as a regression test. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(#962): widen the mapfile static guard's anchor set (self-review) Two independent reviewers (a general diff review and oss:auditor) flagged the same gap in test_git_reconcile_mapfile_floor_952.py's regex-based static guard: it only recognised `mapfile`/`readarray` preceded by `;`/`&`/`|`/`(`/`then`/`do`, missing real shell command-start shapes such as `else mapfile ...`, `elif mapfile ...`, a `case` branch (`pat) mapfile ...`), or a brace-group (`{ mapfile ...; }`). None of the current shipped shell happens to use those shapes, so the guard's current "clean" verdict was still correct, but a future mapfile call written in one of them would have passed silently. Widened the anchor set and added a positive-control assertion for each of the four missing shapes; also reworded one docstring line a reviewer found referred to an import that does not exist (the win32 skip is a local re-declaration, not an import, matching the row this file's own docs/windows-skip-triage.md entry already describes correctly). Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
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.
Split out of the combined #951/#952/#953 PR (#960) by the maintainer: #951's fix is verified working on the only platform it could fail on and is test-only with no production-code blast radius, while #952/#953's macOS-only regression in a different file (hooks.d/after_save/60-git-reconcile.sh) is a separate, harder, still-open investigation. Bundling them meant a done, verified fix sat blocked behind an unrelated unresolved one, paying for a full CI wait each round for both.
tests/test_autonomous_log_retention_487.py's fast-path tests previously asserted only the sweep's outcome, never that
_remember_auto_refwas actually built by the realmktempon the runner, so a test named after the fast path could pass just as well if the fallback silently ran instead. Added aMKTEMP_SHIM_LOG-based marker to the 4 relevant tests.Windows CI then exposed a second bug this change's own evidence mechanism needed to not be red: both PATH-prepending helpers in this file built the subprocess PATH as
env["PATH"] = os.pathsep.join(...)with native, drive-lettered directories, and bash's own colon-based PATH splitting shreds aC:\...;C:\...-style value on the drive letter's own colon, independent of slash direction -- which is why two earlier attempts (forward-slashing paths, fixing a shim-script newline) each left the symptom byte-for-byte unchanged. Added_bash_path_prepend(), which converts each prepended directory to MSYS-posix form (/c/...) and injects it into the generated bash script text viaexport PATH=...instead of through the env block, applied at both PATH-prepending call sites in the file (the fast-path helper and a sibling fork-counting helper with the identical latent defect).Verified by the maintainer
Confirmed directly against the raw CI job logs (not the check labels): all 5 windows-latest legs (pytest 3.9/3.10/3.11/3.12 plus the compiled hook-tests leg) show
conclusion: success, and the pytest-windows job log itself shows all dots for this test file with zero F's and noassert 'SUCCEEDED' in ''anywhere -- the prior failure signature is gone, not merely unreported.Closes #951
🤖 Generated with Claude Code
[AI-generated]