@wildshard/engine 0.1.18 → 0.1.20
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/budgets/shard-size-baseline.json +10 -4
- package/index.html +6 -4
- package/lint/engine-sides.json +18 -0
- package/lint/ratchet.json +0 -68
- package/lint/ratchet.mjs +1 -4
- package/package.json +19 -15
- package/scripts/agent-sync.mjs +27 -8
- package/scripts/app-build/appCook.ts +8 -2
- package/scripts/app-build/catalogue.ts +10 -7
- package/scripts/app-build/gen.ts +33 -2
- package/scripts/app-build/isolation.d.mts +10 -0
- package/scripts/app-build/isolation.mjs +47 -0
- package/scripts/app-build/outputProducts.mjs +4 -0
- package/scripts/app-build/previousDeploy.d.mts +2 -0
- package/scripts/app-build/previousDeploy.mjs +10 -1
- package/scripts/app-build/serviceWorker.ts +10 -3
- package/scripts/app-build/splitOutput.mjs +4 -2
- package/scripts/app-build/standaloneOutput.d.mts +1 -1
- package/scripts/app-build/standaloneOutput.mjs +5 -3
- package/scripts/app-build/titlePreloads.d.mts +8 -0
- package/scripts/app-build/titlePreloads.mjs +69 -0
- package/scripts/app-build/worldMapAtlas.ts +10 -6
- package/scripts/app-build-pipeline.mjs +31 -3
- package/scripts/built-product.mjs +1 -1
- package/scripts/cell-mem-bench.mjs +83 -23
- package/scripts/check-custom-sections-zero.mjs +1 -1
- package/scripts/check-devserver.mjs +2 -0
- package/scripts/check-models.mjs +2 -0
- package/scripts/check-paths.allow.json +0 -115
- package/scripts/check-paths.mjs +2 -2
- package/scripts/check-platform-ratchets.mjs +2 -3
- package/scripts/chromium-keychain.d.mts +1 -1
- package/scripts/ci-static.sh +1 -1
- package/scripts/committed-fast-checks.mjs +0 -2
- package/scripts/content-sw-proof.mjs +2 -1
- package/scripts/cook-worker.mjs +9 -3
- package/scripts/cook.mjs +18 -5
- package/scripts/docs-inputs-proof.mjs +6 -6
- package/scripts/e7-voice-staging-proof.mjs +1 -1
- package/scripts/gate-related-tests.mjs +1 -1
- package/scripts/git-source-view.mjs +1 -1
- package/scripts/goldens/capture.mjs +17 -5
- package/scripts/grid-crossing-nightly.mjs +59 -0
- package/scripts/grid-crossing-qa.mjs +44 -0
- package/scripts/grid-crossing-ratchet.d.mts +6 -0
- package/scripts/grid-crossing-ratchet.mjs +52 -0
- package/scripts/grid-crossing-report.mjs +122 -0
- package/scripts/grid-crossing-stages.mjs +47 -0
- package/scripts/grid-crossing-tour.mjs +284 -0
- package/scripts/grid-crossing-walk-proof.mjs +126 -17
- package/scripts/host-ruler/roots.mjs +2 -2
- package/scripts/host-ruler.d.mts +91 -0
- package/scripts/host-ruler.mjs +565 -0
- package/scripts/land.mjs +2 -1
- package/scripts/live-prepush.py +3 -5
- package/scripts/loading-flow/benchmax.mjs +37 -12
- package/scripts/loading-flow/deskbench.mjs +276 -0
- package/scripts/loading-flow/stalls.d.mts +17 -3
- package/scripts/loading-flow/stalls.mjs +82 -3
- package/scripts/look-loop/test_look_loop.py +1 -38
- package/scripts/memory-proof.mjs +61 -6
- package/scripts/mmo-bots.mjs +8 -2
- package/scripts/net-lag-proof.mjs +219 -0
- package/scripts/night-market-kit-budget.mjs +2 -2
- package/scripts/nightly-model.ts +9 -6
- package/scripts/offline-proof-rules.d.mts +2 -2
- package/scripts/offline-proof-rules.mjs +15 -4
- package/scripts/offline-proof.mjs +80 -13
- package/scripts/{shard-platform-output.mjs → output-reader.mjs} +1 -1
- package/scripts/page-release/content.d.mts +9 -1
- package/scripts/page-release/content.mjs +131 -17
- package/scripts/page-release/flow.mjs +36 -10
- package/scripts/page-release/stamp-content.mjs +24 -0
- package/scripts/page-release.mjs +28 -6
- package/scripts/page-size.mjs +2 -1
- package/scripts/parity/boot-smoke.mjs +13 -2
- package/scripts/pin-format.ts +5 -2
- package/scripts/pin-packs.ts +1 -1
- package/scripts/pins-reuse.d.mts +1 -0
- package/scripts/pins-reuse.mjs +22 -0
- package/scripts/pins.ts +4 -4
- package/scripts/precommit-checks.mjs +1 -7
- package/scripts/precommit-jobs.mjs +0 -1
- package/scripts/precommit-source.py +1 -9
- package/scripts/program-discovery.mjs +1 -1
- package/scripts/ring-cook.mjs +2 -1
- package/scripts/ring-step.ts +1 -1
- package/scripts/scratch-dir.mjs +95 -0
- package/scripts/scratch-sweep.mjs +182 -0
- package/scripts/script-scenario-metrics.mjs +1 -1
- package/scripts/shard-output-content.d.mts +1 -1
- package/scripts/shard-output-content.mjs +2 -2
- package/scripts/shard-outputs.mjs +1 -1
- package/scripts/shard-public.mjs +1 -1
- package/scripts/shard-wire-meter.mjs +24 -9
- package/scripts/side-parity.mjs +4 -2
- package/scripts/standalone-smoke.mjs +8 -3
- package/scripts/tier-textures.mjs +22 -4
- package/scripts/tile-bake-report.mjs +1 -1
- package/scripts/tile-bakes.mjs +1 -1
- package/scripts/title-assets.generated.json +2 -0
- package/scripts/tsconfig.json +2 -14
- package/scripts/vendor/basisu/LICENSE +201 -0
- package/scripts/vendor/basisu/basis_encoder.cjs +2 -0
- package/scripts/vendor/basisu/basis_encoder.wasm +0 -0
- package/scripts/vitest-push-guards.config.ts +1 -1
- package/scripts/vps/harden-apply.sh +4 -1
- package/scripts/vps/harden-prometheus.sh +179 -0
- package/scripts/vps/harden.sh +16 -0
- package/scripts/vps/rebuild.sh +18 -0
- package/scripts/vps/wildshard-config +6 -2
- package/scripts/worker-client-play.mjs +6 -2
- package/scripts/worktree-reap.mjs +59 -13
- package/scripts/worktree.mjs +19 -5
- package/src/.oxlintrc.json +3 -182
- package/src/client/app/entry.ts +10 -2
- package/src/client/engine/anim/rigParser.ts +2 -2
- package/src/client/engine/boot/bootCache.ts +2 -2
- package/src/client/engine/boot/bootTrace.ts +12 -4
- package/src/client/engine/boot/browserChunkRecovery.ts +4 -0
- package/src/client/engine/boot/clearDownloads.ts +5 -2
- package/src/client/engine/boot/contentRead.ts +11 -0
- package/src/client/engine/boot/gpuFiles.ts +4 -2
- package/src/client/engine/boot/lastEnd.ts +99 -12
- package/src/client/engine/boot/texturePack.ts +2 -2
- package/src/client/engine/core/Game.ts +63 -19
- package/src/client/engine/core/gpuOnly.ts +10 -0
- package/src/client/engine/core/renderBudget.ts +134 -0
- package/src/client/engine/net/netPlayer.ts +19 -2
- package/src/client/engine/net/otherPlayers.ts +55 -8
- package/src/client/engine/net/predictor.ts +33 -9
- package/src/client/engine/net/redial.ts +68 -10
- package/src/client/engine/pwa/cacheNames.ts +58 -1
- package/src/client/engine/pwa/sw.js +41 -11
- package/src/client/engine/render/dataLook.ts +219 -44
- package/src/client/engine/render/families/detail.ts +89 -0
- package/src/client/engine/render/families/pbr.ts +9 -1
- package/src/client/engine/render/families/registry.ts +11 -2
- package/src/client/engine/render/families/sceneSurface.ts +116 -0
- package/src/client/engine/render/look.ts +12 -0
- package/src/client/engine/render/lookLight.ts +103 -11
- package/src/client/engine/render/lookRender.ts +105 -0
- package/src/client/engine/render/precompile.ts +4 -2
- package/src/client/engine/render/tiers.ts +4 -1
- package/src/client/engine/saves/indexed.ts +2 -2
- package/src/client/engine/telemetry/browserErrors.ts +24 -3
- package/src/client/engine/telemetry/staleBuildReport.ts +22 -1
- package/src/client/engine/ui/debugOptions.ts +1 -1
- package/src/client/engine/ui/lookLightOption.ts +10 -6
- package/src/client/engine/ui/namePrompt.ts +7 -0
- package/src/client/engine/world/declaredProps.ts +5 -1
- package/src/client/engine/world/skyRig.ts +4 -1
- package/src/client/engine/world/terrainTileView.ts +64 -23
- package/src/client/game/boot/audio.generated.ts +114 -114
- package/src/client/game/boot/bytes.generated.ts +118 -220
- package/src/client/game/boot/placedSpawn.ts +35 -0
- package/src/client/game/boot/spawnDownload.ts +25 -6
- package/src/client/game/boot/versions.generated.ts +7 -5
- package/src/client/game/devScene/hook.ts +428 -0
- package/src/client/game/devScene/liveLook.ts +21 -0
- package/src/client/game/grid/cellLoading.ts +12 -2
- package/src/client/game/grid/live.ts +152 -19
- package/src/client/game/grid/liveSession.ts +53 -3
- package/src/client/game/grid/mapAtlas.ts +18 -4
- package/src/client/game/grid/minimapBlend.ts +15 -5
- package/src/client/game/grid/oneWayIn.ts +5 -1
- package/src/client/game/grid/pageEntry.ts +12 -1
- package/src/client/game/grid/placedCells.ts +114 -12
- package/src/client/game/grid/placedContent.ts +85 -0
- package/src/client/game/grid/prefetch.ts +9 -1
- package/src/client/game/grid/productInputs.ts +23 -10
- package/src/client/game/grid/productLeases.ts +4 -1
- package/src/client/game/grid/products.ts +8 -4
- package/src/client/game/grid/roadLook.ts +24 -15
- package/src/client/game/grid/roadLookPlatform.ts +4 -2
- package/src/client/game/grid/roadResources.ts +24 -0
- package/src/client/game/grid/roadSign.worker.ts +4 -3
- package/src/client/game/grid/roadSignPaint.ts +16 -5
- package/src/client/game/grid/roadSignPreparation.ts +4 -3
- package/src/client/game/grid/roadSignScale.ts +8 -0
- package/src/client/game/grid/roadTileCapture.worker.ts +3 -1
- package/src/client/game/grid/roadTileCaptureWorker.ts +2 -1
- package/src/client/game/grid/roadTileWrite.worker.ts +4 -2
- package/src/client/game/grid/roadTileWriter.ts +2 -1
- package/src/client/game/grid/screenReports.ts +39 -0
- package/src/client/game/grid/session.ts +32 -7
- package/src/client/game/grid/softWallLook.ts +25 -8
- package/src/client/game/mainMenu.ts +6 -2
- package/src/client/game/plugin/context.ts +2 -1
- package/src/client/game/plugin/followedMovers.ts +7 -1
- package/src/client/game/quest/figures.ts +2 -0
- package/src/client/game/session/finish.ts +9 -0
- package/src/client/game/shardfile/assetCache.ts +4 -4
- package/src/client/game/shardfile/client.ts +28 -8
- package/src/client/game/shardfile/clientAssets.ts +9 -5
- package/src/client/game/shardfile/clientLibrary.ts +1 -1
- package/src/client/game/shardfile/clientPropMaterials.ts +4 -1
- package/src/client/game/shardfile/clientViews.ts +36 -8
- package/src/client/game/shardfile/clientWater.ts +51 -9
- package/src/client/game/shardfile/clientWorker.ts +19 -7
- package/src/client/game/shardfile/constructionCheckpoint.ts +2 -2
- package/src/client/game/shardfile/groundMerge.ts +57 -5
- package/src/client/game/shardfile/hybrid.ts +2 -0
- package/src/client/game/shardfile/look.ts +8 -3
- package/src/client/game/shardfile/product.ts +34 -7
- package/src/client/game/shardfile/productChecks.ts +2 -2
- package/src/client/game/shardfile/productCost.ts +2 -2
- package/src/client/game/shardfile/readAsset.ts +2 -2
- package/src/client/game/shardfile/reflectingWater.ts +73 -0
- package/src/client/game/shardfile/seatGrace.ts +9 -0
- package/src/client/game/shardfile/skinPlayback.ts +1 -1
- package/src/client/game/shardfile/slabLibrary.ts +115 -49
- package/src/client/game/shardfile/tileContent.ts +1 -1
- package/src/client/game/shardfile/tileDriver.ts +38 -11
- package/src/client/game/shardfile/wirePage.ts +7 -3
- package/src/client/game/shardfile/worldScenes.ts +17 -10
- package/src/client/game/systems/npc/figureRows.ts +9 -0
- package/src/client/host/online/doctor.ts +22 -7
- package/src/client/host/online/doctorView.ts +2 -0
- package/src/client/host/online/linkScreens.ts +109 -5
- package/src/client/host/online/shell.ts +13 -4
- package/src/client/host/standalone/shell.ts +40 -0
- package/src/cook/game/astc6Encode.ts +55 -0
- package/src/cook/game/astc6Wasm.ts +176 -0
- package/src/cook/game/cookJob.ts +30 -6
- package/src/cook/game/cookWorker.ts +38 -11
- package/src/cook/game/entryTotals.ts +51 -24
- package/src/cook/game/shardCook.ts +35 -7
- package/src/cook/game/spawnParts.ts +33 -8
- package/src/cook/game/tierTextures.ts +87 -14
- package/src/server/engine/ai/bossContenders.ts +27 -3
- package/src/server/engine/ai/phases.ts +1 -1
- package/src/server/engine/entities/creatureRefill.ts +9 -2
- package/src/server/engine/net/ledgerBook.ts +2 -0
- package/src/server/engine/net/room.ts +15 -0
- package/src/server/engine/sim/respawn.ts +8 -0
- package/src/server/game/boss/arenaRoomEntry.ts +5 -1
- package/src/server/game/boss/arenaRoomNative.ts +2 -0
- package/src/server/game/boss/native.ts +2 -1
- package/src/server/game/boss/nativeWake.ts +9 -5
- package/src/server/game/boss/openArenaNative.ts +2 -2
- package/src/server/game/boss/openArenaRoom.ts +3 -1
- package/src/server/game/grid/room.ts +44 -3
- package/src/server/game/grid/simulation.ts +23 -0
- package/src/server/game/population/mixedRoster.ts +11 -3
- package/src/server/game/population/nativeBake.ts +8 -3
- package/src/server/game/population/nativeReturns.ts +6 -3
- package/src/server/game/population/roster.ts +5 -3
- package/src/server/game/quest/eliteDrops.ts +18 -3
- package/src/server/game/quest/nativeChapter.ts +1 -1
- package/src/server/game/quest/nativeComposition.ts +5 -1
- package/src/server/game/riding/nativeTaming.ts +22 -7
- package/src/server/game/riding/wildRefill.ts +3 -2
- package/src/server/game/shardfile/bossRow.ts +4 -2
- package/src/server/game/shardfile/homeKeeper.ts +4 -2
- package/src/server/host/bake/headlessWorker.ts +1 -1
- package/src/server/host/dedicated/cellHost.ts +112 -18
- package/src/server/host/dedicated/cellProtocol.ts +18 -1
- package/src/server/host/dedicated/cellWorker.ts +8 -5
- package/src/server/host/dedicated/dedicatedRoom.ts +38 -11
- package/src/server/host/dedicated/gridCells.ts +15 -6
- package/src/server/host/dedicated/loopLag.ts +21 -0
- package/src/server/host/dedicated/main.ts +13 -5
- package/src/server/host/dedicated/packReader.ts +3 -3
- package/src/server/host/dedicated/placementFile.ts +3 -2
- package/src/server/host/dedicated/roadRoom.ts +34 -4
- package/src/server/host/dedicated/serverMetrics.ts +135 -0
- package/src/server/host/dedicated/socketPump.ts +21 -4
- package/src/server/host/dedicated/workerTable.ts +32 -14
- package/src/server/host/dedicated/world.ts +65 -7
- package/src/server/host/headless.ts +1 -1
- package/src/server/host/headlessRuntime.ts +1 -1
- package/src/server/host/standalone/roadWorld.ts +15 -3
- package/src/server/host/standalone/serverHost.ts +57 -8
- package/src/server/host/standalone/serverProduct.ts +48 -16
- package/src/server/host/standalone/serverRuntime.ts +1 -1
- package/src/shared/engine/ai/BossBrain.ts +8 -0
- package/src/shared/engine/core/framePacing.ts +12 -1
- package/src/shared/engine/physics/terrainTiles.ts +20 -4
- package/src/shared/game/boss/wake.ts +6 -0
- package/src/shared/game/devColliders.ts +107 -0
- package/src/shared/game/devGameplay.ts +41 -0
- package/src/shared/game/eliteSystem.ts +8 -0
- package/src/shared/game/grid/allocator.ts +3 -0
- package/src/shared/game/grid/placementRows.ts +5 -2
- package/src/shared/game/plugin/bossRecord.ts +3 -2
- package/src/shared/game/shardfile/ktx2Targets.ts +23 -3
- package/src/shared/game/shardfile/outputDescriptor.ts +9 -5
- package/src/shared/game/shardfile/packReads.ts +28 -3
- package/src/shared/game/shardfile/serverPack.ts +9 -0
- package/src/shared/game/systems/looks/trampleField.ts +2 -0
- package/src/shared/host/formatJsonSchema.ts +2 -2
- package/src/tsconfig.json +1 -27
- package/lint/host-reviews.json +0 -14
- package/lint/listed-view-code.json +0 -13
- package/lint/platform-pending-users.json +0 -2520
- package/lint/platform-pending-users.md +0 -18
- package/scripts/cell-mem/metrics-preload.mjs +0 -65
- package/scripts/check-closed-components.d.mts +0 -7
- package/scripts/check-closed-components.mjs +0 -87
- package/scripts/g571-hosts.d.mts +0 -3
- package/scripts/g571-hosts.mjs +0 -54
- package/scripts/host-ruler/register-migrate.mjs +0 -242
- package/scripts/listed-view-code.d.mts +0 -7
- package/scripts/listed-view-code.mjs +0 -93
- package/scripts/look-loop/fit-lut.py +0 -142
- package/scripts/look-loop/palette-delta.py +0 -183
- package/scripts/look-loop/regions/driftwood-isle.json +0 -25
- package/scripts/look-loop/regions/far-reach.json +0 -225
- package/scripts/look-loop/regions/open-plot-night-market.json +0 -855
- package/scripts/look-loop/regions/pine-hollow.json +0 -22
- package/scripts/look-loop/regions/sunscar-dunes.json +0 -281
- package/scripts/platform-chargebacks.d.mts +0 -9
- package/scripts/platform-chargebacks.mjs +0 -135
- package/scripts/shard-component-spans.d.mts +0 -15
- package/scripts/shard-component-spans.mjs +0 -18
- package/scripts/shard-components.d.mts +0 -16
- package/scripts/shard-components.mjs +0 -363
- package/scripts/shard-platform-hosts.d.mts +0 -2
- package/scripts/shard-platform-hosts.mjs +0 -93
- package/scripts/shard-platform-sections.d.mts +0 -2
- package/scripts/shard-platform-sections.mjs +0 -9
- package/scripts/shard-platform.d.mts +0 -76
- package/scripts/shard-platform.mjs +0 -1072
- package/src/.oxfmtrc.json +0 -48
- package/src/scripts/ask-new.sh +0 -29
- package/src/scripts/asks.mjs +0 -142
- package/src/scripts/herdr-prompt.sh +0 -34
- package/src/scripts/herdr-question-open.sh +0 -67
- package/src/scripts/md-wrap.mjs +0 -229
- /package/scripts/{shard-platform-format.d.mts → node-format.d.mts} +0 -0
- /package/scripts/{shard-platform-format.mjs → node-format.mjs} +0 -0
- /package/scripts/{shard-platform-output.d.mts → output-reader.d.mts} +0 -0
|
@@ -15,7 +15,7 @@ import {VOICE_FULL_M} from '../src/client/engine/net/voiceNear.ts';
|
|
|
15
15
|
const [base,build,key,out=new URL('../tmp/e7-voice-staging/',import.meta.url).pathname]=process.argv.slice(2);
|
|
16
16
|
assert.equal(new URL(base).origin,'https://staging.wildshard.io','J205 requires the isolated staging page');
|
|
17
17
|
assert.match(build,/^[a-f0-9]{40}$/u);assert.match(key,/^[a-f0-9]+$/u);mkdirSync(out,{recursive:true});
|
|
18
|
-
const releaseURL='https://
|
|
18
|
+
const releaseURL='https://packs.wildshard.io/releases/staging.json',sockets=['wss://rooms-staging.wildshard.io','wss://wildshard.tailb41b20.ts.net:8443'];
|
|
19
19
|
const signed=await(await fetch(releaseURL,{cache:'no-store',redirect:'error',signal:AbortSignal.timeout(30000)})).json();
|
|
20
20
|
assert.ok(verify(null,Buffer.from(signed.body),createPublicKey({key:Buffer.from(key,'hex'),format:'der',type:'spki'}),Buffer.from(signed.signature,'hex')));
|
|
21
21
|
const release=JSON.parse(signed.body);assert.equal(release.channel,'staging');assert.equal(release.engineBuild,build);const socket=release.socket.replace(/\/$/u,'');assert.ok(sockets.includes(socket),socket);
|
|
@@ -37,7 +37,7 @@ export function pushGuards(changed) {
|
|
|
37
37
|
return [
|
|
38
38
|
...(changed.some(file => /^src\/(?:format|sdk|sharddev)\//u.test(file)) ? ['test/schema-reference.test.ts'] : []),
|
|
39
39
|
'test/host-callbacks.test.ts', 'test/shardfile-boundaries.test.ts',
|
|
40
|
-
'test/
|
|
40
|
+
'test/manifest-declarations.test.ts',
|
|
41
41
|
];
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -203,7 +203,7 @@ export function deriveGitDiscovery(view,path) {
|
|
|
203
203
|
genShards(process.cwd());
|
|
204
204
|
console.log(JSON.stringify(Object.fromEntries(outputs.map(file=>[file,createHash('sha256').update(readFileSync(file)).digest('hex')]))));
|
|
205
205
|
`;
|
|
206
|
-
const output=execFileSync(process.execPath,['--experimental-transform-types','--import','./scripts/
|
|
206
|
+
const output=execFileSync(process.execPath,['--experimental-transform-types','--import','./scripts/node-format.mjs','--input-type=module','--eval',source,'--',JSON.stringify(job.nativeOutputs)],{cwd:view.root,encoding:'utf8',maxBuffer:8*1024*1024,
|
|
207
207
|
env:{...process.env,WS_GIT_CHECK_ROOT:view.root,WS_GIT_CHECK_REV:view.revision}});
|
|
208
208
|
const line=output.trim().split('\n').at(-1);
|
|
209
209
|
if(line===undefined)throw new Error('Missing generated-output proof');
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
// and turns the board back on. ON_FOOT: a board that shows in the frame. It stows Sky's fan and fills its hover decks, and
|
|
19
19
|
// its goldens have neither, so a player hovering there for its streaming steps off for the shot.
|
|
20
20
|
import {chromium,webkit,devices} from 'playwright';
|
|
21
|
-
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
|
|
21
|
+
import {existsSync,readFileSync,statSync,writeFileSync,mkdirSync} from 'node:fs';
|
|
22
22
|
import {readFile} from 'node:fs/promises';
|
|
23
|
-
import {saveFixture,developerSettings,hideDeveloperOverlays,levelDownloadFixtures} from '../debug-settings.mjs';
|
|
23
|
+
import {saveFixture,developerSettings,hideDeveloperOverlays,levelDownloadFixtures,NAME_ASKED} from '../debug-settings.mjs';
|
|
24
24
|
import {loadingCardIndex} from '../loading-benchmark/catalogue.mjs';
|
|
25
25
|
import {pressEscape} from '../parity/browser-escape.mjs';
|
|
26
26
|
import {KEYCHAIN_ARGS} from '../chromium-keychain.mjs';
|
|
@@ -49,6 +49,10 @@ const hideAstc=()=>{const ext='WEBGL_compressed_texture_astc';for(const gl of [W
|
|
|
49
49
|
gl.prototype.getSupportedExtensions=function(){return getSupportedExtensions.call(this)?.filter(name=>name!==ext)??null;};}};
|
|
50
50
|
// --level-download=packs|shardfile (DL16): Debug ▸ Loading & memory ▸ Level download for every capture (default: the build's)
|
|
51
51
|
const LEVEL_DOWNLOAD=arg('level-download','');if(!['','packs','shardfile'].includes(LEVEL_DOWNLOAD))throw Error(`--level-download=${LEVEL_DOWNLOAD}`);
|
|
52
|
+
// --serve-over=<dir> (S12c): answer a request whose path is a file under <dir> from that file, so a cook's phone textures (laid
|
|
53
|
+
// out at the URLs they stand in for) are judged on a served build. Pair it with --level-download=shardfile: a pack part is not a request.
|
|
54
|
+
const SERVE_OVER=arg('serve-over',''),overHits=new Set();
|
|
55
|
+
const DIRECT=process.argv.includes('--direct');
|
|
52
56
|
mkdirSync(root,{recursive:true});
|
|
53
57
|
|
|
54
58
|
// --engine=webkit: Playwright's WebKit (muted by the game's volume 0; its Escape is a plain key press)
|
|
@@ -90,6 +94,7 @@ try{for(const slug of slugs){
|
|
|
90
94
|
await developerSettings(context,{tier:'phone',volume:0,time:'midday',weather:'clear'});
|
|
91
95
|
await saveFixture(context,{scope:'global',key:'gfx',data:{dpr:'2',aa:'auto'}});
|
|
92
96
|
await saveFixture(context,{scope:'device',key:'debug.global.holdLoading',data:'off'});
|
|
97
|
+
await saveFixture(context,NAME_ASKED);// MP2.4: the Name prompt otherwise covers SHARD SELECT
|
|
93
98
|
if (LEVEL_DOWNLOAD!=='') for (const fixture of levelDownloadFixtures(LEVEL_DOWNLOAD)) await saveFixture(context,fixture);
|
|
94
99
|
// --device-save=<key>=<value>: a Debug row's device slot for a look A / B (D227's debug.gltfMips=on); repeatable
|
|
95
100
|
for (const pair of process.argv.filter(x=>x.startsWith('--device-save=')).map(x=>x.slice(14))) {
|
|
@@ -98,6 +103,8 @@ try{for(const slug of slugs){
|
|
|
98
103
|
}
|
|
99
104
|
await context.addInitScript(hideDeveloperOverlays);
|
|
100
105
|
if(NO_ASTC)await context.addInitScript(hideAstc);
|
|
106
|
+
if(SERVE_OVER)await context.route(()=>true,async route=>{const path=new URL(route.request().url()).pathname,file=`${SERVE_OVER}${decodeURIComponent(path)}`;
|
|
107
|
+
if(!path.includes('..')&&existsSync(file)&&statSync(file).isFile()){overHits.add(path);await route.fulfill({status:200,body:readFileSync(file),headers:{'content-type':'application/octet-stream'}});}else await route.fallback();});
|
|
101
108
|
await context.addInitScript(textures=>{window.__wildshardHarness={seed:357,capture:null,...(textures===''?{}:{textures})};},TEXTURES);
|
|
102
109
|
if (slug==='nine-dragon-stack'&&nativeBinding!==null) await context.addInitScript(`window.__installGoldenResidency=()=>window.__goldenResidencyPromise??=(async()=>{
|
|
103
110
|
try {
|
|
@@ -120,7 +127,9 @@ try{for(const slug of slugs){
|
|
|
120
127
|
const version=await(await page.request.get(new URL('/version.json',base).href)).json();
|
|
121
128
|
const actual=goldenPreviewIdentity(version,arg('sha',''));
|
|
122
129
|
if(actual.build!==source.build)throw Error(`Preview changed from ${source.build} to ${actual.build}`);row.build=actual.build;
|
|
123
|
-
|
|
130
|
+
// --direct (S12c): enter by the shard's own URL (`?chunk=<slug>`), as scripts/tier-textures-proof.mjs does. Since J300's Shard select
|
|
131
|
+
// enters the grid at a shard's cell (a42f92b6), the title's card no longer reaches a grid-hosted shard's one-shard page.
|
|
132
|
+
await page.goto(DIRECT?`${base.replace(/\/$/u,'')}/?chunk=${slug}&skipintro&mute=1&nolock=1`:base,{waitUntil:'load'});
|
|
124
133
|
if (slug==='nine-dragon-stack'&&nativeBinding!==null) {
|
|
125
134
|
// The per-document DOM-ready hook also covers SHARD SELECT's fresh-page
|
|
126
135
|
// navigation. The title's explicit handshake precedes every menu action.
|
|
@@ -129,13 +138,16 @@ try{for(const slug of slugs){
|
|
|
129
138
|
const failure=await page.evaluate(()=>window.__goldenResidencyFailure);if(failure)throw new Error(failure);
|
|
130
139
|
row.nativeBinding={...nativeBinding,installed:'per-document-dom-ready-before-world-entry'};
|
|
131
140
|
}
|
|
141
|
+
let clicker;if(DIRECT)clicker=setInterval(()=>{void page.locator('.ws-load-play').click({timeout:500}).catch(()=>undefined);},1000);else{
|
|
132
142
|
await page.locator('.ws-main-select').click();
|
|
133
143
|
const names=await page.locator('.ws-menu-card b').allTextContents();
|
|
134
144
|
await page.locator(`.ws-menu-dots i[data-i="${loadingCardIndex(names,slug)}"]`).click();
|
|
135
145
|
// ENTER WORLD, the one entry (the shardfile, G531; QD7 LD5 removed the LEGACY / SHARDFILE pair)
|
|
136
146
|
const button=page.locator('.ws-menu-play');
|
|
137
147
|
if(await button.isDisabled())throw Error(`${mode} entry disabled`);await button.click();
|
|
148
|
+
}
|
|
138
149
|
await page.waitForFunction(()=>!!window.__wildshard?.world?.hud?.entered&&!document.querySelector('.ws-load')&&window.__wildshard.world.game.frameGate(),undefined,{timeout:180000});
|
|
150
|
+
clearInterval(clicker);
|
|
139
151
|
if (slug==='nine-dragon-stack'&&nativeBinding!==null) {
|
|
140
152
|
await page.waitForFunction(()=>window.__goldenResidency!==undefined||window.__goldenResidencyFailure!==undefined);
|
|
141
153
|
const failure=await page.evaluate(()=>window.__goldenResidencyFailure);if(failure)throw new Error(failure);
|
|
@@ -208,7 +220,7 @@ try{for(const slug of slugs){
|
|
|
208
220
|
}
|
|
209
221
|
row.status=row.errors.length===0?'complete':'errors';
|
|
210
222
|
}catch(error){row.status='failed';row.failure=String(error);if(page)await page.screenshot({path:`${dir}/failure.jpg`,type:'jpeg',quality:80,scale:'css'}).catch(()=>{});}
|
|
211
|
-
finally{rows.push(row);writeFileSync(`${root}/receipts-${slug}.json`,JSON.stringify(row,null,1));writeFileSync(`${root}/receipts.json`,JSON.stringify(rows,null,2));await context.close();
|
|
212
|
-
console.log(JSON.stringify({slug,status:row.status,poses:row.poses.length,idle:row.poses.map(p=>p.idle.settled),failure:row.failure,errors:row.errors.slice(0,3),warnings:Object.values(row.warnings).reduce((n,c)=>n+c,0)}));}
|
|
223
|
+
finally{if(SERVE_OVER)row.servedOver=[...overHits].sort();rows.push(row);writeFileSync(`${root}/receipts-${slug}.json`,JSON.stringify(row,null,1));writeFileSync(`${root}/receipts.json`,JSON.stringify(rows,null,2));await context.close();
|
|
224
|
+
console.log(JSON.stringify({slug,status:row.status,poses:row.poses.length,idle:row.poses.map(p=>p.idle.settled),failure:row.failure,errors:row.errors.slice(0,3),warnings:Object.values(row.warnings).reduce((n,c)=>n+c,0),...(SERVE_OVER?{servedOver:overHits.size}:{})}));}
|
|
213
225
|
if(row.status==='failed')process.exitCode=1;
|
|
214
226
|
}}finally{try{await browser.close();}finally{await owner?.close();}}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// GRID-CROSSING GC17: GC3's crossing run every night and after every staging release, from this Mac until MAC-MINI-RUNNER MR7 takes it.
|
|
3
|
+
// One call decides what is due and runs it (a launchd agent calls it every hour):
|
|
4
|
+
// release staging's signed release file (packs.wildshard.io/releases/staging.json) names a serial no run has read: the online walks
|
|
5
|
+
// (`grid-crossing-qa.mjs`, Driftwood's exits, Chromium and WebKit, desktop and phone) on staging
|
|
6
|
+
// nightly after 03:00 (this Mac's clock) and none yet today: the every-pair tour (`grid-crossing-tour.mjs`, Chromium desktop) on preview
|
|
7
|
+
// Each run writes `grid-crossing-report.mjs`'s report under <root>/<kind>-<stamp>/report and checks the ratchet: a pair worse than
|
|
8
|
+
// `test/grid-crossing-ratchet.json` is red. Every run appends one line to ~/.cache/wildshard/lane-receipts.log (`grid-nightly DONE` or
|
|
9
|
+
// `grid-nightly RED`, naming the red pairs), which the coordinator reads to open a QA-FEEDBACK row. State (the last serial and night) is
|
|
10
|
+
// <root>/state.json.
|
|
11
|
+
// node scripts/grid-crossing-nightly.mjs [--root=<dir>] [--force=release|nightly] [--dry-run]
|
|
12
|
+
// --root defaults to ~/.cache/wildshard/plan-artifacts/grid/nightly. --dry-run prints what is due and runs nothing.
|
|
13
|
+
import { spawnSync } from 'node:child_process';
|
|
14
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
15
|
+
import { homedir } from 'node:os';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
|
|
18
|
+
/** @param {string} name @param {string} fallback */
|
|
19
|
+
const flag = (name, fallback) => process.argv.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3) ?? fallback;
|
|
20
|
+
const root = flag('root', join(homedir(), '.cache/wildshard/plan-artifacts/grid/nightly')), force = flag('force', ''), dry = process.argv.includes('--dry-run');
|
|
21
|
+
const RECEIPTS = join(homedir(), '.cache/wildshard/lane-receipts.log'), STATE = join(root, 'state.json'), here = join(import.meta.dirname, '..');
|
|
22
|
+
mkdirSync(root, { recursive: true });
|
|
23
|
+
/** @type {{ serial: number | null, night: string | null }} */
|
|
24
|
+
const state = existsSync(STATE) ? JSON.parse(readFileSync(STATE, 'utf8')) : { serial: null, night: null };
|
|
25
|
+
|
|
26
|
+
const now = new Date(), pad = (/** @type {number} */ n) => String(n).padStart(2, '0');
|
|
27
|
+
const today = `${String(now.getFullYear())}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`, stamp = `${today}T${pad(now.getHours())}${pad(now.getMinutes())}`;
|
|
28
|
+
const signed = /** @type {{ body: string }} */ (await (await fetch('https://packs.wildshard.io/releases/staging.json', { cache: 'no-store' })).json());
|
|
29
|
+
const serial = /** @type {{ serial: number }} */ (JSON.parse(signed.body)).serial;
|
|
30
|
+
|
|
31
|
+
/** @type {('release' | 'nightly')[]} */
|
|
32
|
+
const due = [];
|
|
33
|
+
if (force === 'release' || (force === '' && Number.isFinite(serial) && serial !== state.serial)) due.push('release');
|
|
34
|
+
if (force === 'nightly' || (force === '' && now.getHours() >= 3 && state.night !== today)) due.push('nightly');
|
|
35
|
+
console.log(`grid-crossing nightly: staging serial ${String(serial)} (last read ${String(state.serial)}), night ${today} (last ${String(state.night)}); due: ${due.join(', ') || 'nothing'}`);
|
|
36
|
+
if (dry || due.length === 0) process.exit(0);
|
|
37
|
+
|
|
38
|
+
/** @param {string[]} args */
|
|
39
|
+
const run = (args) => spawnSync(join(here, 'scripts/browser-lane.sh'), ['--max', '90', 'node', ...args], { cwd: here, stdio: 'inherit' }).status;
|
|
40
|
+
const clock = () => { const d = new Date(); return `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())} UTC`; };
|
|
41
|
+
let red = false;
|
|
42
|
+
for (const kind of due) {
|
|
43
|
+
const dir = join(root, `${kind}-${stamp}`);
|
|
44
|
+
mkdirSync(dir, { recursive: true });
|
|
45
|
+
const walked = kind === 'release'
|
|
46
|
+
? run(['scripts/grid-crossing-qa.mjs', '--base=https://staging.wildshard.io', `--out=${join(dir, 'walks')}`])
|
|
47
|
+
: run(['scripts/grid-crossing-tour.mjs', '--base=https://preview.wildshard.io', `--out=${join(dir, 'tour')}`, '--lane=grid-nightly']);
|
|
48
|
+
const runs = kind === 'release' ? join(dir, 'walks/rows.json') : join(dir, 'tour');
|
|
49
|
+
const report = spawnSync('node', ['scripts/grid-crossing-report.mjs', join(dir, 'report'), `--runs=${runs}`], { cwd: here, encoding: 'utf8' });
|
|
50
|
+
writeFileSync(join(dir, 'report.log'), `${report.stdout}${report.stderr}`);
|
|
51
|
+
const worse = report.stdout.split('\n').filter(line => line.startsWith('WORSE ')).slice(0, 8).join('; ');
|
|
52
|
+
const ok = report.status === 0;
|
|
53
|
+
red ||= !ok;
|
|
54
|
+
const what = kind === 'release' ? `staging serial ${String(serial)} walks` : 'preview every-pair tour';
|
|
55
|
+
appendFileSync(RECEIPTS, `${clock()} grid-nightly ${ok ? 'DONE' : 'RED'}: GC17 ${kind} ${what}, ${ok ? 'no pair worse than the ratchet' : `ratchet broken: ${worse || 'see report.log'}`}${walked === 0 ? '' : ' (the run itself exited non-zero)'}, ${join(dir, 'report/report.html')}\n`);
|
|
56
|
+
if (kind === 'release') state.serial = serial; else state.night = today;
|
|
57
|
+
writeFileSync(STATE, `${JSON.stringify(state, null, 2)}\n`);
|
|
58
|
+
}
|
|
59
|
+
process.exit(red ? 1 : 0);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// GRID-CROSSING GC1: the crossing harness, one command. It runs `grid-crossing-walk-proof.mjs` (enter the grid by the deck card,
|
|
3
|
+
// approach a named neighbour's entryway, then walk out, boost back home and boost out, by real input) in Chromium and WebKit at the
|
|
4
|
+
// desktop and phone layouts, one after another inside the browser lane, and writes one JSON row per browser and layout to
|
|
5
|
+
// <out>/rows.json: per leg the time from the line to control, the worst stop, frames over 50 and 100 ms, programs linked, and the
|
|
6
|
+
// page's memory at control (JS heap, the grid's resident and playing MB, the memory warning), plus each run's shots under <out>/<run>/.
|
|
7
|
+
// Staging, preview or a loopback page only (the walk proof refuses production, J205).
|
|
8
|
+
// node scripts/grid-crossing-qa.mjs --base=https://staging.wildshard.io [--to=sunscar|pine|farreach|nalati|nightmarket]
|
|
9
|
+
// [--engines=chromium,webkit] [--layouts=desktop,phone] [--out=~/.cache/wildshard/plan-artifacts/grid-crossing/<stamp>]
|
|
10
|
+
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import { homedir } from 'node:os';
|
|
13
|
+
import { join, resolve as absolute } from 'node:path';
|
|
14
|
+
|
|
15
|
+
/** @param {string} name @param {string} fallback */
|
|
16
|
+
const flag = (name, fallback) => process.argv.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3) ?? fallback;
|
|
17
|
+
const base = flag('base', ''), to = flag('to', 'sunscar');
|
|
18
|
+
if (base === '') throw new Error('usage: grid-crossing-qa.mjs --base=<staging, preview or loopback url> [--to=…] [--engines=…] [--layouts=…] [--out=…]');
|
|
19
|
+
const stamp = new Date().toISOString().replaceAll(/[:.]/gu, '-').slice(0, 19);
|
|
20
|
+
const out = absolute(flag('out', join(homedir(), '.cache/wildshard/plan-artifacts/grid-crossing', `${stamp}-${to}`)));
|
|
21
|
+
mkdirSync(out, { recursive: true });
|
|
22
|
+
const root = join(import.meta.dirname, '..');
|
|
23
|
+
/** @type {Record<string, unknown>[]} */
|
|
24
|
+
const rows = [];
|
|
25
|
+
for (const engine of flag('engines', 'chromium,webkit').split(',')) {
|
|
26
|
+
for (const layout of flag('layouts', 'desktop,phone').split(',')) {
|
|
27
|
+
const run = `${engine}-${layout}`, dir = join(out, run);
|
|
28
|
+
const args = [join(root, 'scripts/grid-crossing-walk-proof.mjs'), 'x', dir, 'x', `--base=${base}`, `--to=${to}`, `--engine=${engine}`, `--out=${dir}`,
|
|
29
|
+
...layout === 'phone' ? ['--layout=phone'] : []];
|
|
30
|
+
const done = spawnSync(join(root, 'scripts/browser-lane.sh'), ['--max', '20', process.execPath, ...args], { cwd: root, stdio: 'inherit' });
|
|
31
|
+
const file = join(dir, `${engine}-gc15c-walk.json`);
|
|
32
|
+
/** @type {any} */
|
|
33
|
+
const walk = existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : null;
|
|
34
|
+
rows.push({ run, engine, layout, base, to, pass: done.status === 0, playToReadyMs: walk?.playToReadyMs ?? null, memoryAtHome: walk?.memoryAtHome ?? null,
|
|
35
|
+
legs: (walk?.legs ?? []).map((/** @type {any} */ leg) => ({ name: leg.name, from: leg.from, target: leg.target, boost: leg.boost, borderToControlMs: leg.borderToControlMs, enteredAtMs: leg.enteredAtMs, controlAtMs: leg.controlAtMs,
|
|
36
|
+
worstStopMs: leg.worstStopMs, jumps: leg.jumps, over50: leg.over50, over100: leg.over100, worstFrameMs: leg.worstFrameMs, programLinks: leg.programLinks,
|
|
37
|
+
memory: leg.events?.find((/** @type {any} */ event) => event.control === true)?.memory ?? null })),
|
|
38
|
+
failed: (walk?.steps ?? []).filter((/** @type {any} */ step) => !step.ok).map((/** @type {any} */ step) => step.step) });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
writeFileSync(join(out, 'rows.json'), `${JSON.stringify(rows, null, 2)}\n`);
|
|
42
|
+
for (const row of rows) console.log(`${row.pass === true ? 'PASS' : 'FAIL'} ${String(row.run)} ${JSON.stringify(row.failed)}`);
|
|
43
|
+
console.log(`grid-crossing qa: ${out}/rows.json`);
|
|
44
|
+
process.exit(rows.every(row => row.pass === true) ? 0 : 1);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface PairNumbers { ok: boolean; borderToControlMs?: number | null; freezeMs?: number | null; wallMs?: number | null; over50?: number | null }
|
|
2
|
+
export type Ratchet = Record<string, PairNumbers>;
|
|
3
|
+
export declare const MEASURES: { readonly borderToControlMs: { slack: number; factor: number }; readonly freezeMs: { slack: number; factor: number }; readonly wallMs: { slack: number; factor: number }; readonly over50: { slack: number; factor: number } };
|
|
4
|
+
export declare function pairKey(site: string, run: string, from: string, to: string): string;
|
|
5
|
+
export declare function worse(ratchet: Ratchet, now: Record<string, PairNumbers>): { key: string; measure: string; held: unknown; now: unknown }[];
|
|
6
|
+
export declare function tighten(ratchet: Ratchet, now: Record<string, PairNumbers>): Ratchet;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// GRID-CROSSING GC3: the per-pair ratchet (`test/grid-crossing-ratchet.json`). Each crossing run (site, browser and layout, from
|
|
2
|
+
// cell to cell) keeps its best-known numbers; a later run may only match or beat them, within a noise allowance. Tightening only
|
|
3
|
+
// ever lowers a number (or turns a failed pair into a passing one), so the ratchet moves toward the goal table and never back.
|
|
4
|
+
|
|
5
|
+
/** The measures a pair is held to, and the noise a run may add before it counts as worse. */
|
|
6
|
+
export const MEASURES = /** @type {const} */ ({ borderToControlMs: { slack: 1500, factor: 1.5 }, freezeMs: { slack: 500, factor: 1.5 }, wallMs: { slack: 500, factor: 1.5 }, over50: { slack: 3, factor: 1.5 } });
|
|
7
|
+
|
|
8
|
+
/** @typedef {{ ok: boolean, borderToControlMs?: number | null, freezeMs?: number | null, wallMs?: number | null, over50?: number | null }} PairNumbers */
|
|
9
|
+
/** @typedef {Record<string, PairNumbers>} Ratchet */
|
|
10
|
+
|
|
11
|
+
/** The ratchet key of one crossing. @param {string} site @param {string} run @param {string} from @param {string} to */
|
|
12
|
+
export const pairKey = (site, run, from, to) => `${site}/${run}/${from}:${to}`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What got worse than the ratchet: a pair that passed now fails, or a measure past `max(held × factor, held + slack)`. A pair the
|
|
16
|
+
* ratchet doesn't hold, or a run that didn't try a held pair, is not worse (a partial run passes).
|
|
17
|
+
* @param {Ratchet} ratchet @param {Record<string, PairNumbers>} now @returns {{ key: string, measure: string, held: unknown, now: unknown }[]}
|
|
18
|
+
*/
|
|
19
|
+
export function worse(ratchet, now) {
|
|
20
|
+
/** @type {{ key: string, measure: string, held: unknown, now: unknown }[]} */
|
|
21
|
+
const found = [];
|
|
22
|
+
for (const [key, run] of Object.entries(now)) {
|
|
23
|
+
const held = ratchet[key];
|
|
24
|
+
if (held === undefined) continue;
|
|
25
|
+
if (held.ok && !run.ok) { found.push({ key, measure: 'ok', held: true, now: false }); continue; }
|
|
26
|
+
if (!run.ok) continue;
|
|
27
|
+
for (const [measure, { slack, factor }] of Object.entries(MEASURES)) {
|
|
28
|
+
const was = held[/** @type {keyof PairNumbers} */ (measure)], is = run[/** @type {keyof PairNumbers} */ (measure)];
|
|
29
|
+
if (typeof was !== 'number' || typeof is !== 'number') continue;
|
|
30
|
+
if (is > Math.max(was * factor, was + slack)) found.push({ key, measure, held: was, now: is });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return found;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The ratchet after a run: new pairs join, a pair that now passes is held to passing, and each measure only goes down. @param {Ratchet} ratchet @param {Record<string, PairNumbers>} now @returns {Ratchet} */
|
|
37
|
+
export function tighten(ratchet, now) {
|
|
38
|
+
/** @type {Ratchet} */
|
|
39
|
+
const next = { ...ratchet };
|
|
40
|
+
for (const [key, run] of Object.entries(now)) {
|
|
41
|
+
const held = next[key];
|
|
42
|
+
if (held === undefined || (!held.ok && run.ok)) { next[key] = { ...run }; continue; }
|
|
43
|
+
if (!run.ok) continue;
|
|
44
|
+
/** @type {PairNumbers} */ const kept = { ...held };
|
|
45
|
+
for (const measure of Object.keys(MEASURES)) {
|
|
46
|
+
const name = /** @type {'borderToControlMs' | 'freezeMs' | 'wallMs' | 'over50'} */ (measure), was = held[name], is = run[name];
|
|
47
|
+
if (typeof is === 'number' && (typeof was !== 'number' || is < was)) kept[name] = is;
|
|
48
|
+
}
|
|
49
|
+
next[key] = kept;
|
|
50
|
+
}
|
|
51
|
+
return Object.fromEntries(Object.entries(next).sort(([a], [b]) => a.localeCompare(b)));
|
|
52
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// GRID-CROSSING GC3: one report for every pair. Reads the in-page tours (`grid-crossing-tour.mjs`, `*-tour.json`, every pair both ways
|
|
3
|
+
// on preview or a loopback page) and the online walks (`grid-crossing-qa.mjs`'s `rows.json` on staging: the pairs a walker can reach by
|
|
4
|
+
// input), writes report.html (pairs × the goal's measures, worst first, and thumbnails of the failed or walled crossings in shots/) and checks every
|
|
5
|
+
// crossing against the ratchet `test/grid-crossing-ratchet.json`: a pair worse than its ratchet makes the run exit 1.
|
|
6
|
+
// node scripts/grid-crossing-report.mjs <out dir> --runs=<tour dir or rows.json>,… [--tighten]
|
|
7
|
+
// --tighten writes the ratchet after the run (new pairs join, numbers only go down); without it the ratchet is read only.
|
|
8
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import { basename, dirname, join, resolve as absolute } from 'node:path';
|
|
10
|
+
import sharp from 'sharp';
|
|
11
|
+
import { pairKey, tighten, worse } from './grid-crossing-ratchet.mjs';
|
|
12
|
+
|
|
13
|
+
/** @param {string} name @param {string} fallback */
|
|
14
|
+
const flag = (name, fallback) => process.argv.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3) ?? fallback;
|
|
15
|
+
const out = absolute(process.argv.slice(2).find(arg => !arg.startsWith('--')) ?? '');
|
|
16
|
+
const sources = flag('runs', '').split(',').filter(Boolean).map(path => absolute(path));
|
|
17
|
+
if (out === absolute('') || sources.length === 0) throw new Error('usage: grid-crossing-report.mjs <out dir> --runs=<tour dir or rows.json>,… [--tighten]');
|
|
18
|
+
const RATCHET = join(import.meta.dirname, '../test/grid-crossing-ratchet.json');
|
|
19
|
+
|
|
20
|
+
/** @typedef {{ site: string, run: string, from: string, to: string, boost: boolean, repeat: boolean, ok: boolean, why: string, borderToControlMs: number | null, freezeMs: number | null, wallMs: number | null, over50: number | null, over33: number | null, build: string, shot: string | null }} Row */
|
|
21
|
+
/** @type {Row[]} */
|
|
22
|
+
const rows = [];
|
|
23
|
+
const siteOf = (/** @type {string} */ base) => base.includes('staging') ? 'staging' : base.includes('preview') ? 'preview' : 'local';
|
|
24
|
+
for (const source of sources) {
|
|
25
|
+
const files = statSync(source).isDirectory() ? readdirSync(source).filter(name => name.endsWith('-tour.json')).map(name => join(source, name)) : [source];
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
const data = JSON.parse(readFileSync(file, 'utf8'));
|
|
28
|
+
if (Array.isArray(data)) {
|
|
29
|
+
// grid-crossing-qa rows: the walk proof's legs online
|
|
30
|
+
for (const run of data) for (const leg of run.legs ?? []) {
|
|
31
|
+
if (typeof leg.from !== 'string' || typeof leg.target !== 'string') continue;
|
|
32
|
+
rows.push({ site: siteOf(run.base), run: run.run, from: leg.from, to: leg.target, boost: leg.boost === true, repeat: false, ok: typeof leg.controlAtMs === 'number' && leg.controlAtMs > 0,
|
|
33
|
+
why: '', borderToControlMs: leg.borderToControlMs ?? null, freezeMs: leg.worstStopMs ?? null, wallMs: null, over50: leg.over50 ?? null, over33: null, build: '', shot: null });
|
|
34
|
+
}
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const run = `${String(data.engine)}-${String(data.layout).startsWith('phone') ? 'phone' : 'desktop'}`;
|
|
38
|
+
for (const c of data.crossings ?? []) {
|
|
39
|
+
const shot = join(dirname(file), `${String(data.engine)}-${String(c.from)}-${String(c.to)}.png`);
|
|
40
|
+
rows.push({ site: siteOf(data.base), run, from: c.from, to: c.to, boost: c.boost, repeat: c.repeat, ok: c.ok, why: c.why ?? '', borderToControlMs: c.borderToControlMs ?? null,
|
|
41
|
+
freezeMs: c.freezeMs ?? null, wallMs: c.wallMs ?? null, over50: c.over50 ?? null, over33: c.over33 ?? null, build: data.build ?? '', shot: existsSync(shot) ? shot : null });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// a pair's first crossing in a run is its score; a repeat stands in only for an arc the run never scored
|
|
46
|
+
/** @type {Map<string, Row>} */
|
|
47
|
+
const scored = new Map();
|
|
48
|
+
for (const row of rows) { const key = pairKey(row.site, row.run, row.from, row.to), had = scored.get(key); if (had === undefined || (had.repeat && !row.repeat)) scored.set(key, row); }
|
|
49
|
+
const now = Object.fromEntries([...scored].map(([key, row]) => [key, { ok: row.ok, borderToControlMs: row.borderToControlMs, freezeMs: row.freezeMs, wallMs: row.wallMs, over50: row.over50 }]));
|
|
50
|
+
const ratchet = existsSync(RATCHET) ? JSON.parse(readFileSync(RATCHET, 'utf8')) : {};
|
|
51
|
+
const worsened = worse(ratchet, now);
|
|
52
|
+
if (process.argv.includes('--tighten')) writeFileSync(RATCHET, `${JSON.stringify(tighten(ratchet, now), null, 2)}\n`);
|
|
53
|
+
|
|
54
|
+
// the goal table's bars (meta GRID-CROSSING-PLAN "The goal"): no stop, no wall, no frame over 50 ms on desktop (1 on the phone)
|
|
55
|
+
// a stop is read from samples 100 ms apart, so one sample (100 ms) is the floor of the reading, not a stop
|
|
56
|
+
|
|
57
|
+
const meets = (/** @type {Row} */ row) => row.ok && (row.freezeMs ?? 0) <= 100 && (row.wallMs ?? 0) === 0 && (row.over50 ?? 0) <= (row.run.endsWith('phone') ? 1 : 0);
|
|
58
|
+
const badness = (/** @type {Row} */ row) => (row.ok ? 0 : 1e9) + (row.wallMs ?? 0) * 10 + (row.freezeMs ?? 0) + (row.over50 ?? 0) * 50 + (row.borderToControlMs ?? 0) / 100;
|
|
59
|
+
const pairs = [...new Set([...scored.values()].map(row => `${row.from}:${row.to}`))];
|
|
60
|
+
const runs = [...new Set([...scored.values()].map(row => `${row.site}/${row.run}`))].sort();
|
|
61
|
+
const cellOf = (/** @type {string} */ pair, /** @type {string} */ run) => scored.get(`${run}/${pair}`);
|
|
62
|
+
pairs.sort((a, b) => Math.max(...runs.map(run => { const r = cellOf(b, run); return r === undefined ? -1 : badness(r); })) - Math.max(...runs.map(run => { const r = cellOf(a, run); return r === undefined ? -1 : badness(r); })));
|
|
63
|
+
|
|
64
|
+
const esc = (/** @type {unknown} */ text) => String(text).replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"');
|
|
65
|
+
const ms = (/** @type {number | null} */ value) => value === null ? '–' : value >= 1000 ? `${(value / 1000).toFixed(1)} s` : `${String(value)} ms`;
|
|
66
|
+
const short = (/** @type {string} */ instance) => instance.replace(/^open-plot-/u, 'plot ');
|
|
67
|
+
/** @type {Map<string, string>} */
|
|
68
|
+
const thumbs = new Map();
|
|
69
|
+
// thumbnails beside the report (`shots/`), published with it as the artifact's own files
|
|
70
|
+
mkdirSync(join(out, 'shots'), { recursive: true });
|
|
71
|
+
for (const row of scored.values()) if (row.shot !== null && thumbs.size < 60) {
|
|
72
|
+
const name = `shots/${row.run}-${basename(row.shot, '.png')}.jpg`;
|
|
73
|
+
await sharp(row.shot).resize({ width: 360 }).jpeg({ quality: 62 }).toFile(join(out, name));
|
|
74
|
+
thumbs.set(row.shot, name);
|
|
75
|
+
}
|
|
76
|
+
const cell = (/** @type {Row | undefined} */ row) => {
|
|
77
|
+
if (row === undefined) return '<td class="none">not run</td>';
|
|
78
|
+
const state = !row.ok ? 'fail' : meets(row) ? 'meets' : 'passes';
|
|
79
|
+
const bits = row.ok ? `<b>${ms(row.borderToControlMs)}</b><span>stop ${ms(row.freezeMs)} · wall ${ms(row.wallMs)} · >50 ms ${row.over50 === null ? '–' : String(row.over50)}</span>` : `<b>no control</b><span>${esc(row.why)}</span>`;
|
|
80
|
+
return `<td class="${state}">${bits}${row.boost ? '<i>boost</i>' : '<i>walk</i>'}${row.repeat ? '<i>repeat</i>' : ''}</td>`;
|
|
81
|
+
};
|
|
82
|
+
const all = [...scored.values()], failed = all.filter(row => !row.ok), walled = all.filter(row => row.ok && (row.wallMs ?? 0) > 0), meeting = all.filter(meets);
|
|
83
|
+
const builds = [...new Set(all.map(row => row.build).filter(Boolean))].join(', ');
|
|
84
|
+
const html = `<title>Grid Crossing Pairs</title>
|
|
85
|
+
<meta name="claude:viewport-fit-sides" content="cover">
|
|
86
|
+
<style>
|
|
87
|
+
/* layout: one summary band, then a wide pair table that scrolls inside itself, then the shots of what failed */
|
|
88
|
+
:root { --bg: #f3f5f7; --panel: #ffffff; --fg: #18202a; --muted: #5b6876; --line: #d5dce3; --accent: #1f6fb2; --meets: #1d7a46; --meets-bg: #e3f3ea; --passes: #8a6100; --passes-bg: #fbf1d9; --fail: #b3261e; --fail-bg: #fbe4e2;
|
|
89
|
+
--head: 'Space Grotesk', system-ui, sans-serif; --body: 'Inter', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace }
|
|
90
|
+
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #10151b; --panel: #171e26; --fg: #e4e9ee; --muted: #93a1af; --line: #2a3541; --accent: #6cb2ec; --meets: #6fd39b; --meets-bg: #15301f; --passes: #e6bd5c; --passes-bg: #33290f; --fail: #f08a82; --fail-bg: #3a1714; color-scheme: dark } }
|
|
91
|
+
:root[data-theme="dark"] { --bg: #10151b; --panel: #171e26; --fg: #e4e9ee; --muted: #93a1af; --line: #2a3541; --accent: #6cb2ec; --meets: #6fd39b; --meets-bg: #15301f; --passes: #e6bd5c; --passes-bg: #33290f; --fail: #f08a82; --fail-bg: #3a1714; color-scheme: dark }
|
|
92
|
+
body { background: var(--bg); color: var(--fg); font-family: var(--body); padding-block: 24px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
|
|
93
|
+
main { display: grid; gap: 24px; max-width: 1400px; margin: 0 auto }
|
|
94
|
+
h1, h2 { font-family: var(--head); text-wrap: balance; margin: 0 } h1 { font-size: 1.9rem } h2 { font-size: 1.25rem }
|
|
95
|
+
p { max-width: 70ch; line-height: 1.5; margin: 0; color: var(--muted) } code { font-family: var(--mono); font-size: .85em }
|
|
96
|
+
.sum { display: flex; flex-wrap: wrap; gap: 12px } .sum div { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; min-width: 0 }
|
|
97
|
+
.sum b { display: block; font: 600 1.5rem var(--head); font-variant-numeric: tabular-nums } .sum span { color: var(--muted); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase }
|
|
98
|
+
.wide { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px }
|
|
99
|
+
table { border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums } th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top }
|
|
100
|
+
th { font-family: var(--head); position: sticky; top: 0; background: var(--panel); white-space: nowrap } th.pair { white-space: nowrap }
|
|
101
|
+
td b { display: block; font-weight: 600 } td span { display: block; color: var(--muted); max-width: 26ch } td i { font-style: normal; font-size: .7rem; color: var(--muted); margin-right: 6px; text-transform: uppercase; letter-spacing: .05em }
|
|
102
|
+
td.meets { background: var(--meets-bg) } td.meets b { color: var(--meets) } td.passes { background: var(--passes-bg) } td.passes b { color: var(--passes) } td.fail { background: var(--fail-bg) } td.fail b { color: var(--fail) } td.none { color: var(--muted) }
|
|
103
|
+
.worse { border-left: 3px solid var(--fail); padding-left: 10px } .worse li { font-family: var(--mono); font-size: .8rem }
|
|
104
|
+
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px } figure { margin: 0; min-width: 0 } figure img { width: 100%; border-radius: 4px; border: 1px solid var(--line) } figcaption { font-size: .75rem; color: var(--muted); padding-top: 4px }
|
|
105
|
+
</style>
|
|
106
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=JetBrains+Mono&family=Space+Grotesk:wght@600&display=swap">
|
|
107
|
+
<main>
|
|
108
|
+
<header style="display:grid;gap:8px"><h1>Grid crossing, every pair</h1>
|
|
109
|
+
<p>Each cell is one crossing by real input from 12 m inside a cell's edge to control in its neighbour: <b>border to control</b>, the longest stop (under 0.1 m per 100 ms with the key held), the time held at an unready neighbour's wall, and frames over 50 ms within 3 s of the border. Green meets the plan's goal bars, amber reaches control but misses a bar, red never got control. Built ${esc(builds || 'unknown')}, ${esc(new Date().toISOString().slice(0, 16).replace('T', ' '))} UTC.</p></header>
|
|
110
|
+
<section class="sum"><div><b>${String(pairs.length)}</b><span>pairs (directed)</span></div><div><b>${String(all.length)}</b><span>crossings scored</span></div><div><b>${String(meeting.length)}</b><span>meet every bar</span></div><div><b>${String(walled.length)}</b><span>held at a wall</span></div><div><b>${String(failed.length)}</b><span>no control</span></div><div><b>${String(worsened.length)}</b><span>worse than ratchet</span></div></section>
|
|
111
|
+
${worsened.length === 0 ? '' : `<section class="worse"><h2>Worse than the ratchet</h2><ul>${worsened.map(row => `<li>${esc(row.key)} ${esc(row.measure)}: ${esc(row.held)} → ${esc(row.now)}</li>`).join('')}</ul></section>`}
|
|
112
|
+
<section style="display:grid;gap:8px"><h2>Pairs, worst first</h2><div class="wide"><table><thead><tr><th class="pair">From → to</th>${runs.map(run => `<th>${esc(run)}</th>`).join('')}</tr></thead><tbody>
|
|
113
|
+
${pairs.map(pair => { const [from = '', to = ''] = pair.split(':'); return `<tr><th class="pair">${esc(short(from))} → ${esc(short(to))}</th>${runs.map(run => cell(cellOf(pair, run))).join('')}</tr>`; }).join('\n')}
|
|
114
|
+
</tbody></table></div></section>
|
|
115
|
+
${thumbs.size === 0 ? '' : `<section style="display:grid;gap:8px"><h2>Failed or walled crossings</h2><div class="shots">${[...scored.values()].filter(row => row.shot !== null && thumbs.has(row.shot)).map(row => `<figure><img alt="${esc(row.from)} to ${esc(row.to)}" src="${thumbs.get(/** @type {string} */ (row.shot)) ?? ''}"><figcaption>${esc(row.run)}: ${esc(short(row.from))} → ${esc(short(row.to))}, ${row.ok ? `wall ${ms(row.wallMs)}` : esc(row.why)}</figcaption></figure>`).join('')}</div></section>`}
|
|
116
|
+
<p>Not measured yet: grey stand-ins within 60 m of the player. Online pairs are only those a walker reaches by input (an online page can't place its seat); the in-page tour covers every pair. Sources: ${sources.map(source => `<code>${esc(basename(source))}</code>`).join(', ')}.</p>
|
|
117
|
+
</main>
|
|
118
|
+
`;
|
|
119
|
+
writeFileSync(join(out, 'report.html'), html);
|
|
120
|
+
for (const row of worsened) console.log(`WORSE ${row.key} ${row.measure}: ${String(row.held)} -> ${String(row.now)}`);
|
|
121
|
+
console.log(`grid-crossing report: ${String(all.length)} crossings, ${String(meeting.length)} meet the bars, ${String(failed.length)} without control, ${String(worsened.length)} worse than the ratchet; ${join(out, 'report.html')}`);
|
|
122
|
+
process.exit(worsened.length === 0 ? 0 : 1);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// GRID-CROSSING GC8: stage attribution from the crossing tour (`grid-crossing-tour.mjs`, its `prepare` per crossing). For each
|
|
3
|
+
// preparation span the page measured for the crossing's target (`wildshard.prepare:<slug>:<step>`, developer pages; the cell's
|
|
4
|
+
// instance in a step name reads `<cell>`), its wall time cold (the first crossing into that cell in a tour) and warm (a later
|
|
5
|
+
// one), and per crossing the main thread's long tasks and the bytes fetched under the target's shardfile folder (transfer
|
|
6
|
+
// size is 0 for a cache hit or a loopback page: decoded size beside it). Wall time,
|
|
7
|
+
// not CPU: spans overlap and include their awaits (preparationTiming.ts). Prints a markdown table.
|
|
8
|
+
// node scripts/grid-crossing-stages.mjs <tour json or dir>,…
|
|
9
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
|
|
12
|
+
const files = process.argv.slice(2).flatMap(path => path.split(',')).filter(Boolean)
|
|
13
|
+
.flatMap(path => statSync(path).isDirectory() ? readdirSync(path).filter(name => name.endsWith('-tour.json')).map(name => join(path, name)) : [path]);
|
|
14
|
+
if (files.length === 0) throw new Error('usage: grid-crossing-stages.mjs <tour json or dir>,…');
|
|
15
|
+
/** @type {Map<string, { cold: number[], warm: number[] }>} */
|
|
16
|
+
const steps = new Map();
|
|
17
|
+
/** @type {{ run: string, from: string, to: string, boost: boolean, cold: boolean, wallMs: number, longTasks: number, longTaskMs: number, bytes: number, decoded: number, files: number, slowest: string }[]} */
|
|
18
|
+
const crossings = [];
|
|
19
|
+
for (const file of files) {
|
|
20
|
+
const tour = JSON.parse(readFileSync(file, 'utf8')), run = `${String(tour.engine)} ${String(tour.layout).split(' ')[0]}${tour.cold === true ? ' cold' : ''}`, seen = new Set(['driftwood-isle']);
|
|
21
|
+
for (const crossing of tour.crossings ?? []) {
|
|
22
|
+
const prepare = crossing.prepare; if (prepare === undefined) continue;
|
|
23
|
+
// a `--cold` tour (no HTTP cache, no service worker) fetches every crossing as a first visit
|
|
24
|
+
const cold = tour.cold === true || !seen.has(crossing.to); if (crossing.ok === true) seen.add(crossing.to);
|
|
25
|
+
let slowest = '', slowestMs = -1;
|
|
26
|
+
for (const [name, , ms] of prepare.spans ?? []) {
|
|
27
|
+
const step = String(name).replaceAll(crossing.to, '<cell>');
|
|
28
|
+
const row = steps.get(step) ?? { cold: [], warm: [] }; steps.set(step, row);
|
|
29
|
+
(cold ? row.cold : row.warm).push(ms);
|
|
30
|
+
if (ms > slowestMs) { slowestMs = ms; slowest = `${step} ${String(ms)} ms`; }
|
|
31
|
+
}
|
|
32
|
+
crossings.push({ run, from: crossing.from, to: crossing.to, boost: crossing.boost === true, cold, wallMs: crossing.wallMs ?? 0, longTasks: prepare.longTasks ?? 0,
|
|
33
|
+
longTaskMs: prepare.longTaskMs ?? 0, bytes: prepare.bytes ?? 0, decoded: prepare.decodedBytes ?? 0, files: prepare.files ?? 0, slowest });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const median = (/** @type {number[]} */ values) => { if (values.length === 0) return '-'; const sorted = [...values].sort((a, b) => a - b); return String(sorted[Math.floor(sorted.length / 2)]); };
|
|
37
|
+
const max = (/** @type {number[]} */ values) => values.length === 0 ? '-' : String(Math.max(...values));
|
|
38
|
+
console.log('| Step (span) | Cold n | Cold median ms | Cold max ms | Warm n | Warm median ms | Warm max ms |');
|
|
39
|
+
console.log('|---|---|---|---|---|---|---|');
|
|
40
|
+
for (const [step, row] of [...steps].sort((a, b) => Math.max(0, ...b[1].cold, ...b[1].warm) - Math.max(0, ...a[1].cold, ...a[1].warm))) {
|
|
41
|
+
console.log(`| \`${step}\` | ${String(row.cold.length)} | ${median(row.cold)} | ${max(row.cold)} | ${String(row.warm.length)} | ${median(row.warm)} | ${max(row.warm)} |`);
|
|
42
|
+
}
|
|
43
|
+
console.log('\n| Run | Crossing | Cold | Wall ms | Long tasks (ms) | Files (transfer KB / decoded MB) | Slowest span |');
|
|
44
|
+
console.log('|---|---|---|---|---|---|---|');
|
|
45
|
+
for (const c of crossings) {
|
|
46
|
+
console.log(`| ${c.run} | ${c.from} to ${c.to}${c.boost ? ' (boost)' : ''} | ${c.cold ? 'cold' : 'warm'} | ${String(c.wallMs)} | ${String(c.longTasks)} (${String(c.longTaskMs)}) | ${String(c.files)} (${String(Math.round(c.bytes / 1024))} / ${String(Math.round(c.decoded / 1048576))}) | ${c.slowest} |`);
|
|
47
|
+
}
|