fix(sandbox): correlate mediation by test case - #327
Open
Jake Present (jakepresent) wants to merge 4 commits into
Open
fix(sandbox): correlate mediation by test case#327Jake Present (jakepresent) wants to merge 4 commits into
Jake Present (jakepresent) wants to merge 4 commits into
Conversation
Jake Present (jakepresent)
requested review from
Aaron Aspinwall (AaronAspinwall123),
Chang Liu (changliu2) and
tangym
as code owners
August 20, 2026 05:15
sandbox-action-mediation resolve built its MockCall with no case_id and
had no way to supply one, so once case-bound mocks existed the tool
reported the uncorrelated-run branch for every call. That is worse than
missing: it confidently prints a mock the run will not use.
- add --case-id and thread it into both the find() and resolve() calls
- echo the case being resolved as
- name the matched rule's case binding when one applies
- when no --case-id is given but the setup declares case-bound rules,
say so instead of passing the default branch off as the answer
Also document the case_id precedence rule in the example README. It is a
tier, not another matcher: a case-bound rule outranks every unbound rule
regardless of argument specificity, which is deliberate but surprising if
you assume it just adds a condition.
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.
Problem
MockCallcarried acase_id, but ASSERT never propagated its stable test-case identity into the sandbox. The field was therefore inert: otherwise identical calls in two cases could not intentionally select different mocks, scenario state could be shared by a long-lived host, and action/network evidence lacked direct case correlation.Fix
SandboxedEndpointSessionand the stock containerASSERT_SANDBOX_CASE_IDfrom target overridescase_id:selectors inmocks.yamlExisting ordered retry responses remain supported; this change ensures separate cases each start from their own sequence.
Verification
main.117 passedacross sandbox setup, example, hostile-input, and runtime tests.1375 passed, 24 skipped, 840 subtests passedacrosstests/.Risk
The new fields are optional. Existing rules without
case_id:and callers without a case ID retain their previous behavior. Case-specific rules count as one additional specificity condition and do not change pass/mock/block policy decisions.A fresh local rebuild of the stock image was blocked before product execution by the local Docker builder's PyPI TLS handshake failure. The live proof used a no-network derivative of the existing stock image with this branch's package and stock server copied in; PR CI will perform the clean build path.