@bongos/core 1.19.621 → 1.19.623
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 +60 -30
- package/docs/copy-inventory.md +90 -82
- package/docs/copy-registry.json +205 -111
- package/docs/module-api-changelog.md +4 -0
- package/modules/hall-ui/public/board-room.css +83 -0
- package/modules/hall-ui/public/board-room.html +70 -0
- package/modules/hall-ui/public/board-room.js +517 -0
- package/modules/hall-ui/public/board-room.states.json +104 -0
- package/modules/hall-ui/public/government.css +10 -57
- package/modules/hall-ui/public/government.html +10 -12
- package/modules/hall-ui/public/government.js +119 -367
- package/modules/hall-ui/public/palette.js +5 -2
- package/modules/hall-ui/public/shell.js +16 -0
- package/modules/lifecycle/db-tasks.js +24 -4
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/scripts/gds/fitness-checks-vocabulary.js +7 -0
- package/scripts/gds/start.js +29 -11
- package/src/bongos/auth.js +27 -0
- package/src/bongos/serve-internal.js +21 -0
- package/src/module-api.js +1 -1
- package/tests/auth_resolve_failure.mjs +6 -5
- package/tests/cross_discipline_priority_direction.mjs +196 -0
- package/tests/government_board_hash_redirect.mjs +129 -0
- package/tests/government_board_room_copy.mjs +41 -15
- package/tests/government_board_vote_ui.mjs +5 -1
- package/tests/hall_nav.mjs +5 -1
- package/tests/hall_page_gate_map.mjs +11 -0
- package/tests/hall_palette.mjs +9 -3
- package/tests/rank_tier_single_source.mjs +8 -0
|
@@ -26,20 +26,28 @@ import { fileURLToPath } from 'node:url';
|
|
|
26
26
|
|
|
27
27
|
const require = createRequire(import.meta.url);
|
|
28
28
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
29
|
+
// TWO SOURCES SINCE ADR 0266. The Board Room was the `#board-room` tab of the
|
|
30
|
+
// government page and is now its own page, so the sitting card, its copy and the
|
|
31
|
+
// vote form live in board-room.js / board-room.html. `CLIENT` and `HTML` stay
|
|
32
|
+
// pointed at the government page for the two assertions that are genuinely about
|
|
33
|
+
// what STAYED there — the Constitution's own membership sentence, and the short
|
|
34
|
+
// pass-rule name its change-history line reads.
|
|
29
35
|
const CLIENT = fs.readFileSync(path.join(ROOT, 'modules', 'hall-ui', 'public', 'government.js'), 'utf8');
|
|
30
36
|
const HTML = fs.readFileSync(path.join(ROOT, 'modules', 'hall-ui', 'public', 'government.html'), 'utf8');
|
|
37
|
+
const BOARD = fs.readFileSync(path.join(ROOT, 'modules', 'hall-ui', 'public', 'board-room.js'), 'utf8');
|
|
38
|
+
const BOARD_HTML = fs.readFileSync(path.join(ROOT, 'modules', 'hall-ui', 'public', 'board-room.html'), 'utf8');
|
|
31
39
|
const { PASS_RULES } = require(path.join(ROOT, 'modules', 'government', 'config.js'));
|
|
32
40
|
|
|
33
|
-
const card = () =>
|
|
41
|
+
const card = () => BOARD.slice(BOARD.indexOf('function itemCard'), BOARD.indexOf('async function loadBoard'));
|
|
34
42
|
|
|
35
43
|
// Deleted copy is asserted against the RENDERING source only. The comments in
|
|
36
|
-
//
|
|
44
|
+
// board-room.js deliberately quote what was removed and why — that history is
|
|
37
45
|
// the point of them, and a test that forbade it would push the record out of
|
|
38
46
|
// the file it explains.
|
|
39
|
-
const CODE =
|
|
47
|
+
const CODE = BOARD.split(/\r?\n/).filter((l) => !/^\s*\/\//.test(l)).join('\n');
|
|
40
48
|
|
|
41
49
|
test('every pass rule the server can hold has a plain-language sentence', () => {
|
|
42
|
-
const block =
|
|
50
|
+
const block = BOARD.slice(BOARD.indexOf('const PASS_RULE_PLAIN'), BOARD.indexOf('function decidedByHtml'));
|
|
43
51
|
assert.ok(PASS_RULES.length >= 3, `sanity: found the real rule set (${PASS_RULES})`);
|
|
44
52
|
for (const rule of PASS_RULES) {
|
|
45
53
|
assert.ok(block.includes(`${rule}:`), `PASS_RULE_PLAIN must explain '${rule}' — a rule with no copy renders its enum key`);
|
|
@@ -52,14 +60,23 @@ test('every pass rule the server can hold has a plain-language sentence', () =>
|
|
|
52
60
|
});
|
|
53
61
|
|
|
54
62
|
test('the short name map covers the same rule set (the history line)', () => {
|
|
55
|
-
|
|
63
|
+
// Its reader (historyRow, the amendment change-history) stayed on the
|
|
64
|
+
// government page when ADR 0266 carved the room out, so this map stayed with
|
|
65
|
+
// it. The slice therefore ends at a landmark that is still IN government.js —
|
|
66
|
+
// it used to end at `const PASS_RULE_PLAIN`, which has moved to board-room.js,
|
|
67
|
+
// and an indexOf that misses returns -1: `slice(start, -1)` would have handed
|
|
68
|
+
// this assertion most of the file and passed for the wrong reason.
|
|
69
|
+
const start = CLIENT.indexOf('const PASS_RULE_NAME');
|
|
70
|
+
const end = CLIENT.indexOf('function dialRow');
|
|
71
|
+
assert.ok(start !== -1 && end > start, 'PASS_RULE_NAME sits above dialRow in government.js');
|
|
72
|
+
const block = CLIENT.slice(start, end);
|
|
56
73
|
for (const rule of PASS_RULES) {
|
|
57
74
|
assert.ok(block.includes(`${rule}:`), `PASS_RULE_NAME must name '${rule}'`);
|
|
58
75
|
}
|
|
59
76
|
});
|
|
60
77
|
|
|
61
78
|
test('a rank reaches the reader as a LABEL, never as the enum key', () => {
|
|
62
|
-
assert.match(
|
|
79
|
+
assert.match(BOARD, /function rankNames\(keys\)[\s\S]*?window\.OTB\.rankLabel\(k\)/,
|
|
63
80
|
'the board card resolves rank keys through the branding pack');
|
|
64
81
|
const membership = CLIENT.slice(CLIENT.indexOf('function membershipSentence'), CLIENT.indexOf('function passRuleSentence'));
|
|
65
82
|
assert.match(membership, /window\.OTB\.rankLabel\(k\)/,
|
|
@@ -84,7 +101,7 @@ test('the card order is title → action → the idea → the apparatus', () =>
|
|
|
84
101
|
});
|
|
85
102
|
|
|
86
103
|
test('the idea renders OPEN — never behind a summary', () => {
|
|
87
|
-
const sections =
|
|
104
|
+
const sections = BOARD.slice(BOARD.indexOf('function ideaSectionsHtml'), BOARD.indexOf('function rankNames'));
|
|
88
105
|
assert.ok(!/<details/.test(sections),
|
|
89
106
|
'the substance of the vote is not a disclosure — that was the reported bug');
|
|
90
107
|
assert.match(sections, /gov-idea__body/, 'and it is set as prose, not as a config row');
|
|
@@ -99,12 +116,12 @@ test('the tally stays visible without a click (ADR 0175 §9)', () => {
|
|
|
99
116
|
test('the self-explaining copy is DELETED, not reworded', () => {
|
|
100
117
|
assert.ok(!/Casting arrives with the vote form/.test(CODE),
|
|
101
118
|
'the sentence that explained the UI to itself — and the form it promised has shipped');
|
|
102
|
-
assert.ok(!/tally: \$\{yes\} yes/.test(
|
|
119
|
+
assert.ok(!/tally: \$\{yes\} yes/.test(BOARD), 'the raw-config tally line is gone');
|
|
103
120
|
assert.ok(!/The idea, in full/.test(CODE), 'so is the summary that hid the idea');
|
|
104
121
|
});
|
|
105
122
|
|
|
106
123
|
test('the section a voter faults is shown by NAME, in the ballot and the picker', () => {
|
|
107
|
-
const ballot =
|
|
124
|
+
const ballot = BOARD.slice(BOARD.indexOf('function ballotHtml'), BOARD.indexOf('// ---- the vote form'));
|
|
108
125
|
assert.match(ballot, /SECTION_LABELS\[v\.section_key\]/,
|
|
109
126
|
'`why_matters` is a jsonb key; the objector picked a named section and the reader should see that name');
|
|
110
127
|
});
|
|
@@ -112,18 +129,27 @@ test('the section a voter faults is shown by NAME, in the ballot and the picker'
|
|
|
112
129
|
test('the objection still carries a reason AND one section (ADR 0175 §8)', () => {
|
|
113
130
|
// The requirement simplifying may not weaken: it is why voting lives in the
|
|
114
131
|
// hall instead of on a chat reaction.
|
|
115
|
-
const form =
|
|
132
|
+
const form = BOARD.slice(BOARD.indexOf('function voteFormHtml'), BOARD.indexOf('async function castVoteFromRoom'));
|
|
116
133
|
assert.match(form, /data-vote-reason/, 'the reason box survives');
|
|
117
134
|
assert.match(form, /gov-vote__sections/, 'so does the five-way section picker');
|
|
118
135
|
assert.match(form, /Object\.keys\(SECTION_LABELS\)\.map/, 'with one radio per declared section');
|
|
119
136
|
});
|
|
120
137
|
|
|
121
|
-
test('
|
|
138
|
+
test('each room frames itself in one line, not a paragraph', () => {
|
|
122
139
|
// The two intros used to run ~60 and ~50 words before anything actionable.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
140
|
+
//
|
|
141
|
+
// They now live on two pages (ADR 0266), and the Board Room's heading is its
|
|
142
|
+
// page's own <h1> rather than a panel <h2> — a second "Board Room" heading
|
|
143
|
+
// under the page head would be the copy-that-explains-the-UI-to-itself this
|
|
144
|
+
// file exists to keep out. So the landmark differs per room; the RULE does not.
|
|
145
|
+
const rooms = [
|
|
146
|
+
{ heading: 'Constitution', src: HTML, at: '<h2 class="gov-h">Constitution</h2>' },
|
|
147
|
+
{ heading: 'Board Room', src: BOARD_HTML, at: '<h1 class="page-head__h">Board Room</h1>' },
|
|
148
|
+
];
|
|
149
|
+
for (const { heading, src, at } of rooms) {
|
|
150
|
+
const i = src.indexOf(at);
|
|
151
|
+
assert.notEqual(i, -1, `${heading} heading missing (${at})`);
|
|
152
|
+
const note = /<p class="gov-grid-note">([\s\S]*?)<\/p>/.exec(src.slice(i));
|
|
127
153
|
assert.ok(note, `${heading} has no framing line`);
|
|
128
154
|
const words = note[1].replace(/<[^>]+>/g, ' ').trim().split(/\s+/).length;
|
|
129
155
|
assert.ok(words <= 30, `${heading}'s intro is ${words} words — a reader meets it before anything actionable`);
|
|
@@ -16,7 +16,11 @@ import { fileURLToPath } from 'node:url';
|
|
|
16
16
|
|
|
17
17
|
const require = createRequire(import.meta.url);
|
|
18
18
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
19
|
-
|
|
19
|
+
// board-room.js since ADR 0266, not government.js: every assertion in this file
|
|
20
|
+
// is about the sitting card, the ballot and the vote form, and all three moved
|
|
21
|
+
// with the room onto its own page. The name stays `CLIENT` because that is what
|
|
22
|
+
// each assertion below reads — this file has exactly one source.
|
|
23
|
+
const CLIENT = fs.readFileSync(path.join(ROOT, 'modules', 'hall-ui', 'public', 'board-room.js'), 'utf8');
|
|
20
24
|
const { BASE_TEMPLATE } = require(path.join(ROOT, 'modules', 'ideas', 'templates.js'));
|
|
21
25
|
const board = require(path.join(ROOT, 'modules', 'government', 'board.js'));
|
|
22
26
|
|
package/tests/hall_nav.mjs
CHANGED
|
@@ -177,7 +177,11 @@ test('sidebar groups read by audience, in order', () => {
|
|
|
177
177
|
// 'government' (the Permissions tab, BV1.R113) is the group's one archon-gated item.
|
|
178
178
|
// 'project-settings' joins the Government group at the metic floor (task 1003280,
|
|
179
179
|
// goal 1000072) — it sits before 'government', which is the one archon-only item.
|
|
180
|
-
|
|
180
|
+
// 'board-room' leads the group since ADR 0266: it is the one page here you ACT
|
|
181
|
+
// on (a sitting waits on a decision; the rest is monitoring), the same ordering
|
|
182
|
+
// rule the Community group's first item follows. Before that carve it had no
|
|
183
|
+
// item at all — it was a tab behind the one labelled "Permissions".
|
|
184
|
+
assert.deepEqual(nav[4].items.map((i) => i.id), ['board-room', 'watch', 'harbor', 'gate', 'sessions', 'project-settings', 'government']);
|
|
181
185
|
});
|
|
182
186
|
|
|
183
187
|
test('Economy lives in Docs and points at the reward-schedule page', () => {
|
|
@@ -38,6 +38,7 @@ const SRC = fs.readFileSync(path.join(ROOT, 'src/bongos/serve-internal.js'), 'ut
|
|
|
38
38
|
// requireGovernmentPage page.view.government metic+ (ADR 0157)
|
|
39
39
|
// requireProjectCuratePage project.curate metic+
|
|
40
40
|
// requireGovernmentManagePage government.manage archon
|
|
41
|
+
// requireBoardVotePage board.vote.cast xenos+ (ADR 0266)
|
|
41
42
|
const ORACLE = {
|
|
42
43
|
// Any signed-in builder — no rank floor.
|
|
43
44
|
'/builders/work': 'requireBuilderPage',
|
|
@@ -93,6 +94,16 @@ const ORACLE = {
|
|
|
93
94
|
// tab seals itself for non-archons.
|
|
94
95
|
'/builders/government': 'requireGovernmentPage',
|
|
95
96
|
|
|
97
|
+
// ADR 0266: the Board Room, carved out of the tab strip above onto its own
|
|
98
|
+
// page. It is the ONE hall page whose gate is deliberately WIDER than the
|
|
99
|
+
// group it sits in — `board.vote.cast` floors at xenos, on purpose, so that a
|
|
100
|
+
// constitution widening its board below Metic gets members who can reach the
|
|
101
|
+
// room rather than members who can only vote by curl. The floor is the coarse
|
|
102
|
+
// gate; membership is checked in-handler per item against that item's own
|
|
103
|
+
// snapshotted constitution, so a holder who sits on no board sees the room and
|
|
104
|
+
// no ballot (ADR 0175 §9 made the ballot open on purpose).
|
|
105
|
+
'/builders/board-room': 'requireBoardVotePage',
|
|
106
|
+
|
|
96
107
|
// Deliberately UNGATED — the landing card, the rank ladder, the reward
|
|
97
108
|
// schedule and a builder's public portfolio all render for a stranger.
|
|
98
109
|
//
|
package/tests/hall_palette.mjs
CHANGED
|
@@ -113,11 +113,17 @@ test('Tasks tab anchors exist in work.js makeTabs', () => {
|
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
// TWO rooms since ADR 0266 (was three): the Board Room became its own page at
|
|
117
|
+
// /board-room, so `#board-room` is no longer a tab id here and the palette must
|
|
118
|
+
// not declare it as a sub-destination — it is read live from the sidebar like
|
|
119
|
+
// every other page. The counts stay exact rather than becoming `>= 2`, because
|
|
120
|
+
// the whole point of this test is that a tab and its jump cannot drift apart.
|
|
121
|
+
test('Government section anchors exist in government.js makeTabs', () => {
|
|
117
122
|
const ids = [...read('government.js').matchAll(/\{ id: '([a-z-]+)', label: '[^']*', panel:/g)].map((m) => m[1]);
|
|
118
|
-
assert.ok(ids.length ===
|
|
123
|
+
assert.ok(ids.length === 2, `sanity: found the two government tabs (${ids})`);
|
|
124
|
+
assert.ok(!ids.includes('board-room'), 'the Board Room is a page, not a tab (ADR 0266)');
|
|
119
125
|
const declared = declaredHrefs((x) => x.startsWith('/government#'));
|
|
120
|
-
assert.ok(declared.length ===
|
|
126
|
+
assert.ok(declared.length === 2, 'palette declares the two Government sections');
|
|
121
127
|
for (const h of declared) {
|
|
122
128
|
assert.ok(ids.includes(h.split('#')[1]), `${h} must be a real government.js tab id`);
|
|
123
129
|
}
|
|
@@ -116,6 +116,14 @@ const STATIC_LADDER_FILES = [
|
|
|
116
116
|
// which holds it against catalog.RANK_ORDER and holds the whole browser parser
|
|
117
117
|
// equal to the server one.
|
|
118
118
|
'modules/hall-ui/public/government.js',
|
|
119
|
+
// ADR 0266: the Board Room moved off the government page onto its own, and the
|
|
120
|
+
// sitting card's `decidedByHtml` expands the same `rank:<key>+` membership form
|
|
121
|
+
// to say who may vote on THAT sitting — so the carve took a copy of the ladder
|
|
122
|
+
// with it. Same reason as the row above (browser code cannot require the server
|
|
123
|
+
// module), and the same pinning: `tests/government_board_vote_ui.mjs` reads
|
|
124
|
+
// board-room.js and holds its predicate parser equal to the server's, and the
|
|
125
|
+
// pin below in this file holds the array itself against LIVE_RANK_LADDER.
|
|
126
|
+
'modules/hall-ui/public/board-room.js',
|
|
119
127
|
// task 1002487: the pure agent-definition validator applies the ADR 0043
|
|
120
128
|
// sub-Metic floor to an agent's declared scope, so it needs the ladder to
|
|
121
129
|
// compare against. It is one of the "dependency-free" cases this array exists
|