Skip to content

Commit 769d64e

Browse files
committed
Make the deploy path run every D1 test the full suite runs
test:d1 listed sixteen files. The production deploy workflow runs only the three split lists, and three of those files — MCP authorization, the single-renderer lock and the style-scale lock — were in none of them. So a push straight to main deployed without ever running them. Nothing looked broken from outside, because pull requests and the nightly run both call npm run build, which calls the full list. MCP authorization joins core, where the other identity and security work already runs. The two lock tests join publication; they read files and finish in milliseconds, so the lightest job is the right home and the parallel wall clock does not move. The real defect was not the wrong lists, it was that being wrong was invisible: adding a test file means editing two places and forgetting the second one said nothing. The new check in actions:scope:test compares the full list against the union of the splits in both directions, rejects a file that would run twice, and asserts the workflow actually invokes each split — otherwise a fourth list could be added and left unwired while the first three checks stayed green. Verified by putting the gap back: with the two lock tests removed from publication the check fails with "these files never run on the deploy path". test:d1:publication passes with its new members, 53 tests.
1 parent 88a0ce9 commit 769d64e

2 files changed

Lines changed: 50 additions & 2 deletions

File tree

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"orbit:import:verify": "tsx scripts/orbit-slice3-manifest.ts",
3737
"orbit:import:local": "tsx scripts/orbit-slice3-import.ts --local --database=orbit-v6-local --config=wrangler.test.jsonc",
3838
"test:d1": "tsx --test --test-concurrency=5 scripts/orbit-agent-identity-tests.ts scripts/orbit-api-contract-tests.ts scripts/orbit-handle-policy-tests.ts scripts/orbit-d1-tests.ts scripts/orbit-email-tests.ts scripts/orbit-mcp-authorization-tests.ts scripts/orbit-site-authorization-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-public-repository-tests.ts scripts/orbit-single-renderer-tests.ts scripts/orbit-style-scale-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts scripts/orbit-slice4-tests.ts scripts/orbit-slice5-tests.ts",
39-
"test:d1:core": "tsx --test --test-concurrency=5 scripts/orbit-site-authorization-tests.ts scripts/orbit-agent-identity-tests.ts scripts/orbit-api-contract-tests.ts scripts/orbit-handle-policy-tests.ts scripts/orbit-d1-tests.ts scripts/orbit-email-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-public-repository-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts",
40-
"test:d1:publication": "tsx --test scripts/orbit-slice4-tests.ts",
39+
"test:d1:core": "tsx --test --test-concurrency=5 scripts/orbit-site-authorization-tests.ts scripts/orbit-mcp-authorization-tests.ts scripts/orbit-agent-identity-tests.ts scripts/orbit-api-contract-tests.ts scripts/orbit-handle-policy-tests.ts scripts/orbit-d1-tests.ts scripts/orbit-email-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-public-repository-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts",
40+
"test:d1:publication": "tsx --test scripts/orbit-slice4-tests.ts scripts/orbit-single-renderer-tests.ts scripts/orbit-style-scale-tests.ts",
4141
"test:d1:platform": "tsx --test scripts/orbit-slice5-tests.ts",
4242
"v6:check": "npm run test:d1 && npm run check && npm run worker:build",
4343
"preview": "astro preview",

‎scripts/orbit-actions-scope-tests.mjs‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env node
22
import assert from 'node:assert/strict';
3+
import { readFile } from 'node:fs/promises';
34
import test from 'node:test';
45
import { classifyChangedPaths } from './orbit-actions-scope.mjs';
56

@@ -26,3 +27,50 @@ test('escalates mixed and unknown changes to full', () => {
2627
assert.equal(classifyChangedPaths(['unknown/tool.config']), 'full');
2728
assert.equal(classifyChangedPaths([]), 'full');
2829
});
30+
31+
/* Bölünmüş test listeleri, tam listenin tamamını kapsamak zorunda.
32+
*
33+
* Bu kilit bir boşluk bulunduğu için var. `test:d1` on altı dosya sayıyordu ama
34+
* deploy workflow'u yalnız üç bölünmüş listeyi koşuyor ve üç dosya (MCP
35+
* yetkilendirme, tek-renderer kilidi, skala kilidi) hiçbir listede değildi.
36+
* Yani `main`'e doğrudan push edilen bir değişiklik o üç dosya hiç
37+
* çalışmadan canlıya gidiyordu. Testler PR'da ve gece koşusunda çalıştığı için
38+
* ("npm run build" tam listeyi çağırıyor) dışarıdan hiçbir şey bozuk
39+
* görünmüyordu.
40+
*
41+
* Asıl kusur listelerin yanlış olması değil, yanlış olduklarının hiçbir yerde
42+
* görünmemesiydi: bir test dosyası eklemek iki yeri güncellemeyi gerektiriyor
43+
* ve ikincisini unutmak sessiz kalıyor. Bu test o sessizliği kaldırıyor. */
44+
test('every D1 test file the full suite runs is also in exactly one split', async () => {
45+
const packageJson = JSON.parse(
46+
await readFile(new URL('../package.json', import.meta.url), 'utf8'),
47+
);
48+
const testFiles = (script) => script.match(/scripts\/[\w.-]+/gu) ?? [];
49+
50+
const full = testFiles(packageJson.scripts['test:d1']);
51+
const splitNames = ['test:d1:core', 'test:d1:publication', 'test:d1:platform'];
52+
const split = splitNames.flatMap((name) => testFiles(packageJson.scripts[name]));
53+
54+
const missing = full.filter((file) => !split.includes(file));
55+
assert.deepEqual(missing, [], 'these files never run on the deploy path');
56+
57+
const extra = split.filter((file) => !full.includes(file));
58+
assert.deepEqual(extra, [], 'these files run in a split but not in the full suite');
59+
60+
const duplicated = split.filter((file, index) => split.indexOf(file) !== index);
61+
assert.deepEqual(duplicated, [], 'these files would run twice in one deploy');
62+
63+
/* Bölünmüş listeler workflow'da gerçekten çağrılıyor mu. Dördüncü bir liste
64+
* eklenip workflow'a bağlanmazsa yukarıdaki üç kontrol yeşil kalır ve boşluk
65+
* yeni bir kılıkta geri döner. */
66+
const workflow = await readFile(
67+
new URL('../.github/workflows/deploy-production.yml', import.meta.url),
68+
'utf8',
69+
);
70+
for (const name of splitNames) {
71+
assert.ok(
72+
workflow.includes(`npm run ${name}`),
73+
`${name} is not run by the production deploy workflow`,
74+
);
75+
}
76+
});

0 commit comments

Comments
 (0)