Skip to content

Commit 60ef330

Browse files
committed
fix(plan-59 Phase 5a): rename HDS_NOOP_STREAM_ID :hds:noop → hds-noop
Pryv api-server rejects `:` prefixed stream ids as system-stream namespaces; `:hds:` is not a registered namespace on open-pryv.io so streams.create({id: ':hds:noop'}) returns invalid-request-structure. A regular user stream (plain `hds-noop`) works in any default store. Surfaced by verify-formspec.mjs on first live demo run. Tests + design brief updated to match.
1 parent aadc2da commit 60ef330

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

tests/cmcFormSpec.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ describe('[CFSP] cmcFormSpec helpers', function () {
2929
});
3030

3131
it('[CFS02] HDS_NOOP_STREAM_ID + permission match the brief', () => {
32-
assert.equal(cmcFormSpec.HDS_NOOP_STREAM_ID, ':hds:noop');
33-
assert.deepEqual(cmcFormSpec.HDS_NOOP_PERMISSION, { streamId: ':hds:noop', level: 'read' });
32+
assert.equal(cmcFormSpec.HDS_NOOP_STREAM_ID, 'hds-noop');
33+
assert.deepEqual(cmcFormSpec.HDS_NOOP_PERMISSION, { streamId: 'hds-noop', level: 'read' });
3434
});
3535
});
3636

@@ -45,7 +45,7 @@ describe('[CFSP] cmcFormSpec helpers', function () {
4545
const spec = basicSpec({ permissions: [] });
4646
const out = cmcFormSpec.deriveCmcPermissions(spec);
4747
assert.equal(out.length, 1);
48-
assert.equal(out[0].streamId, ':hds:noop');
48+
assert.equal(out[0].streamId, 'hds-noop');
4949
assert.equal(out[0].level, 'read');
5050
});
5151

@@ -54,7 +54,7 @@ describe('[CFSP] cmcFormSpec helpers', function () {
5454
const out = cmcFormSpec.deriveCmcPermissions(spec);
5555
// All filtered → placeholder injected
5656
assert.equal(out.length, 1);
57-
assert.equal(out[0].streamId, ':hds:noop');
57+
assert.equal(out[0].streamId, 'hds-noop');
5858
});
5959
});
6060

ts/cmc/formSpec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import type {
3737
export const FORM_SPEC_EVENT_TYPE = 'hds:form-spec-v1';
3838

3939
/** The HDS no-op permission stream — see Q-F3/F4 in the FormSpec design brief. */
40-
export const HDS_NOOP_STREAM_ID = ':hds:noop';
40+
export const HDS_NOOP_STREAM_ID = 'hds-noop';
4141

4242
/** Permission level used by the chat-only placeholder. Read on an empty stream is a no-op. */
4343
export const HDS_NOOP_PERMISSION: Permission = { streamId: HDS_NOOP_STREAM_ID, level: 'read' };
@@ -197,12 +197,17 @@ export async function readOfferWithFormSpec (
197197
/**
198198
* Derive the `requestedPermissions` array for `cmc.createInvite` from a
199199
* FormSpec. If the FormSpec has no real permissions (chat-only data set),
200-
* inject the `:hds:noop` placeholder so the CMC schema's non-empty-
200+
* inject the `hds-noop` placeholder so the CMC schema's non-empty-
201201
* permissions check passes (Q-F4 lock).
202202
*
203203
* The placeholder grants `read` on an empty patient-side stream — a
204-
* functional no-op. The patient's hds-webapp provisions `:hds:noop` at
204+
* functional no-op. The patient's hds-webapp provisions `hds-noop` at
205205
* first launch (Q-F3: patient-only).
206+
*
207+
* Note: the stream is plain `hds-noop` (no colon prefix) — `:hds:` is
208+
* not a registered system-stream namespace on open-pryv.io, so the
209+
* api-server's streams.create rejects `:hds:noop` with `invalid-request-
210+
* structure`. A regular user stream works fine.
206211
*/
207212
export function deriveCmcPermissions (formSpec: FormSpec): Permission[] {
208213
const perms = (formSpec.permissions || []).filter(p => p && p.streamId && p.level);
@@ -211,7 +216,7 @@ export function deriveCmcPermissions (formSpec: FormSpec): Permission[] {
211216
}
212217

213218
/**
214-
* Patient-side: provision the `:hds:noop` stream used by the chat-only
219+
* Patient-side: provision the `hds-noop` stream used by the chat-only
215220
* placeholder permission. Idempotent — re-runs OK.
216221
*/
217222
export async function provisionHdsNoop (connection: pryv.Connection): Promise<void> {

0 commit comments

Comments
 (0)