@bongos/core 1.19.1035 → 1.19.1037
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 +102 -92
- package/.claude/skills/grade-recover/SKILL.md +1 -1
- package/clients/bongos-client/index.d.ts +1 -1
- package/docs/adr/0302-the-third-identical-failure-stops-the-session-and-asks.md +3 -2
- package/docs/adr/0329-the-rendered-fit-check-is-a-kit-floor-and-an-advisory-ship-check-row.md +2 -2
- package/docs/adr/0339-a-projects-owner-upgrades-it-and-a-hosted-project-hands-off-to-the-hub-door.md +84 -0
- package/docs/adr/README.md +2 -1
- package/docs/api/openapi.json +7 -5
- package/docs/copy-inventory.md +10 -10
- package/docs/copy-registry.json +13 -13
- package/docs/module-api-changelog.md +4 -0
- package/modules/economy/credits.js +1 -1
- package/modules/grading/grader-config.js +3 -12
- package/modules/grading/grader-no-artifact.js +227 -2
- package/modules/grading/grader-prompt.js +1 -1
- package/modules/grading/grader-rubric.json +1 -86
- package/modules/grading/grader-score.js +1 -169
- package/modules/grading/grader-subagent.js +1 -51
- package/modules/grading/grader.js +26 -211
- 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/collab.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.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/people.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 +36 -5
- package/modules/hall-ui/public/studio.html +1 -1
- package/modules/hall-ui/public/task.html +1 -1
- package/modules/hall-ui/public/watch.html +1 -1
- package/modules/hall-ui/public/work.html +1 -1
- package/modules/lifecycle/db-ship.js +3 -3
- package/modules/provisioning/core-upgrade-authz.js +85 -0
- package/modules/provisioning/core-upgrade.js +2 -1
- package/modules/provisioning/provisioning.js +4 -4
- package/modules/provisioning/routes/core-upgrade.js +12 -6
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/release-notes.json +20 -0
- package/scripts/gds/claim.js +2 -1
- package/scripts/gds/grade-smoke.js +3 -3
- package/scripts/gds/provision-core-upgrade.js +12 -4
- package/scripts/gds/render-check.js +1 -1
- package/scripts/gds/ship-check.js +1 -1
- package/scripts/gds/ship-flow.js +1 -1
- package/scripts/gds/ship-grade-steps.js +2 -2
- package/scripts/gds/visual-review-nudge.js +2 -1
- package/src/bongos/auth.js +8 -2
- package/src/bongos/routes/core-update.js +25 -3
- package/src/module-api.js +1 -1
- package/tests/adr_0162_gate_citation.mjs +167 -0
- package/tests/core_upgrade_owner_door.mjs +444 -0
- package/tests/grader.mjs +48 -126
- package/tests/grader_unbacked_score.mjs +1 -1
- package/tests/nav_permission_atoms.mjs +1 -1
- package/tests/provisioning_teardown_intent.mjs +28 -2
- package/tests/regrade_actual_minutes.mjs +18 -17
- package/tests/render_check.mjs +1 -1
- package/tests/scouting_page_gate.mjs +11 -3
- package/tests/skill_grade_audit.mjs +3 -3
- package/tests/skill_grader_health.mjs +2 -2
- package/scripts/gds/audit-ships.js +0 -319
- package/tests/audit_ships_git_argv.mjs +0 -173
package/tests/grader.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// tests/grader.mjs
|
|
2
2
|
//
|
|
3
|
-
// Grader tests.
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// Grader tests: the subagent quality grader (the credits gate since V3.R18 #209).
|
|
4
|
+
// The v1 deterministic process-audit grader was retired in task 1002842; the
|
|
5
|
+
// export-surface test below pins that it stays gone.
|
|
6
6
|
//
|
|
7
7
|
// The v2 subagent itself is a real-network call, so the tests stop at the
|
|
8
8
|
// validator + prompt-builder boundary; the network-touching end-to-end check
|
|
@@ -48,127 +48,6 @@ async function testAsync(name, fn) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// ========================================================================
|
|
52
|
-
// v1 — deterministic grader (legacy, used only by audit-ships.js)
|
|
53
|
-
// ========================================================================
|
|
54
|
-
|
|
55
|
-
test('v1 scoreEstActualBand: ratio inside [0.5, 2.0] → 10', () => {
|
|
56
|
-
assert.equal(grader.scoreEstActualBand(60, 60), 10);
|
|
57
|
-
assert.equal(grader.scoreEstActualBand(30, 60), 10);
|
|
58
|
-
assert.equal(grader.scoreEstActualBand(120, 60), 10);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('v1 scoreEstActualBand: ratio outside band drops linearly', () => {
|
|
62
|
-
assert.equal(grader.scoreEstActualBand(18, 60), 5);
|
|
63
|
-
assert.equal(grader.scoreEstActualBand(360, 60), 5);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test('v1 scoreEstActualBand: extreme ratios → 0', () => {
|
|
67
|
-
assert.equal(grader.scoreEstActualBand(6, 60), 0);
|
|
68
|
-
assert.equal(grader.scoreEstActualBand(600, 60), 0);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('v1 scoreEstActualBand: missing est → 6, missing actual → 5', () => {
|
|
72
|
-
assert.equal(grader.scoreEstActualBand(60, null), 6);
|
|
73
|
-
assert.equal(grader.scoreEstActualBand(null, 60), 5);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('v1 scoreValueSummary: maps length + verb', () => {
|
|
77
|
-
assert.equal(grader.scoreValueSummary(''), 0);
|
|
78
|
-
assert.equal(grader.scoreValueSummary(null), 0);
|
|
79
|
-
assert.equal(grader.scoreValueSummary('short note'), 5);
|
|
80
|
-
assert.equal(grader.scoreValueSummary('a moderately worded summary that lands above forty characters'), 8);
|
|
81
|
-
const s = 'wire the auto-grader into the completed→confirmed transition so every task gets a quality mark before its credits are paid out';
|
|
82
|
-
assert.ok(s.length > 120);
|
|
83
|
-
assert.equal(grader.scoreValueSummary(s), 10);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('v1 scoreDiffHygiene: phantom ship → 0, normal → 10, too-broad → 5', () => {
|
|
87
|
-
assert.equal(grader.scoreDiffHygiene({ files_changed: 0, lines_added: 0, lines_removed: 0 }), 0);
|
|
88
|
-
assert.equal(grader.scoreDiffHygiene({ files_changed: 5, lines_added: 200, lines_removed: 30 }), 10);
|
|
89
|
-
assert.equal(grader.scoreDiffHygiene({ files_changed: 80, lines_added: 1000, lines_removed: 200 }), 5);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
test('v1 scoreScopingSignal: maps each level', () => {
|
|
93
|
-
assert.equal(grader.scoreScopingSignal(0), 2);
|
|
94
|
-
assert.equal(grader.scoreScopingSignal(1), 4);
|
|
95
|
-
assert.equal(grader.scoreScopingSignal(2), 6);
|
|
96
|
-
assert.equal(grader.scoreScopingSignal(3), 7);
|
|
97
|
-
assert.equal(grader.scoreScopingSignal(4), 8);
|
|
98
|
-
assert.equal(grader.scoreScopingSignal(5), 10);
|
|
99
|
-
assert.equal(grader.scoreScopingSignal(null), 6);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test('v1 scoreLocNetNegative', () => {
|
|
103
|
-
assert.equal(grader.scoreLocNetNegative({ lines_added: 20, lines_removed: 100 }), 10);
|
|
104
|
-
assert.equal(grader.scoreLocNetNegative({ lines_added: 100, lines_removed: 20 }), 0);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('v1 scoreLearningRow', () => {
|
|
108
|
-
assert.equal(grader.scoreLearningRow({ body_md: 'x'.repeat(200) }), 10);
|
|
109
|
-
assert.equal(grader.scoreLearningRow(null), 0);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
test('v1 scoreArtRubricAvg clamps + nulls', () => {
|
|
113
|
-
assert.equal(grader.scoreArtRubricAvg(8.7), 8.7);
|
|
114
|
-
assert.equal(grader.scoreArtRubricAvg(15), 10);
|
|
115
|
-
assert.equal(grader.scoreArtRubricAvg(-1), 0);
|
|
116
|
-
assert.equal(grader.scoreArtRubricAvg(NaN), null);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test('v1 blendWeightsForKind: feature renorms to 1.0', () => {
|
|
120
|
-
const w = grader.blendWeightsForKind('feature');
|
|
121
|
-
const total = Object.values(w).reduce((a, b) => a + b, 0);
|
|
122
|
-
assert.ok(Math.abs(total - 1.0) < 1e-6, `total=${total}, expected 1.0`);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
test('v1 blendWeightsForKind: cleanup replaces diff_hygiene', () => {
|
|
126
|
-
const w = grader.blendWeightsForKind('cleanup');
|
|
127
|
-
assert.ok('loc_net_negative' in w);
|
|
128
|
-
assert.ok(!('diff_hygiene' in w));
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test('v1 gradeDeterministic: well-shipped feature passes', () => {
|
|
132
|
-
const result = grader.gradeDeterministic({
|
|
133
|
-
task: { id: 99, kind: 'feature', est_minutes: 240, actual_minutes: 200, scoping_confidence: 4 },
|
|
134
|
-
verification: {
|
|
135
|
-
scanner_clean: true, smoke_clean: true,
|
|
136
|
-
diff_stats: { files_changed: 10, lines_added: 400, lines_removed: 50 },
|
|
137
|
-
},
|
|
138
|
-
actualMinutes: 200,
|
|
139
|
-
valueSummary: 'wire the auto-grader into ship.js so every task gets a quality mark before credits are paid; gates the completed→confirmed transition',
|
|
140
|
-
});
|
|
141
|
-
assert.ok(result.score >= 9.0, `score=${result.score}`);
|
|
142
|
-
assert.equal(result.passed, true);
|
|
143
|
-
assert.equal(result.grader_kind, 'auto');
|
|
144
|
-
assert.equal(result.grader_version, grader.RUBRIC.v1.version);
|
|
145
|
-
assert.equal(result.threshold, grader.RUBRIC.v1.threshold);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test('v1 gradeDeterministic: phantom ship scores low', () => {
|
|
149
|
-
const result = grader.gradeDeterministic({
|
|
150
|
-
task: { id: 100, kind: 'feature', est_minutes: 240, actual_minutes: 30, scoping_confidence: 2 },
|
|
151
|
-
verification: {
|
|
152
|
-
scanner_clean: true, smoke_clean: true,
|
|
153
|
-
diff_stats: { files_changed: 0, lines_added: 0, lines_removed: 0 },
|
|
154
|
-
},
|
|
155
|
-
actualMinutes: 30,
|
|
156
|
-
valueSummary: '',
|
|
157
|
-
});
|
|
158
|
-
assert.ok(result.score < 5.0, `score=${result.score}`);
|
|
159
|
-
assert.equal(result.passed, false);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test('v1 gradeDeterministic: notes_md says deprecated', () => {
|
|
163
|
-
const result = grader.gradeDeterministic({
|
|
164
|
-
task: { id: 106, kind: 'feature', est_minutes: 60, actual_minutes: 60, scoping_confidence: 4 },
|
|
165
|
-
verification: { scanner_clean: true, smoke_clean: true, diff_stats: { files_changed: 3, lines_added: 50, lines_removed: 5 } },
|
|
166
|
-
actualMinutes: 60,
|
|
167
|
-
valueSummary: 'a reasonable shipped change',
|
|
168
|
-
});
|
|
169
|
-
assert.match(result.notes_md, /v1.*deprecated/i);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
51
|
// ========================================================================
|
|
173
52
|
// v2 — subagent grader (the credits gate as of V3.R18 #209)
|
|
174
53
|
// ========================================================================
|
|
@@ -181,17 +60,29 @@ test('v4 exports the expected surface (current panel-based gate)', () => {
|
|
|
181
60
|
'buildPrompt', 'selectGraderModel', 'validateAndScore', 'aggregateShots',
|
|
182
61
|
'runSubagent', 'runOneShot', 'gradeSubagentV3MultiShot',
|
|
183
62
|
// constants
|
|
184
|
-
'THRESHOLD', 'VERSION', 'DEFAULT_GRADER_MODEL', '
|
|
63
|
+
'THRESHOLD', 'VERSION', 'DEFAULT_GRADER_MODEL', 'ASSUMED_BUILDER_MODEL',
|
|
185
64
|
// utilities
|
|
186
65
|
'extractJson', 'extractAssistantResult', 'extractCostUsd', 'RUBRIC',
|
|
187
66
|
];
|
|
188
67
|
for (const name of required) {
|
|
189
68
|
assert.ok(name in grader, `missing export: ${name}`);
|
|
190
69
|
}
|
|
70
|
+
// task 1002842: the v1 generation is retired, not merely unused.
|
|
71
|
+
for (const gone of ['gradeDeterministic', 'scoreEstActualBand', 'scoreValueSummary', 'scoreDiffHygiene',
|
|
72
|
+
'scoreScannerSmoke', 'scoreScopingSignal', 'scoreLocNetNegative', 'scoreLearningRow', 'scoreArtRubricAvg',
|
|
73
|
+
'blendWeightsForKind']) {
|
|
74
|
+
assert.equal(gone in grader, false, `retired v1 export came back: ${gone}`);
|
|
75
|
+
}
|
|
76
|
+
assert.equal('v1' in grader.RUBRIC, false, 'the v1 rubric block is retired');
|
|
77
|
+
assert.equal('v3' in grader.RUBRIC, false, 'the v3 rubric block is retired');
|
|
78
|
+
// The moved plumbing is one implementation, reachable from both homes.
|
|
79
|
+
const noArtifact = require('../modules/grading/grader-no-artifact.js');
|
|
80
|
+
assert.equal(grader.aggregateShots, noArtifact.aggregateShots);
|
|
81
|
+
assert.equal(grader.runOneShot, noArtifact.runOneShot);
|
|
191
82
|
assert.ok(typeof grader.THRESHOLD === 'number');
|
|
192
83
|
assert.ok(grader.THRESHOLD >= 5.0 && grader.THRESHOLD <= 10.0);
|
|
193
84
|
assert.ok(grader.VERSION.startsWith('v4'), `expected v4.*, got ${grader.VERSION}`);
|
|
194
|
-
assert.equal(
|
|
85
|
+
assert.equal('DEFAULT_SHOTS' in grader, false, 'the v3 3-shot default is retired (task 1002842)');
|
|
195
86
|
assert.equal(grader.DEFAULT_GRADER_MODEL, 'claude-sonnet-5'); // task 1002659: Claude 5 family pin
|
|
196
87
|
assert.equal(grader.ASSUMED_BUILDER_MODEL, 'claude-fable-5');
|
|
197
88
|
assert.equal(grader.FALLTHROUGH_CONFIDENCE, 0.3);
|
|
@@ -2316,6 +2207,37 @@ test('isTrivialDiff: empty changed-files or zero-line diff → false', () => {
|
|
|
2316
2207
|
);
|
|
2317
2208
|
});
|
|
2318
2209
|
|
|
2210
|
+
// ---------- task 1002842: the kept trivial-diff fast path still works ----------
|
|
2211
|
+
//
|
|
2212
|
+
// The v3 generation is retired, but its fast path is kept (moving it onto a v4
|
|
2213
|
+
// panel needs a new reviewer type — an owner decision). These pin that what was
|
|
2214
|
+
// kept works: ONE generalist shot by default, the generalist prompt, and the
|
|
2215
|
+
// moved aggregateShots collapse — driven through the runShot seam, no model spawned.
|
|
2216
|
+
|
|
2217
|
+
await testAsync('fast path: one generalist shot by default, aggregated into a gradeable result', async () => {
|
|
2218
|
+
const calls = [];
|
|
2219
|
+
const r = await grader.gradeSubagentV3MultiShot({
|
|
2220
|
+
task: { id: 1002842, title: 't', description: 'd', kind: 'cleanup' },
|
|
2221
|
+
valueSummary: 'v', diff: '+ docs line', changedFiles: ['docs/x.md'], diffStats: { files_changed: 1, lines_added: 1, lines_removed: 0 },
|
|
2222
|
+
builderModel: 'claude-fable-5', runOpts: {},
|
|
2223
|
+
runShot: async (args) => { calls.push(args); return mkPassShot(8, 8, 0.9, args.shotIndex); },
|
|
2224
|
+
});
|
|
2225
|
+
assert.equal(calls.length, 1, 'the fast path runs exactly one shot unless told otherwise');
|
|
2226
|
+
assert.match(calls[0].prompt, /default-fail|DEFAULT/i, 'it is the generalist default-fail prompt');
|
|
2227
|
+
assert.equal(r.passed, true);
|
|
2228
|
+
assert.equal(r.rubric_scores.functional_fidelity, 8);
|
|
2229
|
+
assert.equal(r.rubric_scores.code_quality, 8);
|
|
2230
|
+
assert.equal(r.signals.confidence, 0.9, 'the server gate reads a real confidence');
|
|
2231
|
+
});
|
|
2232
|
+
|
|
2233
|
+
await testAsync('fast path: a failing shot still fails the grade (not loosened by the move)', async () => {
|
|
2234
|
+
const r = await grader.gradeSubagentV3MultiShot({
|
|
2235
|
+
task: { id: 1 }, valueSummary: 'v', diff: '+ x', changedFiles: ['docs/x.md'], diffStats: {},
|
|
2236
|
+
runOpts: {}, runShot: async (args) => mkFailShot(4, 8, 0.9, args.shotIndex),
|
|
2237
|
+
});
|
|
2238
|
+
assert.equal(r.passed, false);
|
|
2239
|
+
});
|
|
2240
|
+
|
|
2319
2241
|
// ---------- Summary ----------
|
|
2320
2242
|
|
|
2321
2243
|
console.log('');
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// server's ff gate failed the ship — a PASS verdict inside a FAIL grade;
|
|
15
15
|
// 3. the card had no branch for it, so it printed the ordinary FAIL block.
|
|
16
16
|
// The constraint the task set: close it WITHOUT letting an unbacked low score
|
|
17
|
-
// pass and WITHOUT adding a gate (
|
|
17
|
+
// pass and WITHOUT adding a gate (the task's own scope: it corrects what the grade SAYS). Every case below that has a low
|
|
18
18
|
// score also asserts the server still refuses it.
|
|
19
19
|
//
|
|
20
20
|
// Run: node tests/grader_unbacked_score.mjs
|
|
@@ -87,7 +87,7 @@ test('the hall-preview fixture carries every atom /me resolves', () => {
|
|
|
87
87
|
// the file and left the query alone, so a returning browser kept the cached copy —
|
|
88
88
|
// a fix that reaches nobody looks identical to a fix that does not work.
|
|
89
89
|
|
|
90
|
-
const SHELL_SHA = '
|
|
90
|
+
const SHELL_SHA = '983282a83fd5aa71';
|
|
91
91
|
|
|
92
92
|
test('shell.js has not changed without its cache-bust being bumped', () => {
|
|
93
93
|
const actual = crypto.createHash('sha256').update(SHELL).digest('hex').slice(0, 16);
|
|
@@ -47,20 +47,22 @@ async function ta(name, fn) {
|
|
|
47
47
|
// A stateful fake of provisioning_intents that ENFORCES ux_provisioning_intents_open
|
|
48
48
|
// (at most ONE open pending|running intent per instance, action-blind) — so the exact
|
|
49
49
|
// collision the bug rode on is reproduced, not approximated. Dispatches on SQL shape.
|
|
50
|
-
function fakeIntentDb(seed = []) {
|
|
50
|
+
function fakeIntentDb(seed = [], { shape = 'co-tenant' } = {}) {
|
|
51
51
|
let nextId = 1;
|
|
52
|
+
let updates = 0;
|
|
52
53
|
const rows = seed.map((r) => ({ id: nextId++, requested_by: null, last_error: null, resolved_at: null, ...r }));
|
|
53
54
|
const open = (instanceId) => rows.filter((r) =>
|
|
54
55
|
String(r.instance_id) === String(instanceId) && (r.state === 'pending' || r.state === 'running'));
|
|
55
56
|
return {
|
|
56
57
|
rows,
|
|
58
|
+
get updates() { return updates; },
|
|
57
59
|
query: async (sql, params) => {
|
|
58
60
|
// The self-row guard's shape lookup (task 1003159, ADR 0293 D2): every enqueue
|
|
59
61
|
// now asks "is this the control plane?" before it writes. These cases are all
|
|
60
62
|
// ORDINARY instances, so the honest answer is a tenant shape — answering
|
|
61
63
|
// 'control-plane' here would refuse every teardown in this file.
|
|
62
64
|
if (/SELECT hosting_shape FROM provisioning_instances/.test(sql)) {
|
|
63
|
-
return { rows: [{ hosting_shape:
|
|
65
|
+
return { rows: [{ hosting_shape: shape }] };
|
|
64
66
|
}
|
|
65
67
|
if (/INSERT INTO provisioning_intents/.test(sql)) {
|
|
66
68
|
const [instance_id, action, requested_by] = params;
|
|
@@ -80,6 +82,12 @@ function fakeIntentDb(seed = []) {
|
|
|
80
82
|
// push, task 1003238 to the restart; an open teardown is left alone for the
|
|
81
83
|
// idempotent path).
|
|
82
84
|
assert.match(sql, /action IN \('provision', 'settings-apply', 'restart', 'repo-private'\) AND state = 'pending'/);
|
|
85
|
+
updates++;
|
|
86
|
+
// The supersede must skip the platform's own row IN ITS OWN SQL (task 1004286): the
|
|
87
|
+
// guard refuses that teardown only afterwards, in enqueueIntent. Modelled, not assumed.
|
|
88
|
+
if (shape === 'control-plane' && /NOT EXISTS \(SELECT 1 FROM provisioning_instances WHERE id = \$1 AND hosting_shape = 'control-plane'\)/.test(sql)) {
|
|
89
|
+
return { rows: [] };
|
|
90
|
+
}
|
|
83
91
|
const hit = rows.filter((r) =>
|
|
84
92
|
String(r.instance_id) === String(params[0]) && SUPERSEDABLE.has(r.action) && r.state === 'pending');
|
|
85
93
|
for (const r of hit) { r.state = 'error'; r.last_error = 'superseded: teardown requested'; }
|
|
@@ -135,6 +143,24 @@ await ta('a clean queue just enqueues (no supersede)', async () => {
|
|
|
135
143
|
assert.equal(r.intent.requested_by, 'api:archon:1');
|
|
136
144
|
});
|
|
137
145
|
|
|
146
|
+
// task 1004286 — the supersede runs BEFORE the control-plane guard (which lives in
|
|
147
|
+
// enqueueIntent, the one place every intent passes), and the two share no transaction. So a teardown pressed on
|
|
148
|
+
// the platform's own row was correctly refused — after it had already cancelled a
|
|
149
|
+
// pending restart. 'restart' is the one action both allowed on the control plane and
|
|
150
|
+
// superseded by a teardown, so that is the whole blast radius. The owner was told nothing
|
|
151
|
+
// happened while the restart they asked for no longer ran. The supersede now skips that row in
|
|
152
|
+
// its own statement, so the guard still runs once, in one place.
|
|
153
|
+
await ta('a REFUSED teardown of the control-plane row leaves a pending restart pending', async () => {
|
|
154
|
+
const db = fakeIntentDb([{ instance_id: 1, action: 'restart', state: 'pending' }], { shape: 'control-plane' });
|
|
155
|
+
await assert.rejects(provisioning.enqueueTeardown(db, 1, 'api:archon:1'),
|
|
156
|
+
(e) => e.code === 'control_plane_protected', 'the teardown is refused, as before');
|
|
157
|
+
const restart = db.rows.find((x) => x.action === 'restart');
|
|
158
|
+
assert.equal(restart.state, 'pending', 'the refused teardown cancelled nothing');
|
|
159
|
+
assert.equal(restart.last_error, null);
|
|
160
|
+
assert.equal(db.rows.filter((x) => x.action === 'teardown').length, 0, 'and queued nothing');
|
|
161
|
+
assert.equal(db.updates, 1, 'one supersede statement ran, and it matched nothing on the control-plane row');
|
|
162
|
+
});
|
|
163
|
+
|
|
138
164
|
t('PROVISION_ENQUEUE_FROM: an active or tearing-down instance never re-enqueues a provision intent', () => {
|
|
139
165
|
assert.equal(provisioning.PROVISION_ENQUEUE_FROM.has('active'), false, 'active — the enabling misstep');
|
|
140
166
|
assert.equal(provisioning.PROVISION_ENQUEUE_FROM.has('tearing_down'), false, 'tearing_down — mid-reclaim');
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
import { strict as assert } from 'node:assert';
|
|
33
33
|
import { test } from 'node:test';
|
|
34
34
|
import { createRequire } from 'node:module';
|
|
35
|
-
import { readFileSync } from 'node:fs';
|
|
35
|
+
import { readFileSync, readdirSync } from 'node:fs';
|
|
36
36
|
|
|
37
37
|
const require = createRequire(import.meta.url);
|
|
38
38
|
const { buildPrompt } = require('../modules/grading/grader-prompt.js');
|
|
@@ -78,23 +78,24 @@ test('a task with no actual_minutes at all builds the same prompt', () => {
|
|
|
78
78
|
assert.equal(withFigure, without, 'actual_minutes changes nothing about what the panel reads');
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
test('
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
81
|
+
test('no grader entry reads actual_minutes — the one scorer that did is retired', () => {
|
|
82
|
+
// scoreEstActualBand was the ONE scorer that read the figure. It lived in the v1
|
|
83
|
+
// gradeDeterministic, whose only non-test caller was scripts/gds/audit-ships.js;
|
|
84
|
+
// task 1002842 retired all three. So the stale-figure risk this file guards is now
|
|
85
|
+
// closed at the source, and this pins it: nothing in the grading module may
|
|
86
|
+
// accept or read the figure, and the retired entry may not come back.
|
|
87
87
|
const grader = require('../modules/grading/grader.js');
|
|
88
|
-
assert.equal(
|
|
89
|
-
assert.equal(grader.
|
|
88
|
+
assert.equal(grader.gradeDeterministic, undefined, 'the retired v1 entry stays gone');
|
|
89
|
+
assert.equal(grader.scoreEstActualBand, undefined, 'and so does its minutes scorer');
|
|
90
|
+
assert.equal(typeof grader.gradeSubagent, 'function', 'the live entry is still here');
|
|
90
91
|
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
assert.
|
|
92
|
+
// Every grading source, not just grader.js: a new reader anywhere in the module
|
|
93
|
+
// is the same risk as wiring the figure into the prompt.
|
|
94
|
+
const dir = new URL('../modules/grading/', import.meta.url);
|
|
95
|
+
const files = readdirSync(dir, { recursive: true }).filter((f) => String(f).endsWith('.js'));
|
|
96
|
+
assert.ok(files.length > 5, 'the grading module was found');
|
|
97
|
+
for (const f of files) {
|
|
98
|
+
const src = readFileSync(new URL(String(f), dir), 'utf8');
|
|
99
|
+
assert.doesNotMatch(src, /actualMinutes|actual_minutes/, `${f} must not read actual_minutes`);
|
|
99
100
|
}
|
|
100
101
|
});
|
package/tests/render_check.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// tests/render_check.mjs — the rendered fit check (task 1004203, ADR 0329): which pages a changed path
|
|
2
2
|
// reaches, which report rows it keeps, and that /ship-check shows it as a signal that never flips its exit
|
|
3
|
-
// (ADR
|
|
3
|
+
// (ADR 0329, decision 3). DB-free and browser-free; the in-page measurement is pinned in tests/ui_design_kit_fit.mjs.
|
|
4
4
|
import assert from 'node:assert/strict';
|
|
5
5
|
import { test } from 'node:test';
|
|
6
6
|
import fs from 'node:fs';
|
|
@@ -174,11 +174,19 @@ await t('the OTHER page gates are untouched — their seam is never consulted at
|
|
|
174
174
|
assert.ok(vote, 'board.vote.cast floors at xenos on purpose (ADR 0266) — admitted without the seam');
|
|
175
175
|
});
|
|
176
176
|
|
|
177
|
-
await t('only
|
|
177
|
+
await t('only the gates WITH A PROOF declare a second door (a widening must be opted into, one gate at a time)', () => {
|
|
178
178
|
const src = require('node:fs').readFileSync(new URL('../src/bongos/auth.js', import.meta.url), 'utf8');
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
// Keyed by GATE, not just the door's name, so a third gate borrowing 'isProjectOwner'
|
|
180
|
+
// fails here instead of hiding behind an unchanged list of names. Each entry names the
|
|
181
|
+
// file that proves its widening:
|
|
182
|
+
// requireProjectCuratePage — this file (ADR 0210 D3);
|
|
183
|
+
// requireCorePinPage — tests/core_upgrade_owner_door.mjs (ADR 0339, task 1004174).
|
|
184
|
+
const declarations = [...src.matchAll(/(require\w+Page):\s*Object\.freeze\(\{[^}]*alsoAdmits:\s*'([^']+)'/g)]
|
|
185
|
+
.map((m) => `${m[1]}:${m[2]}`);
|
|
186
|
+
assert.deepEqual(declarations, ['requireProjectCuratePage:isProjectOwner', 'requireCorePinPage:isProjectOwner'],
|
|
181
187
|
'a second alsoAdmits appearing without its own proof is how a page gate quietly widens');
|
|
188
|
+
const plain = [...src.matchAll(/alsoAdmits:\s*'([^']+)'/g)].length;
|
|
189
|
+
assert.equal(plain, declarations.length, 'every alsoAdmits sits on a named page gate this test can see');
|
|
182
190
|
});
|
|
183
191
|
|
|
184
192
|
seams._reset();
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// accountability sweep from the grader-hardening evaluation §6 (task 1002657):
|
|
3
3
|
// the override ledger, dropped blocker/major findings on passing grades (with
|
|
4
4
|
// the advisory-Narc attribution filter), the false-pass spot-check, and the
|
|
5
|
-
// outage roll-up handoff — describing and queueing ONLY (ADR
|
|
6
|
-
// never confirms a task or flips status).
|
|
5
|
+
// outage roll-up handoff — describing and queueing ONLY (ADR 0158 §2: it
|
|
6
|
+
// never confirms a task or flips status; ADR 0162: it adds no approval step to a ship).
|
|
7
7
|
import assert from 'node:assert/strict';
|
|
8
8
|
import { test } from 'node:test';
|
|
9
9
|
import { readFileSync, existsSync } from 'node:fs';
|
|
@@ -45,6 +45,6 @@ test('/grade-audit exists, covers the sweep legs, and stays describe-and-queue o
|
|
|
45
45
|
|
|
46
46
|
// The hard constraint.
|
|
47
47
|
assert.match(md, /never confirm/i, 'states it never confirms');
|
|
48
|
-
assert.match(md, /ADR 0162/, 'anchors the no-
|
|
48
|
+
assert.match(md, /ADR 0162/, 'anchors the no-approval-step-on-a-ship constraint');
|
|
49
49
|
assert.ok(!/curl[^\n]*\/confirm/.test(md), 'carries no ready-to-paste confirm curl');
|
|
50
50
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// the four health axes from the grader-hardening evaluation §6 (task 1002656):
|
|
3
3
|
// outage runs, pass-rate drift, cost anomalies, and stale model pins — reading
|
|
4
4
|
// LIVE data surfaces, emitting exact --regrade remediation lines, and staying
|
|
5
|
-
// read-only (describe, never confirm/flip — ADR 0162).
|
|
5
|
+
// read-only (describe, never confirm/flip — ADR 0158 §2; no approval step on anyone's ship — ADR 0162).
|
|
6
6
|
import assert from 'node:assert/strict';
|
|
7
7
|
import { test } from 'node:test';
|
|
8
8
|
import { readFileSync, existsSync } from 'node:fs';
|
|
@@ -44,5 +44,5 @@ test('/grader-health exists and covers the four health axes on live data', (t) =
|
|
|
44
44
|
assert.match(md, /--probe/, 'offers the optional live calibration probe');
|
|
45
45
|
assert.match(md, /grade-smoke\.js/, 'names the probe script');
|
|
46
46
|
assert.match(md, /read-only/i, 'states the read-only contract');
|
|
47
|
-
assert.match(md, /ADR 0162/, 'anchors the no-
|
|
47
|
+
assert.match(md, /ADR 0162/, 'anchors the no-approval-step-on-a-ship constraint');
|
|
48
48
|
});
|