fix(sandbox): correlate mediation by test case - #327
Open
Jake Present (jakepresent) wants to merge 9 commits into
Open
fix(sandbox): correlate mediation by test case#327Jake Present (jakepresent) wants to merge 9 commits into
Jake Present (jakepresent) wants to merge 9 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.
Chang Liu (changliu2)
requested changes
Aug 24, 2026
Chang Liu (changliu2)
left a comment
Collaborator
There was a problem hiding this comment.
Two blockers on exact head 46d583a:
- Endpoint sandbox targets do not receive the per-test-case ID. The endpoint session still posts only
messageandhistory, so case-bound mocks cannot vary correctly across an already-running endpoint. ScenarioBackend.current_state()now accepts an optional case ID, but callers always pass it; legacy subclasses that override the prior one-argument method raiseTypeError.
Please also align wildcard/no-case matching and evidence case-ID precedence so mock selection and recorded evidence cannot disagree.
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
ASSERT carried a
case_id, but the sandbox path did not propagate and enforce one consistent identity end to end. That made case-bound mocks incomplete, allowed ambiguous rule selection, and left evidence unable to prove which case rule fired.Fix
SandboxedEndpointSession, the stock container environment, and the optional JSON request sent to an already-running sandbox endpoint;target.endpointrequest shape when no case ID is configured;current_state(scenario)extension contract;mock_source, replay detail, andmatched_case_idin judge-visible evidence; andVerification
124 passed.1461 passed, 23 skipped, 840 subtests passed.main, including the merged host-owned egress ledger correction.Risk
The endpoint
case_idfield is optional. Existing ordinary endpoints and mock rules without a case binding retain their previous behavior. Legacy custom scenario backends remain usable, but cannot gain per-case state isolation until they adopt the new case-aware contract.A clean local stock-image rebuild remains blocked by the local Docker builder's external PyPI TLS failure. The final combined correction tree was separately exercised with the exact branch source overlaid onto the existing stock image; clean-image CI is owned by #328.