Repository navigation
refactor(lib): simplify the last third of hook-utils.sh - #15417
Conversation
Simplify the functions that start in the last third of lib/hook-utils.sh (hook::ansi_c_decode_to onward) without changing behavior, per #14333: - git_resolve_index: merge the two env -S splice arms, drop option arms that matched what the default arm already did, drop the redundant guard around the env and sudo short-option peels, and fold the optional-operand skips into one line each. - git_resolve_subcommand: one arm for -c/--config/--config-env in both the two-word and the = form. - env_s_split, wsl_operand, shell_c_operand, git_effective_dir_to, bash_parse_segments_shfmt and findings_to: shorter control flow. Regenerated the 20 shared copies and added one patch fragment per carrying plugin. 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: no security issues foundThis PR refactors the shared bash library What I checked, hunk by hunk (
Copies: the 20 Not applicable here:
critical-findings: 0 |
|
claude-review reviewed Code review: PR #15417, refactor(lib): simplify the last third of hook-utils.shNo findings. I read every hunk of
Closing issue #14333 criteria
Changelog: each carrier plugin gets one Spend: none. The change doesn't touch lane runs, models or schedules. |
Closes #14333
Summary
Simplifies the last third of
lib/hook-utils.sh(lines 3469-5201 at 1feb847, fromansi_c_decode_toon) without changing its behavior, per #14333. Changed:env_s_split,shell_c_operand,wsl_operand,git_resolve_index,git_resolve_subcommand,git_effective_dir_to,bash_parse_segments_shfmtandfindings_to. No new functions; exported names, flags and printed text unchanged.emit_telemetry, which starts in part 2's range, is untouched.Built by hand rather than by the issue lane: the lane's patch would exceed its 262144-byte scan cap because
hook-utils.shhas 20 regenerated copies underplugins/. Same route as part 2 (#15399), agreed with the hub session.session: Simplify Planning
Fix
casearms that did what the default arm does or could not be reached, and-[!-]*guards the peel regexes already cover; merged the config arm (itsbreakreaches the samereturn 1with the same globals) and theenv -Sarm (same operand source, slice offset and double strip). Each newA && B && ((i++))list increments a value already 1 or more, so it is safe underset -e.scripts/sync-shared-copies.shregenerated the 20 copies; each carrier plugin has onebump: patchfragment.Verification
HOOK_GIT_*result global that destructive-guard.sh and the tests read (git_invocation,git_resolve_index,env_s_split,git_effective_dir_to,git_is_bin,shell_c_operand,wsl_operand,bash_parse_segmentscallbacks, refusals and heredoc modes,findings_to --delta): identical. Two deliberate breaks were caught.sync-shared-copies.test.sh96, block-dangerous-git 1030 (5 fail also at base: strace execve counts and 512 KB-stack timing on this host), noncanonical-commit 292 (2 fail also at base).sync-shared-copies.sh --check(767 copies) and--check-bump, fragment--check, typos: clean.Related
Follow-ups
lib/hook-utils.shfailsshfmtunder the repo.editorconfig(switch_case_indent) at base; not reformatted here.🤖 Generated with Claude Code
https://claude.ai/code/session_01VQb9Q3tnh28AzDYZ8AUjhH