Repository navigation
Add non-dispatching PIC approval adapter and real-verification recovery scenarios - #4
Conversation
Signed-off-by: Fabio Marcello Salvadori <[email protected]>
Signed-off-by: Fabio Marcello Salvadori <[email protected]>
…ecovery scenarios Signed-off-by: Fabio Marcello Salvadori <[email protected]>
…ine probes Signed-off-by: Fabio Marcello Salvadori <[email protected]>
…rification Signed-off-by: Fabio Marcello Salvadori <[email protected]>
|
Thanks @madeinplutofabio — this is substantial progress, and it addresses the PIC verification dependency we had left open after @ryjen's A03 review. I reviewed the adapter contract and the recovery integration. The separation between signed-approval verification, new-effect admission, retained-operation recognition, and historical-result disclosure is the right direction. I particularly appreciate that the implementation distinguishes real PIC verification from the synthetic caller authorization and recovery policy, and that the test clock is documented as worker-scoped instrumentation rather than an SDK capability. A few points I'd like to preserve before merging:
I'll review the implementation and committed test evidence against these boundaries. T01–T03 can proceed as a separate retention increment so we avoid coupling pruning behavior to the PIC adapter. Thanks for making this an executable contribution rather than leaving A03 as a proposed test vector. |
|
Thanks @arjun2075. Agreed on all 4 boundaries. They remain explicit in the contract, README and committed validation record: A03 is a candidate recovery policy, decision and operation identities remain separate, and the response fields and reason codes are fixture-local. PIC verification is real; caller authorization, disclosure and recovery storage remain synthetic. I’ll preserve those distinctions through review and keep T01–T03 separate. |
|
Hi @arjun2075, thanks for independently running #4 and building the retention increment on it. Is there anything you need from me to complete the adapter review, or should I keep waiting for your implementation review? |
|
Hi Fabio — thanks for following up. Nothing further is needed from you on the implementation at this stage. I independently reproduced the #4 validation results at f01ccb4, and the retention work in #5 is intentionally separate from your adapter. I’m completing the final implementation review, particularly the non-dispatching verification boundary, failure-closed behavior, and decision-to-operation binding. I’ll raise any concrete findings directly on this PR. Could you mark #4 ready for review? Once the review is closed, the plan is to integrate #4 into the retry-recovery branch, then bring in #5. The A03 recovery policy and fixture-local semantics will remain explicitly provisional. Thanks again for the substantial contribution. |
arjun2075
left a comment
There was a problem hiding this comment.
Reviewed the non-dispatching PIC verification boundary, worker isolation, fail-closed client behavior, and decision/operation separation against the committed independent validation evidence at f01ccb4. The archived rerun records 113 passing unit tests, 10/10 original MCP cases, 19/19 real-PIC approval cases, and a passing vendored PIC baseline. Approved for integration as an experimental fixture only. A03 recovery-after-revocation, fresh-operation-ID conflict handling, cross-context binding, and added adapter codes/fields remain provisional fixture choices, not MCP/PIC conformance requirements. Retention/pruning remains separately scoped to #5; no durability, exactly-once payments, or production auth claims.
Integrate the full experimental MCP lost-response/retry-recovery harness, PIC signed-approval verifier (PR #4), and retention/readback increment (PR #5) into main. Preserve staged evidence and explicit limitations: synthetic effect and authorization model, no durable/concurrent safety, and provisional policy semantics. Reconcile docs and final PR description with the tested scope.
Adds the signed-approval side of the retry-recovery fixture (#2), for
modelcontextprotocol/modelcontextprotocol#3394, implementing the non-dispatching
adapter contract proposed in
adapter-contract.md.What this adds
test(retry-recovery): vendor PIC refund example and add baseline runner:the refund example at
eb7cd467, vendored byte-for-byte with its Apache-2.0licence and a SHA-256 manifest, plus a runner that executes its own checks in a
disposable copy.
feat(retry-recovery): add non-dispatching PIC approval adapter:pic_adapter/(verifier, worker-scoped test clock, worker subprocess, asyncclient), keyring fixtures and tests.
feat(retry-recovery): integrate real PIC approval verification into recovery scenarios:an opt-in approval mode in
recovery.py, 17 MCP approval scenarios inrun_cases.py, the implemented contract, README updates and regeneratedresults.json.fix(retry-recovery): refuse optimized runs and reject malformed baseline probes:run_cases.pyrefuses to run underpython -OorPYTHONOPTIMIZE, since itsscenario validation uses
assert; the baseline checker validates the originalprobe and case lists instead of silently dropping malformed entries.
test(retry-recovery): exercise A03 signer revocation with real PIC verification:two MCP scenarios that complete an operation under a valid approval, then retry
after signer revocation with disclosure allowed and denied.
The original 10 MCP cases and 8 policy tests are unchanged and still pass.
Executed
Python 3.11.9,
mcp==2.2.0,pic-standard[crypto]at330fdd81(verified frominstalled metadata):
run_cases.py: 10/10 original cases; 19/19 approval cases with real pinned PICverification in one worker (37 verifications, no replacement).
adapter through a real worker, baseline runner, optimized-mode refusal).
Approval scenarios cover R01, R05, A01, A02, A03 under a candidate recovery policy
(signer revoked, disclosure allowed/denied), A04 (disclosure allowed/denied), A05
(tenant, principal), A06 and a tampering control, A07 and a decision-mismatch
control, a replay control, a T04-style positive control, and new effects under an
expired approval and under a revoked signer. Each attempt asserts provider
effects, delivered status and client-reported outcome; adapter decisions are
asserted whenever verification is invoked. Details: README "Executed approval
subset".
Answers to the review questions in #2
PipelineOptions.key_resolver). Clock: no SDKparameter; a worker-scoped test clock patches only the two modules that read
time, as test instrumentation, not a PIC clock API.
pass,fail,not_evaluatedand
unavailable.signer_trustis the configured keyring status of theevidence
key_id; it does not establish that the proposal was signed by it.upstream self-check uses a separate environment because it temporarily modifies
installed package metadata. Verification runs in a separate process only to
isolate vendored module names and the test clock.
Provisional, open for review
described below; the policy itself remains open for review.
conflict;returning the original outcome is an alternative.
proposal_rejected,verification_incomplete,clock_rejected,verifier_unavailable) and thechecks.expected_actionextension.Relation to ryjen's A03 / T01-T03 review
verified against two fixture keyring snapshots, before and after revocation;
the revoked approval is rejected (
signer_revoked) and cannot authorize newexecution. Under the candidate policy, the retry returns the original receipt
when disclosure is allowed and
deniedwith no receipt marker when it isdenied, with one provider effect in both cases. Receipt access rests on the
harness-owned authenticated context, the scoped retained record and current
disclosure permission, never on the rejected proposal. This covers the real
verification part Arjun left pending; the recovery policy itself remains open
for review.
Not claimed
The provider, recovery store and caller authorization are synthetic. A05 shows
the context change is rejected without returning the receipt; it does not
establish existence hiding. No exactly-once remote effects, durability, restart or
concurrency safety, pruning behaviour, adopted MCP semantics or merged conformance
test, and no change to PIC.