@wildshard/engine 0.1.15 → 0.1.18
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 +23 -0
- package/index.html +157 -11
- package/lint/engine-sides.json +23 -0
- package/lint/host-callback-syntax.mjs +2 -1
- package/lint/host-callbacks.mjs +3 -3
- package/lint/host-files.mjs +5 -4
- package/lint/host-register.json +496 -0
- package/lint/no-base64.mjs +3 -1
- package/lint/ratchet.json +2 -2
- package/lint/shard-imports.d.mts +1 -0
- package/lint/shard-imports.mjs +60 -13
- package/lint/shard-source.d.mts +9 -0
- package/lint/shard-source.mjs +91 -0
- package/lint/shardfile-boundaries.mjs +10 -8
- package/lint/sim-closure.mjs +6 -3
- package/lint/wildshard-plugin.d.ts +4 -0
- package/lint/wildshard-plugin.js +44 -27
- package/package.json +24 -6
- package/scripts/app-build/buildIdentity.d.mts +3 -1
- package/scripts/app-build/buildIdentity.mjs +25 -5
- package/scripts/app-build/builtAt.d.mts +4 -0
- package/scripts/app-build/builtAt.mjs +21 -0
- package/scripts/app-build/outputProducts.d.mts +3 -0
- package/scripts/app-build/outputProducts.mjs +31 -0
- package/scripts/app-build/serviceWorker.ts +16 -2
- package/scripts/app-build/versionFiles.ts +2 -1
- package/scripts/app-build-pipeline.mjs +7 -1
- package/scripts/audio-download-proof.mjs +843 -0
- package/scripts/build-app.mjs +4 -0
- package/scripts/build-mirror.d.mts +2 -0
- package/scripts/build-mirror.mjs +5 -4
- package/scripts/built-product.mjs +3 -3
- package/scripts/cell-mem/metrics-preload.mjs +65 -0
- package/scripts/cell-mem-bench.mjs +130 -0
- package/scripts/check-chunks.mjs +2 -1
- package/scripts/check-devserver.mjs +1 -1
- package/scripts/chromium-keychain-check.mjs +4 -2
- package/scripts/chromium-keychain.mjs +3 -1
- package/scripts/cook.mjs +7 -3
- package/scripts/devices.d.mts +4 -0
- package/scripts/devices.mjs +39 -0
- package/scripts/devserver-client.d.mts +7 -0
- package/scripts/devserver-client.mjs +85 -0
- package/scripts/doctor-proof.mjs +1 -1
- package/scripts/e2e-faults.mjs +159 -0
- package/scripts/engine-ci-budget.ts +7 -1
- package/scripts/format-lock.mjs +20 -11
- package/scripts/generate-title-launch.mjs +3 -2
- package/scripts/grid-crossing-walk-proof.mjs +30 -11
- package/scripts/heavy-lane.py +25 -1
- package/scripts/host-ruler/register-migrate.mjs +242 -0
- package/scripts/host-ruler/register.d.mts +36 -0
- package/scripts/host-ruler/register.mjs +116 -0
- package/scripts/host-ruler/roots.d.mts +29 -0
- package/scripts/host-ruler/roots.mjs +333 -0
- package/scripts/host-ruler/server-roots.d.mts +23 -0
- package/scripts/host-ruler/server-roots.mjs +272 -0
- package/scripts/main-watch.d.mts +1 -1
- package/scripts/main-watch.mjs +10 -6
- package/scripts/map-hash.mjs +3 -6
- package/scripts/memory-proof.mjs +158 -0
- package/scripts/mmo-bots.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +5 -2
- package/scripts/offline-proof-rules.mjs +43 -6
- package/scripts/offline-proof.mjs +15 -6
- package/scripts/online-rig.mjs +4 -4
- package/scripts/page-release/flow.d.mts +1 -0
- package/scripts/page-release/flow.mjs +6 -2
- package/scripts/page-release.mjs +5 -1
- package/scripts/physics-route.json +0 -71
- package/scripts/pins-catalogue.ts +103 -0
- package/scripts/pins-reuse.mjs +3 -1
- package/scripts/pins.ts +22 -14
- package/scripts/preview-grid.ts +203 -0
- package/scripts/road-preload-proof.mjs +167 -0
- package/scripts/server-release/publish.mjs +2 -2
- package/scripts/server-release/served-slug.d.mts +2 -0
- package/scripts/server-release/served-slug.mjs +10 -0
- package/scripts/server-release/sign.d.mts +1 -0
- package/scripts/server-release/sign.mjs +3 -7
- package/scripts/shard-components.mjs +0 -2
- package/scripts/shard-outputs.d.mts +8 -0
- package/scripts/shard-outputs.mjs +45 -11
- package/scripts/side-parity.d.mts +2 -1
- package/scripts/side-parity.mjs +25 -4
- package/scripts/test-amber.d.mts +1 -0
- package/scripts/test-amber.mjs +10 -0
- package/scripts/test-products.json +3 -3
- package/scripts/tier-textures-proof.mjs +101 -0
- package/scripts/tier-textures.mjs +60 -0
- package/scripts/tracked-public.d.mts +1 -0
- package/scripts/tracked-public.mjs +17 -0
- package/scripts/tsconfig.json +1 -0
- package/scripts/vps/wildshard-config +79 -23
- package/scripts/worker-client-play.mjs +1 -0
- package/scripts/worker-client-proof.mjs +1 -1
- package/scripts/worker-client-slug.mjs +44 -0
- package/src/cli/engine.mjs +8 -0
- package/src/client/app/bootRoute.ts +4 -1
- package/src/client/app/dropModal.ts +15 -2
- package/src/client/app/entry.ts +96 -13
- package/src/client/app/slugPath.ts +5 -0
- package/src/client/engine/audio/Audio.ts +20 -2
- package/src/client/engine/boot/bakedTextures.ts +3 -2
- package/src/client/engine/boot/bootTrace.ts +6 -1
- package/src/client/engine/boot/bytes.ts +4 -3
- package/src/client/engine/boot/clearDownloads.ts +1 -1
- package/src/client/engine/boot/contentRead.ts +4 -0
- package/src/client/engine/boot/dropNotice.ts +20 -6
- package/src/client/engine/boot/gpuFiles.ts +25 -2
- package/src/client/engine/boot/lastEnd.ts +8 -2
- package/src/client/engine/boot/parsedPages.ts +127 -58
- package/src/client/engine/boot/shardPrefetch.ts +7 -1
- package/src/client/engine/boot/sw.ts +19 -0
- package/src/client/engine/build.d.ts +2 -0
- package/src/client/engine/core/Game.ts +29 -3
- package/src/client/engine/core/GpuRecovery.ts +7 -0
- package/src/client/engine/core/Volumetrics.ts +5 -0
- package/src/client/engine/core/assets.ts +27 -20
- package/src/client/engine/core/bootstrap.ts +5 -3
- package/src/client/engine/core/ktx2.ts +84 -11
- package/src/client/engine/debug/probe.ts +18 -1
- package/src/client/engine/explore/Compare.ts +2 -2
- package/src/client/engine/explore/TouchFly.ts +3 -5
- package/src/client/engine/fx/LightPool.ts +41 -1
- package/src/client/engine/input/dom.ts +12 -0
- package/src/client/engine/net/predictor.ts +6 -2
- package/src/client/engine/player/Player.ts +10 -2
- package/src/client/engine/player/TouchControls.ts +12 -4
- package/src/client/engine/pwa/sw.js +59 -11
- package/src/client/engine/render/drawCheck.ts +96 -0
- package/src/client/engine/render/precompile.ts +20 -14
- package/src/client/engine/saves/staleBuildNote.ts +46 -0
- package/src/client/engine/telemetry/browserErrors.ts +161 -21
- package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
- package/src/client/engine/telemetry/screenOutbox.ts +61 -0
- package/src/client/engine/telemetry/staleBuildReport.ts +12 -0
- package/src/client/engine/ui/DeathFade.ts +99 -11
- package/src/client/engine/ui/ErrorModal.ts +13 -6
- package/src/client/engine/ui/Feedback.ts +2 -1
- package/src/client/engine/ui/Loading.ts +10 -6
- package/src/client/engine/ui/Map.ts +2 -1
- package/src/client/engine/ui/WeaponStrip.ts +2 -1
- package/src/client/engine/ui/backGuard.ts +104 -0
- package/src/client/engine/ui/hudAdapters.ts +30 -4
- package/src/client/engine/ui/loading.css +17 -0
- package/src/client/engine/ui/namePrompt.ts +6 -5
- package/src/client/engine/ui/styles/combat.css +12 -0
- package/src/client/engine/ui/styles/namePrompt.css +4 -2
- package/src/client/game/boot/audio.generated.ts +0 -396
- package/src/client/game/boot/bytes.generated.ts +42 -71
- package/src/client/game/boot/versions.generated.ts +0 -13
- package/src/client/game/compendium/keepsakes.ts +16 -6
- package/src/client/game/grapple/tool.ts +10 -7
- package/src/client/game/grid/area.ts +38 -0
- package/src/client/game/grid/cellLoading.ts +23 -12
- package/src/client/game/grid/cellScreens.ts +39 -74
- package/src/client/game/grid/live.ts +28 -2
- package/src/client/game/grid/liveSession.ts +54 -10
- package/src/client/game/grid/menu.ts +4 -0
- package/src/client/game/grid/nearPlaceholderPlan.ts +8 -0
- package/src/client/game/grid/nearPlaceholderView.ts +9 -3
- package/src/client/game/grid/neighbourPanels.ts +10 -1
- package/src/client/game/grid/oneWayIn.ts +92 -27
- package/src/client/game/grid/pageEntry.ts +19 -0
- package/src/client/game/grid/pageShell.ts +1 -1
- package/src/client/game/grid/placedCards.ts +55 -0
- package/src/client/game/grid/placedCells.ts +131 -0
- package/src/client/game/grid/plotAudio.ts +114 -0
- package/src/client/game/grid/products.ts +55 -5
- package/src/client/game/grid/regionalRuntime.ts +6 -0
- package/src/client/game/grid/regionalWorld.ts +15 -2
- package/src/client/game/grid/roadCull.ts +44 -14
- package/src/client/game/grid/roadLookPlatform.ts +2 -2
- package/src/client/game/grid/roadTileBacking.ts +13 -3
- package/src/client/game/grid/session.ts +47 -22
- package/src/client/game/grid/shardfileFar.ts +9 -3
- package/src/client/game/grid/spawnGround.ts +68 -0
- package/src/client/game/grid/voidLook.ts +29 -23
- package/src/client/game/loot/runtime.ts +3 -1
- package/src/client/game/mainMenu.ts +14 -6
- package/src/client/game/riding/hud.ts +6 -4
- package/src/client/game/session/finish.ts +22 -4
- package/src/client/game/session/play.ts +8 -2
- package/src/client/game/session/session.ts +4 -1
- package/src/client/game/shard/titleList.ts +6 -2
- package/src/client/game/shardfile/clientWorker.ts +43 -13
- package/src/client/game/shardfile/serverRoute.ts +10 -22
- package/src/client/game/slugPage.css +11 -0
- package/src/client/game/slugPage.ts +84 -0
- package/src/client/game/systems/viewmodel/heldView.ts +6 -3
- package/src/client/game/titleDeck.ts +56 -32
- package/src/client/host/online/doctor.ts +7 -6
- package/src/client/host/online/linkScreens.ts +16 -0
- package/src/client/host/online/release.ts +51 -5
- package/src/client/host/online/shell.ts +62 -27
- package/src/client/host/standalone/shell.ts +7 -3
- package/src/cook/game/audioReport.ts +57 -0
- package/src/cook/game/entryTotals.ts +26 -6
- package/src/cook/game/installedRuntimeReads.ts +3 -0
- package/src/cook/game/shardCook.ts +38 -8
- package/src/cook/game/tierTextures.ts +276 -0
- package/src/e2e/smoke/game.ts +19 -14
- package/src/e2e/smoke/page-globals.d.ts +9 -8
- package/src/e2e/smoke/template2.spec.ts +8 -7
- package/src/server/engine/sim/respawn.ts +6 -1
- package/src/server/engine/sim.ts +3 -0
- package/src/server/game/grid/simulation.ts +35 -0
- package/src/server/game/loot/harvest.ts +2 -0
- package/src/server/game/loot/keepsakeProgression.ts +40 -0
- package/src/server/game/loot/playerOwned.ts +5 -1
- package/src/server/game/plugin/simulation.ts +4 -0
- package/src/server/game/population/nativeBake.ts +2 -1
- package/src/server/game/quest/chapterRecords.ts +2 -0
- package/src/server/game/quest/serverChapters.ts +4 -0
- package/src/server/game/quest/serverDoors.ts +11 -5
- package/src/server/game/roomRespawn.ts +4 -0
- package/src/server/game/shardfile/installedSides.ts +18 -0
- package/src/server/game/shardfile/nativeAssemblyHosts.ts +19 -10
- package/src/server/game/shardfile/nativeAssemblyInput.ts +1 -4
- package/src/server/host/bake/headlessWorker.ts +5 -1
- package/src/server/host/dedicated/cellHost.ts +98 -29
- package/src/server/host/dedicated/cellProtocol.ts +11 -1
- package/src/server/host/dedicated/cellWorker.ts +9 -3
- package/src/server/host/dedicated/crossing.ts +6 -2
- package/src/server/host/dedicated/dedicatedRoom.ts +21 -8
- package/src/server/host/dedicated/gridCells.ts +52 -9
- package/src/server/host/dedicated/main.ts +31 -12
- package/src/server/host/dedicated/placementFile.ts +56 -0
- package/src/server/host/dedicated/releaseFile.ts +17 -10
- package/src/server/host/dedicated/roadRoom.ts +21 -5
- package/src/server/host/dedicated/socketTransport.ts +2 -1
- package/src/server/host/dedicated/workerTable.ts +13 -1
- package/src/server/host/dedicated/world.ts +111 -10
- package/src/server/host/headlessRuntime.ts +10 -5
- package/src/server/host/installers.ts +62 -0
- package/src/server/host/openWorld.ts +59 -0
- package/src/server/host/ropeDecks.ts +2 -0
- package/src/server/host/standalone/cellWorld.ts +25 -19
- package/src/server/host/standalone/fallFloor.ts +2 -2
- package/src/server/host/standalone/gridServer.ts +7 -4
- package/src/server/host/standalone/roadWorld.ts +41 -4
- package/src/shared/engine/audio/bootAudio.ts +33 -0
- package/src/shared/engine/level/spec.ts +3 -3
- package/src/shared/engine/net/acts.ts +3 -0
- package/src/shared/engine/net/deviceWord.ts +138 -0
- package/src/shared/engine/net/socketFrames.ts +7 -4
- package/src/shared/engine/physics/query.ts +27 -0
- package/src/shared/engine/physics/terrain.ts +19 -28
- package/src/shared/engine/saves/saves.lock.json +15 -0
- package/src/shared/engine/sim/actRoutes.ts +2 -0
- package/src/shared/game/compendium/keepsakeProgression.ts +24 -0
- package/src/shared/game/grid/catalogue.ts +12 -5
- package/src/shared/game/grid/catalogueSlot.ts +18 -0
- package/src/shared/game/grid/farProxy.ts +6 -5
- package/src/shared/game/grid/pageMode.ts +1 -1
- package/src/shared/game/grid/placementRows.ts +33 -0
- package/src/shared/game/grid/roadLayout.ts +26 -3
- package/src/shared/game/grid/singleplayer.json +0 -13
- package/src/shared/game/grid/voidFloor.ts +122 -0
- package/src/shared/game/strings.ts +15 -0
- package/src/shared/host/standalone/netInput.ts +2 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// T2E-2 (TEMPLATE-E2E-PLAN): the Template 2 smoke's fault drill. Each step of the smoke has a fault planted in the real
|
|
3
|
+
// source that should turn that step, and no earlier one, red. The drill plants one fault at a time, runs the smoke
|
|
4
|
+
// (`--project template-2`), puts the source back, and checks which step failed first.
|
|
5
|
+
//
|
|
6
|
+
// node scripts/e2e-faults.mjs every fault, one smoke run each (about 1.5 min each)
|
|
7
|
+
// node scripts/e2e-faults.mjs <id>... only these
|
|
8
|
+
//
|
|
9
|
+
// Run it in a worktree you own: it rewrites tracked source for the length of a run and restores the bytes it read,
|
|
10
|
+
// also on Ctrl-C. Each run builds the client cold and checks the served build holds this plant and no other. Steps 4
|
|
11
|
+
// (the bag key unbound) and 5 (the attack dropped) join once Template 2 carries a pickup and a weapon (shard-format
|
|
12
|
+
// S2-1, S2-2).
|
|
13
|
+
import { spawnSync } from 'node:child_process';
|
|
14
|
+
import { existsSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
15
|
+
import { join, resolve as resolvePath } from 'node:path';
|
|
16
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
17
|
+
import { CLIENT_DIR, E2E_DIR, STATE_FILE } from './e2e-paths.mjs';
|
|
18
|
+
|
|
19
|
+
const root = resolvePath(import.meta.dirname, '..');
|
|
20
|
+
const REPORT = `${E2E_DIR}/faults-report.json`;
|
|
21
|
+
/** The planted file's path and both texts, while a plant stands. */
|
|
22
|
+
const PLANTED = `${E2E_DIR}/faults-planted.json`;
|
|
23
|
+
|
|
24
|
+
/** @typedef {{ id: string, step: string, why: string, file: string, find: string, plant: string }} Fault */
|
|
25
|
+
/** @type {readonly Fault[]} */
|
|
26
|
+
const FAULTS = [
|
|
27
|
+
{ id: 'use-unbound', step: '3.', why: 'E is bound to nothing in play',
|
|
28
|
+
file: 'src/client/game/inputContexts.ts', find: "dodge: ['KeyV', 'AltLeft'], use: ['KeyE'],", plant: "dodge: ['KeyV', 'AltLeft'], use: ['e2e-fault-use-unbound'],"
|
|
29
|
+
},
|
|
30
|
+
{ id: 'door-hook-stubbed', step: '3.', why: "the door's scene (blender.door.toggle) runs nothing",
|
|
31
|
+
file: 'src/server/game/plugin/simulation.ts', find: 'seats.step(); createQuestScriptPorts(lane, hooks, actors).scene(row.scene, player); return true;', plant: "seats.step(); Reflect.set(globalThis, 'e2eFault', 'e2e-fault-door-hook-stubbed'); return true;"
|
|
32
|
+
},
|
|
33
|
+
// The door's state is its shared field, `blender.door.open` (id 101). Leaving only the quest's `blender.door` flag out of
|
|
34
|
+
// the snapshot stays green: the quest earns it again from that field as the world restores.
|
|
35
|
+
{ id: 'save-skips-door', step: '7.', why: "the save keeps the door's field (blender.door.open, 101) at its default",
|
|
36
|
+
file: 'src/shared/engine/script/state.ts', find: 'shared: [...this.shared], players:',
|
|
37
|
+
plant: "shared: (Reflect.set(globalThis, 'e2eFault', 'e2e-fault-save-skips-door'), this.shared.map((value, index) => this.declaration.shared[index]?.id === 101 ? 0 : value)), players:"
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
/** @param {string} text @param {string} part */
|
|
42
|
+
const count = (text, part) => text.split(part).length - 1;
|
|
43
|
+
|
|
44
|
+
/** Every fault's marker: a string its plant carries that survives the bundle. @param {Fault} fault */
|
|
45
|
+
const marker = fault => `e2e-fault-${fault.id}`;
|
|
46
|
+
|
|
47
|
+
/** The markers the served client holds: the smoke's JavaScript under CLIENT_DIR. @returns {Set<string>} */
|
|
48
|
+
function served() {
|
|
49
|
+
const found = new Set();
|
|
50
|
+
/** @param {string} dir */
|
|
51
|
+
const walk = dir => {
|
|
52
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
53
|
+
const path = join(dir, entry.name);
|
|
54
|
+
if (entry.isDirectory()) walk(path);
|
|
55
|
+
else if (entry.name.endsWith('.js')) { const text = readFileSync(path, 'utf8'); for (const fault of FAULTS) if (text.includes(marker(fault))) found.add(fault.id); }
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
walk(join(root, CLIENT_DIR));
|
|
59
|
+
return found;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** This worktree's watcher, as the smoke drives it. @param {'ready'|'stop'} command */
|
|
63
|
+
function client(command) {
|
|
64
|
+
const run = spawnSync(process.execPath, ['--import', './scripts/format-hook.mjs', 'scripts/e2e-client.mjs', command], { cwd: root, encoding: 'utf8' });
|
|
65
|
+
interrupted(run);
|
|
66
|
+
if (run.status !== 0) throw new Error(`e2e-faults: e2e-client ${command} failed\n${run.stdout}\n${run.stderr}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** @param {number} ms */
|
|
70
|
+
const pause = ms => { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms); };
|
|
71
|
+
/** @param {number} pid */
|
|
72
|
+
const alive = pid => { try { process.kill(pid, 0); return true; } catch { return false; } };
|
|
73
|
+
|
|
74
|
+
/** Wait until this worktree's watcher has exited: the next ready builds the source as it now stands. */
|
|
75
|
+
function stopClient() {
|
|
76
|
+
const state = join(root, STATE_FILE), pid = existsSync(state) ? Number(JSON.parse(readFileSync(state, 'utf8')).pid) : undefined;
|
|
77
|
+
client('stop');
|
|
78
|
+
const running = () => pid !== undefined && alive(pid);
|
|
79
|
+
for (let wait = 0; wait < 300 && running(); wait += 1) pause(100);
|
|
80
|
+
if (running()) throw new Error(`e2e-faults: the watcher (pid ${String(pid)}) did not stop in 30 s`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Puts a planted file back from its recovery record, if one is left, and only while it still holds the plant: an edit
|
|
84
|
+
* made since is kept, and named. @returns {string|undefined} a warning */
|
|
85
|
+
function recover() {
|
|
86
|
+
const record = join(root, PLANTED);
|
|
87
|
+
if (!existsSync(record)) return undefined;
|
|
88
|
+
const { file, before, planted } = JSON.parse(readFileSync(record, 'utf8')), path = join(root, file);
|
|
89
|
+
const now = readFileSync(path, 'utf8');
|
|
90
|
+
rmSync(record, { force: true });
|
|
91
|
+
if (now === before) return undefined;
|
|
92
|
+
if (now === planted) { writeFileSync(path, before); return undefined; }
|
|
93
|
+
return `e2e-faults: ${file} changed during the drill, so its plant was left for you to take out`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A Ctrl-C reaches the child, not this process (spawnSync blocks its handlers): stop on the child's signal. @param {import('node:child_process').SpawnSyncReturns<string>} run */
|
|
97
|
+
function interrupted(run) {
|
|
98
|
+
if (run.signal === null && run.status !== 130) return;
|
|
99
|
+
const warning = recover();
|
|
100
|
+
if (warning !== undefined) console.error(warning);
|
|
101
|
+
try { client('stop'); } catch { /* the stop is best effort here */ }
|
|
102
|
+
process.exit(130);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Every test.step at the top level of a result; the first red one is the step the fault reddened. @param {any} suite @returns {any[]} */
|
|
106
|
+
const resultsOf = suite => [...(suite.specs ?? []).flatMap((/** @type {any} */ spec) => spec.tests).flatMap((/** @type {any} */ test) => test.results), ...(suite.suites ?? []).flatMap(resultsOf)];
|
|
107
|
+
|
|
108
|
+
/** @param {Fault} fault */
|
|
109
|
+
function drill(fault) {
|
|
110
|
+
const path = join(root, fault.file), before = readFileSync(path, 'utf8');
|
|
111
|
+
if (count(before, fault.find) !== 1) return { ok: false, detail: `${fault.file} no longer holds the line to plant in once` };
|
|
112
|
+
if (!fault.plant.includes(marker(fault))) return { ok: false, detail: `its plant carries no ${marker(fault)}` };
|
|
113
|
+
const planted = before.replace(fault.find, fault.plant);
|
|
114
|
+
// A warm watcher can miss a write and restore made seconds apart (its file events are not reliable), so each drill
|
|
115
|
+
// builds cold, about 25 s: a fresh watcher before the plant and another after the restore.
|
|
116
|
+
stopClient();
|
|
117
|
+
// Written first, so a drill killed mid-run is put right by the next one.
|
|
118
|
+
writeFileSync(join(root, PLANTED), JSON.stringify({ file: fault.file, before, planted }));
|
|
119
|
+
writeFileSync(path, planted);
|
|
120
|
+
rmSync(join(root, REPORT), { force: true });
|
|
121
|
+
const started = performance.now();
|
|
122
|
+
let run, warning;
|
|
123
|
+
try {
|
|
124
|
+
// A drill is only as good as the build it ran: the served client must hold this plant and no other.
|
|
125
|
+
client('ready');
|
|
126
|
+
const held = [...served()];
|
|
127
|
+
if (held.length !== 1 || held[0] !== fault.id) return { ok: false, detail: `the served client holds [${held.join(', ')}], not just this plant` };
|
|
128
|
+
run = spawnSync('pnpm', ['exec', 'playwright', 'test', '--config', 'src/e2e/playwright.config.ts', '--project', 'template-2', '--reporter', 'json'],
|
|
129
|
+
{ cwd: root, encoding: 'utf8', env: { ...process.env, PLAYWRIGHT_JSON_OUTPUT_NAME: join(root, REPORT) }, maxBuffer: 64 * 1024 * 1024 });
|
|
130
|
+
interrupted(run);
|
|
131
|
+
} finally {
|
|
132
|
+
warning = recover();
|
|
133
|
+
stopClient();
|
|
134
|
+
}
|
|
135
|
+
if (warning !== undefined) throw new Error(warning);
|
|
136
|
+
const seconds = ((performance.now() - started) / 1000).toFixed(1);
|
|
137
|
+
if (run.status === 0) return { ok: false, detail: `the smoke stayed green (${seconds} s)` };
|
|
138
|
+
if (!existsSync(join(root, REPORT))) return { ok: false, detail: `no report (exit ${String(run.status)})\n${(run.stderr ?? run.error?.message ?? '').slice(-2000)}` };
|
|
139
|
+
const results = resultsOf(JSON.parse(readFileSync(join(root, REPORT), 'utf8')));
|
|
140
|
+
const red = results.flatMap((/** @type {any} */ result) => result.steps ?? []).find((/** @type {any} */ step) => step.error !== undefined);
|
|
141
|
+
if (red === undefined) return { ok: false, detail: `red outside any step (${seconds} s): ${String(results[0]?.error?.message ?? '').split('\n')[0]}` };
|
|
142
|
+
const message = stripVTControlCharacters(String(red.error?.message ?? '')).split('\n').find(line => line.trim() !== '') ?? '';
|
|
143
|
+
return { ok: String(red.title).startsWith(fault.step), detail: `red at "${String(red.title)}" (want step ${fault.step}) in ${seconds} s: ${message.trim()}` };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const asked = process.argv.slice(2);
|
|
147
|
+
const unknown = asked.filter(id => !FAULTS.some(fault => fault.id === id));
|
|
148
|
+
if (unknown.length > 0) throw new Error(`e2e-faults: no fault ${unknown.join(', ')}; known: ${FAULTS.map(fault => fault.id).join(', ')}`);
|
|
149
|
+
const leftover = recover();
|
|
150
|
+
if (leftover !== undefined) throw new Error(leftover);
|
|
151
|
+
let failed = 0;
|
|
152
|
+
for (const fault of FAULTS.filter(row => asked.length === 0 || asked.includes(row.id))) {
|
|
153
|
+
/** @type {{ ok: boolean, detail: string }} */
|
|
154
|
+
let result;
|
|
155
|
+
try { result = drill(fault); } catch (error) { result = { ok: false, detail: error instanceof Error ? error.message : String(error) }; }
|
|
156
|
+
if (!result.ok) failed += 1;
|
|
157
|
+
console.log(`${result.ok ? 'RED AS PLANTED' : 'DRILL FAILED'} ${fault.id} (${fault.why}): ${result.detail}`);
|
|
158
|
+
}
|
|
159
|
+
process.exit(failed === 0 ? 0 : 1);
|
|
@@ -29,11 +29,17 @@ export default class EngineBudget implements Reporter{
|
|
|
29
29
|
const ledger=readTimings()?.amber??{},now=Date.now();
|
|
30
30
|
const verdicts=files.map(file=>judgeFile(file.file,file.durationMs,this.limit,ledger[file.file],now)).filter(verdict=>verdict.level!=='ok');
|
|
31
31
|
const amber=verdicts.filter(verdict=>verdict.level==='amber'),red=verdicts.filter(verdict=>verdict.level==='red');
|
|
32
|
+
// AUDIO AU6 (J303, J295): the cook report's test annotates each shard whose audio is over its line. The lines join
|
|
33
|
+
// the report's amber list, so the timings job repeats them for a main run that reused its plan-branch run, and
|
|
34
|
+
// main-watch reads them as `main AMBER … audio` receipts. Never an error: they change no exit code.
|
|
35
|
+
const audio=modules.flatMap(module=>[...module.children.allTests()].flatMap(test=>test.annotations().map(note=>note.message).filter(message=>message.startsWith('AMBER audio '))));
|
|
32
36
|
const out=resolve(timings??`tmp/engine-ci/timings-${process.pid}.json`);mkdirSync(dirname(out),{recursive:true});
|
|
33
37
|
writeFileSync(out,`${JSON.stringify({schema:'engine-ci-budget/2',sha:sha??null,run:run??null,attempt:attempt??null,reason,errorCount:errors.length,startedAt:this.began,endedAt:now,
|
|
34
|
-
budget:{limitMs:this.limit,amber:amber.map(row=>amberLine(row,run)),red:red.map(row=>amberLine(row,run))},files},null,2)}\n`);
|
|
38
|
+
budget:{limitMs:this.limit,amber:[...amber.map(row=>amberLine(row,run)),...audio],red:red.map(row=>amberLine(row,run))},files},null,2)}\n`);
|
|
35
39
|
for(const row of amber)console.error(`::warning file=${row.file},title=AMBER test file over budget (J295)::${amberLine(row,run)}`);
|
|
36
40
|
for(const row of red)console.error(`::error file=${row.file}::CI test file ${row.ms} ms exceeds ${row.budget} ms, red: ${row.why}. ${amberLine(row,run)}`);
|
|
41
|
+
// One annotation for them all: GitHub keeps only 10 warnings a step.
|
|
42
|
+
if(audio.length>0)console.error(`::warning title=AMBER shard audio over 6 MB (J303)::${audio.join('%0A')}`);
|
|
37
43
|
if(red.length>0)process.exitCode=1;
|
|
38
44
|
}
|
|
39
45
|
}
|
package/scripts/format-lock.mjs
CHANGED
|
@@ -12,6 +12,8 @@ const LOCK = 'pnpm-lock.yaml';
|
|
|
12
12
|
const FORMAT = '@wildshard/format';
|
|
13
13
|
const PACKAGE = '@wildshard/shard-format';
|
|
14
14
|
const PIN = /^github:project-wildshard\/shard-format#(v\d+\.\d+\.\d+)$/u;
|
|
15
|
+
// NPM-PUBLISH NP6: the registry release, by the same alias (`npm:@wildshard/shard-format@^0.4.9`); its lock row is an integrity, no commit
|
|
16
|
+
const NPM_PIN = /^npm:@wildshard\/shard-format@\^?\d+\.\d+\.\d+$/u;
|
|
15
17
|
const SECTIONS = ['dependencies', 'devDependencies', 'optionalDependencies'];
|
|
16
18
|
const FETCH_MS = 8000;
|
|
17
19
|
|
|
@@ -26,16 +28,21 @@ function parseLock(text) {
|
|
|
26
28
|
const block = start === -1 || end === -1 ? '' : text.slice(start, end), keys = [...block.matchAll(/^ {2}(\S+):$/gmu)];
|
|
27
29
|
keys.forEach((key, index) => {
|
|
28
30
|
const body = block.slice(key.index, keys[index + 1]?.index);
|
|
29
|
-
// pnpm locks a github pin as git (`git+ssh://…#<commit>`) or as a codeload tarball (`…/tar.gz/<commit>`)
|
|
30
|
-
const row = /^ {6}'@wildshard\/format':\n {8}specifier: (\S+)\n {8}version: \S
|
|
31
|
-
|
|
31
|
+
// pnpm locks a github pin as git (`git+ssh://…#<commit>`) or as a codeload tarball (`…/tar.gz/<commit>`), an npm one by version
|
|
32
|
+
const row = /^ {6}'@wildshard\/format':\n {8}specifier: (\S+)\n {8}version: (\S+)/mu.exec(body);
|
|
33
|
+
const version = row?.[2] ?? '';
|
|
34
|
+
if (row !== null) importers.set(key[1], { specifier: row[1], commit: /(?:#|\/tar\.gz\/)([0-9a-f]{40})/u.exec(version)?.[1],
|
|
35
|
+
registry: /^'?@wildshard\/shard-format@(\d+\.\d+\.\d+[^('\s]*)/u.exec(version)?.[1] });
|
|
32
36
|
});
|
|
33
|
-
const rows = [...text.matchAll(/^ {2}'@wildshard\/shard-format@[^']*':\n {4}resolution: \{([^}\n]*)\}\n(?: {4}version: (\S+)\n)?/gmu)]
|
|
37
|
+
const rows = [...text.matchAll(/^ {2}'@wildshard\/shard-format@([^']*)':\n {4}resolution: \{([^}\n]*)\}\n(?: {4}version: (\S+)\n)?/gmu)]
|
|
38
|
+
.map(([, key, resolution, version]) => [resolution, version, key])
|
|
34
39
|
.map(row => {
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
return { commit:
|
|
40
|
+
// NP6: a registry row is keyed by its version and resolved by integrity alone
|
|
41
|
+
if (/^integrity: sha512-[^,]+$/u.test(row[0] ?? '') && /^\d+\.\d+\.\d+/u.test(row[2] ?? '')) return { commit: undefined, repo: undefined, version: row[2], registry: true };
|
|
42
|
+
const git = /^commit: ([0-9a-f]{40}), repo: ([^,]+), type: git$/u.exec(row[0] ?? '');
|
|
43
|
+
if (git !== null) return { commit: git[1], repo: git[2], version: row[1], registry: false };
|
|
44
|
+
const tarball = /tarball: https:\/\/codeload\.github\.com\/([\w.-]+\/[\w.-]+)\/tar\.gz\/([0-9a-f]{40})$/u.exec(row[0] ?? '');
|
|
45
|
+
return { commit: tarball?.[2], repo: tarball === null ? undefined : `https://github.com/${tarball[1]}.git`, version: row[1], registry: false };
|
|
39
46
|
});
|
|
40
47
|
return { importers, keys: keys.map(key => key[1]), rows };
|
|
41
48
|
}
|
|
@@ -48,7 +55,7 @@ export function formatLockFailures(read, workflows = []) {
|
|
|
48
55
|
const { importers, keys, rows } = parseLock(text);
|
|
49
56
|
const row = rows[0];
|
|
50
57
|
if (rows.length !== 1 || row === undefined) return [`${LOCK}: expected one ${PACKAGE} package row, found ${rows.length}`];
|
|
51
|
-
if (row.commit === undefined) return [`${LOCK}: ${PACKAGE} row's resolution is neither a git commit nor a
|
|
58
|
+
if (row.commit === undefined && !row.registry) return [`${LOCK}: ${PACKAGE} row's resolution is neither a git commit, a codeload tarball nor a registry integrity`];
|
|
52
59
|
const pins = new Set();
|
|
53
60
|
for (const key of keys) {
|
|
54
61
|
const file = key === '.' ? 'package.json' : `${key}/package.json`, manifest = read(file);
|
|
@@ -59,10 +66,12 @@ export function formatLockFailures(read, workflows = []) {
|
|
|
59
66
|
if (locked !== undefined) failures.push(`${LOCK}: importer ${key} locks ${FORMAT} but ${file} doesn't name it`);
|
|
60
67
|
continue;
|
|
61
68
|
}
|
|
62
|
-
|
|
69
|
+
const npm = NPM_PIN.test(pin);
|
|
70
|
+
if (!npm && !PIN.test(pin)) failures.push(`${file}: ${FORMAT} pin ${pin} isn't a shard-format release tag or npm release`);
|
|
63
71
|
pins.add(pin);
|
|
64
72
|
if (locked?.specifier !== pin) failures.push(`${file}: ${FORMAT} pin ${pin} but ${LOCK} has ${locked?.specifier ?? 'no row'}`);
|
|
65
|
-
else if (
|
|
73
|
+
else if (npm !== row.registry) failures.push(`${LOCK}: importer ${key} pins ${npm ? 'the npm release' : 'a git tag'}, its package row is ${row.registry ? 'a registry' : 'a git'} row`);
|
|
74
|
+
else if (npm ? locked.registry !== row.version : locked.commit !== row.commit) failures.push(`${LOCK}: importer ${key} locks ${npm ? locked.registry : locked.commit}, its package row ${npm ? row.version : row.commit}`);
|
|
66
75
|
}
|
|
67
76
|
if (pins.size > 1) failures.push(`package.json: ${FORMAT} pins disagree: ${[...pins].join(', ')}`);
|
|
68
77
|
const tag = pins.size === 1 ? PIN.exec([...pins][0] ?? '')?.[1] : undefined;
|
|
@@ -14,7 +14,8 @@ const source = readFileSync(resolve(root, 'index.html'), 'utf8');
|
|
|
14
14
|
const style = /<style>([\s\S]*?)<\/style>/u.exec(source)?.[1];
|
|
15
15
|
const shell = /<div class="ws-launch" data-title-shell>[\s\S]*?<\/div><!-- \/title-shell -->/u.exec(source)?.[0];
|
|
16
16
|
if (style === undefined || shell === undefined) throw new Error('Missing first-document title shell');
|
|
17
|
-
// Standalone content starts below the 62 px phone status area (index.html E58).
|
|
17
|
+
// Standalone content starts below the 62 px phone status area (index.html E58). The pill and bar (QA 11-13) are live
|
|
18
|
+
// elements a script fills; iOS's still image before the document keeps the approved hero and wordmark only.
|
|
18
19
|
const nativeInset = 62;
|
|
19
20
|
const previous = /rel="apple-touch-startup-image" href="([^"]+)"/u.exec(source)?.[1];
|
|
20
21
|
if (previous === undefined) throw new Error('Missing native launch image link');
|
|
@@ -27,7 +28,7 @@ try {
|
|
|
27
28
|
await context.route('http://launch.test/**', async route => {
|
|
28
29
|
const path = new URL(route.request().url()).pathname;
|
|
29
30
|
if (path === '/') {
|
|
30
|
-
await route.fulfill({ contentType: 'text/html', body: `<!doctype html><html class="title-first"><head><meta name="viewport" content="width=device-width, initial-scale=1"><style>${style} html.title-first .ws-launch { top: ${nativeInset}px; }</style></head><body>${shell}</body></html>` });
|
|
31
|
+
await route.fulfill({ contentType: 'text/html', body: `<!doctype html><html class="title-first"><head><meta name="viewport" content="width=device-width, initial-scale=1"><style>${style} html.title-first .ws-launch { top: ${nativeInset}px; } .ws-launch-pill, .ws-launch-load { visibility: hidden; }</style></head><body>${shell}</body></html>` });
|
|
31
32
|
} else if (path.startsWith('/assets/title/') || path.startsWith('/fonts/')) {
|
|
32
33
|
const asset = resolve(root, 'public', `.${titleSources.get(path) ?? path}`);
|
|
33
34
|
if (!asset.startsWith(`${resolve(root, 'public')}/`)) throw new Error('Invalid launch asset');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// from the deck's card, then walks into a same-worker neighbour (Sunscar, or Pine Hollow), boosts back into Driftwood and boosts out again, by
|
|
5
5
|
// real input. Each leg passes with no stop (no 1.5 s under 0.15 m a sample while the key is held), no page reload, and control in the
|
|
6
6
|
// target cell (the page inside it, gameplay ready, the player moving). It writes time-to-control per leg beside GC1's baseline.
|
|
7
|
-
// scripts/browser-lane.sh node scripts/grid-crossing-walk-proof.mjs <app dist stamped with http://127.0.0.1:18799/release.json> <work dir> <key.json> [--engine=chromium|webkit] [--to=sunscar|pine] [--out=<dir>]
|
|
7
|
+
// scripts/browser-lane.sh node scripts/grid-crossing-walk-proof.mjs <app dist stamped with http://127.0.0.1:18799/release.json> <work dir> <key.json> [--engine=chromium|webkit] [--to=sunscar|pine|farreach|nalati] [--workers=2] [--base=<staging url>] [--out=<dir>]
|
|
8
8
|
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
9
9
|
import { join, resolve as absolute } from 'node:path';
|
|
10
10
|
import { chromium, webkit } from 'playwright';
|
|
@@ -13,7 +13,7 @@ import { saveFixture } from './debug-settings.mjs';
|
|
|
13
13
|
import { openRig, WORLD_PORT } from './online-rig.mjs';
|
|
14
14
|
|
|
15
15
|
const [dist = '', relativeWork = '', keyFile = ''] = process.argv.slice(2).filter(arg => !arg.startsWith('--')), work = relativeWork === '' ? '' : absolute(relativeWork);
|
|
16
|
-
if (dist === '' || work === '' || keyFile === '') throw new Error('usage: grid-crossing-walk-proof.mjs <dist> <work> <key.json> [--engine=chromium|webkit] [--to=sunscar|pine] [--out=<dir>]');
|
|
16
|
+
if (dist === '' || work === '' || keyFile === '') throw new Error('usage: grid-crossing-walk-proof.mjs <dist> <work> <key.json> [--engine=chromium|webkit] [--to=sunscar|pine|farreach|nalati] [--out=<dir>]');
|
|
17
17
|
const engineName = process.argv.find(arg => arg.startsWith('--engine='))?.slice(9) ?? 'chromium', out = absolute(process.argv.find(arg => arg.startsWith('--out='))?.slice(6) ?? join(work, 'shots'));
|
|
18
18
|
if (engineName !== 'chromium' && engineName !== 'webkit') throw new Error(`No engine ${engineName}`);
|
|
19
19
|
mkdirSync(out, { recursive: true });
|
|
@@ -23,7 +23,9 @@ mkdirSync(out, { recursive: true });
|
|
|
23
23
|
// (`sections/world/edge.json`), so a crossing goes through it: `approach` are waypoints in Driftwood's frame, boosted and not scored,
|
|
24
24
|
// that end in front of it; the legs then walk straight through it.
|
|
25
25
|
const NEIGHBOURS = /** @type {Record<string, { slug: string, axis: 'x' | 'z', sign: number, approach: [number, number][] }>} */ ({
|
|
26
|
-
pine: { slug: 'pine-hollow', axis: 'z', sign: 1, approach: [[-235, -194], [-235, 235], [0, 235]] }, sunscar: { slug: 'sunscar-dunes', axis: 'x', sign: -1, approach: [[-235, -194], [-235, 0]] }
|
|
26
|
+
pine: { slug: 'pine-hollow', axis: 'z', sign: 1, approach: [[-235, -194], [-235, 235], [0, 235]] }, sunscar: { slug: 'sunscar-dunes', axis: 'x', sign: -1, approach: [[-235, -194], [-235, 0]] },
|
|
27
|
+
// GC29 (Jake 11-13): his walk off the south dock toward Far Reach, and east into Nalati (staging: another worker).
|
|
28
|
+
farreach: { slug: 'far-reach', axis: 'z', sign: -1, approach: [[0, -235]] }, nalati: { slug: 'nalati-grasslands', axis: 'x', sign: 1, approach: [[235, -194], [235, 0]] } });
|
|
27
29
|
const toName = process.argv.find(arg => arg.startsWith('--to='))?.slice(5) ?? 'sunscar', to = NEIGHBOURS[toName];
|
|
28
30
|
if (to === undefined) throw new Error(`No neighbour ${toName}: ${Object.keys(NEIGHBOURS).join(', ')}`);
|
|
29
31
|
const HOME = 'driftwood-isle', NEXT = to.slug, STUCK_MS = 1500, LEG_MS = 100_000;
|
|
@@ -35,17 +37,33 @@ const note = (step, ok, detail) => { steps.push({ step, ok, ...detail === undefi
|
|
|
35
37
|
/** @param {number} ms */
|
|
36
38
|
const sleep = ms => new Promise(resolve => { setTimeout(resolve, ms); });
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
// `--base=<url>`: a served site instead of the rig (staging only, J205: a read-only join; never production). dist and key.json are unused.
|
|
41
|
+
const served = process.argv.find(arg => arg.startsWith('--base='))?.slice(7) ?? '';
|
|
42
|
+
if (served !== '' && !/^https:\/\/(staging|preview)\.wildshard\.io\/?$|^http:\/\/127\.0\.0\.1:\d+\/?$/.test(served)) throw new Error('--base takes staging, preview or a loopback page only: never production (J205)');
|
|
43
|
+
const workers = Number(process.argv.find(arg => arg.startsWith('--workers='))?.slice(10) ?? 2);
|
|
44
|
+
if (!Number.isInteger(workers) || workers < 1) throw new Error('--workers takes a whole number from 1');
|
|
45
|
+
const rig = served !== '' ? { base: served.replace(/\/$/, ''), close: () => Promise.resolve() }
|
|
46
|
+
: await openRig({ dist, work, keyFile, pgBin: 'memory:', pgData: '', shard: HOME, more: ['pine-hollow', 'far-reach', 'sunscar-dunes', 'nalati-grasslands'], cells: 'grid', crossing: true, workers });
|
|
39
47
|
let code = 1, browser = /** @type {import('playwright').Browser | null} */ (null);
|
|
40
48
|
/** @type {Record<string, unknown>} */
|
|
41
|
-
const result = { lane: 'opus-gc15c', engine: engineName, layout: 'desktop 1440x900', site: 'local rig, WORLD_CELLS=grid, WORLD_CROSSING=worker, WORLD_WORKERS=2 (staging: Nalati alone, Driftwood with Pine Hollow, Sunscar and Far Reach)' };
|
|
49
|
+
const result = { lane: 'opus-gc15c', engine: engineName, layout: 'desktop 1440x900', site: served !== '' ? served : 'local rig, WORLD_CELLS=grid, WORLD_CROSSING=worker, WORLD_WORKERS=2 (staging: Nalati alone, Driftwood with Pine Hollow, Sunscar and Far Reach)' };
|
|
42
50
|
try {
|
|
43
|
-
let open = null;
|
|
51
|
+
let open = served !== '' ? { cells: 25 } : null;
|
|
44
52
|
for (let tries = 0; tries < 300 && open === null; tries++) { open = await fetch(`http://127.0.0.1:${String(WORLD_PORT)}/health`).then(found => found.ok ? found.json() : null).catch(() => null); if (open === null) await sleep(200); }
|
|
45
|
-
note('the world runs the grid', open !== null && open.cells > 1, { cells: open?.cells });
|
|
53
|
+
note('the world runs the grid', open !== null && open.cells > 1, served !== '' ? { skipped: 'a served site: not read' } : { cells: open?.cells });
|
|
46
54
|
if (open === null) throw new Error(`The world did not start: see ${join(work, 'server.log')}`);
|
|
47
55
|
browser = await (engineName === 'webkit' ? webkit : chromium).launch({ headless: true, args: engineName === 'chromium' ? [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist'] : [] });
|
|
48
56
|
const context = await browser.newContext({ viewport: { width: 1440, height: 900 } }), page = await context.newPage(), errors = /** @type {string[]} */ ([]);
|
|
57
|
+
// RP4: every program's first use (three's uniform read after its link, where a link not yet finished blocks the frame),
|
|
58
|
+
// counted so a leg's receipt says how many programs linked on the way (a cell's whole set relinking at its edge was 2.5 s)
|
|
59
|
+
await context.addInitScript(() => {
|
|
60
|
+
const W = /** @type {any} */ (window); W.__programLinks = 0;
|
|
61
|
+
for (const C of [W.WebGL2RenderingContext, W.WebGLRenderingContext]) {
|
|
62
|
+
if (C === undefined) continue;
|
|
63
|
+
const read = C.prototype.getProgramParameter;
|
|
64
|
+
C.prototype.getProgramParameter = function getProgramParameter(/** @type {WebGLProgram} */ program, /** @type {number} */ name) { if (name === this.ACTIVE_UNIFORMS) W.__programLinks++; return read.call(this, program, name); };
|
|
65
|
+
}
|
|
66
|
+
});
|
|
49
67
|
page.on('pageerror', error => { errors.push(error.message.slice(0, 240)); });
|
|
50
68
|
let navigations = 0;
|
|
51
69
|
page.on('framenavigated', frame => { if (frame === page.mainFrame()) navigations++; });
|
|
@@ -120,7 +138,7 @@ try {
|
|
|
120
138
|
/** @type {Record<string, unknown>[]} */
|
|
121
139
|
const events = [];
|
|
122
140
|
let stuckSince = 0, stuckMs = 0, worstStuck = 0, last = start, enteredAt = 0, controlAt = 0, roadAt = 0, jumps = 0;
|
|
123
|
-
const t1 = Date.now(), framesFrom = await page.evaluate(() => /** @type {any} */ (window).__gc15c.frames.length);
|
|
141
|
+
const t1 = Date.now(), framesFrom = await page.evaluate(() => /** @type {any} */ (window).__gc15c.frames.length), linksFrom = await page.evaluate(() => /** @type {any} */ (window).__programLinks);
|
|
124
142
|
await face(yaw);
|
|
125
143
|
await page.keyboard.down('KeyW'); if (leg.boost) await page.keyboard.down('ShiftLeft');
|
|
126
144
|
while (Date.now() - t1 < LEG_MS) {
|
|
@@ -145,9 +163,10 @@ try {
|
|
|
145
163
|
await page.keyboard.up('KeyW'); if (leg.boost) await page.keyboard.up('ShiftLeft');
|
|
146
164
|
const end = await sample(), frames = /** @type {number[][]} */ (await page.evaluate(n => /** @type {any} */ (window).__gc15c.frames.slice(n), framesFrom));
|
|
147
165
|
await page.screenshot({ path: join(out, `${engineName}-${leg.name}-after.png`) });
|
|
148
|
-
const
|
|
166
|
+
const programLinks = await page.evaluate(() => /** @type {any} */ (window).__programLinks) - linksFrom;
|
|
167
|
+
const deltas = frames.map(row => row[1] ?? 0), row = { name: leg.name, programLinks, from, target: leg.target, boost: leg.boost, roadAtMs: roadAt, enteredAtMs: enteredAt, controlAtMs: controlAt,
|
|
149
168
|
borderToControlMs: enteredAt === 0 || controlAt === 0 ? null : controlAt - enteredAt, worstStopMs: worstStuck, stoppedMs: stuckMs, jumps, frames: deltas.length,
|
|
150
|
-
over50: deltas.filter(ms => ms > 50).length, worstFrameMs: Math.max(0, ...deltas), events, end };
|
|
169
|
+
over50: deltas.filter(ms => ms > 50).length, over100: deltas.filter(ms => ms > 100).length, worstFrameMs: Math.max(0, ...deltas), events, end };
|
|
151
170
|
legs.push(row);
|
|
152
171
|
note(`${leg.name}: arrives in ${leg.target} with control`, controlAt !== 0, { enteredAt, controlAt, end: { inside: end.inside, z: end.z, ready: end.ready } });
|
|
153
172
|
note(`${leg.name}: no stop or wall on the way`, worstStuck <= STUCK_MS && jumps === 0, { worstStuck, jumps });
|
|
@@ -162,7 +181,7 @@ try {
|
|
|
162
181
|
code = steps.every(step => step.ok) ? 0 : 1;
|
|
163
182
|
} catch (error) { note('the run', false, String(error).slice(0, 400)); }
|
|
164
183
|
finally {
|
|
165
|
-
const log = readFileSync(join(work, 'server.log'), 'utf8').split('\n');
|
|
184
|
+
const log = served !== '' ? [] : readFileSync(join(work, 'server.log'), 'utf8').split('\n');
|
|
166
185
|
result.server = { road: log.filter(line => line.includes('road.pack')).slice(0, 2), booted: log.filter(line => line.includes('cell.booted')).length };
|
|
167
186
|
result.steps = steps; result.code = code;
|
|
168
187
|
writeFileSync(join(out, `${engineName}-gc15c-walk.json`), `${JSON.stringify(result, null, 2)}\n`);
|
package/scripts/heavy-lane.py
CHANGED
|
@@ -162,11 +162,35 @@ def wait_label(seconds):
|
|
|
162
162
|
return '5 min' if seconds == 5 * 60 else '%gs' % seconds
|
|
163
163
|
|
|
164
164
|
|
|
165
|
+
def reap_dead(root, slot):
|
|
166
|
+
"""True (and the lease file removed) when a slot's lease names a runner and child that both exited and its lock is free.
|
|
167
|
+
|
|
168
|
+
A SIGKILLed owner never runs its cleanup, so its `.active.json` outlives it; its flock went with it, so the slot is free.
|
|
169
|
+
A lock still held with both pids dead is an orphaned grandchild that inherited the fd: a real holder, kept and named.
|
|
170
|
+
The check and the unlink run under the slot's own lock, so a new owner's lease is never removed."""
|
|
171
|
+
path = root / (slot + '.active.json')
|
|
172
|
+
try:
|
|
173
|
+
with (root / (slot + '.lock')).open('a+') as lock:
|
|
174
|
+
try:
|
|
175
|
+
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
|
176
|
+
except BlockingIOError:
|
|
177
|
+
return False
|
|
178
|
+
entry = read_entry(path)
|
|
179
|
+
pids = [entry.get(key) for key in ('runnerPid', 'childPid') if entry.get(key) is not None]
|
|
180
|
+
if not pids or not all(isinstance(pid, int) and 0 < pid < 2**31 for pid in pids) or any(alive(pid) for pid in pids):
|
|
181
|
+
return False
|
|
182
|
+
path.unlink(missing_ok=True)
|
|
183
|
+
return True
|
|
184
|
+
except OSError:
|
|
185
|
+
return False
|
|
186
|
+
|
|
187
|
+
|
|
165
188
|
def queue_timeout(root, entry):
|
|
166
189
|
slots = set(slot for resource in entry['resources'] for slot in (BUILD_SLOTS if resource == 'build' else (resource,)))
|
|
167
190
|
if 'full-test' in slots:
|
|
168
191
|
slots.update(path.name[:-len('.active.json')] for path in root.glob('full-test-*.active.json'))
|
|
169
|
-
|
|
192
|
+
# 2026-11-13: a killed push gate's lease was named as the holder for 2.8 h and hid the real one
|
|
193
|
+
holders = [holder(slot, read_entry(root / (slot + '.active.json'))) for slot in sorted(slots) if not reap_dead(root, slot)]
|
|
170
194
|
queued = read_entry(root / 'queue.json').get('queue', [])
|
|
171
195
|
holders.extend('queue head ' + holder('/'.join(row['resources']), row) for row in queued
|
|
172
196
|
if row['token'] != entry['token'] and row['ticket'] < entry['ticket']
|