@bongos/core 1.19.156 → 1.19.158
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 +73 -68
- package/.claude/skills/blocker-review/SKILL.md +3 -3
- package/.claude/skills/blocker-solve/SKILL.md +3 -3
- package/.claude/skills/builder-backup/SKILL.md +2 -2
- package/.claude/skills/builder-box/SKILL.md +1 -1
- package/.claude/skills/builder-claim/SKILL.md +1 -1
- package/.claude/skills/builder-connect/SKILL.md +5 -5
- package/.claude/skills/builder-cost/SKILL.md +2 -2
- package/.claude/skills/builder-exit/SKILL.md +1 -1
- package/.claude/skills/builder-reauth/SKILL.md +2 -2
- package/.claude/skills/builder-redteam/SKILL.md +2 -2
- package/.claude/skills/builder-setup/SKILL.md +4 -4
- package/.claude/skills/builder-start/SKILL.md +4 -4
- package/.claude/skills/close-box/SKILL.md +2 -2
- package/.claude/skills/design-sync/SKILL.md +2 -2
- package/.claude/skills/dev/SKILL.md +2 -2
- package/.claude/skills/feedback/SKILL.md +2 -2
- package/.claude/skills/fix-task/SKILL.md +1 -1
- package/.claude/skills/goal-create/SKILL.md +2 -2
- package/.claude/skills/goal-review/SKILL.md +2 -2
- package/.claude/skills/grader-health/SKILL.md +1 -1
- package/.claude/skills/idea-triage/SKILL.md +3 -3
- package/.claude/skills/merge-mode/SKILL.md +2 -2
- package/.claude/skills/planning-session/SKILL.md +2 -2
- package/.claude/skills/priority-session/SKILL.md +2 -2
- package/.claude/skills/read-session-export/SKILL.md +2 -2
- package/.claude/skills/scan-before-install/SKILL.md +3 -3
- package/.claude/skills/status/SKILL.md +1 -1
- package/docs/architecture.md +7 -7
- package/docs/branding-contract.md +1 -1
- package/docs/design/modular-architecture/01-architecture.md +2 -2
- package/docs/design/modular-architecture/02-module-map.md +1 -1
- package/docs/design/modular-architecture/03-builder-flows.md +1 -1
- package/docs/design-contract.md +4 -4
- package/docs/file-map.md +12 -12
- package/docs/modules-contract.md +2 -2
- package/docs/onboarding/diagrams/README.md +4 -4
- package/docs/onboarding/drachmae-and-karma.md +1 -1
- package/docs/recipes/README.md +1 -1
- package/docs/recipes/audit-replay.md +1 -1
- package/docs/recipes/builder-box-lifecycle.md +2 -2
- package/docs/recipes/claude-design-loop.md +4 -4
- package/docs/recipes/core-release-pipeline.md +1 -1
- package/docs/recipes/devbox-app-release.md +2 -2
- package/docs/recipes/devbox-app-windows-test.md +1 -1
- package/docs/recipes/figma-design-loop.md +4 -4
- package/docs/recipes/gds-db-backup.md +3 -3
- package/docs/recipes/instance-deploy.md +1 -1
- package/docs/recipes/managed-settings-remote-control.md +9 -9
- package/docs/recipes/ops-gotchas.md +2 -2
- package/docs/recipes/overnight-builder.md +2 -2
- package/docs/recipes/packaging-the-core.md +1 -1
- package/docs/recipes/search-index-ingestion.md +3 -3
- package/docs/recipes/self-host.md +2 -2
- package/docs/recipes/work-on-a-task-from-your-dev-box.md +1 -1
- package/docs/research/llm-model-agnostic-and-cheaper-grader.md +1 -1
- package/modules/platform-identity/platform-identity.js +31 -12
- package/modules/platform-identity/tests/platform-identity.mjs +18 -1
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/scripts/gds/run-unit-tests.js +1 -1
- package/src/module-api.js +5 -1
- package/tests/scouting_rollup_fanout.mjs +113 -0
|
@@ -342,10 +342,27 @@ await ta('listScoutingRollup aggregates per builder across projects, ranked, joi
|
|
|
342
342
|
assert.match(c.text, /FROM platform_identity_builder_project_activity a/);
|
|
343
343
|
assert.match(c.text, /GROUP BY a\.github_id/);
|
|
344
344
|
assert.match(c.text, /sum\(a\.credits\)/);
|
|
345
|
-
assert.match(c.text, /ORDER BY total_credits DESC/);
|
|
345
|
+
assert.match(c.text, /ORDER BY agg\.total_credits DESC, agg\.total_tasks_shipped DESC/);
|
|
346
346
|
assert.deepEqual(c.params, [50]);
|
|
347
347
|
});
|
|
348
348
|
|
|
349
|
+
await ta('listScoutingRollup scalar aggregation is fan-out-free (task 1002911)', async () => {
|
|
350
|
+
// The old query LEFT JOIN LATERAL unnest(a.disciplines)'d BEFORE GROUP BY, so
|
|
351
|
+
// sums/counts multiplied by the discipline count. Structural guard: the agg CTE
|
|
352
|
+
// (the scalar sums) must contain no unnest/LATERAL; unnest may appear only in
|
|
353
|
+
// the disc CTE. Real-SQL proof of the semantics: tests/scouting_rollup_fanout.mjs.
|
|
354
|
+
const pool = mockPool([{ rows: [] }]);
|
|
355
|
+
await P.listScoutingRollup({ pool, limit: 10 });
|
|
356
|
+
const sql = pool.calls[0].text;
|
|
357
|
+
assert.doesNotMatch(sql, /LATERAL/i, 'no lateral join anywhere in the rollup');
|
|
358
|
+
const aggCte = sql.slice(sql.indexOf('WITH agg AS'), sql.indexOf('disc AS'));
|
|
359
|
+
assert.match(aggCte, /sum\(a\.credits\)/, 'scalar sums live in the agg CTE');
|
|
360
|
+
assert.doesNotMatch(aggCte, /unnest/i, 'the scalar-aggregation CTE must not fan rows out');
|
|
361
|
+
const discCte = sql.slice(sql.indexOf('disc AS'), sql.indexOf('SELECT agg.github_id'));
|
|
362
|
+
assert.match(discCte, /unnest\(a\.disciplines\)/, 'disciplines union is computed separately');
|
|
363
|
+
assert.match(discCte, /array_agg\(DISTINCT x\.d\)/, 'disciplines are deduped across projects');
|
|
364
|
+
});
|
|
365
|
+
|
|
349
366
|
console.log('\nauthorization codes:');
|
|
350
367
|
|
|
351
368
|
await ta('mintAuthCode stores the HASH of the code (never the plaintext) + binds it', async () => {
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bongos/core",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.158",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@bongos/core",
|
|
9
|
-
"version": "1.19.
|
|
9
|
+
"version": "1.19.158",
|
|
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.
|
|
3
|
+
"version": "1.19.158",
|
|
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",
|
|
@@ -76,7 +76,7 @@ const INTEGRATION = new Set([
|
|
|
76
76
|
'claim_gate_open_blocker', 'claim_gate_rebase', 'clawback_confirmed_backlog', 'discord_autojoin', 'discord_oauth',
|
|
77
77
|
'governance_fold_bench', 'governance_live_proof', 'linkify_refs', 'memory_isolation',
|
|
78
78
|
'memory_pull', 'needs_rebase', 'parallel-load', 'reward_mode_cost_plus_only',
|
|
79
|
-
'session_records', 'setup_smoke',
|
|
79
|
+
'scouting_rollup_fanout', 'session_records', 'setup_smoke',
|
|
80
80
|
'status-probe',
|
|
81
81
|
]);
|
|
82
82
|
|
package/src/module-api.js
CHANGED
|
@@ -739,8 +739,12 @@ const { validateOrRespond, LIMITS, parseId, asyncHandler, corsPublicGet, parsePa
|
|
|
739
739
|
// landed since 1.19.154 with no explicit bump. run 31957556550. (task 1002620)
|
|
740
740
|
// 1.19.156 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
|
|
741
741
|
// landed since 1.19.155 with no explicit bump. run 31957976979. (task 1002620)
|
|
742
|
+
// 1.19.157 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
|
|
743
|
+
// landed since 1.19.156 with no explicit bump. run 31958139486. (task 1002620)
|
|
744
|
+
// 1.19.158 — CI auto-patch (publish-on-merge, ADR 0161): carrier for merges
|
|
745
|
+
// landed since 1.19.157 with no explicit bump. run 31958753412. (task 1002620)
|
|
742
746
|
// ---------------------------------------------------------------------------
|
|
743
|
-
const CORE_VERSION = '1.19.
|
|
747
|
+
const CORE_VERSION = '1.19.158'; // CI auto-patch carrier (ADR 0161); see changelog above
|
|
744
748
|
|
|
745
749
|
// A namespaced logger so a module's log lines are attributable + consistent.
|
|
746
750
|
// Usage: const log = api.logger('dev-box'); log.info('mounted');
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// tests/scouting_rollup_fanout.mjs — task 1002911 (real DB).
|
|
2
|
+
//
|
|
3
|
+
// listScoutingRollup used to `LEFT JOIN LATERAL unnest(a.disciplines)` BEFORE
|
|
4
|
+
// GROUP BY, multiplying every activity row by max(1, cardinality(disciplines)) —
|
|
5
|
+
// so project_count and the credits/ships/karma sums were inflated for any builder
|
|
6
|
+
// with 2+ disciplines on a project row. The module's own test suite is DB-free
|
|
7
|
+
// and can only regex-match the SQL text; THIS test proves the aggregation
|
|
8
|
+
// semantics against real SQL: it replays the module's actual migrations, seeds a
|
|
9
|
+
// multi-discipline builder across two projects, and asserts exact totals.
|
|
10
|
+
//
|
|
11
|
+
// Real-DB integration test: self-skips without a reachable Postgres; also in the
|
|
12
|
+
// INTEGRATION set so the default DB-free lane never runs it.
|
|
13
|
+
//
|
|
14
|
+
// Run: DATABASE_URL=... node tests/scouting_rollup_fanout.mjs
|
|
15
|
+
|
|
16
|
+
import { createRequire } from 'node:module';
|
|
17
|
+
import { readFileSync } from 'node:fs';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
import { dirname, join } from 'node:path';
|
|
20
|
+
import { strict as assert } from 'node:assert';
|
|
21
|
+
const require = createRequire(import.meta.url);
|
|
22
|
+
const { Pool } = require('pg');
|
|
23
|
+
const pi = require('../modules/platform-identity/platform-identity.js');
|
|
24
|
+
|
|
25
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const MIG_DIR = join(here, '..', 'modules', 'platform-identity', 'migrations');
|
|
27
|
+
const migrationSql = (f) => readFileSync(join(MIG_DIR, f), 'utf8');
|
|
28
|
+
|
|
29
|
+
const pool = new Pool({ connectionString: process.env.DATABASE_URL || undefined });
|
|
30
|
+
try {
|
|
31
|
+
await pool.query('SELECT 1');
|
|
32
|
+
} catch (e) {
|
|
33
|
+
console.log(`scouting_rollup_fanout.mjs SKIPPED — no reachable Postgres (${e.code || e.message}).`);
|
|
34
|
+
await pool.end().catch(() => {});
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// High-numbered fixture ids so a shared DB can never collide with real data.
|
|
39
|
+
const MULTI = 90002911, SOLO = 90002912, GHOST = 90002913;
|
|
40
|
+
const ALL_IDS = [MULTI, SOLO, GHOST];
|
|
41
|
+
const CLIENTS = ['t1002911-p1', 't1002911-p2'];
|
|
42
|
+
const q = (sql, params) => pool.query(sql, params);
|
|
43
|
+
|
|
44
|
+
async function cleanup() {
|
|
45
|
+
await q(`DELETE FROM platform_identity_builder_project_activity WHERE github_id = ANY($1::bigint[])`, [ALL_IDS]).catch(() => {});
|
|
46
|
+
await q(`DELETE FROM platform_identity_accounts WHERE github_id = ANY($1::bigint[])`, [ALL_IDS]).catch(() => {});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let pass = 0;
|
|
50
|
+
const ok = (cond, msg) => { assert.ok(cond, msg); pass++; console.log(` ok - ${msg}`); };
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
// The module's actual migrations (idempotent CREATE TABLE IF NOT EXISTS).
|
|
54
|
+
await q(migrationSql('platform_identity_001_tables.sql'));
|
|
55
|
+
await q(migrationSql('platform_identity_005_builder_activity.sql'));
|
|
56
|
+
await cleanup();
|
|
57
|
+
|
|
58
|
+
await q(
|
|
59
|
+
`INSERT INTO platform_identity_accounts (github_id, github_login, display_name, avatar_url)
|
|
60
|
+
VALUES ($1, 'multi', 'Multi', 'a'), ($2, 'solo', 'Solo', 'b'), ($3, 'ghost', 'Ghost', 'c')`,
|
|
61
|
+
[MULTI, SOLO, GHOST],
|
|
62
|
+
);
|
|
63
|
+
// MULTI: two projects, 2 and 3 disciplines — the exact fan-out shape the old
|
|
64
|
+
// query inflated (credits would have summed 100*2 + 50*3 = 350, count 5).
|
|
65
|
+
// SOLO: one project, one discipline (was always correct — must stay correct).
|
|
66
|
+
// GHOST: one project, NO disciplines (old query kept it via LEFT JOIN + FILTER).
|
|
67
|
+
await q(
|
|
68
|
+
`INSERT INTO platform_identity_builder_project_activity
|
|
69
|
+
(client_id, github_id, credits, tasks_shipped, karma, disciplines, last_active)
|
|
70
|
+
VALUES ($1, $3, 100, 5, 3, '{engineer,ui}', '2026-01-01T00:00:00Z'),
|
|
71
|
+
($2, $3, 50, 2, 1, '{artist,engineer,ui}', '2026-02-01T00:00:00Z'),
|
|
72
|
+
($1, $4, 60, 4, 2, '{engineer}', '2026-03-01T00:00:00Z'),
|
|
73
|
+
($2, $5, 10, 1, 0, '{}', '2026-04-01T00:00:00Z')`,
|
|
74
|
+
[...CLIENTS, MULTI, SOLO, GHOST],
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const rows = (await pi.listScoutingRollup({ limit: 500, pool })).filter((r) => ALL_IDS.includes(Number(r.github_id)));
|
|
78
|
+
const by = Object.fromEntries(rows.map((r) => [Number(r.github_id), r]));
|
|
79
|
+
|
|
80
|
+
const m = by[MULTI];
|
|
81
|
+
ok(m, 'multi-discipline builder appears in the rollup');
|
|
82
|
+
ok(m.project_count === 2, `project_count is 2, not fanned (got ${m.project_count})`);
|
|
83
|
+
ok(m.total_credits === 150, `total_credits is 100+50=150, not inflated (got ${m.total_credits})`);
|
|
84
|
+
ok(m.total_tasks_shipped === 7, `total_tasks_shipped is 5+2=7 (got ${m.total_tasks_shipped})`);
|
|
85
|
+
ok(m.total_karma === 4, `total_karma is 3+1=4 (got ${m.total_karma})`);
|
|
86
|
+
ok(new Date(m.last_active).toISOString() === '2026-02-01T00:00:00.000Z', 'last_active is the max across projects');
|
|
87
|
+
assert.deepEqual([...m.disciplines].sort(), ['artist', 'engineer', 'ui']);
|
|
88
|
+
pass++; console.log(' ok - disciplines are the deduped union across projects');
|
|
89
|
+
ok(m.github_login === 'multi', 'account display fields join through');
|
|
90
|
+
|
|
91
|
+
const s = by[SOLO];
|
|
92
|
+
ok(s.project_count === 1 && s.total_credits === 60 && s.total_tasks_shipped === 4 && s.total_karma === 2,
|
|
93
|
+
'single-discipline builder totals are unchanged');
|
|
94
|
+
assert.deepEqual(s.disciplines, ['engineer']);
|
|
95
|
+
pass++; console.log(' ok - single discipline survives as a one-element array');
|
|
96
|
+
|
|
97
|
+
const g = by[GHOST];
|
|
98
|
+
ok(g, 'a builder with an empty disciplines array still appears');
|
|
99
|
+
ok(g.disciplines === null, 'empty disciplines roll up as NULL (matches the old FILTER behavior)');
|
|
100
|
+
ok(g.project_count === 1 && g.total_credits === 10, 'empty-disciplines totals are correct');
|
|
101
|
+
|
|
102
|
+
const fixtureOrder = rows.map((r) => Number(r.github_id));
|
|
103
|
+
assert.deepEqual(fixtureOrder, [MULTI, SOLO, GHOST]);
|
|
104
|
+
pass++; console.log(' ok - ranked by total_credits DESC');
|
|
105
|
+
|
|
106
|
+
const limited = await pi.listScoutingRollup({ limit: 1, pool });
|
|
107
|
+
ok(limited.length === 1, 'LIMIT is respected');
|
|
108
|
+
|
|
109
|
+
console.log(`\nscouting_rollup_fanout.mjs: ${pass} passed`);
|
|
110
|
+
} finally {
|
|
111
|
+
await cleanup();
|
|
112
|
+
await pool.end().catch(() => {});
|
|
113
|
+
}
|