@bongos/core 1.24.92 → 1.24.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bongos-core.json +53 -33
- package/docs/adr/0404-a-party-is-a-room-and-rooms-register-as-kinds.md +118 -0
- package/docs/adr/README.md +1 -0
- package/docs/copy-inventory.md +1 -1
- package/docs/copy-registry.json +1 -1
- package/docs/module-api-changelog.md +4 -0
- package/docs/modules-contract.md +2 -0
- package/docs/page-inventory.json +4 -2
- package/docs/page-readings.json +7 -7
- package/modules/hall-ui/public/city.js +1 -1
- package/modules/hall-ui/public/goal-map.html +2 -0
- package/modules/hall-ui/public/home-city.js +14 -3
- package/modules/hall-ui/public/home-gallery.css +6 -0
- package/modules/hall-ui/public/home-gallery.js +30 -0
- package/modules/hall-ui/public/sky-interaction.js +4 -9
- package/modules/hall-ui/public/sky-visor.js +96 -0
- package/modules/hall-ui/public/thinking.css +8 -0
- package/modules/hall-ui/public/thinking.html +2 -0
- package/modules/hall-ui/public/visor.js +2 -1
- package/modules/hall-ui/records/visor.md +17 -3
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/release-notes.json +20 -0
- package/src/module-api.js +1 -1
- package/src/module-seams.js +3 -0
- package/tests/hall_city.mjs +1 -1
- package/tests/hall_sky_visor.mjs +150 -0
- package/tests/hall_visor.mjs +1 -1
- package/tests/home_gallery_widget.mjs +43 -0
- package/tests/room_kinds_seam.mjs +68 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// tests/room_kinds_seam.mjs — ADR 0404 (task 1005220): rooms register as kinds
|
|
2
|
+
// through the 'room.kinds' CONTRIBUTION POINT, because several modules own a kind
|
|
3
|
+
// (lifecycle: party, chain, scoping; government: decision) and a port is
|
|
4
|
+
// single-provider. Pins that choice: two kinds from two modules register side by
|
|
5
|
+
// side and the boot check still passes, while the same pair as a port is refused.
|
|
6
|
+
import assert from 'node:assert/strict';
|
|
7
|
+
import { test } from 'node:test';
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
14
|
+
const seams = require(path.join(ROOT, 'src', 'module-seams.js'));
|
|
15
|
+
|
|
16
|
+
function kind(name, owner, members) {
|
|
17
|
+
return {
|
|
18
|
+
kind: name,
|
|
19
|
+
owner,
|
|
20
|
+
cap: name === 'party' ? 8 : 40,
|
|
21
|
+
members: async () => members,
|
|
22
|
+
isMember: async (_roomId, builderId) => members.some((m) => m.builderId === builderId),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
test('two kinds from two modules both register, and the boot check passes', async () => {
|
|
27
|
+
seams._reset();
|
|
28
|
+
seams.contribute('room.kinds', kind('scoping', 'lifecycle', [{ builderId: 1, joinedAt: 't' }]));
|
|
29
|
+
seams.contribute('room.kinds', kind('decision', 'government', [{ builderId: 2, joinedAt: 't' }]));
|
|
30
|
+
|
|
31
|
+
const kinds = seams.contributions('room.kinds');
|
|
32
|
+
assert.deepEqual(kinds.map((k) => k.kind), ['scoping', 'decision']);
|
|
33
|
+
assert.deepEqual(kinds.map((k) => k.owner), ['lifecycle', 'government']);
|
|
34
|
+
|
|
35
|
+
// a consumer finds a kind by name and calls it — it never reads the owner's tables
|
|
36
|
+
const decision = kinds.find((k) => k.kind === 'decision');
|
|
37
|
+
assert.equal(await decision.isMember('r1', 2), true);
|
|
38
|
+
assert.equal(await decision.isMember('r1', 1), false);
|
|
39
|
+
|
|
40
|
+
// the modules' manifests declare no port for rooms, so the boot check is clean
|
|
41
|
+
const manifests = [
|
|
42
|
+
{ key: 'lifecycle', provides: [], consumes: [] },
|
|
43
|
+
{ key: 'government', provides: [], consumes: [] },
|
|
44
|
+
];
|
|
45
|
+
assert.deepEqual(seams.verifyPortsSatisfied(manifests), { ok: true, errors: [] });
|
|
46
|
+
seams._reset();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('the rejected design: the same pair as one port is refused at boot and at registration', () => {
|
|
50
|
+
seams._reset();
|
|
51
|
+
const manifests = [
|
|
52
|
+
{ key: 'lifecycle', provides: ['room.members'], consumes: [] },
|
|
53
|
+
{ key: 'government', provides: ['room.members'], consumes: [] },
|
|
54
|
+
];
|
|
55
|
+
const res = seams.verifyPortsSatisfied(manifests);
|
|
56
|
+
assert.equal(res.ok, false);
|
|
57
|
+
assert.match(res.errors.join('\n'), /room\.members.*more than one enabled module/);
|
|
58
|
+
|
|
59
|
+
seams.registerProvider('room.members', async () => []);
|
|
60
|
+
assert.throws(() => seams.registerProvider('room.members', async () => []));
|
|
61
|
+
seams._reset();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('an instance with no room owners has no rooms, and nothing throws', () => {
|
|
65
|
+
seams._reset();
|
|
66
|
+
assert.deepEqual(seams.contributions('room.kinds'), []);
|
|
67
|
+
seams._reset();
|
|
68
|
+
});
|