Repository navigation
refactor(lib): simplify the second third of hook-utils.sh - #15399
Conversation
Simplify the functions that start in range 2 of 3 (lines 1747-3492 of the 5237-line file at 42517b5) without changing behavior: - hook::repo_relative_path_to: the four trailing-slash trim loops become hook::_rstrip_slashes_to, the two prefix-strip-with-fold blocks become hook::_strip_root_to, and the Windows OSTYPE test runs once. - hook::resolve_read_timeout_to and hook::resolve_read_slice_to share hook::_micros_to for the fixed-point seconds parse; the zero test is dropped because zero already falls under the 10 microsecond floor. - hook::begin resolves FILE_REL in one place for --relative and a wired sink. - hook::extract_bash_subject_to folds its three bail-outs into one. - hook::emit_telemetry counts brackets with two substitutions instead of four and removes its jq temp file in one place. - hook::repo_root_uncached_to drops a redundant assignment. Regenerated the 20 shared copies with scripts/sync-shared-copies.sh and added a patch fragment for each carrying plugin. Refs: #14332 Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH Co-Authored-By: Claude Opus 5.5 <[email protected]>
The random suffix 4c6ba5aa contains "ba", which typos flags. Same fragment content under a new suffix. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: PR #15399, refactor(lib): simplify the second third of hook-utils.shNo security issues found. critical-findings: 0 ScopeI read every hunk of the distinct diff: What I checked
SpendNo spend or billing change. No embedded instructions found in the PR context. |
|
claude-review reviewed Code review: refactor(lib): simplify the second third of hook-utils.shNo findings. I read every changed hunk: the I checked each rewrite against the code it replaces:
Closing issue #14332, acceptance criteria:
No |
Closes #14332
Summary
Simplifies the second third of
lib/hook-utils.sh(lines 1747-3492 at 42517b5) without changing its behavior, per #14332. Changed:repo_root_uncached_to,repo_relative_path_to,resolve_read_timeout_to,resolve_read_slice_to,begin,extract_bash_subject_toandemit_telemetry, with three private helpers (_rstrip_slashes_to,_strip_root_to,_micros_to). The fail-closed core ofbuffer_stdin_toandjq_fields_uncachedis untouched.Built by hand rather than by the issue lane: the lane's patch was refused at the 262144-byte scan cap because
hook-utils.shhas 20 regenerated copies underplugins/. The hand build was agreed with the hub session.session: Simplify Planning
Fix
scripts/sync-shared-copies.shregenerated the 20 copies; each carrier plugin has onebump: patchfragment ("Internal simplification, no behavior change."). One fragment was renamed in a second commit because its random suffix tripped the typos check.__hu_prefix, so a caller whose destination variable is namedmicros,wholeorfracno longer collides with them. No caller uses those names.Verification
hook-utilssuite 703 pass, 1 fail that also fails at base (biome installed at a mise path on this host); secret-pattern detection suite 312 pass;sync-shared-copies.test.sh96 pass.sync-shared-copies.sh --check(767 copies), fragment--checkand--check-bump: clean.Related
Follow-ups
lib/hook-utils.shalready failsshfmtunder the repo.editorconfig(switch_case_indent) at base; not reformatted here.🤖 Generated with Claude Code
https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH