Repository navigation
perf(adapter-manifest): validate a manifest once per call, CC-637 batch 1 (guard hook 5.3 s to 3.4 s on Windows) - #681
Merged
Conversation
…once per nested helper (CC-637) dispatch_path called adapter_manifest_file about five times; on native Windows that made a guard-executor-write hook call take 5.3 s. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011c6rVDk6zyfgLPEfbVrZi9
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011c6rVDk6zyfgLPEfbVrZi9
…alid runner_kind behavior, link CC-612 (CC-637) Review (risk) found _adapter_manifest_runner_kind_of missing from the export -f block: a child bash inheriting the exported public functions failed with command not found. QA found no direct test for an invalid runner_kind. Architecture: document the validate-once convention. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011c6rVDk6zyfgLPEfbVrZi9
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
adapter_manifest_runner_kind,adapter_manifest_effective_routeandadapter_manifest_dispatch_pathre-ran the full manifest validation (two directory resolutions, two manifest reads) once per nested helper, about five times indispatch_path. They now validate once and share a new internal_adapter_manifest_runner_kind_of. The checks and their order are unchanged.guard-executor-write.shcalls these on every codex write; on native Windows one hook call took 5.3 s.partial: no cache was added, only the nested repeats were removed).Evidence (one machine, single measurements, noisy)
dispatch_path1757 to 740 ms,effective_route711 to 399 ms,guard-executor-write.shcall 5.3 to 3.4 s.mainversus new: 4 real adapters and 13 broken manifests (bad schema, name, runner_kind, route, entrypoint, duplicate keys), 4 functions each = 80 outputs, stdout, stderr and exit code byte-identical. A critic subagent ran an independent 97-line version under plain,set -eandset -u: identical.test-executor-router.sh: 36 passed, 1 failed; the failure ('missing nonexec directory and symlinks rejected', no symlink or exec-bit support on this host) is identical on main (34 passed, 1 failed there, before the two new cases).test-hook-profile-parity.sh: 5 passed.test-guards.sh --filter exw:: 30 passed.export -ffails the child-shell case; skippingrunner_kind_validfails the direct invalid-kind case.Gate and review
export -fblock, so a child bash that inherits the exported public functions failed withcommand not found); fixed in the second commit with a regression case. QA's surviving mutant (no test for an invalid runner_kind called directly) got a case too.test-guards.shwas not run (over 10 minutes here, and one background attempt was killed for memory pressure); symlink, exec-bit and boundary checks cannot be exercised on this host, so CI is the evidence for them;test-doctor.sh,test-install.shandtest-pmctl-adapter-generate.sh(partly) not re-run for this PR.adapter_manifest_dispatch_pathalready fails in a child shell that only inherited the exported functions (its safety patterns do not survive the export round trip); identical on main, not addressed here.tests/shell/test-executor-router.sh(an existing suite).adapter_manifest: exported functions work in a child shell: stable supported boundary (the library exports its public API for child shells), high-impact regression (a missing export made every public function fail there), implementation-independent observable (exit code and output), low maintenance, direct contract; killed by the missing-export mutant.adapter_manifest_runner_kind: invalid runner_kind is rejected directly: same criteria; the shared validation helper is what the refactor touched and no test reached it directly; killed by the skip-validation mutant.🤖 Generated with Claude Code
https://claude.ai/code/session_011c6rVDk6zyfgLPEfbVrZi9