perf: implement all 11 Pass 8 performance findings from PR #3 - #4
Merged
Conversation
The reference copy is target-independent (canonical content + version + canonical SHA-256), yet gen_vendored ran once per file per target in --check mode and twice per file per target in sync mode — 18-36 gen_vendored/shasum spawns where 3 suffice, paid on every commit via the pre-commit hook (~1-2s on macOS, where sha256_of falls back to Perl shasum). Generate the references up front into a scratch REF_DIR; check mode cmp's against them, sync mode installs them via a same-dir temp + mv (atomicity kept) and cmp's the landed file for the write-verify. Pass 8a P2 from TODO.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016mBmyeTGwKzumCZ3VApLum
Replace the per-file mktemp/git-show/grep/rm cycle (~5-6 fork/execs + a temp-file write/read per tracked file, every commit) with a single `git grep --cached -I -nE` over the index — same staged-blob semantics as `git show :<file>`, -I skips binaries, file:line-only reporting kept. Filename checks now loop over the git ls-files list alone, and blob extraction happens only for *.pem files. Also fixed while here: a bare id_rsa/id_ed25519 committed at the repo ROOT now trips the filename check — the old */id_rsa pattern required a leading directory component, so root-level keys were missed. Pass 8a P3 from TODO.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016mBmyeTGwKzumCZ3VApLum
sandbox_stage_claude_config copied plugins/ and statusline/ wholesale with cp -a — including their multi-MB .git dirs — then deleted those dirs with find -exec rm -rf, paying full copy I/O for data immediately discarded on the interactive sandbox-start path. Stage the two git-clone trees via tar --exclude .git (bsdtar + GNU tar compatible, bash-3.2 safe) so .git is never copied; plain items keep cp -a. Vendored copy re-synced. Pass 8a P3 from TODO.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016mBmyeTGwKzumCZ3VApLum
Dockerfile: move the image-wide setuid/setgid strip to just before the
frequently-edited COPY block, so a routine sync.sh allowlist/script
edit no longer re-runs a full-filesystem traversal (~10-40s in the
builder VM) on every rebuild. A scoped strip over the COPY'd paths
(/usr/local/{sbin,bin}, /usr/local/share/dev-sandbox, /etc/squid) is
the new last layer, preserving the defense-in-depth coverage of the
COPY'd files at near-zero cost.
bin/dev: fold the proxy-wait into the top of the lifecycle exec — on
warm reuse the first probe succeeds, so the standalone exec paid a
container-CLI + XPC round-trip (~100-300ms) per launch for nothing.
The wait keeps its barrier role for the start-stopped race. Poll at
0.2s (here and in post-create.sh) instead of 1s, trimming ~0.5s avg
off cold starts.
Pass 8b P3s from TODO.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016mBmyeTGwKzumCZ3VApLum
…cans - egress-test: build via SHA-pinned setup-buildx + build-push-action with the GHA layer cache (cache-from/to type=gha, load: true), then run the smoke test with SKIP_BUILD=1. The Dockerfile's deliberate layer ordering finally pays off in CI: cache-hit builds drop from ~4-8 min (the pipeline's long pole) to seconds. - codeql.yml: triggers scoped to .github/workflows/** and .github/codeql/** — the only paths the actions-language analysis reads. Safe: CI Complete, not CodeQL, is the required check. - Weekly schedule now runs only the rule-DB-dependent scans (Trivy + gitleaks); the six deterministic jobs get if: github.event_name != 'schedule', and the gate tolerates their by-design skips on schedule runs only. - Trivy: one scan (format sarif + exit-code 1) instead of two identical back-to-back scans; Trivy writes the SARIF before applying the exit code, so gating + Security-tab upload are both preserved. - quality-gate/ci-complete collapsed into a single "CI Complete" job (same required-check name, full needs list, skipped-counts-as-failure kept) — removes a serial runner allocation from every run's critical path. - squid job: apt packages installed via SHA-pinned awalsh128/cache-apt-pkgs-action; cache-hit runs skip the ~25-50s apt-get update entirely. Pass 8c P2 + P3s from TODO.md. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016mBmyeTGwKzumCZ3VApLum
…entry Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016mBmyeTGwKzumCZ3VApLum
EraPartner
force-pushed
the
claude/pr-3-findings-1f9ene
branch
from
July 13, 2026 07:28
b158acc to
99bc7ae
Compare
awalsh128/cache-apt-pkgs-action@v1.6.3 triggers a GitHub Actions startup_failure: the whole CI run fails to start, no jobs execute, and GitHub surfaces no parse error. Isolated by bisecting the workflow on throwaway branches (only this step fails; still fails with the version input quoted and with all nested action SHAs verified to resolve). Revert the squid job to plain apt-get update + install; keep the other 10 Pass-8 findings. Update CHANGELOG/TODO to reflect 10 of 11 landed.
EraPartner
marked this pull request as ready for review
July 13, 2026 09:43
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.
Summary
Implements all 11 performance findings (2 × P2, 9 × P3) documented in PR #3's Pass 8 review. This branch contains PR #3's three docs commits (merged in unchanged) plus the implementations, so merging it also lands PR #3 — which can then be closed.
Pass 8a — shell tooling
sync.sh— vendored reference copies are generated once into a scratchREF_DIRbefore the target loop instead of 18–36gen_vendored/shasumruns (check: cmp against the reference; sync: atomic same-dir temp +mvinstall, then cmp write-verify). Cuts ~1–2s of per-commit pre-commit latency on macOS.audit.sh— the secret scan is onegit grep --cached -I -nEover the whole index (same staged-blob semantics,file:line-only reporting) instead of ~5–6 processes + a temp file per tracked file. Bonus fix: a bareid_rsa/id_ed25519at the repo root now trips the filename check (*/id_rsarequired a leading dir).launcher-common.sh— plugins/statusline staged viatar --exclude .gitinstead of copying multi-MB.gitdirs and deleting them (vendored copy re-synced).Pass 8b — sandbox runtime
bin/dev— proxy-wait folded into the lifecyclecontainer exec(one fewer CLI/XPC round-trip per launch; barrier semantics kept); 0.2s polls here and inpost-create.sh.Pass 8c — CI
docker/setup-buildx-action+docker/build-push-actionwith the GHA layer cache, thenSKIP_BUILD=1into the smoke test. Cache-hit builds drop from ~4–8 min to seconds..github/workflows/**+.github/codeql/**.format: sarif,exit-code: "1"); gating + Security-tab upload both preserved.quality-gate+ci-completemerged into one "CI Complete" job (same required-check name, full needs list, skipped-counts-as-failure kept).awalsh128/cache-apt-pkgs-action@v1.6.3.All three new action pins were resolved to real tag commits via
git ls-remote(lightweight tags, so the listed SHAs are commit SHAs).Testing
./audit.shclean on the repo, and a scratch-repo fixture verified all detection paths: staged-secret-with-clean-worktree (index bypass), root-levelid_rsa, private-key.pemflagged, public.pemnot flagged.EGRESS_SELF_ONLY=1 ./sync.sh+--check: re-sync is byte-identical; check passes at every commit..gitdirs excluded at any depth, all other items staged intact, plugin-path JSON rewrite unaffected.bash -n+shellcheck -s bash -e SC1090,SC1091 -S warningclean on every touched script; both workflows parse as YAML.egress-testjob on this PR exercises the real build + boot.🤖 Generated with Claude Code
https://claude.ai/code/session_016mBmyeTGwKzumCZ3VApLum
Generated by Claude Code