@bongos/core 1.21.177 → 1.21.179
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 +147 -152
- package/clients/bongos-client/README.md +1 -1
- package/clients/bongos-client/bongos-client.global.js +0 -6
- package/clients/bongos-client/index.cjs +0 -6
- package/clients/bongos-client/index.d.ts +0 -6
- package/clients/bongos-client/index.mjs +0 -6
- package/docs/adr/0042-builder-self-deploy-ci-auto-merge.md +3 -2
- package/docs/api/openapi.json +1 -87
- package/docs/api-reference.md +1 -8
- package/docs/canonical-permissions.md +3 -3
- package/docs/copy-inventory.md +50 -64
- package/docs/copy-registry.json +109 -236
- package/docs/file-map.md +3 -3
- package/docs/module-api-changelog.md +4 -0
- package/docs/modules-contract.md +2 -2
- package/docs/page-inventory.json +4 -7
- package/docs/page-readings.json +1520 -1569
- package/modules/government/catalog.js +10 -7
- package/modules/government/decision-board.js +0 -1
- package/modules/government/decision-rules.js +0 -1
- package/modules/government/docket.js +0 -1
- package/modules/government/protected-surfaces.js +1 -1
- package/modules/government/protected-surfaces.json +2 -3
- package/modules/hall-ui/public/atlas.html +1 -1
- package/modules/hall-ui/public/blockers.html +1 -1
- package/modules/hall-ui/public/board-room.html +1 -1
- package/modules/hall-ui/public/city.html +1 -1
- package/modules/hall-ui/public/collab.html +1 -1
- package/modules/hall-ui/public/commands.html +1 -1
- package/modules/hall-ui/public/copy-desk.html +1 -1
- package/modules/hall-ui/public/deploy.html +1 -1
- package/modules/hall-ui/public/diagrams.html +1 -1
- package/modules/hall-ui/public/drachmae.html +1 -1
- package/modules/hall-ui/public/fleet.html +1 -1
- package/modules/hall-ui/public/gate.css +4 -26
- package/modules/hall-ui/public/gate.html +12 -27
- package/modules/hall-ui/public/gate.js +26 -176
- package/modules/hall-ui/public/gate.states.json +4 -22
- package/modules/hall-ui/public/goal-map.html +1 -1
- package/modules/hall-ui/public/goals.html +1 -1
- package/modules/hall-ui/public/government.html +1 -1
- package/modules/hall-ui/public/idea.html +1 -1
- package/modules/hall-ui/public/ideas.html +1 -1
- package/modules/hall-ui/public/index.html +1 -1
- package/modules/hall-ui/public/modules.html +1 -1
- package/modules/hall-ui/public/my-agents.html +1 -1
- package/modules/hall-ui/public/primer.html +1 -1
- package/modules/hall-ui/public/profile.html +1 -1
- package/modules/hall-ui/public/project-settings.html +1 -1
- package/modules/hall-ui/public/ranks.html +1 -1
- package/modules/hall-ui/public/roadmap.html +1 -1
- package/modules/hall-ui/public/roster.html +1 -1
- package/modules/hall-ui/public/sessions.html +1 -1
- package/modules/hall-ui/public/settings.html +1 -1
- package/modules/hall-ui/public/shell.js +1 -1
- package/modules/hall-ui/public/street-card.js +5 -9
- package/modules/hall-ui/public/street-desk.js +2 -2
- package/modules/hall-ui/public/street-inside.js +1 -1
- package/modules/hall-ui/public/street.html +1 -1
- package/modules/hall-ui/public/studio.html +1 -1
- package/modules/hall-ui/public/task.html +1 -1
- package/modules/hall-ui/public/thinking.html +1 -1
- package/modules/hall-ui/public/tweak-editor.html +1 -1
- package/modules/hall-ui/public/watch.html +1 -1
- package/modules/hall-ui/public/work.html +1 -1
- package/modules/hall-ui/public/work.js +67 -14
- package/modules/lifecycle/matter-acts.js +0 -6
- package/modules/lifecycle/module.json +0 -1
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/release-notes.json +28 -0
- package/scripts/bongos/adopt-preflight.js +3 -3
- package/scripts/bongos/audit-authorship.sh +1 -3
- package/scripts/bongos/bump-version.js +46 -9
- package/scripts/bongos/doc-cli-guard.js +2 -0
- package/scripts/bongos/doc-control-claims.js +2 -2
- package/scripts/bongos/government-walk.js +3 -9
- package/scripts/bongos/hard-floor.js +52 -0
- package/scripts/bongos/publish-manifest.js +3 -3
- package/scripts/bongos/run-unit-tests.js +17 -5
- package/scripts/gds/hard-floor.js +6 -0
- package/src/bongos/module-scope-map.js +2 -2
- package/src/bongos/permission-path-check.js +1 -1
- package/src/bongos/route-rank-check.js +1 -8
- package/src/bongos/routes.js +1 -2
- package/src/module-api.js +1 -1
- package/src/modules.js +1 -1
- package/tests/acclaim_feed_evidence_db.mjs +42 -23
- package/tests/adr_0089_scope.mjs +7 -5
- package/tests/bump_version.mjs +52 -18
- package/tests/copy_desk_flags_db.mjs +22 -14
- package/tests/gating_review_retired.mjs +1 -1
- package/tests/goal_sort_staleness.mjs +1 -1
- package/tests/government_act_alone_buildings.mjs +1 -3
- package/tests/government_board_membership_db.mjs +35 -22
- package/tests/government_protected_surfaces.mjs +29 -13
- package/tests/governor_docket.mjs +0 -2
- package/tests/governor_matter_acts.mjs +6 -8
- package/tests/hall_city.mjs +1 -1
- package/tests/hall_matter_card.mjs +2 -2
- package/tests/hall_oversight_world.mjs +16 -12
- package/tests/hall_street_desk.mjs +4 -3
- package/tests/hall_street_inside.mjs +1 -1
- package/tests/helpers.mjs +34 -0
- package/tests/howto_state.mjs +33 -56
- package/tests/howto_state_db.mjs +68 -0
- package/tests/idea_credit_streams_db.mjs +11 -3
- package/tests/integration_parked_ratchet.mjs +7 -1
- package/tests/nav_permission_atoms.mjs +1 -1
- package/tests/page_notes_db.mjs +12 -8
- package/tests/page_tweak_no_rearm.mjs +50 -0
- package/tests/publish_manifest.mjs +64 -0
- package/tests/search_isolation.mjs +5 -103
- package/tests/search_isolation_db.mjs +140 -0
- package/tests/session_earnings_mirror_db.mjs +2 -0
- package/tests/work_board_live_refresh.mjs +236 -0
- package/tests/workflow_exec_paths.mjs +9 -11
- package/modules/lifecycle/routes/gate-approvals.js +0 -299
- package/scripts/bongos/ci-grade.js +0 -82
- package/scripts/bongos/gate-review.js +0 -330
- package/scripts/gds/ci-grade.js +0 -7
- package/scripts/gds/gate-review.js +0 -7
- package/tests/gate_approvals.mjs +0 -611
- package/tests/gate_review.mjs +0 -152
package/tests/gate_review.mjs
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
// tests/gate_review.mjs
|
|
2
|
-
//
|
|
3
|
-
// Unit tests for the automatic gate-surface gatekeeper classifier (ADR 0058,
|
|
4
|
-
// task 1139). classifyChanges is PURE (diff-as-data in, verdict out) so the whole
|
|
5
|
-
// policy — including every red-team evasion the design workflow surfaced — is a
|
|
6
|
-
// regression case here. DB-free / network-free → runs in the unit gate.
|
|
7
|
-
//
|
|
8
|
-
// Verdicts: pass (auto-merge) | needs_trust (Metic+ auto / else escalate) | escalate
|
|
9
|
-
// (hard floor — rank-independent, always pings the owner).
|
|
10
|
-
//
|
|
11
|
-
// Run: node tests/gate_review.mjs
|
|
12
|
-
|
|
13
|
-
import { strict as assert } from 'node:assert';
|
|
14
|
-
import { createRequire } from 'node:module';
|
|
15
|
-
|
|
16
|
-
const require = createRequire(import.meta.url);
|
|
17
|
-
const gk = require('../scripts/bongos/gate-review.js');
|
|
18
|
-
const permPath = require('../src/bongos/permission-path-check.js');
|
|
19
|
-
|
|
20
|
-
let passed = 0, failed = 0;
|
|
21
|
-
function test(name, fn) {
|
|
22
|
-
try { fn(); passed++; console.log(` ok ${name}`); }
|
|
23
|
-
catch (e) { failed++; console.log(` FAIL ${name}\n ${e.message}`); }
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Build a classifyChanges call from a compact spec.
|
|
27
|
-
// files: [{path, mode?, deleted?}] blobs: { 'base:path':..., 'head:path':... }
|
|
28
|
-
function classify(files, blobs = {}, diffBytes = 0) {
|
|
29
|
-
const blobAt = (which, p) => (Object.prototype.hasOwnProperty.call(blobs, `${which}:${p}`) ? blobs[`${which}:${p}`] : null);
|
|
30
|
-
return gk.classifyChanges({ files: files.map((f) => ({ mode: '100644', deleted: false, ...f })), blobAt, diffBytes });
|
|
31
|
-
}
|
|
32
|
-
const verdictOf = (...a) => classify(...a).verdict;
|
|
33
|
-
|
|
34
|
-
// --- PASS: no gate surface / pure-narrowing AUTO -------------------------------------
|
|
35
|
-
test('no gate surface (game/art/docs) → pass', () => {
|
|
36
|
-
assert.equal(verdictOf([{ path: 'public/game/main.js' }, { path: 'docs/foo.md' }, { path: 'art/x.png' }]), 'pass');
|
|
37
|
-
});
|
|
38
|
-
test('adding a new test file → pass', () => {
|
|
39
|
-
assert.equal(verdictOf([{ path: 'tests/new_thing.mjs' }], { 'head:tests/new_thing.mjs': 'test(...)' }), 'pass');
|
|
40
|
-
});
|
|
41
|
-
test('run-unit-tests.js REMOVING from INTEGRATION (un-mute) → pass (AUTO)', () => {
|
|
42
|
-
const base = `const INTEGRATION = new Set(['a','b']);\nconst KNOWN_FAILING = new Set(['x']);\nconst Z=1;`;
|
|
43
|
-
const head = `const INTEGRATION = new Set(['a']);\nconst KNOWN_FAILING = new Set(['x']);\nconst Z=1;`;
|
|
44
|
-
const r = classify([{ path: 'scripts/bongos/run-unit-tests.js' }], { 'base:scripts/bongos/run-unit-tests.js': base, 'head:scripts/bongos/run-unit-tests.js': head });
|
|
45
|
-
assert.equal(r.verdict, 'pass');
|
|
46
|
-
assert.deepEqual(r.autoPassed, ['scripts/bongos/run-unit-tests.js']);
|
|
47
|
-
});
|
|
48
|
-
test('secrets-allowlist.txt REMOVING a line (narrow) → pass (AUTO)', () => {
|
|
49
|
-
const r = classify([{ path: '.husky/secrets-allowlist.txt' }], { 'base:.husky/secrets-allowlist.txt': 'aaa\nbbb\n', 'head:.husky/secrets-allowlist.txt': 'aaa\n' });
|
|
50
|
-
assert.equal(r.verdict, 'pass');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// --- NEEDS_TRUST: sensitive-but-routine (rank-trustable) -----------------------------
|
|
54
|
-
test('new migration → needs_trust', () => assert.equal(verdictOf([{ path: 'migrations/120_thing.sql' }]), 'needs_trust'));
|
|
55
|
-
test('package.json bump → needs_trust', () => assert.equal(verdictOf([{ path: 'package.json' }]), 'needs_trust'));
|
|
56
|
-
test('a route file → needs_trust', () => assert.equal(verdictOf([{ path: 'src/bongos/routes/tasks.js' }]), 'needs_trust'));
|
|
57
|
-
test('server.js → needs_trust', () => assert.equal(verdictOf([{ path: 'server.js' }]), 'needs_trust'));
|
|
58
|
-
test('ship.js → needs_trust', () => assert.equal(verdictOf([{ path: 'scripts/bongos/ship.js' }]), 'needs_trust'));
|
|
59
|
-
test('db.js change OUTSIDE the rank-tier region → needs_trust', () => {
|
|
60
|
-
const base = `const REQUIRES_RANK_TIER = { foo: 1 };\nfunction q(){ return 1 }`;
|
|
61
|
-
const head = `const REQUIRES_RANK_TIER = { foo: 1 };\nfunction q(){ return 2 }`;
|
|
62
|
-
assert.equal(verdictOf([{ path: 'src/bongos/db.js' }], { 'base:src/bongos/db.js': base, 'head:src/bongos/db.js': head }), 'needs_trust');
|
|
63
|
-
});
|
|
64
|
-
test('deleting a test file → needs_trust', () => assert.equal(verdictOf([{ path: 'tests/route_rank.mjs', deleted: true }]), 'needs_trust'));
|
|
65
|
-
test('shrinking a test file → needs_trust', () => {
|
|
66
|
-
assert.equal(verdictOf([{ path: 'tests/route_rank.mjs' }], { 'base:tests/route_rank.mjs': 'x'.repeat(500), 'head:tests/route_rank.mjs': 'x'.repeat(50) }), 'needs_trust');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// --- ESCALATE: HARD FLOOR (rank-independent) -----------------------------------------
|
|
70
|
-
for (const p of [
|
|
71
|
-
'scripts/bongos/gate-review.js', 'src/bongos/permission-path-check.js', 'src/bongos/auth.js',
|
|
72
|
-
'src/bongos/route-rank-check.js', 'modules/grading/grader.js', 'modules/grading/grader-workers/narc.js',
|
|
73
|
-
'scripts/bongos/main-audit.js', 'scripts/migrate.sh', 'scripts/deploy/deploy-prod.sh',
|
|
74
|
-
'config/deploy.json', 'infra/branch-protection.json', '.github/workflows/gate-review.yml',
|
|
75
|
-
'CODEOWNERS', '.husky/pre-push', '.claude/hooks/stop-sound.js', '.claude/settings.json',
|
|
76
|
-
]) {
|
|
77
|
-
test(`hard floor: ${p} → escalate`, () => assert.equal(verdictOf([{ path: p }]), 'escalate'));
|
|
78
|
-
}
|
|
79
|
-
test('db.js with the rank-tier region CHANGED → escalate', () => {
|
|
80
|
-
const base = `const REQUIRES_RANK_TIER = { foo: 1 };\nfunction q(){}`;
|
|
81
|
-
const head = `const REQUIRES_RANK_TIER = { foo: 4, bar: 1 };\nfunction q(){}`;
|
|
82
|
-
assert.equal(verdictOf([{ path: 'src/bongos/db.js' }], { 'base:src/bongos/db.js': base, 'head:src/bongos/db.js': head }), 'escalate');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// --- ESCALATE: red-team evasions -----------------------------------------------------
|
|
86
|
-
test('Hole(mute): run-unit-tests.js ADDING to KNOWN_FAILING → escalate (AUTO cert fails → floor)', () => {
|
|
87
|
-
const base = `const INTEGRATION = new Set(['a']);\nconst KNOWN_FAILING = new Set(['x']);`;
|
|
88
|
-
const head = `const INTEGRATION = new Set(['a']);\nconst KNOWN_FAILING = new Set(['x','grader_panel']);`;
|
|
89
|
-
assert.equal(verdictOf([{ path: 'scripts/bongos/run-unit-tests.js' }], { 'base:scripts/bongos/run-unit-tests.js': base, 'head:scripts/bongos/run-unit-tests.js': head }), 'escalate');
|
|
90
|
-
});
|
|
91
|
-
test('Hole(mute): run-unit-tests.js non-set code changed → escalate', () => {
|
|
92
|
-
const base = `const INTEGRATION = new Set(['a']);\nconst KNOWN_FAILING = new Set([]);\nconst TIMEOUT=90000;`;
|
|
93
|
-
const head = `const INTEGRATION = new Set(['a']);\nconst KNOWN_FAILING = new Set([]);\nconst TIMEOUT=1;`;
|
|
94
|
-
assert.equal(verdictOf([{ path: 'scripts/bongos/run-unit-tests.js' }], { 'base:scripts/bongos/run-unit-tests.js': base, 'head:scripts/bongos/run-unit-tests.js': head }), 'escalate');
|
|
95
|
-
});
|
|
96
|
-
test('Hole(allowlist): secrets-allowlist.txt ADDING a broadening line → escalate', () => {
|
|
97
|
-
assert.equal(verdictOf([{ path: '.husky/secrets-allowlist.txt' }], { 'base:.husky/secrets-allowlist.txt': 'aaa\n', 'head:.husky/secrets-allowlist.txt': 'aaa\nLEAKED_KEY=.*\n' }), 'escalate');
|
|
98
|
-
});
|
|
99
|
-
test('Hole8: a symlink in the diff → escalate (alias evasion)', () => {
|
|
100
|
-
assert.equal(verdictOf([{ path: 'src/bongos/routes/x.js', mode: '120000' }]), 'escalate');
|
|
101
|
-
});
|
|
102
|
-
test('Hole6/8: a non-ASCII/homoglyph path → escalate', () => {
|
|
103
|
-
assert.equal(verdictOf([{ path: 'src/bongos/аuth.js' /* cyrillic a */ }]), 'escalate');
|
|
104
|
-
});
|
|
105
|
-
test('Hole10: oversize diff → escalate', () => {
|
|
106
|
-
assert.equal(verdictOf([{ path: 'public/game/main.js' }], {}, 9 * 1024 * 1024), 'escalate');
|
|
107
|
-
});
|
|
108
|
-
test('Hole2: editing gate-review.yml (self-neuter) → escalate', () => {
|
|
109
|
-
assert.equal(verdictOf([{ path: '.github/workflows/gate-review.yml' }]), 'escalate');
|
|
110
|
-
});
|
|
111
|
-
test('Hole4: adding a new middleware + editing routes.js → escalate (auth.js floor) / needs_trust (routes)', () => {
|
|
112
|
-
// routes.js is needs_trust; but pairing with a hard-floor file makes the PR escalate.
|
|
113
|
-
assert.equal(verdictOf([{ path: 'src/bongos/routes.js' }, { path: 'src/bongos/auth.js' }]), 'escalate');
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// --- DRIFT GUARD: no PROTECTED_GLOBS entry is silently un-routed (never pass) ---------
|
|
117
|
-
test('drift guard: every PROTECTED_GLOBS entry routes to escalate or needs_trust (never pass)', () => {
|
|
118
|
-
for (const glob of permPath.PROTECTED_GLOBS) {
|
|
119
|
-
// Synthesize a representative path under each glob.
|
|
120
|
-
const sample = glob.endsWith('/') ? `${glob}__sample__.js` : glob;
|
|
121
|
-
// db.js needs blobs to classify; give it a no-op (region unchanged) → needs_trust (still not pass).
|
|
122
|
-
const blobs = sample === 'src/bongos/db.js'
|
|
123
|
-
? { 'base:src/bongos/db.js': 'const REQUIRES_RANK_TIER = {};\nx', 'head:src/bongos/db.js': 'const REQUIRES_RANK_TIER = {};\ny' }
|
|
124
|
-
: {};
|
|
125
|
-
const v = verdictOf([{ path: sample }], blobs);
|
|
126
|
-
assert.notEqual(v, 'pass', `PROTECTED glob ${glob} (sample ${sample}) classified as PASS — gate-surface leak`);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
test('drift guard: every HARD_FLOOR glob is also covered by PROTECTED_GLOBS (sub-Metic floor protects the gate machinery)', () => {
|
|
130
|
-
for (const g of gk.HARD_FLOOR_GLOBS) {
|
|
131
|
-
// a floor glob must be matched by SOME protected glob (subtree-aware): a file under it is protected.
|
|
132
|
-
const sample = g.endsWith('/') ? `${g}__s__` : g;
|
|
133
|
-
assert.equal(permPath.matchProtected([sample]).length > 0, true, `hard-floor ${g} is not in PROTECTED_GLOBS`);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// --- resolveAction: rank clears needs_trust; ONLY an owner review clears the hard floor (task 1142) ---
|
|
138
|
-
const RA = (verdict, trusted, ownerApproved) => gk.resolveAction({ verdict, trusted, ownerApproved });
|
|
139
|
-
test('resolveAction: pass → pass regardless of trust', () => {
|
|
140
|
-
assert.equal(RA('pass', false, false), 'pass');
|
|
141
|
-
});
|
|
142
|
-
test('resolveAction: needs_trust + Metic+ attestation → pass', () => assert.equal(RA('needs_trust', true, false), 'pass'));
|
|
143
|
-
test('resolveAction: needs_trust + untrusted + no approval → block', () => assert.equal(RA('needs_trust', false, false), 'block'));
|
|
144
|
-
test('resolveAction: needs_trust + owner approval (untrusted) → pass', () => assert.equal(RA('needs_trust', false, true), 'pass'));
|
|
145
|
-
test('resolveAction: escalate + trusted but NOT owner-approved → block (rank never clears the hard floor)', () => {
|
|
146
|
-
assert.equal(RA('escalate', true, false), 'block');
|
|
147
|
-
});
|
|
148
|
-
test('resolveAction: escalate + owner approval → pass (only the owner clears the floor)', () => assert.equal(RA('escalate', false, true), 'pass'));
|
|
149
|
-
test('resolveAction: escalate + nothing → block', () => assert.equal(RA('escalate', false, false), 'block'));
|
|
150
|
-
|
|
151
|
-
console.log(`\ngate-review (task 1139) tests: ${passed} passed, ${failed} failed`);
|
|
152
|
-
process.exit(failed > 0 ? 1 : 0);
|