Repository navigation
Merged
Conversation
…ouched-path scope, fix stale reconcile doc wording #972: scripts/log.sh's pre-#864 orphan-cache-path derivation used a bare `${var/-v2-/-}` substring substitution over the full path instead of the filename's own -v2- segment, so a TMPDIR containing the literal substring -v2- diverted the substitution away from the real orphan. Anchored to the basename at both call sites. #975: two of the four known defects in the hard-disabled 60-git-reconcile.sh are fixed ahead of its eventual re-enable -- a git diff --name-only failure while computing the touched-paths restore scope is now logged and falls back to the pre-#952 scope instead of silently narrowing to nothing, and that diff output is now unquoted the same way the conflict-reporting path already was. The two residual TOCTOU windows and the partial _grc_rebase_in_progress test coverage are re-verified still present and still out of scope for a same-diff fix (the code is entirely unreachable while #969's kill switch holds, and the existing test suite for this file is fully skipped for the same reason). #982: docs/configuration.md's git_reconcile.enabled row said the hook "exits immediately, before even reading this flag" -- false since #979, which made the hook read the flag first (only to decide whether to log a hook-errors.log notice) before its unconditional exit. Same stale wording corrected in two test files' own prose (#979 missed those, not just the doc); the now-stale trap.d/969 bookkeeping fragment is removed since #979 did fix all three files it names. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Second half of the combined #972/#975/#982 fix -- the trap.d bookkeeping removal landed in the previous commit; this one carries the actual code fixes (scripts/log.sh, hooks.d/after_save/60-git-reconcile.sh, docs/configuration.md), the two stale-wording corrections in test prose, the two new regression test files, and the three changelog fragments. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ter quotes Self-review finding (Explore spawn): the shared _grc_unquote_porcelain_path helper added in the previous commit stripped only the leading/trailing double-quote characters git's porcelain output wraps a path in -- it left git's own C-style escaping of the path's interior untouched (an escaped quote, an escaped backslash, a tab/newline, or octal for a non-ASCII/ control byte), so the exact case #975 item 2 names (a touched path with non-ASCII bytes) still would not match the real file on disk after "unquoting". Verified directly: the pre-fix helper turned the porcelain token for cafe-with-accent.txt into the literal escape text, not the real UTF-8 bytes. Fixed by decoding the escapes properly: a literal escaped backslash is protected behind a sentinel before printf %b decodes the rest (the escaped quote and the octal/control escapes bash's own %b already understands), then the sentinel is restored to a literal backslash. Verified against four cases directly in bash: the non-ASCII octal case, an embedded quote, a plain unquoted path, and the pathological case of a literal backslash immediately followed by a literal quote in the real filename (which a naive single-pass substitution gets wrong). No new pytest regression test for this helper specifically -- the whole hook (and its own test suite) is unreachable while #969's kill switch holds, same constraint noted in the prior commit; bash -n syntax-checks clean and the active (non-skipped) test classes in tests/test_git_reconcile_903.py, tests/test_git_backup_push_rejected_253.py and tests/test_git_restore_hook_253.py still pass (68 passed, 21 skipped, no change in skip count). Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ash-quote shape CI on PR #985 failed 10 legs (pytest ubuntu/windows x python 3.9-3.12, plus "hook tests (compiled)" on ubuntu/windows). Root cause: this repo's own built-tree shape checker (tests/test_scanner_shapes_source_898.py, .github/scripts/check_release_tree.py's BACKSLASH_QUOTE/ESCAPED_QUOTE, #898 round 7/8) forbids a literal backslash-then-quote shape in a shipped .sh file -- a sed/awk-style escape-replacement pattern the real Anthropic directory portal scanner holds submissions on. The previous commit's _grc_unquote_porcelain_path wrote exactly that shape twice (${_grc_up_path//\\\"/\"}). Rewrote the same two escape-replacement steps using variables built from single characters (_grc_up_bs, _grc_up_bsbs, _grc_up_bsq) instead of a literal backslash-quote sequence in the source -- the same convention this file's own _grc_foreign_changes already uses for its outer-quote strip (a `_grc_dq='"'` variable rather than an inline `\"`). Verified: - All 5 decode cases (non-ASCII octal, embedded quote, plain path, pathological backslash-before-quote, tab control char) re-run directly in bash -- unchanged output, confirming the rewrite is behavior- preserving. - bash -n syntax-checks clean. - tests/test_scanner_shapes_source_898.py: 389 passed, both against the worktree directly and against a disposable local clone compiled with .github/scripts/compile_hooks.py --apply (the exact step the failing "hook tests (compiled)" CI job runs) -- zero BACKSLASH_QUOTE/ ESCAPED_QUOTE hits either way. - Full previously-targeted test set re-run: 465 passed, 21 skipped (no change in skip count -- the kill-switch-disabled reconcile suite is unaffected). 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.
Closes #972. Closes #975. Closes #982.
#972 -- scripts/log.sh
_remember_cfg_flatten_cache_path_v1()and the inline_f_v1derivation in_remember_cfg_flatten_cache_publish()used a bare${var/-v2-/-}substring substitution over the FULL path (including${TMPDIR:-/tmp}), so a TMPDIR containing the literal substring-v2-(e.g./mnt/build-v2-staging/tmp) diverted the substitution away from the real pre-#864 orphan-cache filename segment. Fixed by anchoring the substitution to the basename only at both call sites (split path into dir/base via%/*and##*/, substitute only on the base).New test file tests/test_tmpdir_v2_substring_collision_972.py, two tests -- the actual collision case and a positive control. Red confirmed against the pre-fix code (
git stashthe changed script, run,git stash pop): 1 failed as expected, positive control passed. Green: 5 passed combined with the pre-existing tests/test_v1_cache_orphan_cleanup_888.py.#975 -- hooks.d/after_save/60-git-reconcile.sh pre-re-enable checklist
The whole file is unreachable in production (kill switch, unconditional
exit 0) and its own test suite is entirely skip-disabled for the same reason, confirmed unchanged before and after this diff (6 passed, 21 skipped both times). Issue named 4 known defects:_grc_compute_touched_pathsswallowedgit diff --name-onlyerrors to2>/dev/nullwith nobody checking rc, silently emptying the touched-path list while the consumer's_checkout_okstayed 1. Now checks both calls' rc and falls back to$SLUG-only scope with a logged WARNING, mirroring the existing merge-base-failure fallback immediately above it.core.quotePathleft on for that diff output, so a touched path with non-ASCII/special bytes silently dropped out of the restore. A shared helper_grc_unquote_porcelain_pathwas factored out and applied at both the original call site and a new one. Self-review (see below) found the first version only stripped outer quote characters without decoding git's C-style interior escaping; fixed in a follow-up commit._grc_rebase_in_progresscall sites has a dedicated test, and that one test is itself skipped under the kill switch too. Adding dedicated tests for the other 4 sites was judged not worth doing: they would also be skipped and provide zero real verification until fix: 60-git-reconcile.sh conflict-abort restore can still destroy a concurrent write before the rebase --quit snapshot window (residual after #966) #969's real fix lands.Verification for items 1 and 2's actual fix is reasoned/verified-by-direct-bash-repro, not observed-via-pytest -- the whole file's test harness cannot reach these functions while the kill switch holds:
bash -nsyntax-checks clean, and the active (non-skipped) test classes across the affected test files pass with no change in pass/skip counts.Self-review correction
A reviewer found that the first version of
_grc_unquote_porcelain_pathonly stripped outer"characters and did not decode git's C-style interior escaping (\",\\,\t,\n,\NNNoctal for non-ASCII/control bytes) -- so the exact non-ASCII case item 2 claims to fix would still silently drop out of the restore. Reproduced directly: git's porcelain token for an accented filename renders as"caf\303\251.txt", and the first-version helper produced the literal 17-byte escape text, not the real UTF-8 filename. Fixed via a sentinel-protectedprintf '%b'pass, verified against 4 cases directly in bash (non-ASCII octal, embedded quote, plain unquoted, and the pathological literal-backslash-before-literal-quote case). No pytest regression test added for this helper specifically, for the same unreachability reason as the rest of the file.#982 -- docs/configuration.md
docs/configuration.mdline 31'sgit_reconcile.enabledrow said the hook "exits immediately, before even reading this flag" -- false since PR #979, which made the hook read the flag first before deciding whether to log a hook-errors.log notice via report_error, prior to its still-unconditionalexit 0. Fixed the doc row to describe the actual read-then-notify behavior, naming the hook-errors.log //remember:doctorRecent-errors-WARN consequence for users who opted in.Adjacent finding (same stale-wording class, found while verifying #979's "eight test copies" claim): tests/test_git_backup_push_rejected_253.py and tests/test_git_restore_hook_253.py still carried the identical false "exits before it ever reads git_reconcile.enabled" phrase in their own docstrings and assertion messages (not test logic) -- two of the test files #979 apparently did not cover. Fixed in this same diff: mechanical same-subsystem prose correction, one-sentence blast radius each, re-verified by re-running both files afterward (62 passed, no change in test logic, only message text changed).
Bookkeeping: trap.d/969.stale-reconcile-prose-not-updated.md removed per the issue's own note that it is now stale -- verified clean (0 matches) against all three files the fragment names before deleting.
New test file tests/test_reconcile_flag_doc_wording_982.py, three tests. Red confirmed against the pre-fix doc (
git stashdocs/configuration.md, run,git stash pop): 1 failed as expected. Green: 29 passed combined with tests/test_host_neutral_wording_562.py and tests/test_config_contract.py.Docs
README.md: no change needed -- grepped for the stale phrases this diff touches ("exits immediately, before even reading", "v1 orphan") and confirmed both absent; README never described either of these internals.
Platform
Observed (macOS/darwin, bash 5): all pytest runs above, bash -n syntax checks, the direct bash reproductions of the quoting fix. Reasoned (not run on this machine): Linux/Windows legs of CI -- confirmed via reading .github/workflows/tests.yml that the matrix is ubuntu-latest/macos-latest/windows-latest x python 3.9-3.12, and that macos-latest resolves plain
bashto the stock 3.2 binary this repo's own CLAUDE.md pins as the floor; all new/changed shell and the new Python test files were written against that floor.[AI-generated]