Commit 7b7fe2a
committed
fix(cmc): readOffer must omit
After the previous `streamIds → streams` fix, readOffer still fails
against any real api-server with `unknown-referenced-resource`: the
api-server validates that streams referenced in events.get actually
exist, and `:_cmc:_internal:offer` is NOT auto-provisioned on every
user account — only the per-capability children
`:_cmc:_internal:offer:<capId>` are minted by capabilityMintHook.
The accepter doesn't know <capId> from the capabilityUrl alone, so a
specific-stream filter isn't possible either. The plugin's own
implementation of the same read (`readOfferViaCapability` in
acceptOrchestration.ts:71-78) handles this correctly: omit the streams
filter entirely and rely on the capability access's permissions to
narrow the response to the single offer event this token can read.
Mirror that approach. Keep the `types: [ET_REQUEST]` filter as
defense in case future plugin revisions place additional event types
on the offer stream. Verified end-to-end on demo: readOffer now
returns the offer with `requestedPermissions`, `consent`, etc.
No new tests in this PR — the existing cmc.test.js mocks
Connection.apiOne, so neither the field-name bug nor this parent-
stream-doesn't-exist bug is caught at unit-test time. Both surface
only against a real api-server.streams filter — :_cmc:_internal:offer is not a real parent1 parent 38bf4e6 commit 7b7fe2a
1 file changed
Lines changed: 13 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
550 | 550 | | |
551 | 551 | | |
552 | 552 | | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
557 | 565 | | |
558 | | - | |
| 566 | + | |
559 | 567 | | |
560 | 568 | | |
561 | 569 | | |
| |||
0 commit comments