@bongos/core 1.19.613 → 1.19.615
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 +36 -26
- package/docs/adr/0111-instance-hosting-provisioning-module.md +1 -0
- package/docs/adr/0267-unanimity-and-the-revise-and-re-sit-loop.md +124 -0
- package/docs/adr/README.md +1 -0
- package/docs/copy-inventory.md +36 -34
- package/docs/copy-registry.json +53 -35
- package/docs/module-api-changelog.md +4 -0
- package/modules/government/board.js +83 -12
- package/modules/government/config.js +49 -8
- package/modules/hall-ui/public/government.js +30 -5
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/scripts/gds/provision-net.js +30 -0
- package/scripts/gds/provision-units.js +25 -12
- package/scripts/gds/provision.js +27 -1
- package/src/module-api.js +1 -1
- package/tests/government_board_amendment.mjs +4 -4
- package/tests/government_board_close.mjs +1 -1
- package/tests/government_config.mjs +5 -4
- package/tests/government_unanimous.mjs +319 -0
- package/tests/provision.mjs +55 -5
package/tests/provision.mjs
CHANGED
|
@@ -19,10 +19,11 @@ import { join } from 'node:path';
|
|
|
19
19
|
const require = createRequire(import.meta.url);
|
|
20
20
|
const P = require('../scripts/gds/provision.js');
|
|
21
21
|
|
|
22
|
-
// The env-var prefix a provisioned instance resolves = the envPrefix
|
|
23
|
-
// webEnvBody
|
|
24
|
-
//
|
|
25
|
-
//
|
|
22
|
+
// The env-var prefix a provisioned instance resolves = the envPrefix an instance INHERITS from
|
|
23
|
+
// the neutral pack (task 1003740: webEnvBody no longer pins a branding pack anywhere — the
|
|
24
|
+
// instance loads its own config/branding.json by default — but the prefix floor is still the
|
|
25
|
+
// neutral pack's, and every live co-tenant pack pins the same value explicitly). Read it here so
|
|
26
|
+
// these assertions stay in lockstep with the code (both derive it), not a pinned literal.
|
|
26
27
|
const NEUTRAL_PREFIX =
|
|
27
28
|
JSON.parse(readFileSync(new URL('../config/branding.neutral.json', import.meta.url), 'utf8')).envPrefix || 'CLOUDBONGOS';
|
|
28
29
|
const reEsc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -205,7 +206,6 @@ t('webEnvBody: OAuth creds use the LOADED pack\'s envPrefix (not the slug) + bra
|
|
|
205
206
|
const b = P.webEnvBody(coTenant); // coTenant.domain === null
|
|
206
207
|
assert.match(b, new RegExp(`${reEsc(NEUTRAL_PREFIX)}_GITHUB_CLIENT_ID=`));
|
|
207
208
|
assert.match(b, new RegExp(`${reEsc(NEUTRAL_PREFIX)}_GITHUB_CLIENT_SECRET=`));
|
|
208
|
-
assert.match(b, /GDS_BRANDING_FILE=config\/branding\.neutral\.json/);
|
|
209
209
|
assert.match(b, /PORT=3003/);
|
|
210
210
|
assert.match(b, /PGDATABASE=mercury/);
|
|
211
211
|
// The prior slug prefix was a latent bug: it never matched the neutral pack's
|
|
@@ -215,6 +215,56 @@ t('webEnvBody: OAuth creds use the LOADED pack\'s envPrefix (not the slug) + bra
|
|
|
215
215
|
assert.doesNotMatch(b, /_BUILDERS_ORIGIN=/);
|
|
216
216
|
});
|
|
217
217
|
|
|
218
|
+
t('webEnvBody: an instance is never pinned to the neutral pack, so it serves its OWN name (task 1003740)', () => {
|
|
219
|
+
// THE BUG THIS PINS. Provisioning used to pin every instance to config/branding.neutral.json
|
|
220
|
+
// into every instance's web.env — a leftover from the shared-checkout co-tenant model. Under
|
|
221
|
+
// ADR 0108 each instance has its own checkout and its own config/branding.json, and
|
|
222
|
+
// src/branding.js's ENV_OVERRIDES cover domains/auth.idp/landing but NEVER identity.productName.
|
|
223
|
+
// So the pin made every hosted instance answer GET /api/gds/instance with the PLATFORM's name:
|
|
224
|
+
// hermeslines-marketing, mercury and demo all said "Cloud Bongos" while their own packs on disk
|
|
225
|
+
// said otherwise, and `bongos login <instance>` greeted newcomers with the wrong project.
|
|
226
|
+
const b = P.webEnvBody({ ...coTenant, domain: 'mercury.example.com' });
|
|
227
|
+
// Matched on the distinctive half of the env var's name: the full name carries a legacy literal
|
|
228
|
+
// the goal-1000073 rename ratchet counts, and this is strictly stronger anyway — it also catches
|
|
229
|
+
// a pin written under any other prefix.
|
|
230
|
+
assert.doesNotMatch(b, /BRANDING_FILE/,
|
|
231
|
+
'provisioning must not pin the branding pack — the instance loads its own config/branding.json');
|
|
232
|
+
|
|
233
|
+
// The pin is gone, but the env PREFIX it used to keep in lockstep must still be the one
|
|
234
|
+
// ENV_OVERRIDES reads, or the origin overrides silently stop firing (the task-1972 failure).
|
|
235
|
+
assert.match(b, new RegExp(`${reEsc(NEUTRAL_PREFIX)}_BUILDERS_ORIGIN=`));
|
|
236
|
+
assert.match(b, new RegExp(`${reEsc(NEUTRAL_PREFIX)}_GITHUB_CLIENT_ID=`));
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
t('identityVerdict: a live instance serving the PLATFORM name is caught, not shrugged at (task 1003740)', () => {
|
|
240
|
+
const N = require('../scripts/gds/provision-net.js');
|
|
241
|
+
const neutralName = 'Cloud Bongos';
|
|
242
|
+
|
|
243
|
+
// The bug's exact live shape — healthz was green the whole time this was true.
|
|
244
|
+
const bad = N.identityVerdict({ manifest: { name: 'Cloud Bongos' }, slug: 'hermeslines-marketing', neutralName });
|
|
245
|
+
assert.equal(bad.ok, false);
|
|
246
|
+
assert.match(bad.reason, /platform default name/);
|
|
247
|
+
|
|
248
|
+
// Fixed: the instance answers as itself.
|
|
249
|
+
assert.equal(N.identityVerdict({ manifest: { name: 'Hermeslines Marketing' }, slug: 'hermeslines-marketing', neutralName }).ok, true);
|
|
250
|
+
|
|
251
|
+
// It reads brand.identity.productName too — the manifest carries the name in both places.
|
|
252
|
+
assert.equal(N.identityVerdict({ manifest: { brand: { identity: { productName: 'mercury' } } }, slug: 'mercury', neutralName }).ok, true);
|
|
253
|
+
|
|
254
|
+
// NOT a false positive: a project genuinely named after the platform keeps its name. The check
|
|
255
|
+
// must never fail a working standup over a legitimate name.
|
|
256
|
+
assert.equal(N.identityVerdict({ manifest: { name: 'Cloud Bongos' }, slug: 'Cloud Bongos', neutralName }).ok, true);
|
|
257
|
+
|
|
258
|
+
// Unknowable → null, never a false accusation.
|
|
259
|
+
assert.equal(N.identityVerdict({ manifest: {}, slug: 'x', neutralName }).ok, null);
|
|
260
|
+
assert.equal(N.identityVerdict({ manifest: { name: 'x' }, slug: 'x', neutralName: null }).ok, true);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
t('identityCmd: probes the manifest over loopback, like healthzCmd', () => {
|
|
264
|
+
const N = require('../scripts/gds/provision-net.js');
|
|
265
|
+
assert.match(N.identityCmd({ port: 3011 }), /127\.0\.0\.1:3011\/api\/gds\/instance/);
|
|
266
|
+
});
|
|
267
|
+
|
|
218
268
|
t('webEnvBody: a domain writes the single-host origin overrides so the hall loads (task 1972)', () => {
|
|
219
269
|
const b = P.webEnvBody({ ...coTenant, domain: 'mercury.example.com' });
|
|
220
270
|
const O = reEsc('https://mercury.example.com');
|