@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/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,22 @@ run `../repo-kit/release.sh vX.Y.Z --prepare` and `--finish` as before (the help
|
|
|
9
9
|
`scripts/changelog.mjs` checks the format; the pre-push hook and CI refuse a push whose `package.json` version has no
|
|
10
10
|
valid section, and a `vX.Y.Z` tag whose commit has none.
|
|
11
11
|
|
|
12
|
+
## v0.1.23 (2026-11-15)
|
|
13
|
+
|
|
14
|
+
- New and updated shards are cooked for the world again: since Saturday the cook refused every upload as over its space.
|
|
15
|
+
- Lamps carried by players and creatures move their light with them, and the 16 nearest lamps light the scene.
|
|
16
|
+
- Brasscap Mesa keeps its far view from the road, and a shard's creatures respawn where they were placed.
|
|
17
|
+
- You can take a melee weapon from its rack, and creatures in a shared shard stay in their own cell.
|
|
18
|
+
- The game's files now come from our content network, so the page is smaller and loads faster, and cached files survive a release.
|
|
19
|
+
|
|
20
|
+
## v0.1.22 (2026-11-15)
|
|
21
|
+
|
|
22
|
+
- Brasscap Mesa: you walk in with the lever-action in hand, its rack restocks your rounds, and every bandit and beast in the cell is drawn.
|
|
23
|
+
- A shard placed on the grid after a release keeps its road speed limit on the server too.
|
|
24
|
+
- When the world's files fail to download, the game says so and offers Try again instead of waiting forever.
|
|
25
|
+
- Reloading for a new version brings you back into the game rather than to the title.
|
|
26
|
+
- Behind the scenes: the server swaps out a stuck or drained worker without dropping players, and the cook follows staging by itself.
|
|
27
|
+
|
|
12
28
|
## v0.1.21 (2026-11-15)
|
|
13
29
|
|
|
14
30
|
- The hoverboard is faster online too: 14 m/s in a shard and 30 on the road, and boost is four times that (56 and 120).
|
package/lint/engine-sides.json
CHANGED
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"src/client/engine/boot/contentBase.ts": "client",
|
|
77
77
|
"src/client/engine/boot/contentRead.ts": "client",
|
|
78
78
|
"src/client/engine/boot/download.ts": "client",
|
|
79
|
+
"src/client/engine/boot/downloadGiveUp.ts": "client",
|
|
79
80
|
"src/client/engine/boot/dropNotice.ts": "client",
|
|
80
81
|
"src/client/engine/boot/earlyPrograms.ts": "client",
|
|
81
82
|
"src/client/engine/boot/extras.ts": "client",
|
|
@@ -433,6 +434,7 @@
|
|
|
433
434
|
"src/client/engine/ui/authoredDebugRows.ts": "client",
|
|
434
435
|
"src/client/engine/ui/BootSettings.ts": "client",
|
|
435
436
|
"src/client/engine/ui/backGuard.ts": "client",
|
|
437
|
+
"src/client/engine/ui/downloadFailed.ts": "client",
|
|
436
438
|
"src/client/engine/ui/graphicsBlock.ts": "client",
|
|
437
439
|
"src/client/engine/ui/BossBar.ts": "client",
|
|
438
440
|
"src/client/engine/ui/buildCheck.ts": "client",
|
|
@@ -633,6 +635,7 @@
|
|
|
633
635
|
"src/client/game/grid/copyIdentity.ts": "client",
|
|
634
636
|
"src/client/game/grid/copyLayout.ts": "client",
|
|
635
637
|
"src/client/game/grid/copyPrompts.ts": "client",
|
|
638
|
+
"src/client/game/grid/dataCellKit.ts": "client",
|
|
636
639
|
"src/client/game/grid/edgeSources.ts": "client",
|
|
637
640
|
"src/client/game/grid/enteredEquipment.ts": "client",
|
|
638
641
|
"src/client/game/grid/enteredInteract.ts": "client",
|
|
@@ -1216,6 +1219,7 @@
|
|
|
1216
1219
|
"src/server/game/boss/slotsNative.ts": "server",
|
|
1217
1220
|
"src/server/game/boss/windEliteNative.ts": "server",
|
|
1218
1221
|
"src/server/game/grapple/native.ts": "server",
|
|
1222
|
+
"src/server/game/grid/cellHome.ts": "server",
|
|
1219
1223
|
"src/server/game/grid/durability.ts": "server",
|
|
1220
1224
|
"src/server/game/grid/room.ts": "server",
|
|
1221
1225
|
"src/server/game/grid/roomNet.ts": "server",
|
|
@@ -1688,6 +1692,7 @@
|
|
|
1688
1692
|
"src/shared/game/loot/exchange.ts": "shared",
|
|
1689
1693
|
"src/shared/game/loot/Owned.ts": "shared",
|
|
1690
1694
|
"src/shared/game/loot/ownedRows.ts": "shared",
|
|
1695
|
+
"src/shared/game/loot/platformCatalogue.ts": "shared",
|
|
1691
1696
|
"src/shared/game/loot/Purse.ts": "shared",
|
|
1692
1697
|
"src/shared/game/loot/tableRows.ts": "shared",
|
|
1693
1698
|
"src/shared/game/newGame.ts": "shared",
|
|
@@ -18,9 +18,11 @@ const packages = new Map();
|
|
|
18
18
|
|
|
19
19
|
function publicPackage(root, source) {
|
|
20
20
|
if (source === 'three' || source.startsWith('three/') || source === 'valibot') return true;
|
|
21
|
-
const pkg = /^@wildshard\/(engine|game|sdk|
|
|
21
|
+
const pkg = /^@wildshard\/(engine|game|sdk|format)(?:\/(.+))?$/u.exec(source);
|
|
22
22
|
if (pkg === null) return false;
|
|
23
|
-
const file =
|
|
23
|
+
const file = pkg[1] === 'engine'
|
|
24
|
+
? resolve(root, 'package.json')
|
|
25
|
+
: resolve(root, 'node_modules', '@wildshard', pkg[1], 'package.json');
|
|
24
26
|
if (!packages.has(file)) packages.set(file, existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')).exports ?? {} : {});
|
|
25
27
|
const sub = pkg.at(2);
|
|
26
28
|
return Object.hasOwn(packages.get(file), sub === undefined ? '.' : `./${sub}`);
|
package/lint/sim-players.json
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"about": "P1-E5.2a: per-file reads of a one-player SimHost member (`members`, which ended at 0) and leadPlayer binds (`lead`: systems not yet per-player) in non-test source, by type, not by spelling (scripts/check-sim-players.mjs). They never rise.",
|
|
3
3
|
"members": 0,
|
|
4
|
-
"lead":
|
|
5
|
-
"files": {
|
|
6
|
-
"src/server/engine/net/simWorld.ts": 1,
|
|
7
|
-
"src/shared/engine/sim/snapshot.ts": 3,
|
|
8
|
-
"src/client/game/grid/copyPrompts.ts": 1,
|
|
9
|
-
"src/client/game/grid/neighbourPanels.ts": 1,
|
|
10
|
-
"src/server/game/grid/simulation.ts": 1,
|
|
11
|
-
"src/server/game/plugin/mover.ts": 2,
|
|
12
|
-
"src/server/host/bake/headlessWorker.ts": 1,
|
|
13
|
-
"src/shared/host/headlessJourney.ts": 1,
|
|
14
|
-
"src/server/host/headlessRuntime.ts": 1,
|
|
15
|
-
"src/shared/host/headlessTape.ts": 1
|
|
16
|
-
}
|
|
4
|
+
"lead": 0,
|
|
5
|
+
"files": {}
|
|
17
6
|
}
|
package/lint/wildshard-plugin.js
CHANGED
|
@@ -1140,7 +1140,7 @@ export const TEST_DOMAIN_RUNTIME_RULES = [
|
|
|
1140
1140
|
'runtime-performance', 'no-raw-random-time', 'no-runtime-generator',
|
|
1141
1141
|
];
|
|
1142
1142
|
/** @param {string} path */
|
|
1143
|
-
const testFixtures = path => /^src\/(?:engine|game|sdk|sharddev)\/test\//u.test(path);
|
|
1143
|
+
const testFixtures = path => /^(?:src\/(?:test\/(?:engine|game|sdk)|(?:engine|game|sdk|sharddev)\/test)|@wildshard\/(?:engine|game|sdk|sharddev)\/test)\//u.test(path);
|
|
1144
1144
|
/** @param {string} path */
|
|
1145
1145
|
const testModule = path => path.endsWith('.test.ts') || testFixtures(path);
|
|
1146
1146
|
const testDomain = context => testModule(pathOf(context));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wildshard/engine",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"description": "The Wildshard engine: one repo with shared, client, server and cook code and three build targets (client, dedicated server, standalone listen server), shaped like Unreal or Source.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@sentry/browser": "11.0.0",
|
|
68
68
|
"@sentry/core": "11.0.0",
|
|
69
69
|
"@valibot/to-json-schema": "1.8.0",
|
|
70
|
-
"@wildshard/format": "npm:@wildshard/shard-format@^0.5.
|
|
70
|
+
"@wildshard/format": "npm:@wildshard/shard-format@^0.5.9",
|
|
71
71
|
"@wildshard/wire": "^0.1.0",
|
|
72
72
|
"ajv": "6.15.0",
|
|
73
73
|
"fflate": "0.8.3",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@types/three": "*",
|
|
86
86
|
"@typescript/typescript6": "6.0.2",
|
|
87
|
+
"playwright": "1.65.0",
|
|
87
88
|
"sharp": "0.35.5",
|
|
88
89
|
"vite": "8.3.0"
|
|
89
90
|
},
|
|
@@ -91,6 +92,9 @@
|
|
|
91
92
|
"@types/three": {
|
|
92
93
|
"optional": true
|
|
93
94
|
},
|
|
95
|
+
"playwright": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
94
98
|
"sharp": {
|
|
95
99
|
"optional": true
|
|
96
100
|
}
|
|
@@ -730,6 +734,7 @@
|
|
|
730
734
|
"./boot/prefetchQuota": "./src/client/engine/boot/prefetchQuota.ts",
|
|
731
735
|
"./boot/readContentResponse": "./src/client/engine/boot/readContentResponse.ts",
|
|
732
736
|
"./boot/contentRead": "./src/client/engine/boot/contentRead.ts",
|
|
737
|
+
"./boot/downloadGiveUp": "./src/client/engine/boot/downloadGiveUp.ts",
|
|
733
738
|
"./sim/readiness": "./src/shared/engine/sim/readiness.ts",
|
|
734
739
|
"./sim/shore": "./src/shared/engine/sim/shore.ts",
|
|
735
740
|
"./physics/readinessWalls": "./src/shared/engine/physics/readinessWalls.ts",
|
|
@@ -819,6 +824,9 @@
|
|
|
819
824
|
"./game/population/perchBody": "./src/server/game/population/perchBody.ts",
|
|
820
825
|
"./game/population/productCreatures": "./src/client/game/population/productCreatures.ts",
|
|
821
826
|
"./game/quest/ledger": "./src/shared/game/quest/ledger.ts",
|
|
827
|
+
"./game/ledger": "./src/shared/game/ledger.ts",
|
|
828
|
+
"./game/grid/cellHome": "./src/server/game/grid/cellHome.ts",
|
|
829
|
+
"./game/loot/platformCatalogue": "./src/shared/game/loot/platformCatalogue.ts",
|
|
822
830
|
"./game/quest/legacyRecords": "./src/shared/game/quest/legacyRecords.ts",
|
|
823
831
|
"./game/shardfile/pageWater": "./src/client/game/shardfile/pageWater.ts",
|
|
824
832
|
"./game/shardfile/pagePreparation": "./src/client/game/shardfile/pagePreparation.ts",
|
package/scripts/apfs-clone.mjs
CHANGED
|
@@ -48,10 +48,11 @@ function copyPair(source,target){
|
|
|
48
48
|
* Clone each `[source, target]` pair. Returns `clone` when every pair is an APFS clone, `copy` when some were copied.
|
|
49
49
|
* Throws when a source is a link, missing or neither a file nor a directory, or a target exists; a pair cloned before
|
|
50
50
|
* the failure stays.
|
|
51
|
-
*
|
|
51
|
+
* `copy:false` refuses unsupported cloning instead of allocating a full copy.
|
|
52
|
+
* @param {readonly (readonly [string,string])[]} pairs @param {{platform?:string,copy?:boolean}} [options]
|
|
52
53
|
* @returns {'clone'|'copy'|'none'}
|
|
53
54
|
*/
|
|
54
|
-
export function clonePaths(pairs,{platform=process.platform}={}){
|
|
55
|
+
export function clonePaths(pairs,{platform=process.platform,copy=true}={}){
|
|
55
56
|
if(pairs.length===0)return 'none';
|
|
56
57
|
let rest=pairs;
|
|
57
58
|
if(platform==='darwin'){
|
|
@@ -62,6 +63,8 @@ export function clonePaths(pairs,{platform=process.platform}={}){
|
|
|
62
63
|
if(!/Operation not supported|Cross-device link/u.test(reason))throw new Error(`clonefile: ${reason}`);
|
|
63
64
|
rest=pairs.filter(([,target])=>{try{lstatSync(target);return false;}catch{return true;}});
|
|
64
65
|
}
|
|
66
|
+
if(!copy&&rest.length>0)throw new Error('clonefile unavailable; copy disabled');
|
|
67
|
+
if(!copy)return 'clone';
|
|
65
68
|
for(const [source,target] of rest)copyPair(source,target);
|
|
66
69
|
return 'copy';
|
|
67
70
|
}
|
|
@@ -39,11 +39,14 @@ const readTitleRows = (outDir: string): readonly TitleManifest[] => {
|
|
|
39
39
|
};
|
|
40
40
|
const hash8 = (bytes: Uint8Array): string => createHash('sha256').update(bytes).digest('hex').slice(0, 8);
|
|
41
41
|
/** A title row from a shard's discovery document: `home` is an origin for a shard cooked to R2 (J138). */
|
|
42
|
-
export function titleRowOf(bytes: Uint8Array, home = ''): TitleManifest {
|
|
42
|
+
export function titleRowOf(bytes: Uint8Array, home = '', resourceSlug?: string): TitleManifest {
|
|
43
43
|
const {data} = JSON.parse(new TextDecoder().decode(bytes)) as {readonly data: TitleManifest};
|
|
44
|
-
const
|
|
44
|
+
const base = home.replace(/\/$/u, ''), from = `/shardfiles/${data.slug}/`, to = `/shardfiles/${resourceSlug ?? data.slug}/`;
|
|
45
|
+
// A stored cook serves blobs under its canonical identity (template),
|
|
46
|
+
// while an older discovery can still name its authored folder (_template).
|
|
47
|
+
const at = (url: string): string => (url.startsWith(from) ? `${base}${to}${url.slice(from.length)}` : url.startsWith('/shardfiles/') ? `${base}${url}` : url);
|
|
45
48
|
const {thumb, portrait, landscape} = data.card;
|
|
46
|
-
return {...titleMetadata(data), card: {thumb: at(thumb), portrait: at(portrait), landscape: at(landscape)}, discovery: `${
|
|
49
|
+
return {...titleMetadata(data), ...(data.shardfile === undefined ? {} : {shardfile: at(data.shardfile)}), card: {thumb: at(thumb), portrait: at(portrait), landscape: at(landscape)}, discovery: `${base}/shardfiles/${data.slug}/discovery.json?v=${hash8(bytes)}`};
|
|
47
50
|
}
|
|
48
51
|
/** Every built product's title row, in title order. */
|
|
49
52
|
export function productTitleRows(products: string, outDir?: string): readonly TitleManifest[] {
|
|
@@ -141,14 +144,42 @@ export function addCookedShards(outDir: string, shards: readonly CookedShard[],
|
|
|
141
144
|
writeFileSync(serverFile, JSON.stringify(servers));
|
|
142
145
|
}
|
|
143
146
|
html = html.replace(expression, () => `<script type="application/json" id="boot-module-files">${JSON.stringify(bank).replaceAll('<', String.raw`\u003c`)}</script>`);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
writeFileSync(file, appendValidationVerdicts(html, verdicts));
|
|
148
|
+
const added = shards.flatMap(row => {
|
|
149
|
+
if (row.discovery === undefined) return [];
|
|
150
|
+
const stored = home?.shards.includes(row.slug) === true;
|
|
151
|
+
return [titleRowOf(row.discovery, stored ? home.base : '', stored ? row.slug : undefined)];
|
|
152
|
+
});
|
|
149
153
|
if (added.length > 0) writeTitleRows(outDir, [...readTitleRows(outDir).filter(row => !added.some(next => next.slug === row.slug)), ...added]);
|
|
150
154
|
}
|
|
151
155
|
|
|
156
|
+
/** The verdict array shares a script with build labels and other stamps.
|
|
157
|
+
* Find its JSON boundary without consuming or executing those assignments. */
|
|
158
|
+
export function appendValidationVerdicts(html: string, verdicts: readonly unknown[]): string {
|
|
159
|
+
const marker = 'globalThis.__WS_SHARDFILE_VERDICTS__=', start = html.indexOf(marker);
|
|
160
|
+
if (start === -1) throw new Error('Missing validation verdicts');
|
|
161
|
+
const from = start + marker.length;
|
|
162
|
+
let depth = 0, quoted = false, escaped = false;
|
|
163
|
+
for (let at = from; at < html.length; at++) {
|
|
164
|
+
const char = html[at];
|
|
165
|
+
if (quoted) {
|
|
166
|
+
if (escaped) escaped = false;
|
|
167
|
+
else if (char === '\\') escaped = true;
|
|
168
|
+
else if (char === '"') quoted = false;
|
|
169
|
+
} else if (char === '"') quoted = true;
|
|
170
|
+
else if (char === '[' || char === '{') depth++;
|
|
171
|
+
else if (char === ']' || char === '}') {
|
|
172
|
+
depth--;
|
|
173
|
+
if (depth === 0) {
|
|
174
|
+
const before: unknown = JSON.parse(html.slice(from, at + 1));
|
|
175
|
+
if (!Array.isArray(before)) throw new Error('Invalid validation verdicts');
|
|
176
|
+
return html.slice(0, from) + JSON.stringify([...before, ...verdicts]).replaceAll('<', String.raw`\u003c`) + html.slice(at + 1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
throw new Error('Unclosed validation verdicts');
|
|
181
|
+
}
|
|
182
|
+
|
|
152
183
|
/** What a page takes on trust for one tarball: a verdict is earned here, by this build's format validator, whichever validator
|
|
153
184
|
* stamped its receipt, because a page trusts it by its index hash. */
|
|
154
185
|
export async function productVerdict(tarball: Uint8Array, out: string): Promise<{readonly verdict: unknown; readonly discovery?: Uint8Array}> {
|
|
@@ -8,6 +8,7 @@ import { ASSET_CACHE_NAME } from '../../src/client/engine/pwa/cacheNames';
|
|
|
8
8
|
import { serverPackBookPath } from '../../src/shared/game/shardfile/serverPack';
|
|
9
9
|
import { packsBookPath } from '../../src/shared/game/shardfile/spawnManifest';
|
|
10
10
|
import { titleAssetURLs } from '../title-assets.mjs';
|
|
11
|
+
import { staticAssetHashes, contentNamed } from './assetHashes';
|
|
11
12
|
import { documentIsolation } from './isolation.mjs';
|
|
12
13
|
import { writtenBundle, type EmittedFile } from './writtenBundle';
|
|
13
14
|
|
|
@@ -101,11 +102,13 @@ export async function serviceWorkerCore(bundle: Readonly<Record<string, EmittedF
|
|
|
101
102
|
content = [...new Set(moved)].map(path => new URL(`.${path}`, base).href);
|
|
102
103
|
files = files.filter(path => !isContentPath(path)); shellList = shellList.filter(path => !isContentPath(path));
|
|
103
104
|
}
|
|
105
|
+
const versions = base === '' ? {} : Object.fromEntries(Object.entries(staticAssetHashes(root)).filter(([path]) => isContentPath(path) && !contentNamed(path)));
|
|
106
|
+
digest.update(JSON.stringify(versions));
|
|
104
107
|
const build = `${buildId}-${digest.digest('hex').slice(0, 10)}`;
|
|
105
108
|
const core = source.replaceAll('__BUILD_ID__', build).replaceAll('__ASSET_CACHE__', ASSET_CACHE_NAME)
|
|
106
109
|
.replace(/['"]__FILES__['"]/u, () => JSON.stringify(JSON.stringify(files)))
|
|
107
110
|
.replace(/['"]__SHELL_FILES__['"]/u, () => JSON.stringify(JSON.stringify(shellList)))
|
|
108
|
-
.replace(/['"]__CONTENT__['"]/u, () => JSON.stringify(JSON.stringify({ base, files: content })))
|
|
111
|
+
.replace(/['"]__CONTENT__['"]/u, () => JSON.stringify(JSON.stringify({ base, files: content, ...base === '' ? {} : {versions} })))
|
|
109
112
|
.replace(/['"]__DOCUMENT__['"]/u, () => JSON.stringify(html))
|
|
110
113
|
// PZ12: the page origin's COOP and COEP on the baked document, so a load the worker serves is isolated like the network's
|
|
111
114
|
.replace(/['"]__DOCUMENT_HEADERS__['"]/u, () => JSON.stringify(JSON.stringify(documentHeaders)));
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// joins before it packages, and the jobs that serve the whole game from dist (nightly, hover contract) join too.
|
|
7
7
|
//
|
|
8
8
|
// node scripts/app-build/splitOutput.mjs [dist] [--join]
|
|
9
|
-
import {existsSync, lstatSync, mkdirSync, readdirSync, renameSync, rmSync, rmdirSync, writeFileSync} from 'node:fs';
|
|
9
|
+
import {existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, rmdirSync, writeFileSync} from 'node:fs';
|
|
10
10
|
import {dirname, join, resolve} from 'node:path';
|
|
11
11
|
import {pathToFileURL} from 'node:url';
|
|
12
12
|
import {carriedPaths, classify, shardNames} from '../page-size.mjs';
|
|
@@ -38,12 +38,21 @@ function files(root) {
|
|
|
38
38
|
|
|
39
39
|
/** Move each path from one root to the other, then drop the folders the moves emptied.
|
|
40
40
|
* @param {string} from @param {string} to @param {readonly {path: string, bytes: number}[]} rows */
|
|
41
|
-
function move(from, to, rows) {
|
|
41
|
+
function move(from, to, rows, reuse = false) {
|
|
42
42
|
for (const {path} of rows) {
|
|
43
|
-
const target = join(to, path);
|
|
44
|
-
|
|
43
|
+
const source = join(from, path), target = join(to, path);
|
|
44
|
+
let old;
|
|
45
|
+
try { old = lstatSync(target); } catch { /* A new generated path. */ }
|
|
46
|
+
if (old) {
|
|
47
|
+
if (!reuse) throw new Error(`splitOutput: ${target} already exists`);
|
|
48
|
+
const next = lstatSync(source);
|
|
49
|
+
const same = old.isFile() && next.isFile() && old.size === next.size && readFileSync(target).equals(readFileSync(source))
|
|
50
|
+
|| old.isSymbolicLink() && next.isSymbolicLink() && readlinkSync(target) === readlinkSync(source);
|
|
51
|
+
if (same) { rmSync(source); continue; }
|
|
52
|
+
rmSync(target, {recursive: true, force: true});
|
|
53
|
+
}
|
|
45
54
|
mkdirSync(dirname(target), {recursive: true});
|
|
46
|
-
renameSync(
|
|
55
|
+
renameSync(source, target);
|
|
47
56
|
}
|
|
48
57
|
const folders = new Set(rows.flatMap(({path}) => path.split('/').slice(0, -1).map((_, at, parts) => parts.slice(0, at + 1).join('/'))));
|
|
49
58
|
for (const folder of [...folders].sort((a, b) => b.length - a.length)) {
|
|
@@ -61,22 +70,35 @@ function disjoint(root, content) {
|
|
|
61
70
|
if (root === content || content.startsWith(`${root}/`) || root.startsWith(`${content}/`)) throw new Error(`splitOutput: ${content} and ${root} overlap`);
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
/** Split a freshly built page.
|
|
73
|
+
/** Split a freshly built page. Unchanged content retains its inode/APFS blocks; stale paths are replaced. An interrupted split
|
|
65
74
|
* left (the page still holds SPLITTING) is kept and finished. A page that holds no content is already split.
|
|
66
75
|
* @param {string} dist @param {string} [content] @returns {{files: number, bytes: number}} */
|
|
67
76
|
export function splitOutput(dist, content = contentDirOf(dist)) {
|
|
68
77
|
const root = resolve(dist), target = resolve(content), mark = join(root, SPLITTING);
|
|
69
78
|
disjoint(root, target);
|
|
79
|
+
try {
|
|
80
|
+
if (!lstatSync(target).isDirectory() || lstatSync(target).isSymbolicLink()) throw new Error('splitOutput: content root must be a real directory');
|
|
81
|
+
} catch (error) { if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) throw error; }
|
|
70
82
|
if (!existsSync(join(root, 'index.html'))) throw new Error(`splitOutput: ${root} holds no index.html; give a built page`);
|
|
71
83
|
// a kept build's content (MF2 carry, PZ5: an unmarked build reads it from the page) stays on the page until it ages out
|
|
72
84
|
const carried = carriedPaths(root)?.paths ?? new Set();
|
|
73
|
-
const shards = shardNames(root), rows = files(root).filter(row => row.path !== SPLITTING && !carried.has(row.path) && isContent(row.path, shards));
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
const shards = shardNames(root), rows = files(root).filter(row => row.path !== SPLITTING && row.path !== `${SPLITTING}.tmp` && !carried.has(row.path) && isContent(row.path, shards));
|
|
86
|
+
// The full desired path list makes pruning resumable too. An empty mark
|
|
87
|
+
// from the previous implementation already had its old target removed.
|
|
88
|
+
if (rows.length > 0 && !existsSync(mark)) {
|
|
89
|
+
writeFileSync(`${mark}.tmp`, JSON.stringify(rows.map(row => row.path)));
|
|
90
|
+
renameSync(`${mark}.tmp`, mark);
|
|
91
|
+
}
|
|
92
|
+
if (existsSync(mark) && readFileSync(mark, 'utf8') !== '') {
|
|
93
|
+
let paths;
|
|
94
|
+
try { paths = JSON.parse(readFileSync(mark, 'utf8')); } catch { throw new Error('splitOutput: invalid interrupted path list; inspect output and remove .splitting to restart'); }
|
|
95
|
+
if (!Array.isArray(paths) || !paths.every(path => typeof path === 'string')) throw new Error('splitOutput: invalid interrupted path list; inspect output and remove .splitting to restart');
|
|
96
|
+
const desired = new Set(paths);
|
|
97
|
+
for (const {path} of files(target)) if (!desired.has(path)) rmSync(join(target, path));
|
|
77
98
|
}
|
|
78
|
-
const moved = move(root, target, rows);
|
|
99
|
+
const moved = move(root, target, rows, true);
|
|
79
100
|
rmSync(mark, {force: true});
|
|
101
|
+
rmSync(`${mark}.tmp`, {force: true});
|
|
80
102
|
return moved;
|
|
81
103
|
}
|
|
82
104
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// card, so they take `client`. The warm visit must fetch its route's own phone manifest; a later visit may read it from the
|
|
11
11
|
// page's store and fetch none, so it is judged against the manifest its warm visit fetched.
|
|
12
12
|
// `cross` (preview only) is a player's way into an Open Plot: Shard select, its deck neighbour (CROSS_IN), ENTER WORLD, then a
|
|
13
|
-
// walk across the road into the plot through the in-page server.
|
|
13
|
+
// walk across the road into the plot through the in-page server. The production path now uses zone entry; this historical
|
|
14
14
|
// local build's world door refuses it, so only preview runs it. Its sound window is the first 10 s after the crossing, and the
|
|
15
15
|
// plot's own score must become the music's score in it; its manifest is the neighbour's grid one.
|
|
16
16
|
//
|
|
@@ -20,9 +20,12 @@ export function spelledPathFailures(files, read) {
|
|
|
20
20
|
const failures = [], paths = [...files.keys()], folders = new Set(['src']);
|
|
21
21
|
for (const path of paths) for (let at = path.indexOf('/'); at !== -1; at = path.indexOf('/', at + 1)) folders.add(path.slice(0, at));
|
|
22
22
|
for (const file of paths) {
|
|
23
|
-
const isolated = /^src\/(engine|game)\/isolated-[^/]+\.test\.ts$/u.exec(file)
|
|
24
|
-
if (isolated !==
|
|
25
|
-
|
|
23
|
+
const isolated = /^src\/(client|cook|server|shared)\/(engine|game)\/isolated-[^/]+\.test\.ts$/u.exec(file);
|
|
24
|
+
if (isolated !== null) for (const [, rel] of read(file).matchAll(ROOTED)) {
|
|
25
|
+
const [side, ...rest] = rel.split('/');
|
|
26
|
+
const target = side === undefined || rest.length === 0 ? `src/${isolated[1]}/${isolated[2]}/${rel}` : `src/${side}/${isolated[2]}/${rest.join('/')}`;
|
|
27
|
+
if (!exists(files, folders, target)) failures.push(`${file}: no module at ${target}: the isolated test spells a side the file left`);
|
|
28
|
+
}
|
|
26
29
|
if (/^scripts\/.*\.[cm]?[jt]s$/u.test(file) && !file.includes('.test.')) for (const match of read(file).matchAll(EMITTED))
|
|
27
30
|
if (!exists(files, folders, `src/${match[2]}/${match[3]}`.replace(/[./]+$/u, ''))) failures.push(`${file}: no module at src/${match[2]}/${match[3]}: an emitted import spells a side the file left`);
|
|
28
31
|
if (MAP_FILE.test(file)) for (const input of JSON.parse(read(file)).inputs ?? []) {
|
package/scripts/ci-pack.mjs
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
// in its job. With more than one job it starts the last job (EV3), so it never lands behind job 1's
|
|
16
16
|
// shards (that made job 1 the long pole, p50 12.6 min against 9.1); the other units pack over every job,
|
|
17
17
|
// and the last takes shards once it is the least loaded (EV3b: alone it ran 5.2-8.1 min against 9.6-11.3).
|
|
18
|
-
// boundaries engine-boundaries' push half, cook-to-play on Ring 1's products
|
|
18
|
+
// boundaries engine-boundaries' push half, cook-to-play on Ring 1's products; blocking after TS15's green soak.
|
|
19
19
|
// It needs the full pins (its Ring 1 cook reads raw tarballs only `pnpm pins` fetches, run 43303094170),
|
|
20
20
|
// then installs Ring 1's and Chromium itself and builds its own tree, so it needs no other unit: ci.yml
|
|
21
|
-
// runs it as its own
|
|
21
|
+
// runs it as its own blocking job from t=0 (TS15/EV3b; after products in job 6 it took that job to 13.7
|
|
22
22
|
// min). Packed with products, it still follows products into products' job
|
|
23
23
|
// Phases run in order: before pins (up to C units at once), `pnpm pins && pnpm gen:inputs`, the shards ONE AT A TIME,
|
|
24
24
|
// then products and boundaries. A shard has the runner to itself, as its plan assumes: two at once on the 4-vCPU runner
|
|
@@ -46,7 +46,7 @@ const FOLLOWS=Object.freeze(/** @type {Record<string,string>} */({boundaries:'pr
|
|
|
46
46
|
* 2026-11-12): that job then packs like the rest, so the shards fill the 2-4 min products leaves free there. Alone it ran
|
|
47
47
|
* 5.2-8.1 min while jobs 1-5 ran 9.6-11.3 (runs 43313302390 .. 43315974456). Its shards still run before products. */
|
|
48
48
|
const OWN_JOB=new Set(['products']);
|
|
49
|
-
const NONBLOCKING=new Set(['quarantine'
|
|
49
|
+
const NONBLOCKING=new Set(['quarantine']);
|
|
50
50
|
const SHARD_LIMIT_MS=300_000;
|
|
51
51
|
/** @typedef {{name:string,phase:number,seconds:number,blocking:boolean}} Unit */
|
|
52
52
|
/** @typedef {{name:string,phase:number,blocking:boolean,started:number,charged:number,ended:number,seconds:number,code:number}} UnitResult */
|
|
@@ -164,7 +164,7 @@ export async function committedFastChecks(root,base,tip,phase,paths) {
|
|
|
164
164
|
const policy=json(view,'lint/ratchet.json');
|
|
165
165
|
if(view.files.has('scripts/check-spelled-paths.mjs')) {
|
|
166
166
|
const {spelledPathFailures}=/** @type {typeof import('./check-spelled-paths.mjs')} */(await module('scripts/check-spelled-paths.mjs'));
|
|
167
|
-
view.prime([...view.files.keys()].filter(path=>/^src\/(?:engine|game)\/isolated-[^/]+\.test\.ts$|^scripts\/.*\.[cm]?[jt]s$|^src\/shards\/[^/]+\/(?:data|look)\/map\.json$/u.test(path)));
|
|
167
|
+
view.prime([...view.files.keys()].filter(path=>/^src\/(?:client|cook|server|shared)\/(?:engine|game)\/isolated-[^/]+\.test\.ts$|^scripts\/.*\.[cm]?[jt]s$|^src\/shards\/[^/]+\/(?:data|look)\/map\.json$/u.test(path)));
|
|
168
168
|
failures.push(...spelledPathFailures(view.files,path=>view.read(path).toString('utf8')));
|
|
169
169
|
}
|
|
170
170
|
// The folder rule of check-paths, over committed paths: a new file in a shard's root needs the layout's word.
|
|
@@ -237,7 +237,7 @@ export async function committedFastChecks(root,base,tip,phase,paths) {
|
|
|
237
237
|
} else if(phase==='census') {
|
|
238
238
|
// The census ratchets of CI's prepare job, over the tip's blobs, last so they spend only what the budget leaves.
|
|
239
239
|
// One that runs out of time is CI's, not a verdict.
|
|
240
|
-
if(view.files.has('scripts/sort-sides.mjs')&&view.files.has('scripts/check-sim-players.mjs')&&paths.some(path=>/^(?:src\/(?:engine|game|
|
|
240
|
+
if(view.files.has('scripts/sort-sides.mjs')&&view.files.has('scripts/check-sim-players.mjs')&&paths.some(path=>/^(?:src\/(?:client|cook|server|shared)\/(?:engine|game|host)|lint)\//u.test(path))) {
|
|
241
241
|
const census=async(/** @type {string} */ script)=>{
|
|
242
242
|
const child=spawn(process.execPath,[resolve(root,'scripts/sort-sides.mjs'),'--view',tip,script],{cwd:root,timeout:25_000,stdio:['ignore','pipe','pipe']});
|
|
243
243
|
const closed=once(child,'close'),[stdout,stderr]=await Promise.all([text(child.stdout),text(child.stderr)]);
|
|
@@ -10,10 +10,21 @@ const index=Number(process.env.WS_CI_SHARD),shard=plan.shards[index-1];
|
|
|
10
10
|
if(shard===undefined)throw new Error('Missing matrix shard');
|
|
11
11
|
const started=Date.now();let failed=false;
|
|
12
12
|
mkdirSync('tmp/engine-ci',{recursive:true});
|
|
13
|
+
// TS8: warm the selected browser once outside the file's native deadlines.
|
|
14
|
+
// Its I/O remains charged to this shard, including the final wall check.
|
|
15
|
+
const warmStarted=Date.now();
|
|
16
|
+
const chrome=shard.native.includes('test/tooling/parity/browser-escape.test.mjs')
|
|
17
|
+
?await import('./warm-native-chrome.mjs').then(({nativeChromeExecutable,warmNativeChrome})=>warmNativeChrome(nativeChromeExecutable())):null;
|
|
18
|
+
if(chrome!==null)console.log(JSON.stringify({preparation:'native Chrome files read',shard:index,milliseconds:Date.now()-warmStarted,bytes:chrome.bytes}));
|
|
13
19
|
for(const phase of /** @type {const} */ (['native','ordinary'])){
|
|
14
20
|
if(shard[phase].length===0)continue;
|
|
15
21
|
const report=resolve(`tmp/engine-ci/shard-${index}-${phase}.json`);
|
|
16
22
|
/** @type {NodeJS.ProcessEnv} */ const env={...process.env,WS_CI_PHASE:phase,WS_CI_TIMINGS:report};
|
|
23
|
+
if(chrome!==null){
|
|
24
|
+
env.WS_CI_NATIVE_CHROME_WARM=chrome.executable;
|
|
25
|
+
if(phase==='native')env.CHROME_PATH=chrome.executable;
|
|
26
|
+
}
|
|
27
|
+
else Reflect.deleteProperty(env,'WS_CI_NATIVE_CHROME_WARM');
|
|
17
28
|
if(plan.ring==='1')env.WILDSHARD_RING='1';else Reflect.deleteProperty(env,'WILDSHARD_RING');
|
|
18
29
|
const result=spawnSync('python3',['scripts/heavy-lane.py','full-test','--',process.execPath,'scripts/vitest-tmp.ts','run','--config','scripts/engine-ci.config.ts','--reporter=default','--reporter=./scripts/engine-ci-budget.ts'],{env,stdio:'inherit',timeout:300000});
|
|
19
30
|
if(result.error!==undefined||result.status!==0)failed=true;
|
|
@@ -41,7 +41,7 @@ export const CASES = Object.freeze([
|
|
|
41
41
|
{ mode: '19b', id: 'resuming/blocked', parent: 'resuming', owner: 'FM4', phase: 'play', screen: 'resuming-blocked', inject: 'an action after 35 s down', recover: 'closes on the first frame', blocked: 'the harness drives no in-world tap under a banner yet' },
|
|
42
42
|
{ mode: '20', id: 'lost', owner: 'FM4', phase: 'play', screen: 'lost', inject: 'drop, then refuse-upgrade 503 for 122 s', recover: 'heal, Try again: seated', run: 'socketDown' },
|
|
43
43
|
{ mode: '21', id: 'slow', owner: 'FM4b', phase: 'play', screen: 'slow', inject: 'delay-frames 160 ms both ways (RTT over 250 ms)', recover: 'heal: clears after 10 good seconds', run: 'linkQuality' },
|
|
44
|
-
{ mode: '22', id: 'lossy', owner: 'FM4b', phase: 'play', screen: 'lossy', inject: 'delay-frames 20 ms
|
|
44
|
+
{ mode: '22', id: 'lossy', owner: 'FM4b', phase: 'play', screen: 'lossy', inject: 'downstream delay-frames swinging 20 ms / 420 ms every 2.5 s (RTT span over 250 ms)', recover: 'heal: clears after 10 good seconds', run: 'linkQuality' },
|
|
45
45
|
{ mode: '23', id: 'version-skew', owner: 'FM5', phase: 'play', screen: 'version-skew', inject: 'socket close 4000 (reload) on every connection', recover: 'one reload, then the page', run: 'socketDown' },
|
|
46
46
|
{ mode: '24', id: 'too-old', owner: 'FM5b', phase: 'play', screen: 'too-old-warning', inject: 'verified retention metadata excluding this build', recover: 'next load: too-old page', blocked: 'FM7 retention metadata not built' },
|
|
47
47
|
{ mode: '25', id: 'full', owner: 'FM4', phase: 'play', screen: 'full', inject: 'socket close 4002 on every connection for 3 s (FM7b queue numbers not built)', recover: 'heal: seated on the next 30 s retry', run: 'socketDown' },
|
|
@@ -121,7 +121,9 @@ try {
|
|
|
121
121
|
if (init !== undefined) await context.addInitScript(init);
|
|
122
122
|
const page = await context.newPage();
|
|
123
123
|
page.on('pageerror', error => { errors.push(error.message.slice(0, 240)); });
|
|
124
|
-
page.on('console', line => { if (line.type() === 'error') errors.push(line.text().slice(0, 240)); });
|
|
124
|
+
page.on('console', line => { if (line.type() === 'error') errors.push(line.text().slice(0, 240)); if (process.env.FM_TRACE === '1') console.log(` [page ${line.type()}] ${line.text().slice(0, 300)}`); });
|
|
125
|
+
page.on('response', response => { if (process.env.FM_TRACE === '1' && response.status() >= 400) console.log(` [http ${String(response.status())}] ${response.url().slice(0, 200)}`); });
|
|
126
|
+
page.on('framenavigated', frame => { if (frame === page.mainFrame() && process.env.FM_TRACE === '1') console.log(` [nav] ${frame.url()}`); });
|
|
125
127
|
return { page, context, errors };
|
|
126
128
|
};
|
|
127
129
|
/** Through the Name box (if it asks) into the world, to 30 frames. @param {Entered} entered @param {number} [timeout] */
|
|
@@ -189,6 +191,18 @@ try {
|
|
|
189
191
|
};
|
|
190
192
|
/** Clicks a button on the case's screen. @param {import('playwright').Page} page @param {string} id @param {string} label */
|
|
191
193
|
const press = (page, id, label) => page.locator(`[data-failmode~="${id}"] button`, { hasText: label }).first().click({ timeout: 5000 });
|
|
194
|
+
/** WebKit's setOffline (Playwright) leaves loopback sockets up, so a WebKit page "offline" kept playing on the rig (opus-fm1's mode 1).
|
|
195
|
+
* There the proxy cuts the world door too while the browser is offline: a live link drops and new upgrades are refused. Labelled in
|
|
196
|
+
* the receipt as `loopbackCut`; Chromium needs none (its offline mode closes the socket itself). @param {boolean} live */
|
|
197
|
+
const cutLoopback = async live => {
|
|
198
|
+
if (engine !== 'webkit') return false;
|
|
199
|
+
if (live) {
|
|
200
|
+
const before = await control(); await arm('webkit-offline', [{ route: 'socket', kind: 'drop-after', afterMs: 0 }]);
|
|
201
|
+
for (let tries = 0; tries < 40 && await matchedSince(before, 'socket') === 0; tries++) await sleep(100);
|
|
202
|
+
}
|
|
203
|
+
await arm('webkit-offline-held', [{ route: 'socket', kind: 'refuse-upgrade', code: 503 }]);
|
|
204
|
+
return true;
|
|
205
|
+
};
|
|
192
206
|
|
|
193
207
|
/** @type {Record<string, (item: Case) => Promise<Result>>} */
|
|
194
208
|
const runners = {
|
|
@@ -317,12 +331,13 @@ try {
|
|
|
317
331
|
try {
|
|
318
332
|
await page.goto(URL_PLAY); await intoWorld(entered);
|
|
319
333
|
const started = Date.now(); await context.setOffline(true);
|
|
334
|
+
const loopbackCut = await cutLoopback(true), injection = { setOffline: true, ...loopbackCut ? { loopbackCut } : {} };
|
|
320
335
|
const seen = await screen(page, item.screen, 8000, started), shot = seen === null ? undefined : await shoot(page, item.id, 'card');
|
|
321
|
-
await sleep(2000); await context.setOffline(false);
|
|
336
|
+
await sleep(2000); await context.setOffline(false); if (loopbackCut) await heal();
|
|
322
337
|
const result = await judged(seen, item, page);
|
|
323
338
|
const back = result.outcome === 'pass' && await recovered(page, 30_000);
|
|
324
|
-
return result.outcome !== 'pass' ? { ...result, injection
|
|
325
|
-
} finally { await context.setOffline(false).catch(() => undefined); await entered.context.close(); }
|
|
339
|
+
return result.outcome !== 'pass' ? { ...result, injection } : back ? { ...result, ...shot === undefined ? {} : { shot }, injection, recovery: 'online: a frame, no card' } : { outcome: 'ui-fail', reason: 'no recovery online', seen, notes: await onScreen(page) };
|
|
340
|
+
} finally { await context.setOffline(false).catch(() => undefined); await heal().catch(() => undefined); await entered.context.close(); }
|
|
326
341
|
},
|
|
327
342
|
// J298: a world the device holds loads offline and says so
|
|
328
343
|
offlineLaunch: async item => {
|
|
@@ -337,14 +352,15 @@ try {
|
|
|
337
352
|
if (!controlled) return { outcome: 'unsupported', reason: `${engine}: no controlling service worker after the warm visit, so nothing can launch offline` };
|
|
338
353
|
await sleep(3000);
|
|
339
354
|
await context.setOffline(true);
|
|
355
|
+
const loopbackCut = await cutLoopback(false), injection = { warmed: true, setOffline: true, ...loopbackCut ? { loopbackCut } : {} };
|
|
340
356
|
const started = Date.now(); await page.goto(URL_PLAY).catch(() => undefined);
|
|
341
357
|
await intoWorld(entered, 60_000).catch(() => undefined);
|
|
342
358
|
const seen = await screen(page, item.screen, 15_000, started), shot = seen === null ? await shoot(page, item.id, 'missing') : await shoot(page, item.id, 'card');
|
|
343
|
-
await context.setOffline(false);
|
|
359
|
+
await context.setOffline(false); if (loopbackCut) await heal();
|
|
344
360
|
const result = await judged(seen, item, page);
|
|
345
|
-
if (result.outcome !== 'pass') return { ...result, shot };
|
|
346
|
-
return await recovered(page, 45_000) ? { ...result, shot, injection
|
|
347
|
-
} finally { await context.setOffline(false).catch(() => undefined); await entered.context.close(); }
|
|
361
|
+
if (result.outcome !== 'pass') return { ...result, shot, injection };
|
|
362
|
+
return await recovered(page, 45_000) ? { ...result, shot, injection, recovery: 'online: a frame, no card' } : { outcome: 'ui-fail', reason: 'no recovery online', seen, shot, notes: await onScreen(page) };
|
|
363
|
+
} finally { await context.setOffline(false).catch(() => undefined); await heal().catch(() => undefined); await entered.context.close(); }
|
|
348
364
|
},
|
|
349
365
|
// the page frozen (CDP), with or without a visibility change
|
|
350
366
|
freeze: async item => {
|
|
@@ -372,8 +388,14 @@ try {
|
|
|
372
388
|
try {
|
|
373
389
|
await page.goto(URL_PLAY); await intoWorld(entered);
|
|
374
390
|
const before = await control(), started = Date.now();
|
|
375
|
-
|
|
376
|
-
|
|
391
|
+
// Mode 22 (opus-of18): the proxy keeps a socket's frames in order, so per-frame jitter on a 60 Hz stream queues every frame behind
|
|
392
|
+
// the slowest and the pong RTT sits flat near the jitter's top (seen: no screen under ±200 ms). An unstable link is one whose
|
|
393
|
+
// delay swings: the driver moves the downstream delay between 20 ms and 420 ms every 2.5 s, so the last five pongs span over 250 ms.
|
|
394
|
+
const waving = { on: item.id === 'lossy' };
|
|
395
|
+
const wave = (async () => { for (let high = true; waving.on; high = !high) { await arm(item.id, [{ route: 'socket', kind: 'delay-frames', direction: 'down', ms: high ? 420 : 20, jitterMs: 0, seed: 7 }]); await sleep(2500); } })();
|
|
396
|
+
if (item.id === 'slow') await arm(item.id, [{ route: 'socket', kind: 'delay-frames', direction: 'both', ms: 160, jitterMs: 0, seed: 7 }]);
|
|
397
|
+
const seen = await screen(page, item.screen, 15_000, started).finally(() => { waving.on = false; }), shot = seen === null ? undefined : await shoot(page, item.id, 'chip');
|
|
398
|
+
await wave;
|
|
377
399
|
const injection = { socketMatches: await matchedSince(before, 'socket') };
|
|
378
400
|
await heal();
|
|
379
401
|
if (injection.socketMatches === 0) return { outcome: 'harness-fail', reason: 'the delay matched no frame', injection };
|
|
@@ -439,7 +461,9 @@ try {
|
|
|
439
461
|
const result = await judged(seen, item, page);
|
|
440
462
|
if (result.outcome !== 'pass') return { ...result, injection, shot };
|
|
441
463
|
// the budgeted retries were spent before the line showed: healed, the card's Retry is the player's way on
|
|
442
|
-
|
|
464
|
+
// mode 36's page covers the card: its Try again is the same RETRY
|
|
465
|
+
const retry = item.id === 'download-failed' ? page.locator('[data-failmode~="download-failed"] button', { hasText: 'Try again' }).first() : page.locator('.ws-load-retry:visible').first();
|
|
466
|
+
const pressed = await retry.click({ timeout: 5000 }).then(() => true, () => false);
|
|
443
467
|
await intoWorld(entered, 90_000).catch(() => undefined);
|
|
444
468
|
return await recovered(page, 30_000) ? { ...result, injection, shot, recovery: pressed ? 'heal, Retry: the world loads' : 'heal: the world loads' } : { outcome: 'ui-fail', reason: 'no recovery after heal', seen, injection, shot, notes: await onScreen(page) };
|
|
445
469
|
} finally { await heal(); await entered.context.close(); }
|