fix(cmc): readOffer must use streams not streamIds on events.get#67
Closed
perki wants to merge 1 commit into
Closed
fix(cmc): readOffer must use streams not streamIds on events.get#67perki wants to merge 1 commit into
streams not streamIds on events.get#67perki wants to merge 1 commit into
Conversation
`readOffer` was calling `events.get` with `streamIds: [...]` which the api-server schema rejects with OBJECT_ADDITIONAL_PROPERTIES. `events.get` takes `streams` (recursive read filter); `streamIds` is the `events.create` write target. The four other `events.get` callers in this file (listInvites, waitForAccept, listAcceptedRelationships) all already use `streams` correctly. Reproduces 100% against any open-pryv.io running the CMC plugin — any `cmc.readOffer(capabilityUrl)` call throws on the first await. No new tests in this PR — existing cmc.test.js suite mocks the Connection.apiOne layer and doesn't exercise the wire-shape; the schema mismatch only surfaces against a real api-server. End-to-end verification via an HDS-side scenario test runs green post-fix.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Member
Author
perki
added a commit
that referenced
this pull request
May 19, 2026
The contract test was asserting the buggy intermediate shape from PR #67 (`streams: [':_cmc:_internal:offer']`). PR #68 corrected that to omit the streams filter entirely (parent stream isn't auto-provisioned). Update the assertion to match the final correct wire-shape: no `streams`, no `streamIds`, with `types: ['consent/request-cmc']` as the only filter.
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
readOffer(components/pryv-cmc/src/index.js:553-556) callsevents.getwith{streamIds: [NS_INTERNAL + ':offer'], limit: 1}. The api-server'sevents.getschema rejects this with:events.gettakesstreams(recursive read filter);streamIdsis theevents.createwrite target. EveryreadOffercall fails against every deploy.The four other
events.getcallers in this file (listInvites:374-375,waitForAccept:445-446,listAcceptedRelationships:827-828,acceptScopeUpdate:982) all already usestreamscorrectly — this is an isolated typo.Fix
Change
streamIds→streamsinreadOffer. 1-line behavioural change plus a clarifying comment.Visible impact pre-fix
Any caller of
cmc.readOffer(capabilityUrl)throws on the first await. Patient apps can't peek the offer (display title/description/permissions) before clicking accept. HDS's plan-59 Phase-5a UX needs this primitive to render the offer-preview screen.Test
No new tests in this PR — the existing
cmc.test.jssuite mocksConnection.apiOneand doesn't exercise the wire-shape, so the schema mismatch slipped past unit coverage. The downstream behavior is exercised end-to-end against a deployed open-pryv.io via HDS's_plans/59-pryv-cmc-integration-atwork/tests/08-sdk-handshake.js(PASS post-fix).If you'd like, I can add a contract test that asserts the underlying Connection call uses
streams— let me know.