Assert every published argument pattern has a matcher - #459
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
lamemustafa
force-pushed
the
fix/amends-batch-id-pattern
branch
from
September 16, 2026 21:41
dd63687 to
738e7d8
Compare
lamemustafa
force-pushed
the
fix/amends-batch-id-pattern
branch
from
September 16, 2026 21:44
738e7d8 to
6ebba4b
Compare
#444 admitted amends_batch_id through tools/call. What stays open is why it was refused: validate_string_bounds refuses every value under a pattern admission does not implement, and nothing notices a new one. Split the matcher lookup out so a test can walk every tool's top-level string patterns through it, and admit the batch id with the build's own valid_batch_id, checked equal to is_uuid_v4_lowercase on edge inputs. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lamemustafa
force-pushed
the
fix/amends-batch-id-pattern
branch
from
September 16, 2026 23:06
65b325e to
cfa2aa0
Compare
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.
Outcome and reason
Rebuilt on master after #444. #444 independently admitted
amends_batch_idthroughtools/call, which fixed the same bug this PR first targeted. That bug: every amendment over MCP was refused asargument_invalid:amends_batch_id, found by the live lab end-to-end run described below. This PR now keeps only what #444 does not cover: nothing stops the next published pattern from failing the same way.validate_string_boundsrefuses every value published under a pattern thatpublished_pattern_matchesdoes not implement.amends_batch_idshipped like that, and 16 tests and two reviews passed because the tests called the handler directly.Change
agent_catalog.rs:published_pattern_matcher(pattern) -> Option<fn(&str) -> bool>is split out ofpublished_pattern_matches, which now calls it.Nonemeans an unrecognised pattern. The three older arms keep their exact logic; the date arm moved verbatim intodate_wire_matches. The batch-id arm now appliesagent_import::valid_batch_id, the rule the build itself enforces, in place of Parse password-protected bank statements into voucher proposals, through PDFium #444'sstrip_prefix("bridge-").is_some_and(is_uuid_v4_lowercase).BRIDGE_BATCH_ID_PATTERNstayspub(super)for the schema, andis_uuid_v4_lowercasestays forproposals_id.agent_admission_tests.rs:every_pattern_admission_reads_is_one_it_recognizeswalks every registered tool's top-level string properties and top-level string array items, which is exactly whatvalidate_tool_argumentsreads. It assertspublished_pattern_matcherhas an arm for each pattern, asking the matcher itself rather than a list kept in the test.the_batch_id_pattern_admits_exactly_what_the_build_admitsrefuses uppercase, a missing prefix, version 1, variantc, no hyphens, braces, aurn:uuid:form, the nil UUID, a trailing newline and a non-ASCII character. It also assertsvalid_batch_idandstrip_prefix + is_uuid_v4_lowercaseagree on all those inputs plus 256 fresh v4 ids.Scope limit: the walk covers top-level patterns only. Nested patterns are read by
validate_against_schemaforvoucher_presence, whose inventory test already pins them, and by the import payload's typed parser.Validation and evidence
every_pattern_admission_reads_is_one_it_recognizes,the_batch_id_pattern_admits_exactly_what_the_build_admitsand Parse password-protected bank statements into voucher proposals, through PDFium #444'san_amendment_is_admitted_through_tools_call_argument_validationall fail. Restored,cargo test --locked --lib -- agent::catalog an_amendment_is_admitted_through_tools_call an_unknown_amendment_targetpasses 11 tests: the 9 inagent::catalog, Parse password-protected bank statements into voucher proposals, through PDFium #444's tools/call amendment test, andan_unknown_amendment_target_is_refused_before_any_tally_read. Without the last filter, 10 pass.cargo fmtis clean, andcargo clippy -p bridge --lib --tests -- -D warnings -A clippy::pedanticis clean.BRIDGE SHAPE LAB, first version of this PR): MCPbuild_import_xmlwithamends_batch_idwas refused at masterf25fc91a. With the fix it was admitted; the compare-and-swap matched both vouchers; the amendment importedALTERED=2and verified 2/2; and a later change behind Bridge's back was refused withbook_voucher_diverged. The admission rule was the samevalid_batch_idused here.🤖 Generated with Claude Code