hosted-allowed-vaults.test.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
2 days ago
| 1 | import test from 'node:test'; |
| 2 | import assert from 'node:assert'; |
| 3 | import { resolveAllowedVaultIdsForHostedContext } from '../hub/lib/hosted-workspace-resolve.mjs'; |
| 4 | |
| 5 | test('non-delegate without access row: all canister vaults', () => { |
| 6 | const out = resolveAllowedVaultIdsForHostedContext({ |
| 7 | delegate: false, |
| 8 | actorUid: 'owner', |
| 9 | accessMap: {}, |
| 10 | canisterIds: ['default', 'work', 'personal'], |
| 11 | }); |
| 12 | assert.deepStrictEqual(out, ['default', 'work', 'personal']); |
| 13 | }); |
| 14 | |
| 15 | test('non-delegate with explicit access: intersect with canister list', () => { |
| 16 | const out = resolveAllowedVaultIdsForHostedContext({ |
| 17 | delegate: false, |
| 18 | actorUid: 'owner', |
| 19 | accessMap: { owner: ['default'] }, |
| 20 | canisterIds: ['default', 'work'], |
| 21 | }); |
| 22 | assert.deepStrictEqual(out, ['default']); |
| 23 | }); |
| 24 | |
| 25 | test('delegate without access row: default only', () => { |
| 26 | const out = resolveAllowedVaultIdsForHostedContext({ |
| 27 | delegate: true, |
| 28 | actorUid: 'editor1', |
| 29 | accessMap: {}, |
| 30 | canisterIds: ['default', 'work'], |
| 31 | }); |
| 32 | assert.deepStrictEqual(out, ['default']); |
| 33 | }); |
| 34 | |
| 35 | test('delegate with explicit access', () => { |
| 36 | const out = resolveAllowedVaultIdsForHostedContext({ |
| 37 | delegate: true, |
| 38 | actorUid: 'editor1', |
| 39 | accessMap: { editor1: ['work'] }, |
| 40 | canisterIds: ['default', 'work'], |
| 41 | }); |
| 42 | assert.deepStrictEqual(out, ['work']); |
| 43 | }); |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
2 days ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
3 days ago