@wildshard/engine 0.1.21 → 0.1.23
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/CHANGELOG.md +16 -0
- package/lint/engine-sides.json +5 -0
- package/lint/shardfile-boundaries.mjs +4 -2
- package/lint/sim-players.json +2 -13
- package/lint/wildshard-plugin.js +1 -1
- package/package.json +10 -2
- package/scripts/apfs-clone.mjs +5 -2
- package/scripts/app-build/catalogue.ts +39 -8
- package/scripts/app-build/serviceWorker.ts +4 -1
- package/scripts/app-build/splitOutput.mjs +33 -11
- package/scripts/audio-download-proof.mjs +1 -1
- package/scripts/check-spelled-paths.mjs +6 -3
- package/scripts/ci-pack.mjs +3 -3
- package/scripts/committed-fast-checks.mjs +2 -2
- package/scripts/engine-ci-shard.mjs +11 -0
- package/scripts/failmode-cases.mjs +1 -1
- package/scripts/failmode-proof.mjs +35 -11
- package/scripts/fight-page-census.mjs +131 -0
- package/scripts/goldens/board.py +44 -11
- package/scripts/goldens/native-residency.d.mts +1 -0
- package/scripts/goldens/native-residency.mjs +18 -4
- package/scripts/grid-crossing-walk-proof.mjs +3 -3
- package/scripts/hover-speed-probe.mjs +2 -2
- package/scripts/keep-copy.mjs +120 -0
- package/scripts/land.mjs +36 -6
- package/scripts/lane-live.mjs +136 -0
- package/scripts/leftovers-report.mjs +47 -0
- package/scripts/loading-card-proof.mjs +42 -9
- package/scripts/loading-flow/benchmax.mjs +57 -7
- package/scripts/loading-flow/stalls.d.mts +2 -0
- package/scripts/loading-flow/stalls.mjs +13 -0
- package/scripts/mmo-bots.mjs +11 -5
- package/scripts/mmo-grid-proof.mjs +74 -0
- package/scripts/mmo-seat-proof.mjs +43 -0
- package/scripts/net-lag-proof.mjs +1 -1
- package/scripts/nightly-heads.ts +13 -13
- package/scripts/nightly-model.ts +26 -12
- package/scripts/nightly.proof.ts +18 -5
- package/scripts/nightly.ts +13 -8
- package/scripts/no-astc-boot.mjs +77 -0
- package/scripts/online-rig.mjs +7 -7
- package/scripts/parity/boot-smoke.mjs +1 -1
- package/scripts/physics-route.json +6 -6
- package/scripts/pins-reuse.mjs +1 -0
- package/scripts/pins-staging.ts +54 -0
- package/scripts/pins.ts +5 -0
- package/scripts/release-cook.mjs +6 -2
- package/scripts/ring3.proof.ts +71 -0
- package/scripts/ring3.ts +100 -0
- package/scripts/scratch-dir.mjs +31 -12
- package/scripts/scratch-sweep.mjs +15 -23
- package/scripts/server-release/items.d.mts +7 -0
- package/scripts/server-release/items.mjs +28 -0
- package/scripts/server-release/publish.mjs +9 -1
- package/scripts/side-parity.mjs +1 -1
- package/scripts/test-products.json +1 -21
- package/scripts/tsconfig.json +2 -0
- package/scripts/vitest-ci-files.ts +5 -1
- package/scripts/vps/cook-follow.d.mts +6 -0
- package/scripts/vps/cook-follow.mjs +45 -0
- package/scripts/vps/harden-apply.sh +10 -1
- package/scripts/vps/rebuild.sh +104 -36
- package/scripts/vps/wildshard-config +106 -3
- package/scripts/warm-native-chrome.mjs +9 -3
- package/scripts/worker-client-fights.mjs +9 -3
- package/scripts/worktree-reap.mjs +15 -131
- package/scripts/worktree.mjs +92 -12
- package/src/client/app/entry.ts +2 -3
- package/src/client/engine/audio/audioLog.ts +7 -2
- package/src/client/engine/boot/contentRead.ts +24 -4
- package/src/client/engine/boot/diagnostics.ts +69 -1
- package/src/client/engine/boot/downloadGiveUp.ts +34 -0
- package/src/client/engine/combat/EquipmentService.ts +2 -0
- package/src/client/engine/core/Game.ts +6 -2
- package/src/client/engine/core/ktx2.ts +5 -3
- package/src/client/engine/core/ktx2Zstd.ts +2 -1
- package/src/client/engine/pwa/sw.js +26 -8
- package/src/client/engine/render/dataLook.ts +14 -7
- package/src/client/engine/render/lookLight.ts +64 -20
- package/src/client/engine/ui/Loading.ts +6 -8
- package/src/client/engine/ui/downloadFailed.ts +54 -0
- package/src/client/engine/ui/lookLightOption.ts +1 -1
- package/src/client/game/audio/cueDirector.ts +2 -1
- package/src/client/game/boot/spawnDownload.ts +12 -1
- package/src/client/game/boss/arenaRoom.ts +4 -3
- package/src/client/game/boss/roamingProjection.ts +1 -1
- package/src/client/game/devScene/hook.ts +1 -1
- package/src/client/game/devScene/liveLook.ts +1 -1
- package/src/client/game/grid/copyPrompts.ts +3 -4
- package/src/client/game/grid/dataCellKit.ts +99 -0
- package/src/client/game/grid/enteredEquipment.ts +11 -2
- package/src/client/game/grid/live.ts +9 -299
- package/src/client/game/grid/liveSession.ts +31 -8
- package/src/client/game/grid/neighbourLife.ts +50 -32
- package/src/client/game/grid/products.ts +21 -7
- package/src/client/game/grid/reveal.ts +7 -2
- package/src/client/game/grid/session.ts +10 -74
- package/src/client/game/plugin/weaponFamily.ts +6 -0
- package/src/client/game/population/signals.ts +1 -1
- package/src/client/game/quest/chapterDirector.ts +1 -0
- package/src/client/game/shardfile/clientBossTelegraph.ts +4 -3
- package/src/client/game/shardfile/clientWorker.ts +35 -9
- package/src/client/game/shardfile/look.ts +1 -1
- package/src/client/game/shardfile/runtimeProduct.ts +9 -5
- package/src/client/game/shardfile/wirePage.ts +5 -2
- package/src/client/game/shardfile/worldSceneTextures.ts +15 -9
- package/src/client/host/online/shell.ts +37 -13
- package/src/cook/game/cookWorker.ts +8 -5
- package/src/cook/game/tierTextures.ts +5 -3
- package/src/server/engine/net/simWorld.ts +3 -4
- package/src/server/game/grid/cellHome.ts +58 -0
- package/src/server/game/grid/room.ts +2 -38
- package/src/server/game/grid/simulation.ts +5 -4
- package/src/server/game/plugin/mover.ts +18 -14
- package/src/server/game/shardfile/declaredKitItems.ts +39 -9
- package/src/server/host/bake/headlessWorker.ts +3 -3
- package/src/server/host/dedicated/cellHost.ts +2 -2
- package/src/server/host/dedicated/cellProtocol.ts +1 -1
- package/src/server/host/dedicated/cellWorker.ts +5 -3
- package/src/server/host/dedicated/dedicatedRoom.ts +8 -3
- package/src/server/host/dedicated/gridCells.ts +5 -3
- package/src/server/host/dedicated/main.ts +12 -7
- package/src/server/host/dedicated/packReader.ts +15 -2
- package/src/server/host/dedicated/playerStore.ts +1 -1
- package/src/server/host/dedicated/workerTable.ts +0 -10
- package/src/server/host/dedicated/world.ts +39 -5
- package/src/server/host/headlessRuntime.ts +11 -6
- package/src/server/host/standalone/cellWorld.ts +21 -7
- package/src/server/host/standalone/gridServer.ts +3 -1
- package/src/server/host/standalone/roadWorld.ts +6 -0
- package/src/shared/engine/physics/gridBorders.ts +15 -1
- package/src/shared/engine/saves/shape.ts +17 -2
- package/src/shared/engine/sim/snapshot.ts +5 -5
- package/src/shared/engine/strings.ts +10 -0
- package/src/shared/game/grid/placementRows.ts +4 -3
- package/src/shared/game/ledger.ts +13 -4
- package/src/shared/game/loot/platformCatalogue.ts +14 -0
- package/src/shared/game/quest/ledger.ts +3 -3
- package/src/shared/game/shardfile/items.ts +9 -1
- package/src/shared/host/headlessJourney.ts +3 -3
- package/src/shared/host/headlessTape.ts +7 -6
- package/src/shared/host/releaseRows.ts +4 -1
- package/src/client/game/grid/cellLoading.ts +0 -110
- package/src/client/game/grid/cellScreens.ts +0 -48
package/scripts/nightly-heads.ts
CHANGED
|
@@ -17,17 +17,12 @@ import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
|
17
17
|
|
|
18
18
|
await import('./bake-loader.mjs');
|
|
19
19
|
const {folderStore} = await import('../src/cook/game/packStore.ts');
|
|
20
|
-
const {objectHeaders} = await import('../src/cook/game/cookWorker.ts');
|
|
20
|
+
const {objectHeaders, DEFAULT_LIMITS} = await import('../src/cook/game/cookWorker.ts');
|
|
21
21
|
const {addStoredShards} = await import('./app-build/catalogue.ts');
|
|
22
22
|
const {bareSlug} = await import('../src/shared/game/grid/catalogueSlot.ts');
|
|
23
23
|
const [browserName, groupText, directory = 'tmp/nightly/reports', only] = process.argv.slice(2);
|
|
24
24
|
if (browserName !== 'chromium' && browserName !== 'webkit') throw new Error('Choose chromium or webkit');
|
|
25
25
|
const expected = plan(), selected = partition(expected.heads, Number(groupText));
|
|
26
|
-
// SDK hover-row contract: inspect real admitted metadata at actual gameplay.
|
|
27
|
-
const paddingProofHeads: readonly string[] = ['template', 'blender-template', 'pastel-plain', 'ink-cel-valley'];
|
|
28
|
-
for (const slug of [...paddingProofHeads, 'open-plot-ember-forge', 'driftwood-isle']) {
|
|
29
|
-
if (!expected.heads.some(head => head.slug === slug)) throw new Error(`Hover contract head is missing: ${slug}`);
|
|
30
|
-
}
|
|
31
26
|
if (only !== undefined && !selected.some(row => row.slug === only)) throw new Error('Head outside partition');
|
|
32
27
|
const out = resolvePath(directory), root = process.cwd(), dist = join(root, 'dist');
|
|
33
28
|
mkdirSync(out, {recursive: true});
|
|
@@ -49,7 +44,7 @@ try {
|
|
|
49
44
|
const phase = async (name: string, run: () => unknown): Promise<boolean> => {
|
|
50
45
|
const started = Date.now();
|
|
51
46
|
try {const detail = await run(); result.phases.push({name, ok: true, ms: Date.now() - started, detail}); checkpoint(); return true;}
|
|
52
|
-
catch (error) {result.phases.push({name, ok: false, ms: Date.now() - started, error: String(error).slice(0, 4000)}); checkpoint(); return false;}
|
|
47
|
+
catch (error) {result.phases.push({name, ok: false, ms: Date.now() - started, error: (error instanceof Error ? error.stack ?? String(error) : String(error)).slice(0, 4000)}); checkpoint(); return false;}
|
|
53
48
|
};
|
|
54
49
|
const cooked = join(work, head.slug), evidence = join(work, `${head.slug}-evidence`);
|
|
55
50
|
mkdirSync(evidence);
|
|
@@ -64,8 +59,11 @@ try {
|
|
|
64
59
|
};
|
|
65
60
|
try {
|
|
66
61
|
if (!await phase('cook', () => {
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
// Exercise the production worker's time allowance, including cold phone
|
|
63
|
+
// ASTC encodes. The old private 300 s cap was half its current limit.
|
|
64
|
+
const timeout = DEFAULT_LIMITS.seconds * 1000;
|
|
65
|
+
execFileSync(process.execPath, ['scripts/ring-cook.mjs', '--ring2', `--only=${head.slug}`, `--out=${cooked}`, `--build=${build}`, `--timeout-ms=${timeout}`],
|
|
66
|
+
{stdio: 'inherit', timeout: timeout + 30_000});
|
|
69
67
|
const cookedReceipt = (read(join(cooked, 'receipt.json')) as {indexes: CookIndex[]});
|
|
70
68
|
const index = cookedReceipt.indexes[0];
|
|
71
69
|
if (index?.hash !== head.hash || index.slug !== head.slug || index.build !== build || index.keys.length === 0) throw new Error('Wrong or empty cooked product');
|
|
@@ -95,7 +93,7 @@ try {
|
|
|
95
93
|
if (bankText === undefined) throw new Error('Missing build bank');
|
|
96
94
|
const bank = JSON.parse(bankText) as {spawnManifests: {client: Record<string, unknown>}};
|
|
97
95
|
for (const slug of Object.keys(bank.spawnManifests.client)) if (bareSlug(slug) === bareSlug(head.slug)) delete bank.spawnManifests.client[slug];
|
|
98
|
-
writeFileSync(join(dist, 'index.html'), originalHTML.replace(expression, (_, before, _body, after) => `${before}${JSON.stringify(bank)}${after}`));
|
|
96
|
+
writeFileSync(join(dist, 'index.html'), originalHTML.replace(expression, (_, before, _body, after) => `${before}${JSON.stringify(bank).replaceAll('<', String.raw`\u003c`)}${after}`));
|
|
99
97
|
const added = await addStoredShards(dist, [head], store,
|
|
100
98
|
hash => Promise.resolve(readFileSync(join(process.env.WILDSHARD_PIN_CACHE ?? join(homedir(), '.cache/wildshard/pins'), `${hash}.tar`))),
|
|
101
99
|
{base: `http://127.0.0.1:${address.port}`, shards: []}, live);
|
|
@@ -111,13 +109,15 @@ try {
|
|
|
111
109
|
await phase('boot', async () => {
|
|
112
110
|
const boot = await bootCase(activeBrowser, url, mode, evidence, route, true, async page => {
|
|
113
111
|
await phase('hover', async () => {
|
|
114
|
-
|
|
112
|
+
// J352: these product boots are inside a zone, whose cruise is
|
|
113
|
+
// 14 m/s. Road cruise is exercised by the grid tests.
|
|
114
|
+
const expectedCap = 14;
|
|
115
115
|
const actualCap = await page.evaluate(() => {
|
|
116
116
|
const player = window.__wildshard?.world?.player;
|
|
117
117
|
if (player === undefined) throw new Error('Hover metadata has no entered player');
|
|
118
118
|
return player.hoverSpeedLimit?.() ?? 14;
|
|
119
119
|
});
|
|
120
|
-
if (
|
|
120
|
+
if (actualCap !== expectedCap) throw new Error(`${head.slug}: admitted hover cap ${actualCap} differs from ${expectedCap}`);
|
|
121
121
|
const control = page.locator('.ws-touch-hover');
|
|
122
122
|
await control.tap({timeout: 5000});
|
|
123
123
|
await page.waitForFunction(() => {
|
|
@@ -160,7 +160,7 @@ try {
|
|
|
160
160
|
});
|
|
161
161
|
await phase('explorer', async () => {await sweepExplorer(activeBrowser, url, route, evidence, true); return {route, rendered: true};});
|
|
162
162
|
} catch (error) {
|
|
163
|
-
if (!result.phases.some(row => row.name === 'boot')) result.phases.push({name: 'boot', ok: false, error: String(error).slice(0, 4000)});
|
|
163
|
+
if (!result.phases.some(row => row.name === 'boot')) result.phases.push({name: 'boot', ok: false, error: (error instanceof Error ? error.stack ?? String(error) : String(error)).slice(0, 4000)});
|
|
164
164
|
checkpoint();
|
|
165
165
|
} finally {
|
|
166
166
|
await browser?.close().catch(retirementFailed);
|
package/scripts/nightly-model.ts
CHANGED
|
@@ -9,15 +9,17 @@ export interface Phase {name: string; ok: boolean; error?: string; ms?: number;
|
|
|
9
9
|
export interface HeadResult extends Head {phases: Phase[]}
|
|
10
10
|
export interface HeadsReport extends Plan {kind: 'heads'; browser: string; group: number; results: HeadResult[]}
|
|
11
11
|
export interface TestFile {path: string; ok: boolean; assertions: number; skipped: number}
|
|
12
|
-
export interface TestsReport extends Plan {kind: 'tests'; exitCode: number; kitExitCode: number; totalTests: number; files: TestFile[]}
|
|
12
|
+
export interface TestsReport extends Plan {kind: 'tests'; group: number; groups: number; exitCode: number; kitExitCode: number; totalTests: number; files: TestFile[]}
|
|
13
13
|
export type Receipt = HeadsReport | TestsReport;
|
|
14
14
|
export interface Failure {key: string; error: string}
|
|
15
15
|
export interface Row extends Head {browser: string; phase: string; ok: boolean; error?: string}
|
|
16
16
|
export interface Verdict {version: number; sha: string; pins: string; testList: string; ok: boolean; tag: string; rows: Row[]; failures: Failure[];
|
|
17
|
+
tests: {group: number; ok: boolean; files: number; assertions: number}[];
|
|
17
18
|
run?: string | null; baseline: {sha: string; run: string | null} | null; newFailures: string[]; resolved: string[]}
|
|
18
19
|
export const browsers = ['chromium', 'webkit'];
|
|
19
20
|
export const phases = ['cook', 'boot', 'hover', 'draw', 'explorer'];
|
|
20
21
|
export const groups = 4;
|
|
22
|
+
export const testGroups = 2;
|
|
21
23
|
export const digest = (value: unknown): string => createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
22
24
|
export const read = (path: string): unknown => JSON.parse(readFileSync(path, 'utf8'));
|
|
23
25
|
|
|
@@ -30,7 +32,7 @@ export function plan(root = process.cwd()): Plan {
|
|
|
30
32
|
if (shards.some(row => !/^[a-z0-9-]+$/u.test(row.slug) || !/^[a-f0-9]{64}$/u.test(row.hash))) throw new Error('Unsafe pinned head');
|
|
31
33
|
if (tests.length === 0 || new Set(tests).size !== tests.length) throw new Error('Empty or duplicate Ring 2 list');
|
|
32
34
|
const heads = [...shards].sort((a, b) => a.slug.localeCompare(b.slug));
|
|
33
|
-
return {version:
|
|
35
|
+
return {version: 2, sha: execFileSync('git', ['rev-parse', 'HEAD'], {cwd: root, encoding: 'utf8'}).trim(),
|
|
34
36
|
pins: digest(shards), testList: digest(tests), heads, tests};
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -61,23 +63,31 @@ export function verdict(expected: Plan, reports: Receipt[], previous?: Verdict,
|
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
const suites = reports.filter((row): row is TestsReport => row.version === expected.version && row.kind === 'tests' && row.sha === expected.sha && row.pins === expected.pins && row.testList === expected.testList);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (suites.length !== testGroups || suites.some(suite => suite.groups !== testGroups || !Number.isInteger(suite.group) || suite.group < 0 || suite.group >= testGroups)) failures.push({key: 'shared/tests', error: `Expected exactly ${testGroups} suite partitions, got ${suites.length}`});
|
|
67
|
+
const tests: Verdict['tests'] = [];
|
|
68
|
+
for (let group = 0; group < testGroups; group++) {
|
|
69
|
+
const matching = suites.filter(suite => suite.group === group), suite = matching[0];
|
|
70
|
+
const assertions = suite?.files.reduce((sum, file) => sum + file.assertions, 0) ?? 0;
|
|
71
|
+
tests.push({group, ok: matching.length === 1 && suite?.groups === testGroups && suite.exitCode === 0 && suite.kitExitCode === 0 && suite.totalTests > 0 && assertions > 0 && suite.files.length > 0 && suite.files.every(file => file.ok), files: suite?.files.length ?? 0, assertions});
|
|
72
|
+
if (matching.length !== 1 || suite === undefined) failures.push({key: `shared/tests/${group}`, error: `Expected one partition receipt, got ${matching.length}`});
|
|
73
|
+
else if (suite.exitCode !== 0 || suite.kitExitCode !== 0 || suite.totalTests < 1 || suite.files.length === 0 || assertions < 1) failures.push({key: `shared/tests/${group}`, error: `Vitest exit ${suite.exitCode}, kit exit ${suite.kitExitCode}, ${suite.totalTests} tests, ${assertions} passing assertions`});
|
|
74
|
+
}
|
|
75
|
+
const files = suites.flatMap(suite => suite.files);
|
|
76
|
+
if (new Set(files.map(file => file.path)).size !== files.length) failures.push({key: 'shared/tests/duplicates', error: 'A test file appeared in more than one suite partition'});
|
|
77
|
+
if (suites.length > 0) {
|
|
68
78
|
for (const path of expected.tests) {
|
|
69
|
-
const executions =
|
|
79
|
+
const executions = files.filter(row => row.path === path);
|
|
70
80
|
const [run] = executions;
|
|
71
81
|
if (executions.length !== 1 || run === undefined || !run.ok || run.assertions < 1 || run.skipped !== 0) failures.push({key: `shared/${path}`, error: 'Listed test missing, skipped or failed'});
|
|
72
82
|
}
|
|
73
|
-
for (const file of
|
|
83
|
+
for (const file of files.filter(row => !row.ok)) {
|
|
74
84
|
if (!failures.some(row => row.key === `shared/${file.path}`)) failures.push({key: `shared/${file.path}`, error: 'Suite failure outside the slow-test list'});
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
|
-
const baseline = previous?.version === 1 && Array.isArray(previous.failures) ? previous : undefined;
|
|
87
|
+
const baseline = (previous?.version === 1 || previous?.version === 2) && Array.isArray(previous.failures) ? previous : undefined;
|
|
78
88
|
const old = new Set(baseline?.failures.map(row => row.key)), current = new Set(failures.map(row => row.key));
|
|
79
|
-
return {version:
|
|
80
|
-
ok: failures.length === 0, tag: failures.length === 0 ? 'eligible' : 'HOLD', rows, failures,
|
|
89
|
+
return {version: expected.version, sha: expected.sha, pins: expected.pins, testList: expected.testList,
|
|
90
|
+
ok: failures.length === 0, tag: failures.length === 0 ? 'eligible' : 'HOLD', rows, tests, failures,
|
|
81
91
|
baseline: baseline === undefined ? null : {sha: baseline.sha, run: baseline.run ?? null},
|
|
82
92
|
newFailures: failures.filter(row => !old.has(row.key)).map(row => row.key),
|
|
83
93
|
resolved: [...old].filter(key => !current.has(key))};
|
|
@@ -93,6 +103,8 @@ export function markdown(report: Verdict): string {
|
|
|
93
103
|
const rows = report.rows.filter(row => row.browser === browser && row.slug === slug);
|
|
94
104
|
lines.push(`| ${slug} @ ${rows[0]?.hash.slice(0, 12)} | ${browser} | ${phases.map(phase => rows.find(row => row.phase === phase)?.ok ? 'pass' : '**RED**').join(' | ')} |`);
|
|
95
105
|
}
|
|
106
|
+
lines.push('', '## Shared suite', '', '| Partition | Files | Passing assertions | Verdict |', '| --- | --- | --- | --- |',
|
|
107
|
+
...report.tests.map(suite => `| ${suite.group + 1}/${testGroups} | ${suite.files} | ${suite.assertions} | ${suite.ok ? 'pass' : '**RED**'} |`));
|
|
96
108
|
lines.push('', '## Failures', '');
|
|
97
109
|
if (report.failures.length === 0) lines.push('None.');
|
|
98
110
|
for (const failure of report.failures) lines.push(`- ${report.newFailures.includes(failure.key) ? 'NEW' : 'existing'} \`${failure.key}\`: ${failure.error.replaceAll(/[\r\n|<>]/gu, ' ').slice(0, 1500)}`);
|
|
@@ -103,9 +115,11 @@ export function markdown(report: Verdict): string {
|
|
|
103
115
|
export function requireGreen(report: Verdict, expected: Plan): void {
|
|
104
116
|
const keys = expected.heads.flatMap(head => browsers.flatMap(browser => phases.map(phase => `${browser}/${head.slug}@${head.hash}/${phase}`)));
|
|
105
117
|
const actual = report.rows?.map(row => `${row.browser}/${row.slug}@${row.hash}/${row.phase}`) ?? [];
|
|
118
|
+
const suites = report.tests ?? [];
|
|
106
119
|
if (report.version !== expected.version || !report.ok || report.tag !== 'eligible' || report.sha !== expected.sha || report.pins !== expected.pins || report.testList !== expected.testList ||
|
|
107
120
|
!Array.isArray(report.failures) || report.failures.length > 0 || actual.length !== keys.length || new Set(actual).size !== keys.length ||
|
|
108
|
-
keys.some(key => !actual.includes(key)) || report.rows.some(row => !row.ok)
|
|
121
|
+
keys.some(key => !actual.includes(key)) || report.rows.some(row => !row.ok) || suites.length !== testGroups ||
|
|
122
|
+
new Set(suites.map(suite => suite.group)).size !== testGroups || suites.some(suite => !Number.isInteger(suite.group) || suite.group < 0 || suite.group >= testGroups || !suite.ok || suite.files < 1 || suite.assertions < 1)) {
|
|
109
123
|
throw new Error('J167: complete green nightly for this exact commit and pins required; tag held');
|
|
110
124
|
}
|
|
111
125
|
}
|
package/scripts/nightly.proof.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {join, resolve} from 'node:path';
|
|
|
7
7
|
import {browsers, partition, phases, plan, read, requireBuild, requireGreen, requireLatest, type HeadsReport, type Plan, type TestsReport, type Verdict} from './nightly-model.ts';
|
|
8
8
|
|
|
9
9
|
interface Execution {status: number | null; report: Verdict; summary: string}
|
|
10
|
-
interface Fixture {root: string; heads: HeadsReport[]; suite: TestsReport; expected: Plan;
|
|
10
|
+
interface Fixture {root: string; heads: HeadsReport[]; suite: TestsReport; suites: TestsReport[]; expected: Plan;
|
|
11
11
|
execute: (baseline?: string, env?: NodeJS.ProcessEnv) => Execution; write: (path: string, value: unknown) => void}
|
|
12
12
|
|
|
13
13
|
const cli = resolve('scripts/nightly.ts'), tagger = resolve('scripts/nightly-tag.mjs');
|
|
@@ -23,19 +23,23 @@ function fixture(run: (context: Fixture) => void): void {
|
|
|
23
23
|
const expected = plan(root);
|
|
24
24
|
const heads: HeadsReport[] = browsers.flatMap(browser => Array.from({length: 4}, (_, group) => ({...expected, kind: 'heads' as const, browser, group,
|
|
25
25
|
results: partition(expected.heads, group).map(head => ({slug: head.slug, hash: head.hash, phases: phases.map(name => ({name, ok: true}))}))})));
|
|
26
|
-
const suite: TestsReport = {...expected, kind: 'tests', exitCode: 0, kitExitCode: 0, totalTests: 1, files: [{path: 'test/journey.test.ts', ok: true, assertions: 1, skipped: 0}]};
|
|
26
|
+
const suite: TestsReport = {...expected, kind: 'tests', group: 0, groups: 2, exitCode: 0, kitExitCode: 0, totalTests: 1, files: [{path: 'test/journey.test.ts', ok: true, assertions: 1, skipped: 0}]};
|
|
27
|
+
const suites: TestsReport[] = [suite, {...suite, group: 1, files: [{path: 'test/ordinary.test.ts', ok: true, assertions: 1, skipped: 0}]}];
|
|
27
28
|
const execute = (baseline?: string, env: NodeJS.ProcessEnv = {}): Execution => {
|
|
29
|
+
rmSync(join(root, 'reports'), {recursive: true, force: true});
|
|
28
30
|
for (const report of heads) write(`reports/heads-${report.browser}-${report.group}.json`, report);
|
|
29
|
-
write(
|
|
31
|
+
for (const [index, report] of suites.entries()) write(`reports/tests-${index}.json`, report);
|
|
30
32
|
const child = spawnSync(process.execPath, [cli, 'report', join(root, 'reports'), ...(baseline === undefined ? [] : [baseline])], {cwd: root, encoding: 'utf8', env: {...process.env, ...env}});
|
|
31
33
|
return {status: child.status, report: read(join(root, 'reports/verdict.json')) as Verdict, summary: readFileSync(join(root, 'reports/summary.md'), 'utf8')};
|
|
32
34
|
};
|
|
33
|
-
run({root, heads, suite, expected, execute, write});
|
|
35
|
+
run({root, heads, suite, suites, expected, execute, write});
|
|
34
36
|
} finally {rmSync(root, {recursive: true, force: true});}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
await test('complete real report files admit the exact commit, but never another commit or repeated row', () => fixture(({expected, execute}) => {
|
|
38
40
|
const result = execute(); assert.equal(result.status, 0); requireGreen(result.report, expected);
|
|
41
|
+
assert.throws(() => requireGreen({...result.report, version: 1}, expected), /J167/u);
|
|
42
|
+
assert.throws(() => requireGreen({...result.report, tests: result.report.tests.slice(0, 1)}, expected), /J167/u);
|
|
39
43
|
requireBuild(`${expected.sha.slice(0, 7)}-proof`, expected);
|
|
40
44
|
assert.throws(() => requireBuild('0000000-stale', expected), /stale/u);
|
|
41
45
|
assert.throws(() => requireGreen(result.report, {...expected, sha: 'wrong'}), /J167/u);
|
|
@@ -64,6 +68,15 @@ await test('ordinary suite skips retain existing policy while listed journeys mu
|
|
|
64
68
|
suite.files.push({path: 'test/ordinary-platform.test.ts', ok: true, assertions: 0, skipped: 1});
|
|
65
69
|
assert.equal(execute().status, 0);
|
|
66
70
|
}));
|
|
71
|
+
await test('missing, duplicate, malformed or overlapping suite partitions hold an otherwise green night', () => {
|
|
72
|
+
const mutations: ((suites: TestsReport[]) => void)[] = [suites => {suites.pop();}, suites => {suites[1].group = 0;}, suites => {suites[1].groups = 1;}, suites => {suites[1].files = [...suites[0].files];}, suites => {suites[1].files = [];}];
|
|
73
|
+
for (const mutate of mutations) fixture(({suites, execute, expected}) => {
|
|
74
|
+
mutate(suites);
|
|
75
|
+
const result = execute();
|
|
76
|
+
assert.equal(result.status, 1);
|
|
77
|
+
assert.throws(() => requireGreen(result.report, expected), /J167/u);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
67
80
|
await test('an empty artifact directory never produces green', () => fixture(({root}) => {
|
|
68
81
|
mkdirSync(join(root, 'empty'));
|
|
69
82
|
const result = spawnSync(process.execPath, [cli, 'report', join(root, 'empty')], {cwd: root, encoding: 'utf8'});
|
|
@@ -77,7 +90,7 @@ await test('a failed Actions job holds the tag even if every uploaded phase pass
|
|
|
77
90
|
}));
|
|
78
91
|
await test('prior nightly failures are compared by head hash, browser and phase', () => fixture(({heads, execute, root, write}) => {
|
|
79
92
|
heads[0].results[0].phases[0].ok = false;
|
|
80
|
-
const first = execute(); write('previous.json', first.report);
|
|
93
|
+
const first = execute(); write('previous.json', {...first.report, version: 1});
|
|
81
94
|
heads[0].results[0].phases[0].ok = true; heads[1].results[0].phases[1].ok = false;
|
|
82
95
|
const next = execute(join(root, 'previous.json'));
|
|
83
96
|
assert.equal(next.report.resolved.length, 1); assert.equal(next.report.newFailures.length, 1);
|
package/scripts/nightly.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {spawnSync} from 'node:child_process';
|
|
3
3
|
import {existsSync, mkdirSync, readdirSync, writeFileSync} from 'node:fs';
|
|
4
4
|
import {join, relative, resolve} from 'node:path';
|
|
5
|
-
import {browsers, groups, markdown, partition, plan, read, requirePublishedGreen, verdict, type Receipt, type TestsReport, type Verdict} from './nightly-model.ts';
|
|
5
|
+
import {browsers, groups, markdown, partition, plan, read, requirePublishedGreen, testGroups, verdict, type Receipt, type TestsReport, type Verdict} from './nightly-model.ts';
|
|
6
6
|
|
|
7
7
|
interface VitestResult {numTotalTests?: number; testResults?: {name: string; status: string; assertionResults?: {status: string}[]}[]}
|
|
8
8
|
|
|
@@ -13,24 +13,29 @@ if (command === 'plan') {
|
|
|
13
13
|
console.log(JSON.stringify({include: browsers.flatMap(browser => Array.from({length: groups}, (_, group) => ({browser, group,
|
|
14
14
|
os: browser === 'webkit' ? 'macos-15' : 'ubuntu-24.04', heads: partition(expected.heads, group).map(row => row.slug).join(',')})))}));
|
|
15
15
|
} else if (command === 'tests') {
|
|
16
|
+
const group = Number(process.env.NIGHTLY_TEST_GROUP ?? '-1');
|
|
17
|
+
if (!Number.isInteger(group) || group < 0 || group >= testGroups) throw new Error('Set NIGHTLY_TEST_GROUP to 0 or 1; the verdict requires both suite partitions');
|
|
16
18
|
mkdirSync(out, {recursive: true});
|
|
17
|
-
const json = join(out,
|
|
19
|
+
const json = join(out, `vitest-${group}.json`);
|
|
18
20
|
const kit = spawnSync('pnpm', ['test:kit'], {stdio: 'inherit', timeout: 120000});
|
|
19
|
-
//
|
|
21
|
+
// The two jobs cover the entire admitted suite once, including every slow
|
|
22
|
+
// Ring 2 entry. Keep each job's existing 25-minute process limit.
|
|
20
23
|
const child = spawnSync('python3', ['scripts/heavy-lane.py', 'full-test', '--', process.execPath, 'scripts/vitest-tmp.ts', 'run',
|
|
21
|
-
'--maxWorkers=2', '--reporter=default', '--reporter=json', `--outputFile.json=${json}`],
|
|
24
|
+
'--maxWorkers=2', `--shard=${group + 1}/${testGroups}`, '--reporter=default', '--reporter=json', `--outputFile.json=${json}`],
|
|
22
25
|
{stdio: 'inherit', timeout: 1500000, env: {...process.env, WS_FULL_SUITE: '1', WILDSHARD_RING: '2'}});
|
|
23
26
|
const raw: VitestResult = existsSync(json) ? (read(json) as VitestResult) : {};
|
|
24
27
|
const files = (raw.testResults ?? []).map(file => ({path: relative(process.cwd(), file.name).replaceAll('\\', '/'),
|
|
25
28
|
ok: file.status !== 'failed' && file.assertionResults?.every(row => row.status !== 'failed') === true,
|
|
26
29
|
assertions: file.assertionResults?.filter(row => row.status === 'passed').length ?? 0,
|
|
27
30
|
skipped: file.assertionResults?.filter(row => row.status !== 'passed' && row.status !== 'failed').length ?? 0}));
|
|
28
|
-
const report: TestsReport = {...expected, kind: 'tests', exitCode: child.status ?? 1, kitExitCode: kit.status ?? 1, totalTests: raw.numTotalTests ?? 0, files};
|
|
29
|
-
write(
|
|
30
|
-
|
|
31
|
+
const report: TestsReport = {...expected, kind: 'tests', group, groups: testGroups, exitCode: child.status ?? 1, kitExitCode: kit.status ?? 1, totalTests: raw.numTotalTests ?? 0, files};
|
|
32
|
+
write(`tests-${group}.json`, report);
|
|
33
|
+
// Listed journeys in either partition are checked together by report;
|
|
34
|
+
// a partition must still fail for any ordinary or listed test failure.
|
|
35
|
+
if (report.exitCode !== 0 || report.kitExitCode !== 0 || report.totalTests < 1 || files.some(file => !file.ok)) process.exitCode = 1;
|
|
31
36
|
} else if (command === 'report') {
|
|
32
37
|
mkdirSync(out, {recursive: true});
|
|
33
|
-
const receipts = readdirSync(out).filter(name => /^(heads-|tests
|
|
38
|
+
const receipts = readdirSync(out).filter(name => /^(heads-|tests[-.])/u.test(name) && name.endsWith('.json')).map(name => (read(join(out, name)) as Receipt));
|
|
34
39
|
const jobs = {plan: process.env.NIGHTLY_PLAN_RESULT, tests: process.env.NIGHTLY_TESTS_RESULT, heads: process.env.NIGHTLY_HEADS_RESULT};
|
|
35
40
|
const report = {...verdict(expected, receipts, baseline !== undefined && existsSync(baseline) ? (read(baseline) as Verdict) : undefined, jobs), run: process.env.GITHUB_RUN_ID ?? null};
|
|
36
41
|
write('verdict.json', report);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// EG-16 (meta docs/plans/test-coverage/ENGINE.md, TEST-COVERAGE row 32): the `--no-astc` boot. A phone with no ASTC draws (BUG-9).
|
|
3
|
+
// Chromium at the phone tier (an iPhone profile), with WEBGL_compressed_texture_astc hidden as capture.mjs --no-astc hides it (S4),
|
|
4
|
+
// enters a head with a phone set by its own URL and holds:
|
|
5
|
+
// hidden textures load as images, the reason names the raw-ASTC veto (src/client/engine/boot/gpuFiles.ts `rawAstcVeto`), no raw
|
|
6
|
+
// ASTC 6x6 file is read, the world is entered with frames running, the frame isn't black, and nothing fatal shows;
|
|
7
|
+
// shown the control: the same page with ASTC reads raw ASTC files, so the hidden pass proves a choice, not an empty table.
|
|
8
|
+
// BUG-9's fault, planted at the source (`rawAstcVeto` returning null), turns the hidden pass red: the page reads Pine's raw ASTC
|
|
9
|
+
// phone set on a GPU that can't sample it. A harness texture pin is no plant: the veto overrules a pin too.
|
|
10
|
+
// scripts/browser-lane.sh node scripts/no-astc-boot.mjs --base=http://127.0.0.1:4401/ [--slug=pine-hollow] [--out=tmp/no-astc]
|
|
11
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { chromium, devices } from 'playwright';
|
|
14
|
+
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
15
|
+
import { frameFailure, screenshotPixels } from './parity/black-frame.mjs';
|
|
16
|
+
|
|
17
|
+
/** @param {string} key @param {string} fallback */
|
|
18
|
+
const arg = (key, fallback) => process.argv.find(value => value.startsWith(`--${key}=`))?.slice(key.length + 3) ?? fallback;
|
|
19
|
+
const base = arg('base', ''), slug = arg('slug', 'pine-hollow'), out = arg('out', 'tmp/no-astc');
|
|
20
|
+
if (!/^http:\/\/(127\.0\.0\.1|localhost)(:\d+)?\/$/u.test(base)) throw new Error('Requires --base=<a local served build>/ (scripts/serve-build.sh)');
|
|
21
|
+
/** The cook's raw ASTC 6x6 files and the hand-made overlays (gpuFiles.ts RAW_ASTC). */
|
|
22
|
+
const RAW_ASTC = /\/astc6\/|\.t[0-9]+-[a-f0-9]{8}\.(?:ktx2|glb)$/u;
|
|
23
|
+
const hideAstc = () => {
|
|
24
|
+
const ext = 'WEBGL_compressed_texture_astc';
|
|
25
|
+
for (const gl of [WebGLRenderingContext, WebGL2RenderingContext]) {
|
|
26
|
+
const proto = gl.prototype, realExtension = Reflect.get(proto, 'getExtension'), realList = Reflect.get(proto, 'getSupportedExtensions');
|
|
27
|
+
proto.getExtension = function getExtension(name) { return name === ext ? null : Reflect.apply(realExtension, this, [name]); };
|
|
28
|
+
proto.getSupportedExtensions = function getSupportedExtensions() { return Reflect.apply(realList, this, [])?.filter(name => name !== ext) ?? null; };
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const angle = process.platform === 'darwin' ? 'metal' : 'swiftshader';
|
|
32
|
+
const browser = await chromium.launch({ args: [...KEYCHAIN_ARGS, '--mute-audio', '--ignore-gpu-blocklist', `--use-angle=${angle}`] });
|
|
33
|
+
const { defaultBrowserType: _engine, ...phone } = devices['iPhone 16 Pro'];
|
|
34
|
+
|
|
35
|
+
/** One boot of `slug` on a fresh phone; what it chose, read and drew. @param {boolean} astc */
|
|
36
|
+
async function boot(astc) {
|
|
37
|
+
const context = await browser.newContext(phone), page = await context.newPage();
|
|
38
|
+
/** @type {string[]} */ const raw = [];
|
|
39
|
+
/** @type {string[]} */ const fatal = [];
|
|
40
|
+
if (!astc) await context.addInitScript(hideAstc);
|
|
41
|
+
page.on('response', response => { const path = new URL(response.url()).pathname; if (RAW_ASTC.test(path)) raw.push(path); });
|
|
42
|
+
page.on('pageerror', error => { fatal.push(error.message.slice(0, 300)); });
|
|
43
|
+
page.on('console', line => { if (line.type() === 'error' || /\brefused\b/iu.test(line.text())) fatal.push(line.text().slice(0, 300)); });
|
|
44
|
+
try {
|
|
45
|
+
await page.goto(new URL(`?chunk=${slug}&skipintro&mute=1&nolock=1`, base).href, { waitUntil: 'load' });
|
|
46
|
+
const play = setInterval(() => { void page.locator('.ws-load-play').click({ timeout: 500 }).catch(() => undefined); }, 1000);
|
|
47
|
+
const entered = await page.waitForFunction(() => window.__wildshard?.world?.hud?.entered === true && document.querySelector('.ws-load') === null && window.__wildshard.world.game.frameGate(), undefined, { timeout: 180_000 })
|
|
48
|
+
.then(() => true, () => false);
|
|
49
|
+
clearInterval(play);
|
|
50
|
+
await page.waitForTimeout(4000);
|
|
51
|
+
const seen = await page.evaluate(() => {
|
|
52
|
+
const api = window.__wildshard, gl = document.createElement('canvas').getContext('webgl2');
|
|
53
|
+
return { textures: api?.textures?.() ?? null, astc: gl?.getExtension('WEBGL_compressed_texture_astc') !== null,
|
|
54
|
+
errors: [...document.querySelectorAll('#wserr,.ws-load-error,.ws-game-dev-alert,[data-boot-fatal]')].map(node => (node.textContent ?? '').slice(0, 200)) };
|
|
55
|
+
});
|
|
56
|
+
const shot = await page.screenshot();
|
|
57
|
+
mkdirSync(out, { recursive: true }); writeFileSync(join(out, `${slug}-${astc ? 'astc' : 'no-astc'}.png`), shot);
|
|
58
|
+
const pixels = await page.evaluate(screenshotPixels, Array.from(shot));
|
|
59
|
+
return { entered, ...seen, raw: raw.length, rawSample: raw.slice(0, 3), black: frameFailure(pixels), darkShare: Math.round(pixels.darkShare * 100) / 100, fatal: [...new Set([...fatal, ...seen.errors])].slice(0, 6) };
|
|
60
|
+
} finally { await context.close(); }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @type {string[]} */ const failures = [];
|
|
64
|
+
const hidden = await boot(false), shown = await boot(true);
|
|
65
|
+
await browser.close();
|
|
66
|
+
/** @param {boolean} ok @param {string} what */
|
|
67
|
+
const check = (ok, what) => { if (!ok) failures.push(what); };
|
|
68
|
+
check(!hidden.astc && shown.astc, 'the extension was not hidden on one page and shown on the other');
|
|
69
|
+
check(hidden.entered, 'no-ASTC: the world never opened');
|
|
70
|
+
check(hidden.textures?.mode === 'img' && /overruled: .*no ASTC/u.test(hidden.textures.why), `no-ASTC: textures are ${JSON.stringify(hidden.textures)}, not images by the raw-ASTC veto`);
|
|
71
|
+
check(hidden.raw === 0, `no-ASTC: read ${hidden.raw} raw ASTC files (${hidden.rawSample.join(', ')})`);
|
|
72
|
+
check(hidden.black === null, `no-ASTC: ${hidden.black}`);
|
|
73
|
+
check(hidden.fatal.length === 0, `no-ASTC: ${hidden.fatal.join(' | ')}`);
|
|
74
|
+
check(shown.entered && shown.raw > 0, `control: with ASTC the page read ${shown.raw} raw ASTC files, so ${slug} has no phone set to choose against`);
|
|
75
|
+
console.log(JSON.stringify({ test: 'no-astc-boot', slug, hidden, shown }, null, 1));
|
|
76
|
+
console.log(failures.length === 0 ? `no-astc-boot green: ${slug} draws on a phone with no ASTC` : `no-astc-boot RED:\n${failures.map(line => ` ${line}`).join('\n')}`);
|
|
77
|
+
process.exit(failures.length === 0 ? 0 : 1);
|
package/scripts/online-rig.mjs
CHANGED
|
@@ -46,12 +46,12 @@ export async function intoWorld(page) {
|
|
|
46
46
|
|
|
47
47
|
/** `pgBin` 'memory:' keeps the saves in the server's memory, for a proof that never reads them back (voice-proof.mjs): no Postgres.
|
|
48
48
|
* `more` are other shards the release names, `cells` the server's `WORLD_CELLS` (default `shard`), and `socket` the address the
|
|
49
|
-
* release names when a proof puts its own front door before the server (grid-gate-proof.mjs).
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param {{ dist: string, nextDist?: string, work: string, keyFile: string, pgBin: string, pgData: string, shard?: string, seats?: number, more?: string[], cells?: string, socket?: string,
|
|
54
|
-
export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgData, shard = 'driftwood-isle', seats, more = [], cells = shard, socket = `ws://127.0.0.1:${String(WORLD_PORT)}/`,
|
|
49
|
+
* release names when a proof puts its own front door before the server (grid-gate-proof.mjs). Every rig has the road;
|
|
50
|
+
* J353 removed the continuous-crossing switch. `workers` sets `WORLD_WORKERS` (the rig's release is production's,
|
|
51
|
+
* 4 by default; staging runs 2). FM3: `origins` are loopback page origins the server also lets in, and `channel`
|
|
52
|
+
* is the release file's channel (`production`).
|
|
53
|
+
* @param {{ dist: string, nextDist?: string, work: string, keyFile: string, pgBin: string, pgData: string, shard?: string, seats?: number, more?: string[], cells?: string, socket?: string, workers?: number, origins?: string[], channel?: string }} options */
|
|
54
|
+
export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgData, shard = 'driftwood-isle', seats, more = [], cells = shard, socket = `ws://127.0.0.1:${String(WORLD_PORT)}/`, workers, origins = [], channel = 'production' }) {
|
|
55
55
|
if (origins.some(origin => new URL(origin).origin !== origin || new URL(origin).hostname !== '127.0.0.1')) throw new Error('A rig lets in loopback page origins only');
|
|
56
56
|
const memory = pgBin === 'memory:';
|
|
57
57
|
const key = JSON.parse(readFileSync(keyFile, 'utf8')), build = buildOf(dist), nextBuild = nextDist === '' ? '' : buildOf(nextDist), DATABASE = memory ? 'memory:' : database('saves_online');
|
|
@@ -83,7 +83,7 @@ export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgDat
|
|
|
83
83
|
|
|
84
84
|
const world = (running = build) => {
|
|
85
85
|
const room = spawn(process.execPath, [join(server, 'main.mjs')], { cwd: ROOT, stdio: ['ignore', 'pipe', 'pipe'],
|
|
86
|
-
env: { ...process.env, RELEASE_URL: `http://127.0.0.1:${String(RELEASE_PORT)}/release.json`, RELEASE_PUBLIC_KEY: key.public, PACK_ORIGIN: `file://${origin}/`, PACK_CACHE: join(work, 'packs'), DATABASE_URL: DATABASE, SEAT_SECRET: 'online-proof', HOST: '127.0.0.1', PORT: String(WORLD_PORT), ALLOWED_ORIGINS: [`http://127.0.0.1:${String(PAGE_PORT)}`, ...origins].join(','), WILDSHARD_BUILD: running, WORLD_CELLS: cells, RELEASE_POLL_MS: '500', GRACE_MS: '6000', ...seats === undefined ? {} : { WORLD_SEATS: String(seats) },
|
|
86
|
+
env: { ...process.env, RELEASE_URL: `http://127.0.0.1:${String(RELEASE_PORT)}/release.json`, RELEASE_PUBLIC_KEY: key.public, PACK_ORIGIN: `file://${origin}/`, PACK_CACHE: join(work, 'packs'), DATABASE_URL: DATABASE, SEAT_SECRET: 'online-proof', HOST: '127.0.0.1', PORT: String(WORLD_PORT), ALLOWED_ORIGINS: [`http://127.0.0.1:${String(PAGE_PORT)}`, ...origins].join(','), WILDSHARD_BUILD: running, WORLD_CELLS: cells, RELEASE_POLL_MS: '500', GRACE_MS: '6000', ...seats === undefined ? {} : { WORLD_SEATS: String(seats) }, ...workers === undefined ? {} : { WORLD_WORKERS: String(workers) } } });
|
|
87
87
|
room.stdout.pipe(log, { end: false }); room.stderr.pipe(log, { end: false });
|
|
88
88
|
return room;
|
|
89
89
|
};
|
|
@@ -273,7 +273,7 @@ export function bootRoadCompletionState() {
|
|
|
273
273
|
return {at, timeOrigin: performance.timeOrigin, stop: stop ?? null,
|
|
274
274
|
compact: compact === null ? null : {inside: field(compact, 'inside'), current: field(live, 'current'), ready: field(live, 'gameplayReady'),
|
|
275
275
|
pendingCount: Array.isArray(pending) ? pending.length : null, phase: field(crossing, 'phase')},
|
|
276
|
-
observer: ids === null ? null : {present: ids.
|
|
276
|
+
observer: ids === null ? null : {present: ids.some((id) => id.startsWith('harness.walk')), systems: ids.length},
|
|
277
277
|
owner: scope === undefined ? null : {name: scope.name, disposed: scope.disposed, disposing: scope.disposing},
|
|
278
278
|
view: {coverage: ui?.presentation, still: ui?.still, blocking: ui?.blocking, top: ui?.top,
|
|
279
279
|
visibility: typeof document === 'undefined' ? null : document.visibilityState,
|
|
@@ -3093,10 +3093,10 @@
|
|
|
3093
3093
|
}
|
|
3094
3094
|
],
|
|
3095
3095
|
"timeout": 40,
|
|
3096
|
-
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev
|
|
3096
|
+
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev 6 pinned). Legs follow shardfile src/tools/brasscap/canyon.ts ROUTES; each ends at its camp's edge (the camp's tent stands on the route's end) and none crosses the gate, which is shut until the camps fall."
|
|
3097
3097
|
},
|
|
3098
3098
|
{
|
|
3099
|
-
"name": "canyon branch to the ledge
|
|
3099
|
+
"name": "canyon branch to the ledge ladder",
|
|
3100
3100
|
"start": {
|
|
3101
3101
|
"x": -2,
|
|
3102
3102
|
"z": -22,
|
|
@@ -3108,12 +3108,12 @@
|
|
|
3108
3108
|
"z": -25.8
|
|
3109
3109
|
},
|
|
3110
3110
|
{
|
|
3111
|
-
"x":
|
|
3112
|
-
"z": -
|
|
3111
|
+
"x": 8.4,
|
|
3112
|
+
"z": -28.4
|
|
3113
3113
|
}
|
|
3114
3114
|
],
|
|
3115
3115
|
"timeout": 30,
|
|
3116
|
-
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev
|
|
3116
|
+
"notes": "Rev 6 (shard-brasscap edbd9bb, TEMPLATE-E2E; camps as rev 5): camp 2's ledge is a 6.5 m block (x 10 to 26, z -43 to -25) reached by a ladder on its west face at (9.55, -28.4); the leg ends at the ladder's foot. BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev 6 pinned). Legs follow shardfile src/tools/brasscap/canyon.ts ROUTES; each ends at its camp's edge (the camp's tent stands on the route's end) and none crosses the gate, which is shut until the camps fall."
|
|
3117
3117
|
},
|
|
3118
3118
|
{
|
|
3119
3119
|
"name": "side canyon into camp 3",
|
|
@@ -3145,7 +3145,7 @@
|
|
|
3145
3145
|
}
|
|
3146
3146
|
],
|
|
3147
3147
|
"timeout": 40,
|
|
3148
|
-
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev
|
|
3148
|
+
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev 6 pinned). Legs follow shardfile src/tools/brasscap/canyon.ts ROUTES; each ends at its camp's edge (the camp's tent stands on the route's end) and none crosses the gate, which is shut until the camps fall."
|
|
3149
3149
|
}
|
|
3150
3150
|
],
|
|
3151
3151
|
"open-plot-frostline-peaks": [
|
package/scripts/pins-reuse.mjs
CHANGED
|
@@ -48,6 +48,7 @@ export const KEY_EXEMPT=Object.freeze({
|
|
|
48
48
|
'scripts/renderer-revision.mjs':'names a printed preparation label only (J262); no byte under out/',
|
|
49
49
|
'src/shared/game/shardfile/ktx2Targets.ts':'hashed already: the validation revision in the key covers src/shared/game/shardfile (S11)',
|
|
50
50
|
'scripts/pins-catalogue.ts':'refresh check only (DEL9): refuses before the pins are written; no byte under out/',
|
|
51
|
+
'scripts/pins-staging.ts':'refresh/export only; selection materializes shardfiles.json already hashed in the key',
|
|
51
52
|
'scripts/server-release/served-slug.mjs':'refresh check only (DEL9): names a slug\'s served folder for the catalogue compare',
|
|
52
53
|
});
|
|
53
54
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Row 23: a reviewed staging snapshot, independent of production's live pointers.
|
|
2
|
+
import {createHash} from 'node:crypto';
|
|
3
|
+
import {mkdirSync, readFileSync, writeFileSync} from 'node:fs';
|
|
4
|
+
import {pathToFileURL} from 'node:url';
|
|
5
|
+
import {catalogueSlugs, documentSlugs, unlistedMessage, unlistedSlugs} from './pins-catalogue.ts';
|
|
6
|
+
|
|
7
|
+
interface Pin {slug: string; revision: number; hash: string; bytes: number}
|
|
8
|
+
interface Document {shards: Omit<Pin, 'bytes'>[]; missing: unknown[]; placements: {slug: string}[]; grid: {cells: {slug: string}[]}}
|
|
9
|
+
export interface StagingPins {version: 1; channel: 'staging'; api: string; catalogueHash: string; releaseHash: null; catalogue: Document; shards: Pin[]}
|
|
10
|
+
const file = 'test/pins/staging.json';
|
|
11
|
+
const json = (value: unknown): string => `${JSON.stringify(value, null, 2)}\n`;
|
|
12
|
+
const hash = (value: unknown): string => createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
13
|
+
|
|
14
|
+
export function checkStaging(value: StagingPins): void {
|
|
15
|
+
if (value.version !== 1 || value.channel !== 'staging' || value.releaseHash !== null || value.catalogueHash !== hash(value.catalogue)) throw new Error('Invalid staging snapshot identity');
|
|
16
|
+
const {catalogue, shards} = value;
|
|
17
|
+
if (!Array.isArray(catalogue.missing) || catalogue.missing.length > 0 || !Array.isArray(shards) || shards.length === 0 || new Set(shards.map(row => row.slug)).size !== shards.length) throw new Error('Incomplete staging catalogue');
|
|
18
|
+
if (shards.some(row => !/^[a-z0-9-]+$/u.test(row.slug) || !/^[a-f0-9]{64}$/u.test(row.hash) || !Number.isSafeInteger(row.revision) || row.revision < 1 || !Number.isSafeInteger(row.bytes) || row.bytes <= 0)) throw new Error('Invalid staging pin');
|
|
19
|
+
if (catalogue.shards.length !== shards.length || catalogue.shards.some(row => !shards.some(pin => pin.slug === row.slug && pin.hash === row.hash && pin.revision === row.revision))) throw new Error('Staging pins disagree with catalogue');
|
|
20
|
+
const unlisted = unlistedSlugs(catalogueSlugs(catalogue), {staging: documentSlugs(catalogue)});
|
|
21
|
+
if (unlisted.length > 0) throw new Error(unlistedMessage(unlisted));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function refreshStaging(api: string): Promise<void> {
|
|
25
|
+
const get = async (path: string): Promise<unknown> => {
|
|
26
|
+
const response = await fetch(`${api}${path}`);
|
|
27
|
+
if (!response.ok) throw new Error(`${path}: HTTP ${response.status}`);
|
|
28
|
+
return response.json();
|
|
29
|
+
};
|
|
30
|
+
const [document, listing] = await Promise.all([get('/api/catalogue.json?channel=staging'), get('/api/shardfiles')]);
|
|
31
|
+
const catalogue = document as Document;
|
|
32
|
+
const sizes = new Map((listing as {shardfiles: {hash: string; bytes: number}[]}).shardfiles.map(row => [row.hash, row.bytes]));
|
|
33
|
+
const snapshot: StagingPins = {version: 1, channel: 'staging', api, catalogueHash: hash(catalogue),
|
|
34
|
+
// AP-26 has no public release identity yet. Never call a catalogue digest a release hash.
|
|
35
|
+
releaseHash: null, catalogue, shards: catalogue.shards.map(row => ({slug: row.slug, revision: row.revision, hash: row.hash, bytes: sizes.get(row.hash) ?? 0}))};
|
|
36
|
+
checkStaging(snapshot);
|
|
37
|
+
mkdirSync('test/pins', {recursive: true});
|
|
38
|
+
writeFileSync(file, json(snapshot));
|
|
39
|
+
console.log(`Pinned ${snapshot.shards.length} staging heads; release-hash verification waits on api-server AP-26`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Materialize only in an explicitly selected test checkout; installers and both rings keep one input path. */
|
|
43
|
+
export function selectStaging(): void {
|
|
44
|
+
const snapshot = JSON.parse(readFileSync(file, 'utf8')) as StagingPins;
|
|
45
|
+
checkStaging(snapshot);
|
|
46
|
+
writeFileSync('test/pins/shardfiles.json', json({api: snapshot.api, shards: snapshot.shards}));
|
|
47
|
+
writeFileSync('test/pins/catalogue.json', json(snapshot.catalogue));
|
|
48
|
+
console.log(`Selected staging catalogue ${snapshot.catalogueHash}; release hash is unverified (AP-26)`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
52
|
+
if (process.argv[2] === 'select') selectStaging();
|
|
53
|
+
else throw new Error('Use pins.ts refresh --channel staging, or pins-staging.ts select in a disposable test checkout');
|
|
54
|
+
}
|
package/scripts/pins.ts
CHANGED
|
@@ -462,8 +462,13 @@ function status(): void {
|
|
|
462
462
|
|
|
463
463
|
const [command = 'status', ...rest] = process.argv.slice(2);
|
|
464
464
|
if (command === 'refresh') {
|
|
465
|
+
if (rest.length === 2 && rest[0] === '--channel' && rest[1] === 'staging') {
|
|
466
|
+
const {refreshStaging} = await import('./pins-staging.ts');
|
|
467
|
+
await refreshStaging(API);
|
|
468
|
+
} else {
|
|
465
469
|
if (rest.some((arg, at) => arg.startsWith('-') ? arg !== '--drop' : rest[at - 1] !== '--drop')) throw new Error('usage: pins.ts refresh [--drop slug[,slug]]...');
|
|
466
470
|
await refresh(rest.flatMap((arg, at) => rest[at - 1] === '--drop' ? arg.split(',') : []));
|
|
471
|
+
}
|
|
467
472
|
}
|
|
468
473
|
else if (command === 'install' && rest[0] === '--ring') await installRing(rest[1] ?? '1');
|
|
469
474
|
else if (command === 'install' && rest[0] === '--from-format') await install(rest.slice(1), 'format');
|
package/scripts/release-cook.mjs
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
// 1. Production's signed release must name vX.Y.Z (read from packs.wildshard.io, public; the box checks the signature).
|
|
6
6
|
// 2. If the box's wildshard-config has no `cook` verb yet, it is installed from a signed tag that carries it, by the
|
|
7
7
|
// allowlisted `wildshard-apply <tag> harden` (which refreshes /usr/local/sbin and /opt/wildshard-vps). Only after
|
|
8
|
-
// `wildshard-harden --check` shows no `fail` row, so the apply changes no sshd, ufw or Tailscale
|
|
8
|
+
// `wildshard-harden --check` shows no `fail` row outside OFF_SSH_ROWS, so the apply changes no sshd, ufw or Tailscale
|
|
9
|
+
// setting. An OFF_SSH_ROWS fail is one the apply fixes away from them (v0.1.21: SC2, Prometheus down on a root-only
|
|
10
|
+
// /etc/prometheus, fixed by the tag's harden).
|
|
9
11
|
// 3. `sudo -n wildshard-config cook vX.Y.Z`: the box verifies the tag, writes cook.settings, rebuilds the cook step alone,
|
|
10
12
|
// waits for its /health and rolls back if it does not come up. Then `show cook` and the worker's /health.
|
|
11
13
|
// --dry-run reads the box and says what it would do; it writes nothing. Output never carries an address or a secret.
|
|
@@ -16,6 +18,8 @@ const RELEASES = 'https://packs.wildshard.io/releases';
|
|
|
16
18
|
const TAG = /^v\d{1,4}\.\d{1,4}\.\d{1,4}$/u;
|
|
17
19
|
const SIGNED_TAG = /^(?:v\d{1,4}\.\d{1,4}\.\d{1,4}|server-(?:staging|production)-[0-9a-f]{40})$/u, COMMIT = /^[0-9a-f]{40}$/u;
|
|
18
20
|
const MARK = 'cook <tag>';
|
|
21
|
+
// harden --check rows whose fix never touches sshd, ufw or Tailscale: SC2 is the box-local Prometheus on loopback.
|
|
22
|
+
const OFF_SSH_ROWS = new Set(['SC2']);
|
|
19
23
|
|
|
20
24
|
/** @param {string} what @param {string} message */
|
|
21
25
|
function say(what, message) { console.info(`${what.padEnd(7)} ${redact(message)}`); }
|
|
@@ -69,7 +73,7 @@ async function main() {
|
|
|
69
73
|
const source = carries(production.build) ? production : carries(staging.build) ? staging : null;
|
|
70
74
|
if (source === null) stop('no signed release carries `wildshard-config cook` yet: it rides the next staging serial (AUTO-RELEASE AR8)');
|
|
71
75
|
const check = box('sudo -n /usr/local/sbin/wildshard-harden --check');
|
|
72
|
-
const fails = check.out.split('\n').filter(line => line.startsWith('fail'));
|
|
76
|
+
const fails = check.out.split('\n').filter(line => line.startsWith('fail') && !OFF_SSH_ROWS.has(line.split(/\s+/u)[1] ?? ''));
|
|
73
77
|
if (fails.length > 0) stop(`harden --check has ${String(fails.length)} fail row(s) (${fails.map(line => line.split(/\s+/u)[1]).join(', ')}): applying would change the box, so no auto-install`);
|
|
74
78
|
if (dry) { say('would', `install the cook verb by: sudo -n wildshard-apply ${source.tag} harden`); }
|
|
75
79
|
else {
|