@bongos/core 1.19.942 → 1.19.943

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 CHANGED
@@ -2,11 +2,11 @@
2
2
  "artifact": "bongos-core",
3
3
  "manifest_schema": 1,
4
4
  "generator": "scripts/gds/package-core.js",
5
- "core_version": "1.19.942",
6
- "core_contract": "1.19.942",
7
- "source_commit": "1e45821468069b9d8f26ed2f7dbf1bbf647ea4b8",
5
+ "core_version": "1.19.943",
6
+ "core_contract": "1.19.943",
7
+ "source_commit": "d2864572d1b1f1112a574071d4fe288920a71216",
8
8
  "source_ref": "HEAD",
9
- "built_at": "2026-09-21T21:46:27.727Z",
9
+ "built_at": "2026-09-21T22:14:04.050Z",
10
10
  "redaction": {
11
11
  "model": "docs-redacted+functional-verbatim",
12
12
  "docs_redacted": 511,
@@ -17,7 +17,7 @@
17
17
  "gate": "passed"
18
18
  },
19
19
  "file_count": 2877,
20
- "tree_sha256": "5e3c476a60b0631f79c68b199ba47f437ab6295e2518dfc86e7104e8fe0e9bfe",
20
+ "tree_sha256": "475596e7ac9620819058973e021b0c26d5122429253e9206320f31130a67c709",
21
21
  "files": [
22
22
  {
23
23
  "path": ".claude/skills/ask-for-help/SKILL.md",
@@ -2677,7 +2677,7 @@
2677
2677
  {
2678
2678
  "path": "docs/module-api-changelog.md",
2679
2679
  "mode": "0000644",
2680
- "sha256": "cf5f371ef80387f8344682a639e736c8cc3240debb4ee97106dfc2525e402e97"
2680
+ "sha256": "441e7d11f2b340623b122c51c788d0ff1d0610ff1c4296db3344c8702c8fb541"
2681
2681
  },
2682
2682
  {
2683
2683
  "path": "docs/modules-contract.md",
@@ -8002,12 +8002,12 @@
8002
8002
  {
8003
8003
  "path": "package-lock.json",
8004
8004
  "mode": "0000644",
8005
- "sha256": "04da7afdf07b5eacb7b5d8e18f034a45e62c318eed546facfa4e65480f5a6292"
8005
+ "sha256": "2ff2f30a70ad8facea46291fa01e89889194edb8fa02e904bda7b8343754bbfd"
8006
8006
  },
8007
8007
  {
8008
8008
  "path": "package.json",
8009
8009
  "mode": "0000644",
8010
- "sha256": "79d643dab7e8bf794763c95cfa6f05200054d4aa2be271b61805954b1b82eb83"
8010
+ "sha256": "35b084d56b257e0df6c6a738d94c305a6aa8419471c7b9fe32f41afef640f5fd"
8011
8011
  },
8012
8012
  {
8013
8013
  "path": "public-docs/index.html",
@@ -9617,7 +9617,7 @@
9617
9617
  {
9618
9618
  "path": "scripts/migrate.sh",
9619
9619
  "mode": "0000644",
9620
- "sha256": "6f927d08ea67e4a7081972fb78fd6131c9eee569730932621d1e1ee6334ddd3a"
9620
+ "sha256": "3a35826ec753908fb9aec9c5a4b5c37e71e38ba0d00c1d1f30387087be509d97"
9621
9621
  },
9622
9622
  {
9623
9623
  "path": "scripts/migrate_cost_ledger.sh",
@@ -10012,7 +10012,7 @@
10012
10012
  {
10013
10013
  "path": "src/module-api.js",
10014
10014
  "mode": "0000644",
10015
- "sha256": "ea1889449a3dab8921a6d4ce4fc539c8c550aef3eedc14d22493a26cd6af1bcc"
10015
+ "sha256": "cd5bcc86c8d6ecb21b11c6dd9df73de2b63e0759edf781eeee2e6d36f6452aad"
10016
10016
  },
10017
10017
  {
10018
10018
  "path": "src/module-loader/catalog.js",
@@ -10187,7 +10187,7 @@
10187
10187
  {
10188
10188
  "path": "tests/agents_sync.mjs",
10189
10189
  "mode": "0000644",
10190
- "sha256": "2e161bf9ef98425974d8295c8227688cd6fde55314fb3b9413df55542d5a109a"
10190
+ "sha256": "1184d82ba51d3dd3f2bf952292b71defd4b6ea51fba5e3800429cfed1450fe31"
10191
10191
  },
10192
10192
  {
10193
10193
  "path": "tests/agents_validate.mjs",
@@ -12512,7 +12512,7 @@
12512
12512
  {
12513
12513
  "path": "tests/migrate_module_overrides_db.mjs",
12514
12514
  "mode": "0000644",
12515
- "sha256": "a998b59c0a6d28a0c0d1fe617059631cff052c68afe954265e92a0cca8ce04e4"
12515
+ "sha256": "9d96fe899e8f3f25030ae13b471d2ec9b2f8edb1f9242d221c927e7eac5d7329"
12516
12516
  },
12517
12517
  {
12518
12518
  "path": "tests/migrate_root_resolution.mjs",
@@ -2358,5 +2358,7 @@ is load-bearing: the script throws rather than guess if it is missing, and
2358
2358
  landed since 1.19.940 with no explicit bump. run 35652433730. (task 1002620)
2359
2359
  1.19.942 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
2360
2360
  landed since 1.19.941 with no explicit bump. run 35659043986. (task 1002620)
2361
+ 1.19.943 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
2362
+ landed since 1.19.942 with no explicit bump. run 35661533404. (task 1002620)
2361
2363
  ---------------------------------------------------------------------------
2362
2364
  ```
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.19.942",
3
+ "version": "1.19.943",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bongos/core",
9
- "version": "1.19.942",
9
+ "version": "1.19.943",
10
10
  "license": "AGPL-3.0-or-later",
11
11
  "dependencies": {
12
12
  "express": "^4.21.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.19.942",
3
+ "version": "1.19.943",
4
4
  "description": "Cloud Bongos — the AI-first build platform core (GDS + platform surfaces + module system), installed as a versioned dependency (ADR 0108).",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "main": "src/platform-server.js",
@@ -407,10 +407,18 @@ fi
407
407
  #
408
408
  # Silent when the module is off: `agents` is default:false, so on most instances
409
409
  # there is no table to reconcile into and nothing to say about it.
410
- if node -e "process.exit(require('./src/modules').isModuleEnabled('agents') ? 0 : 1)" 2>/dev/null; then
410
+ #
411
+ # Gated on the module set the module loop just migrated (DB overrides included,
412
+ # task 1004138). A fresh isModuleEnabled() read never loaded the overrides, so an
413
+ # `agents` switched on in the hall got its tables but never its registry. Pinned to
414
+ # $DB like that read, so the reconcile writes into the schema this run applied. The
415
+ # file check keeps an instance without the script as silent as the old cwd-relative
416
+ # require left it: a split-root instance (core in node_modules) still does not
417
+ # reconcile, because which .claude/agents it should read is an open design question.
418
+ if [[ " $NODE_ENABLED_MODULES " == *" agents "* ]] && [ -f scripts/gds/agents-sync.js ]; then
411
419
  echo
412
420
  echo "post-deploy: reconciling .claude/agents/ into the agent registry"
413
- if ! node scripts/gds/agents-sync.js; then
421
+ if ! DATABASE_URL='' PGDATABASE="$DB" node scripts/gds/agents-sync.js; then
414
422
  echo "post-deploy: agents-sync failed — the registry is stale by one deploy, not broken" >&2
415
423
  fi
416
424
  fi
package/src/module-api.js CHANGED
@@ -71,7 +71,7 @@ const { responsibilityFor, ROLE_RESPONSIBILITIES } = require('./role-responsibil
71
71
  // there. scripts/gds/bump-version.js still rewrites the literal below; it appends
72
72
  // the entry to that file. Look for a version's history there, not here.
73
73
  // ---------------------------------------------------------------------------
74
- const CORE_VERSION = '1.19.942'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
74
+ const CORE_VERSION = '1.19.943'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
75
75
 
76
76
  // A namespaced logger so a module's log lines are attributable + consistent.
77
77
  // Usage: const log = api.logger('dev-box'); log.info('mounted');
@@ -403,7 +403,10 @@ t('migrate.sh invokes agents-sync, module-gated and fail-open', () => {
403
403
  // writes into a few lines above, so the table exists by the time it runs.
404
404
  const sh = fs.readFileSync(new URL('../scripts/migrate.sh', import.meta.url), 'utf8');
405
405
  assert.match(sh, /scripts\/gds\/agents-sync\.js/, 'the deploy path must call it');
406
- assert.match(sh, /isModuleEnabled\('agents'\)/, "gated on the module — it is default:false");
406
+ // Gated on the set the module loop migrated, DB overrides included (task 1004138);
407
+ // a fresh isModuleEnabled() read never saw a hall toggle.
408
+ assert.match(sh, /\$NODE_ENABLED_MODULES " == \*" agents "\*/, "gated on the module — it is default:false");
409
+ assert.doesNotMatch(sh, /isModuleEnabled\('agents'\)/, 'no override-blind re-read of the module flag');
407
410
  // Fail-OPEN: a stale registry is a nuisance, an aborted deploy is an outage,
408
411
  // and the script is already fail-closed about what it imports.
409
412
  assert.match(sh, /agents-sync failed — the registry is stale by one deploy/,
@@ -1,19 +1,24 @@
1
- // tests/migrate_module_overrides_db.mjs — migrate.sh migrates a module the hall switched on (task 1004137).
1
+ // tests/migrate_module_overrides_db.mjs — migrate.sh follows the hall's module toggles (tasks 1004137, 1004138).
2
2
  //
3
3
  // The hall's Modules toggle writes module_enablement_overrides, and the server reads that table
4
4
  // before it mounts any routes. migrate.sh used to pick its module set in a fresh process that never
5
5
  // read it, so a module on ONLY by override was skipped on every deploy while the next restart
6
- // mounted its routes against tables that did not exist. This drives the real migrate.sh through its
7
- // --print-modules seam (the same function its module loop calls) against a real database.
6
+ // mounted its routes against tables that did not exist. This drives the real migrate.sh against a
7
+ // real database: its --print-modules seam (the same function its module loop calls), and a full run
8
+ // with psql stubbed out to show the post-deploy agents reconcile gates on that same set.
8
9
  //
9
- // Integration lane: needs Postgres plus the PG* env migrate.sh connects with (the lane sets both);
10
- // self-skips when no Postgres is reachable. Leaves the override table as it found it.
10
+ // Integration lane: needs Postgres, reached BOTH through DATABASE_URL (this process) and the PG*
11
+ // env (migrate.sh blanks DATABASE_URL so its reads hit the database psql migrates) — the lane sets
12
+ // both. Self-skips when no Postgres is reachable. Leaves the override table as it found it.
11
13
  //
12
- // Run: DATABASE_URL=postgres://... node tests/migrate_module_overrides_db.mjs
14
+ // Run: PGHOST=… PGPORT=… PGUSER=… PGPASSWORD=… PGDATABASE=… DATABASE_URL=postgres://… \
15
+ // node tests/migrate_module_overrides_db.mjs
13
16
 
14
17
  import { strict as assert } from 'node:assert';
15
18
  import { execFileSync } from 'node:child_process';
16
19
  import { createRequire } from 'node:module';
20
+ import { chmodSync, mkdtempSync, writeFileSync } from 'node:fs';
21
+ import { tmpdir } from 'node:os';
17
22
  import { fileURLToPath } from 'node:url';
18
23
  import path from 'node:path';
19
24
 
@@ -23,13 +28,15 @@ const { moduleScopeKey } = require('../src/modules.js');
23
28
 
24
29
  const REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
25
30
  const MIGRATE = path.join(REPO_ROOT, 'scripts', 'migrate.sh');
26
- // Ships a migration, meters no spend and is off in the packs, so the override alone decides it.
31
+ // Both ship migrations and are off in the packs, so the override alone decides them.
27
32
  const MODULE = 'discord';
33
+ const AGENTS = 'agents';
34
+ const RECONCILE_LINE = 'post-deploy: reconciling .claude/agents/ into the agent registry';
28
35
 
29
36
  try {
30
37
  await pool.query('SELECT 1');
31
38
  } catch (e) {
32
- console.log(`migrate_module_overrides_db.mjs SKIPPED — no reachable Postgres (${e.code || e.message}). Set DATABASE_URL to run.`);
39
+ console.log(`migrate_module_overrides_db.mjs SKIPPED — no reachable Postgres (${e.code || e.message}). Set DATABASE_URL and the PG* env to run.`);
33
40
  await pool.end().catch(() => {});
34
41
  process.exit(0);
35
42
  }
@@ -37,34 +44,47 @@ try {
37
44
  const { rows: [{ db }] } = await pool.query('SELECT current_database() AS db');
38
45
  const scope = moduleScopeKey();
39
46
 
40
- function printModules(overrides = {}) {
47
+ // A psql that records nothing and applies nothing: the full run below walks every loop without
48
+ // touching the schema, so only the module-set read (node, real DB) decides what it reaches.
49
+ const stubDir = mkdtempSync(path.join(tmpdir(), 'migrate-stub-psql-'));
50
+ writeFileSync(path.join(stubDir, 'psql'), '#!/usr/bin/env bash\nexit 0\n');
51
+ chmodSync(path.join(stubDir, 'psql'), 0o755);
52
+
53
+ function migrate(args, overrides = {}) {
41
54
  const env = { ...process.env, PGDATABASE: db, ...overrides };
42
55
  delete env.INIT_CWD;
43
- const out = execFileSync('bash', [MIGRATE, '--print-modules'], {
56
+ return execFileSync('bash', [MIGRATE, ...args], {
44
57
  cwd: REPO_ROOT, env, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'],
45
58
  });
46
- return out.trim().split(/\s+/).filter(Boolean);
47
59
  }
60
+ const printModules = (overrides) => migrate(['--print-modules'], overrides).trim().split(/\s+/).filter(Boolean);
61
+ const fullRunWithStubPsql = () => migrate([], { PATH: `${stubDir}${path.delimiter}${process.env.PATH}` });
48
62
 
49
- const setOverride = (enabled) => pool.query(
63
+ const setOverride = (key, enabled) => pool.query(
50
64
  `INSERT INTO module_enablement_overrides (scope, module_key, enabled) VALUES ($1, $2, $3)
51
65
  ON CONFLICT (scope, module_key) DO UPDATE SET enabled = EXCLUDED.enabled`,
52
- [scope, MODULE, enabled],
66
+ [scope, key, enabled],
67
+ );
68
+ const clearOverride = (key) => pool.query(
69
+ 'DELETE FROM module_enablement_overrides WHERE scope = $1 AND module_key = $2', [scope, key],
53
70
  );
54
71
 
55
72
  const { rows: prior } = await pool.query(
56
- 'SELECT enabled, set_by, set_at FROM module_enablement_overrides WHERE scope = $1 AND module_key = $2',
57
- [scope, MODULE],
73
+ 'SELECT module_key, enabled, set_by, set_at FROM module_enablement_overrides WHERE scope = $1 AND module_key = ANY($2)',
74
+ [scope, [MODULE, AGENTS]],
58
75
  );
59
76
 
60
77
  try {
61
- await pool.query('DELETE FROM module_enablement_overrides WHERE scope = $1 AND module_key = $2', [scope, MODULE]);
78
+ await clearOverride(MODULE);
79
+ await clearOverride(AGENTS);
62
80
  const packs = printModules();
63
81
  assert.ok(packs.length > 0, 'with no override the pack set still resolves (not an empty read)');
64
- assert.ok(!packs.includes(MODULE), `precondition: ${MODULE} is off in the packs, so only an override can turn it on`);
82
+ for (const key of [MODULE, AGENTS]) {
83
+ assert.ok(!packs.includes(key), `precondition: ${key} is off in the packs, so only an override can turn it on`);
84
+ }
65
85
  console.log(` ok no override: ${MODULE} is not migrated`);
66
86
 
67
- await setOverride(true);
87
+ await setOverride(MODULE, true);
68
88
  const toggled = printModules();
69
89
  assert.ok(toggled.includes(MODULE), `a hall toggle ON must reach migrate's module set, got: ${toggled.join(' ')}`);
70
90
  assert.deepEqual(toggled.filter((m) => m !== MODULE), packs, 'and changes nothing else');
@@ -75,17 +95,32 @@ try {
75
95
  const unreadable = printModules({ PGHOST: '127.0.0.1', PGPORT: '1' });
76
96
  assert.deepEqual(unreadable, packs, 'an unreachable override database resolves exactly the pack set');
77
97
  console.log(' ok unreadable overrides fall back to the packs');
78
- } finally {
79
- if (prior.length) {
80
- await pool.query(
81
- `INSERT INTO module_enablement_overrides (scope, module_key, enabled, set_by, set_at)
82
- VALUES ($1, $2, $3, $4, $5)
83
- ON CONFLICT (scope, module_key)
84
- DO UPDATE SET enabled = EXCLUDED.enabled, set_by = EXCLUDED.set_by, set_at = EXCLUDED.set_at`,
85
- [scope, MODULE, prior[0].enabled, prior[0].set_by, prior[0].set_at],
86
- );
98
+
99
+ // The reconcile itself is real: where its table exists it would write registry rows this test
100
+ // cannot cleanly undo, so it only runs where the sync fails harmlessly (the lane: agents is off).
101
+ const { rows: [{ reg }] } = await pool.query("SELECT to_regclass('agents_definitions') AS reg");
102
+ if (reg) {
103
+ console.log(` SKIP ${AGENTS} reconcile case — agents_definitions exists here, and a full run would write into it`);
87
104
  } else {
88
- await pool.query('DELETE FROM module_enablement_overrides WHERE scope = $1 AND module_key = $2', [scope, MODULE]);
105
+ assert.ok(!fullRunWithStubPsql().includes(RECONCILE_LINE), `${AGENTS} off: the post-deploy reconcile stays silent`);
106
+ await setOverride(AGENTS, true);
107
+ assert.ok(fullRunWithStubPsql().includes(RECONCILE_LINE), `a hall toggle ON for ${AGENTS} must reach the post-deploy reconcile`);
108
+ console.log(` ok override on: the ${AGENTS} registry reconcile runs`);
109
+ }
110
+ } finally {
111
+ for (const key of [MODULE, AGENTS]) {
112
+ const row = prior.find((r) => r.module_key === key);
113
+ if (row) {
114
+ await pool.query(
115
+ `INSERT INTO module_enablement_overrides (scope, module_key, enabled, set_by, set_at)
116
+ VALUES ($1, $2, $3, $4, $5)
117
+ ON CONFLICT (scope, module_key)
118
+ DO UPDATE SET enabled = EXCLUDED.enabled, set_by = EXCLUDED.set_by, set_at = EXCLUDED.set_at`,
119
+ [scope, key, row.enabled, row.set_by, row.set_at],
120
+ );
121
+ } else {
122
+ await clearOverride(key);
123
+ }
89
124
  }
90
125
  await pool.end().catch(() => {});
91
126
  }