@wildshard/engine 0.1.17 → 0.1.19
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 +21 -0
- package/lint/host-callback-syntax.mjs +2 -1
- package/lint/host-callbacks.mjs +3 -3
- package/lint/host-files.mjs +5 -4
- package/lint/no-base64.mjs +3 -1
- package/lint/ratchet.json +0 -68
- package/lint/ratchet.mjs +1 -4
- package/lint/shard-imports.mjs +6 -7
- package/lint/shard-source.d.mts +9 -0
- package/lint/shard-source.mjs +91 -0
- package/lint/shardfile-boundaries.mjs +10 -8
- package/lint/sim-closure.mjs +6 -3
- package/lint/wildshard-plugin.d.ts +4 -0
- package/lint/wildshard-plugin.js +22 -23
- package/package.json +25 -16
- 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 +22 -2
- package/scripts/app-build/isolation.d.mts +10 -0
- package/scripts/app-build/isolation.mjs +47 -0
- package/scripts/app-build/outputProducts.d.mts +3 -0
- package/scripts/app-build/outputProducts.mjs +35 -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 +34 -3
- package/scripts/built-product.mjs +1 -1
- package/scripts/cell-mem-bench.mjs +81 -23
- package/scripts/check-custom-sections-zero.mjs +1 -1
- package/scripts/check-devserver.mjs +3 -1
- 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-check.mjs +4 -2
- package/scripts/chromium-keychain.d.mts +1 -1
- package/scripts/chromium-keychain.mjs +3 -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 +20 -3
- package/scripts/devices.d.mts +4 -0
- package/scripts/devices.mjs +39 -0
- package/scripts/devserver-client.d.mts +4 -2
- package/scripts/devserver-client.mjs +25 -8
- package/scripts/docs-inputs-proof.mjs +6 -6
- package/scripts/doctor-proof.mjs +1 -1
- package/scripts/e2e-faults.mjs +159 -0
- 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 +277 -0
- package/scripts/grid-crossing-walk-proof.mjs +136 -18
- 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/live-prepush.py +3 -5
- package/scripts/loading-flow/benchmax.mjs +3 -1
- package/scripts/look-loop/test_look_loop.py +1 -38
- package/scripts/memory-proof.mjs +213 -0
- 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/offline-proof-rules.d.mts +5 -3
- package/scripts/offline-proof-rules.mjs +34 -7
- package/scripts/offline-proof.mjs +88 -18
- 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/pin-packs.ts +1 -1
- 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/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-proof.mjs +101 -0
- package/scripts/tier-textures.mjs +78 -0
- 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 +1 -2
- 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 +176 -0
- package/scripts/vps/harden.sh +16 -0
- package/scripts/vps/rebuild.sh +18 -0
- package/scripts/vps/wildshard-config +84 -24
- package/scripts/worker-client-play.mjs +7 -2
- package/scripts/worker-client-proof.mjs +1 -1
- package/scripts/worker-client-slug.mjs +44 -0
- package/scripts/worktree-reap.mjs +5 -5
- package/src/.oxlintrc.json +3 -182
- package/src/client/app/entry.ts +47 -12
- 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/parsedPages.ts +127 -58
- package/src/client/engine/boot/texturePack.ts +2 -2
- package/src/client/engine/build.d.ts +2 -0
- package/src/client/engine/core/Game.ts +18 -0
- package/src/client/engine/core/bootstrap.ts +4 -1
- package/src/client/engine/debug/probe.ts +18 -1
- package/src/client/engine/fx/LightPool.ts +41 -1
- 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 +29 -6
- package/src/client/engine/pwa/cacheNames.ts +58 -1
- package/src/client/engine/pwa/sw.js +53 -14
- package/src/client/engine/render/dataLook.ts +152 -40
- package/src/client/engine/render/families/detail.ts +89 -0
- package/src/client/engine/render/families/pbr.ts +7 -1
- package/src/client/engine/render/look.ts +6 -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 +20 -14
- package/src/client/engine/saves/indexed.ts +2 -2
- package/src/client/engine/telemetry/browserErrors.ts +28 -4
- package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
- 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/game/boot/audio.generated.ts +114 -216
- package/src/client/game/boot/bytes.generated.ts +118 -238
- 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 -7
- package/src/client/game/devScene/hook.ts +291 -0
- package/src/client/game/grid/area.ts +38 -0
- package/src/client/game/grid/cellLoading.ts +12 -2
- package/src/client/game/grid/live.ts +134 -12
- package/src/client/game/grid/liveSession.ts +47 -5
- package/src/client/game/grid/mapAtlas.ts +18 -4
- package/src/client/game/grid/menu.ts +4 -0
- package/src/client/game/grid/minimapBlend.ts +15 -5
- package/src/client/game/grid/neighbourPanels.ts +10 -1
- package/src/client/game/grid/oneWayIn.ts +5 -1
- package/src/client/game/grid/placedCards.ts +55 -0
- package/src/client/game/grid/placedCells.ts +233 -0
- 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 +3 -1
- package/src/client/game/grid/productLeases.ts +4 -1
- package/src/client/game/grid/products.ts +8 -4
- package/src/client/game/grid/regionalRuntime.ts +6 -0
- package/src/client/game/grid/regionalWorld.ts +15 -2
- package/src/client/game/grid/roadCull.ts +44 -14
- package/src/client/game/grid/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/roadTileBacking.ts +13 -3
- 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 +29 -4
- package/src/client/game/grid/shardfileFar.ts +9 -3
- 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 +11 -1
- package/src/client/game/shard/titleList.ts +6 -2
- package/src/client/game/shardfile/assetCache.ts +4 -4
- package/src/client/game/shardfile/client.ts +4 -1
- package/src/client/game/shardfile/clientAssets.ts +9 -5
- package/src/client/game/shardfile/clientLibrary.ts +1 -1
- package/src/client/game/shardfile/clientWater.ts +51 -9
- package/src/client/game/shardfile/clientWorker.ts +21 -8
- 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/systems/npc/figureRows.ts +9 -0
- package/src/client/game/titleDeck.ts +4 -3
- package/src/client/host/online/doctor.ts +2 -0
- package/src/client/host/online/linkScreens.ts +30 -4
- package/src/client/host/online/shell.ts +14 -0
- package/src/client/host/standalone/shell.ts +4 -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 +67 -9
- package/src/cook/game/spawnParts.ts +33 -8
- package/src/cook/game/tierTextures.ts +349 -0
- package/src/e2e/smoke/game.ts +19 -14
- package/src/e2e/smoke/page-globals.d.ts +9 -8
- package/src/e2e/smoke/template2.spec.ts +8 -7
- package/src/server/engine/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 +15 -4
- 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 +10 -6
- 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 +98 -16
- package/src/server/host/dedicated/cellProtocol.ts +16 -1
- package/src/server/host/dedicated/cellWorker.ts +8 -5
- package/src/server/host/dedicated/dedicatedRoom.ts +16 -6
- 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 +4 -19
- package/src/server/host/dedicated/roadRoom.ts +34 -4
- package/src/server/host/dedicated/serverMetrics.ts +126 -0
- package/src/server/host/dedicated/socketPump.ts +21 -4
- package/src/server/host/dedicated/socketTransport.ts +2 -1
- package/src/server/host/dedicated/workerTable.ts +15 -4
- package/src/server/host/dedicated/world.ts +95 -8
- 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 +4 -1
- package/src/server/host/standalone/serverProduct.ts +41 -11
- package/src/shared/engine/ai/BossBrain.ts +8 -0
- package/src/shared/engine/net/deviceWord.ts +138 -0
- package/src/shared/engine/net/socketFrames.ts +7 -4
- package/src/shared/game/boss/wake.ts +6 -0
- package/src/shared/game/devColliders.ts +47 -0
- package/src/shared/game/eliteSystem.ts +8 -0
- package/src/shared/game/grid/allocator.ts +3 -0
- package/src/shared/game/grid/catalogueSlot.ts +7 -0
- package/src/shared/game/grid/placementRows.ts +36 -0
- 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
|
@@ -11,6 +11,10 @@ export const DECK_SHARDS = Object.freeze([
|
|
|
11
11
|
]);
|
|
12
12
|
/** Open Plots have no deck card (the open-plots audit): a player reaches them by a deep link with Developer on, or a resume. */
|
|
13
13
|
export const OPEN_PLOTS = Object.freeze(['open-plot-thin-ice', 'open-plot-night-market', 'open-plot-mosslight-ruins']);
|
|
14
|
+
/** OF3, OF5b: whether the grid catalogue (`src/shared/game/grid/singleplayer.json`, its `grid.cells`) places a shard, so a world
|
|
15
|
+
* build may enter it. Thin Ice is a draft with no cell: a world build answers "Not in this world yet" for it.
|
|
16
|
+
* @param {string} slug @param {{ grid?: { cells?: readonly { slug?: unknown }[] } }} catalogue */
|
|
17
|
+
export const gridPlaces = (slug, catalogue) => (catalogue.grid?.cells ?? []).some(cell => cell.slug === slug);
|
|
14
18
|
/** Every shard the proof covers, in run order. */
|
|
15
19
|
export const ALL_SHARDS = Object.freeze([...DECK_SHARDS.map(shard => shard.slug), ...OPEN_PLOTS]);
|
|
16
20
|
|
|
@@ -30,10 +34,18 @@ export const CRITICAL_PHASES = Object.freeze(['start', 'download', 'load', 'none
|
|
|
30
34
|
* servedBy: 'service-worker' | 'network' | 'failed' | 'pending', status: number, fail: string }} RequestRow */
|
|
31
35
|
/** One poll of the screen.
|
|
32
36
|
* @typedef {{ t: number, phase: string, step: string, card: boolean, title: boolean, player: boolean, failCard: string,
|
|
33
|
-
* text: string }} ScreenSample */
|
|
37
|
+
* text: string, inside?: string | null }} ScreenSample */
|
|
34
38
|
/** One reason a run is red.
|
|
35
39
|
* @typedef {{ shard: string, rule: string, url?: string, detail?: string }} Failure */
|
|
36
|
-
/** @typedef {'play' | 'seat-wait' | 'title' | 'stalled' | 'error' | 'no-resume'} Outcome */
|
|
40
|
+
/** @typedef {'play' | 'seat-wait' | 'title' | 'stalled' | 'error' | 'no-resume' | 'outside-world'} Outcome */
|
|
41
|
+
|
|
42
|
+
/** OF5b: what counts as the screen changing, for the seat wait (10 s still at LOAD `server`) and the stall (60 s still, the game's
|
|
43
|
+
* own stuck watch, `stuckStep.ts`). The card's
|
|
44
|
+
* own state and its progress counters, never its free text: the card's clock and time-left tick every frame, and on a shard whose
|
|
45
|
+
* HUD has no quest lines (Template, Brasscap, Pastel Plain, Ink & Cel, the Open Plots) they fall inside any text prefix, so the
|
|
46
|
+
* screen never held still and those shards ran to the time limit instead of reaching the seat wait (buddy-engine's run, OF5b).
|
|
47
|
+
* @param {{ phase: string, step: string, error: string, failCard: string, title: boolean, player: boolean, progress: string }} screen */
|
|
48
|
+
export const screenKey = screen => JSON.stringify([screen.phase, screen.step, screen.error, screen.failCard, screen.title, screen.player, screen.progress]);
|
|
37
49
|
|
|
38
50
|
/** A request that may fail without the run going red (OF5: telemetry, `/version.json` and the release read). Telemetry is
|
|
39
51
|
* `/api/telemetry` and the error report `/api/errors`; the release read is the CDN's `/releases/<channel>.json` or the proof's
|
|
@@ -65,7 +77,7 @@ const failed = row => (row.servedBy === 'failed' && row.fail !== 'net::ERR_ABORT
|
|
|
65
77
|
* The red rules of one entry. `warm` is the paths the warm visit read (undefined for the warm visit itself).
|
|
66
78
|
* @param {{ shard: string, channel: 'staging' | 'preview', mode: string, entry: string, rows: readonly RequestRow[],
|
|
67
79
|
* samples: readonly ScreenSample[], outcome: Outcome, warm?: ReadonlySet<string>, layout?: boolean, walkthrough?: boolean,
|
|
68
|
-
* requireWorld?: boolean, proofError?: string, leaks?: number }} run
|
|
80
|
+
* requireWorld?: boolean, proofError?: string, leaks?: number, placed?: boolean, linked?: boolean }} run
|
|
69
81
|
* @returns {Failure[]}
|
|
70
82
|
*/
|
|
71
83
|
export function judge(run) {
|
|
@@ -102,16 +114,31 @@ export function judge(run) {
|
|
|
102
114
|
const proof = run.proofError !== undefined && run.proofError !== '';
|
|
103
115
|
out.push({ shard, rule: proof ? 'proof-error' : 'load-error-screen', detail: proof ? run.proofError : samples.at(-1)?.text.slice(0, 200) ?? '' });
|
|
104
116
|
}
|
|
105
|
-
|
|
117
|
+
// OF9: on a world build, reopening the page lands on the title by design (QA 11-12 row 35, Jake: "I expected reload to go back to
|
|
118
|
+
// main menu"; GO1: only a tap enters a world that seats a body), so its resume is the title, and the deck is the way back in.
|
|
119
|
+
// GC26: preview's grid page is a world page too (its deck enters the grid), so a placed shard's resume is the title there as well.
|
|
120
|
+
const titleByDesign = (channel === 'staging' || run.placed === true) && run.outcome === 'no-resume';
|
|
121
|
+
if (run.outcome === 'no-resume' && !titleByDesign) out.push({ shard, rule: 'no-resume', detail: 'reopening the page showed the title, not the shard' });
|
|
106
122
|
if ((run.leaks ?? 0) > 0) out.push({ shard, rule: 'offline-leak', detail: `${String(run.leaks)} reads reached the server while offline (the URLs are in the run's screens log)` });
|
|
107
|
-
if (run.requireWorld === true && run.outcome !== 'play') out.push({ shard, rule: 'not-in-world', detail: run.outcome });
|
|
123
|
+
if (run.requireWorld === true && run.outcome !== 'play' && !titleByDesign && !(run.outcome === 'outside-world' && run.placed === false)) out.push({ shard, rule: 'not-in-world', detail: run.outcome });
|
|
124
|
+
// GC26 (J311): preview's deck enters a placed shard in its grid cell, so the player ends inside that cell (the grid's `inside`), not
|
|
125
|
+
// on a one-shard page (no grid: `inside` absent) or another cell. A shard with no card (the Open Plots, Pastel Plain, Ink & Cel) is
|
|
126
|
+
// entered by its `?chunk=` link, which opens its one-shard page (GC25/GC27: the deck shows 7 grid cards), so it is judged as that page.
|
|
127
|
+
if (channel === 'preview' && run.placed === true && run.entry === 'deck' && run.linked !== true && run.outcome === 'play') {
|
|
128
|
+
let last; for (const sample of samples) if (sample.player) last = sample;
|
|
129
|
+
if (last !== undefined && last.inside !== shard) out.push({ shard, rule: 'not-in-cell', detail: last.inside === undefined ? 'a one-shard page, not the grid' : `inside ${last.inside ?? 'the road'}` });
|
|
130
|
+
}
|
|
131
|
+
// OF3: a world build never enters a shard its grid doesn't place (a draft such as Thin Ice): the title's "Not in this world yet"
|
|
132
|
+
// is the right end there, and wrong for a placed shard or a build with no world (preview opens every shard).
|
|
133
|
+
if (run.outcome === 'outside-world' && !(channel === 'staging' && run.placed === false))
|
|
134
|
+
out.push({ shard, rule: 'outside-world', detail: channel === 'staging' ? 'the grid places this shard, yet the page said it is not in this world' : 'a build with no world opens every shard' });
|
|
108
135
|
// 6. A load that never finished with nothing else to blame.
|
|
109
136
|
if (run.outcome === 'stalled' && out.length === 0) {
|
|
110
137
|
const last = samples.at(-1);
|
|
111
138
|
out.push({ shard, rule: 'stalled', detail: `${last?.phase ?? '?'}/${last?.step ?? '?'}` });
|
|
112
139
|
}
|
|
113
|
-
// 7. OF20: an offline entry reads the grid layout from the cache, and reads it at all.
|
|
114
|
-
if (run.layout === true) {
|
|
140
|
+
// 7. OF20: an offline entry reads the grid layout from the cache, and reads it at all (a shard the world doesn't open loads none).
|
|
141
|
+
if (run.layout === true && run.outcome !== 'outside-world') {
|
|
115
142
|
const layout = rows.filter(row => row.origin === 'page' && GRID_LAYOUT.test(pathOf(row.url)));
|
|
116
143
|
if (layout.length === 0) out.push({ shard, rule: 'grid-layout-not-read', detail: 'the entry read no grid layout (a one-shard route, or none)' });
|
|
117
144
|
for (const row of layout) if (row.servedBy !== 'service-worker') out.push({ shard, rule: 'grid-layout-not-cached', url: row.url, detail: row.servedBy });
|
|
@@ -27,12 +27,16 @@
|
|
|
27
27
|
// world, a staging-like seat wait included. `--report` prints the same and exits 0. CI never runs this (FM11: no browser proof
|
|
28
28
|
// in pre-push or CI); it is not in scripts/ci-pack.mjs.
|
|
29
29
|
//
|
|
30
|
+
// `--one-origin` (OF12) serves both channels on the staging-like origin, from one profile: the proxy stamps the world only while
|
|
31
|
+
// the staging pass runs. Passes preview, staging, then preview again (offline, from what the first pass warmed), so each
|
|
32
|
+
// channel's worker activating over the other's on one origin must leave the other's caches whole.
|
|
33
|
+
//
|
|
30
34
|
// `--walkthrough <slug>` is Jake's walk-through (OF21) on the staging-like build, on a fresh profile: online, Shard select to
|
|
31
35
|
// the shard, play about 30 s moving around, close the browser, reopen it offline, Shard select to the same shard. Green only
|
|
32
36
|
// when START, DOWNLOAD and LOAD finish from the cache, the player is in the world, and then the connection card shows.
|
|
33
37
|
//
|
|
34
38
|
// scripts/browser-lane.sh node scripts/offline-proof.mjs [--channel=staging|preview|both] [--mode=offline|slow|nobackend]
|
|
35
|
-
// [--shard=<slug>[,<slug>]] [--entry=deck|resume|both] [--jobs=<n>] [--base=<served build>] [--out=<dir>] [--require-world] [--staging-port=<n>] [--report]
|
|
39
|
+
// [--shard=<slug>[,<slug>]] [--entry=deck|resume|both] [--jobs=<n>] [--base=<served build>] [--out=<dir>] [--require-world] [--staging-port=<n>] [--one-origin] [--cells=<n>] [--cold] [--report]
|
|
36
40
|
// scripts/browser-lane.sh node scripts/offline-proof.mjs --walkthrough <slug> [--base=…] [--out=…] [--report]
|
|
37
41
|
// With no `--base` it builds this working tree with scripts/serve-build.sh and stops that server at the end. `--jobs` above 1
|
|
38
42
|
// gives each shard its own profile (one profile can't hold two browsers), which trades the shared-device shape for time.
|
|
@@ -44,7 +48,7 @@ import { join, resolve as resolvePath } from 'node:path';
|
|
|
44
48
|
import { chromium } from 'playwright';
|
|
45
49
|
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
46
50
|
import { saveFixture } from './debug-settings.mjs';
|
|
47
|
-
import { ALL_SHARDS, DECK_SHARDS, judge, OPEN_PLOTS, pathOf, servedCounts } from './offline-proof-rules.mjs';
|
|
51
|
+
import { ALL_SHARDS, DECK_SHARDS, gridPlaces, judge, OPEN_PLOTS, pathOf, screenKey, servedCounts } from './offline-proof-rules.mjs';
|
|
48
52
|
import { CHANNELS, RELEASE_PUBLIC_KEY } from './page-release/flow.mjs';
|
|
49
53
|
|
|
50
54
|
/** @typedef {import('./offline-proof-rules.mjs').RequestRow} RequestRow */
|
|
@@ -74,11 +78,22 @@ if (!Number.isInteger(jobs) || jobs < 1) throw new Error(`--jobs is a whole numb
|
|
|
74
78
|
/** OF5 and OF9 on: an entry that ends anywhere but in the world is red (a staging-like seat wait included). */
|
|
75
79
|
const requireWorld = argv.includes('--require-world');
|
|
76
80
|
const report = argv.includes('--report');
|
|
81
|
+
/** OF13: `--cold` enters a shard this profile never visited (no warm visits), as a device that downloaded only other shards. */
|
|
82
|
+
const cold = argv.includes('--cold');
|
|
83
|
+
/** OF12: both channels on one origin and one profile (see above). */
|
|
84
|
+
const oneOrigin = argv.includes('--one-origin');
|
|
85
|
+
if (oneOrigin && (jobs !== 1 || walkthrough !== undefined)) throw new Error('--one-origin runs one profile: --jobs=1, no --walkthrough');
|
|
77
86
|
const out = resolvePath(ROOT, option('out') ?? join('tmp', 'offline-proof', new Date().toISOString().replaceAll(/[:.]/gu, '-')));
|
|
78
87
|
mkdirSync(out, { recursive: true });
|
|
79
88
|
const STAGING = CHANNELS.staging;
|
|
89
|
+
/** The grid catalogue: a world build enters only the shards it places (OF3). It is this checkout's, so it matches a build of this
|
|
90
|
+
* tree (the default, or a `--base` served from it), not a build of another commit. */
|
|
91
|
+
const CATALOGUE = JSON.parse(readFileSync(join(ROOT, 'src/shared/game/grid/singleplayer.json'), 'utf8'));
|
|
80
92
|
/** The stand-in door's world word: every proof shard on staging's grid. */
|
|
81
|
-
|
|
93
|
+
/** OF5b: `--cells=1` makes the stand-in door say production's one-cell word, so every page takes the one-shard `client` route. */
|
|
94
|
+
const WORD_CELLS = Number(option('cells') ?? 20);
|
|
95
|
+
if (!Number.isInteger(WORD_CELLS) || WORD_CELLS < 1) throw new Error(`--cells is a whole number from 1, not ${String(option('cells'))}`);
|
|
96
|
+
const WORLD_WORD = Buffer.concat([Buffer.from([9]), Buffer.from(JSON.stringify({ cells: WORD_CELLS, shards: [...ALL_SHARDS] }))]);
|
|
82
97
|
const IPHONE = 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1';
|
|
83
98
|
/** @param {number} ms */
|
|
84
99
|
const sleep = ms => new Promise(resolve => { setTimeout(resolve, ms); });
|
|
@@ -110,6 +125,8 @@ const RELEASE_PATH = '/__offline-proof/staging.json';
|
|
|
110
125
|
/** @type {Promise<string> | undefined} */
|
|
111
126
|
let signedRelease;
|
|
112
127
|
let stamperHits = 0, proxyOffline = false;
|
|
128
|
+
/** OF12 `--one-origin`: off while the preview pass runs, so the one origin serves the build as built. */
|
|
129
|
+
let stampOn = true;
|
|
113
130
|
/** @type {string[]} the last reads the proxy answered, to name an offline leak */
|
|
114
131
|
const stamperSeen = [];
|
|
115
132
|
/** @param {import('node:http').IncomingMessage} request @param {import('node:http').ServerResponse} response */
|
|
@@ -143,7 +160,10 @@ async function stamp(request, response) {
|
|
|
143
160
|
const sent = {};
|
|
144
161
|
answer.headers.forEach((value, name) => { if (!['content-length', 'transfer-encoding', 'connection', 'keep-alive'].includes(name)) sent[name] = value; });
|
|
145
162
|
const html = (answer.headers.get('content-type') ?? '').includes('text/html');
|
|
146
|
-
|
|
163
|
+
const workerCore = new URL(request.url ?? '/', upstream).pathname.startsWith('/sw-core/');
|
|
164
|
+
// OF12: one origin, two documents under one name: neither may come from the HTTP cache, or a channel switch never lands
|
|
165
|
+
if (oneOrigin && (html || workerCore)) { for (const name of ['etag', 'last-modified']) Reflect.deleteProperty(sent, name); sent['cache-control'] = 'no-store'; }
|
|
166
|
+
if (stampOn && (html || workerCore)) {
|
|
147
167
|
const text = body.toString('utf8');
|
|
148
168
|
if (!text.includes('globalThis.__WS_BUILD_ID__=')) { response.writeHead(500).end('offline-proof: a document without the build stamp'); return; }
|
|
149
169
|
// in the worker's copy the stamp sits inside a JSON string, so it goes in escaped
|
|
@@ -167,7 +187,7 @@ await new Promise((resolve, reject) => { stamper.once('error', reject); stamper.
|
|
|
167
187
|
const stamperAddress = stamper.address();
|
|
168
188
|
if (stamperAddress === null || typeof stamperAddress === 'string') throw new Error('offline-proof: the stamping server has no port');
|
|
169
189
|
/** @type {Record<Channel, string>} */
|
|
170
|
-
const ORIGINS = { preview: upstream.origin, staging: `http://127.0.0.1:${String(stamperAddress.port)}` };
|
|
190
|
+
const ORIGINS = { preview: oneOrigin ? `http://127.0.0.1:${String(stamperAddress.port)}` : upstream.origin, staging: `http://127.0.0.1:${String(stamperAddress.port)}` };
|
|
171
191
|
STAMP = `globalThis.__WS_WORLD__=${JSON.stringify({ release: `${ORIGINS.staging}${RELEASE_PATH}`, key: RELEASE_PUBLIC_KEY })};`;
|
|
172
192
|
|
|
173
193
|
/** A free loopback port for a browser's own DevTools endpoint. */
|
|
@@ -196,15 +216,22 @@ const readScreen = () => {
|
|
|
196
216
|
const title = main instanceof HTMLElement && main.offsetParent !== null;
|
|
197
217
|
const fail = [...document.querySelectorAll('[class^="ws-fail"],[class*=" ws-fail"]')].find(node => node instanceof HTMLElement && node.offsetParent !== null);
|
|
198
218
|
const world = /** @type {{ __wildshard?: { world?: { player?: unknown } } }} */ (/** @type {unknown} */ (window)).__wildshard?.world;
|
|
219
|
+
/** @type {string | null | undefined} */ let grid;
|
|
220
|
+
// the probe's area (T2E-1b): a grid cell's instance, null between cells (the road); a one-shard page's area has no instance
|
|
221
|
+
try { const area = /** @type {any} */ (window).__wildshard?.area?.(); grid = area === null ? null : typeof area?.instance === 'string' ? area.instance : undefined; } catch { grid = undefined; }
|
|
199
222
|
return {
|
|
200
223
|
card, title: title && !card, player: world?.player !== undefined && world.player !== null && !card,
|
|
201
224
|
phase: card ? (on instanceof HTMLElement ? on.dataset.phase ?? 'none' : 'none') : title ? 'title' : 'page',
|
|
202
225
|
step: load instanceof HTMLElement ? load.dataset.step ?? '' : '',
|
|
226
|
+
// OF5b: the card's progress counters, which hold still while it waits on the seat (its clock and time-left never do)
|
|
227
|
+
progress: load instanceof HTMLElement ? [load.dataset.setup, load.dataset.readBytes, load.dataset.streamedBytes, load.dataset.spawnFilesDone, load.dataset.serverFiles].join('|') : '',
|
|
203
228
|
error: (document.querySelector('.ws-load-error')?.textContent ?? '').replaceAll(/\s+/gu, ' ').slice(0, 300),
|
|
204
229
|
// oxlint-disable-next-line unicorn/prefer-dom-node-text-content -- the text a player sees, not hidden templates
|
|
205
230
|
failCard: fail instanceof HTMLElement ? fail.innerText.replaceAll(/\s+/gu, ' ').slice(0, 300) : '',
|
|
206
231
|
// oxlint-disable-next-line unicorn/prefer-dom-node-text-content -- the text a player sees, not hidden templates
|
|
207
232
|
text: (document.body?.innerText ?? '').replaceAll(/\s+/gu, ' ').slice(0, 3000), url: location.href, world: Reflect.get(globalThis, '__WS_WORLD__') !== undefined,
|
|
233
|
+
// GC26: the grid cell the player stands in (absent on a one-shard page, null on the road)
|
|
234
|
+
...grid === undefined ? {} : { inside: grid },
|
|
208
235
|
};
|
|
209
236
|
};
|
|
210
237
|
|
|
@@ -286,8 +313,9 @@ async function enter(run) {
|
|
|
286
313
|
if (screen !== undefined) {
|
|
287
314
|
last = screen; phase = screen.phase; step = screen.step;
|
|
288
315
|
const previous = samples.at(-1);
|
|
289
|
-
|
|
290
|
-
|
|
316
|
+
/** @type {ScreenSample} */
|
|
317
|
+
const sample = { t: at(), phase: screen.phase, step: screen.step, card: screen.card, title: screen.title, player: screen.player, failCard: screen.failCard, text: screen.text, ...screen.inside === undefined ? {} : { inside: screen.inside } };
|
|
318
|
+
if (previous === undefined || previous.phase !== sample.phase || previous.step !== sample.step || previous.title !== sample.title || previous.player !== sample.player || previous.failCard !== sample.failCard || previous.inside !== sample.inside || previous.text.slice(0, 400) !== sample.text.slice(0, 400)) samples.push(sample);
|
|
291
319
|
}
|
|
292
320
|
};
|
|
293
321
|
const poller = setInterval(() => { void poll(); }, 250);
|
|
@@ -303,9 +331,10 @@ async function enter(run) {
|
|
|
303
331
|
try {
|
|
304
332
|
const open = OPEN_PLOTS.includes(slug) && entry === 'deck' ? `/?chunk=${slug}&skipintro&mute=1` : '/?mute=1';
|
|
305
333
|
// a deep link is the entry itself: its reads are the card's from the first one
|
|
306
|
-
|
|
334
|
+
let linked = open !== '/?mute=1';
|
|
335
|
+
if (linked) phase = 'none';
|
|
307
336
|
const hitsBefore = stamperHits;
|
|
308
|
-
proxyOffline = mode === 'offline' && channel === 'staging' && jobs === 1;
|
|
337
|
+
proxyOffline = mode === 'offline' && (channel === 'staging' || oneOrigin) && jobs === 1;
|
|
309
338
|
leakFrom = () => stamperHits - hitsBefore;
|
|
310
339
|
leakedUrls = () => stamperSeen.slice(-Math.min(stamperSeen.length, stamperHits - hitsBefore));
|
|
311
340
|
await page.goto(new URL(open, ORIGINS[channel]).href, { waitUntil: 'commit', timeout: 60_000 }).catch((/** @type {unknown} */ error) => { consoleLines.push(`goto ${String(error).slice(0, 200)}`); });
|
|
@@ -321,7 +350,7 @@ async function enter(run) {
|
|
|
321
350
|
if (index === -1) {
|
|
322
351
|
// a shard this build's deck doesn't show (Pastel Plain, Ink & Cel): the deep link with Developer on, as for Open Plots
|
|
323
352
|
consoleLines.push(`no deck card "${card}" (deck: ${names.join(', ')}): entered by ?chunk=`);
|
|
324
|
-
phase = 'none';
|
|
353
|
+
phase = 'none'; linked = true;
|
|
325
354
|
await page.goto(new URL(`/?chunk=${slug}&skipintro&mute=1`, ORIGINS[channel]).href, { waitUntil: 'commit', timeout: 60_000 });
|
|
326
355
|
} else {
|
|
327
356
|
await page.locator(`.ws-menu-dots i[data-i="${String(index)}"]`).click();
|
|
@@ -338,15 +367,18 @@ async function enter(run) {
|
|
|
338
367
|
if (screen === undefined) continue;
|
|
339
368
|
if (await page.locator('.ws-load-play').isVisible().catch(() => false)) await page.locator('.ws-load-play').click({ timeout: 3000 }).catch(() => undefined);
|
|
340
369
|
cardSeen ||= screen.card;
|
|
341
|
-
const now =
|
|
370
|
+
const now = screenKey(screen);
|
|
342
371
|
if (now !== key) { key = now; changed = Date.now(); }
|
|
343
372
|
if (screen.player) { outcome = 'play'; break; }
|
|
344
373
|
if (screen.error !== '') { outcome = 'error'; break; }
|
|
345
374
|
if (cardSeen && screen.title) { outcome = 'title'; break; }
|
|
346
375
|
if (!cardSeen && screen.title && entry === 'resume' && at() - tappedAt > 20_000) { outcome = 'no-resume'; break; }
|
|
376
|
+
// OF3: a world build's title after a link to a shard its grid doesn't place (judged against the catalogue)
|
|
377
|
+
// (a link's answer only: a closed deck card shows the same badge)
|
|
378
|
+
if (linked && !cardSeen && screen.title && /not in this world yet/iu.test(screen.text) && at() - tappedAt > 5000) { outcome = 'outside-world'; break; }
|
|
347
379
|
// a staging-like page waits on the seat, which the stand-in door never gives
|
|
348
380
|
if (channel === 'staging' && screen.phase === 'load' && screen.step === 'server' && Date.now() - changed > 10_000) { outcome = 'seat-wait'; break; }
|
|
349
|
-
if (Date.now() - changed > (mode === 'slow' ? 90_000 :
|
|
381
|
+
if (Date.now() - changed > (mode === 'slow' ? 90_000 : 60_000) || at() - tappedAt > limit) { outcome = 'stalled'; break; }
|
|
350
382
|
}
|
|
351
383
|
outcomeMs = at() - tappedAt;
|
|
352
384
|
await shot(outcome);
|
|
@@ -373,7 +405,7 @@ async function enter(run) {
|
|
|
373
405
|
for (const name of await globalThis.caches.keys()) counts[name] = (await (await globalThis.caches.open(name)).keys()).length;
|
|
374
406
|
return counts;
|
|
375
407
|
}), 10_000) ?? {};
|
|
376
|
-
const reached = mode === 'offline' && channel === 'staging' ? leakFrom() : 0;
|
|
408
|
+
const reached = mode === 'offline' && (channel === 'staging' || oneOrigin) ? leakFrom() : 0;
|
|
377
409
|
if (reached > 0) consoleLines.push(`offline ${proxyOffline ? 'reads refused by the offline proxy' : 'leak'}: ${leakedUrls().join(' ')}`);
|
|
378
410
|
// refused reads failed as they would on a phone, so they aren't a leak; with --jobs above 1 the proxy can't go offline
|
|
379
411
|
const leaks = proxyOffline ? 0 : reached;
|
|
@@ -397,17 +429,53 @@ async function installApp(profile) {
|
|
|
397
429
|
} finally { await context.close().catch(() => undefined); }
|
|
398
430
|
}
|
|
399
431
|
|
|
432
|
+
/**
|
|
433
|
+
* OF12 `--one-origin`: hand the one origin to a channel. The page is served by the worker in control, whose copy of the document
|
|
434
|
+
* is the old channel's, so the new channel's worker is installed by an update check and adopted (SKIP_WAITING), as a deploy's is,
|
|
435
|
+
* until a fresh load of `/` carries the channel's stamp (or none). Logs the origin's caches after the switch.
|
|
436
|
+
* @param {string} profile @param {Channel} channel
|
|
437
|
+
*/
|
|
438
|
+
async function switchChannel(profile, channel) {
|
|
439
|
+
const context = await chromium.launchPersistentContext(profile, { headless: true, viewport: { width: 402, height: 874 }, deviceScaleFactor: 3, hasTouch: true, isMobile: true, userAgent: IPHONE,
|
|
440
|
+
serviceWorkers: 'allow', args: ['--use-angle=metal', ...KEYCHAIN_ARGS, '--mute-audio'] });
|
|
441
|
+
try {
|
|
442
|
+
const page = context.pages()[0] ?? await context.newPage();
|
|
443
|
+
for (let attempt = 0; attempt < 4; attempt++) {
|
|
444
|
+
await page.goto(new URL('/?mute=1', ORIGINS[channel]).href, { waitUntil: 'load', timeout: 60_000 });
|
|
445
|
+
const world = await page.evaluate(() => Reflect.get(globalThis, '__WS_WORLD__') !== undefined);
|
|
446
|
+
const controlled = await page.evaluate(() => navigator.serviceWorker.controller !== null);
|
|
447
|
+
if (world === (channel === 'staging') && controlled) {
|
|
448
|
+
const names = await page.evaluate(async () => (await caches.keys()).sort());
|
|
449
|
+
log(`one origin is ${channel}'s (attempt ${String(attempt + 1)}); caches: ${names.join(' ')}`);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
await page.evaluate(async () => {
|
|
453
|
+
const registration = await navigator.serviceWorker.getRegistration();
|
|
454
|
+
await registration?.update().catch(() => undefined);
|
|
455
|
+
const next = registration?.installing ?? registration?.waiting;
|
|
456
|
+
if (next === null || next === undefined) return;
|
|
457
|
+
if (next.state === 'installing') await new Promise(resolve => { next.addEventListener('statechange', () => { if (next.state !== 'installing') resolve(null); }); });
|
|
458
|
+
// oxlint-disable-next-line unicorn/require-post-message-target-origin -- a ServiceWorker's postMessage takes no origin
|
|
459
|
+
next.postMessage({ type: 'SKIP_WAITING' });
|
|
460
|
+
await new Promise(resolve => { navigator.serviceWorker.addEventListener('controllerchange', () => { resolve(null); }); setTimeout(resolve, 10_000); });
|
|
461
|
+
}).catch(() => undefined);
|
|
462
|
+
}
|
|
463
|
+
throw new Error(`offline-proof: the one origin never turned to ${channel}`);
|
|
464
|
+
} finally { await context.close().catch(() => undefined); }
|
|
465
|
+
}
|
|
466
|
+
|
|
400
467
|
/**
|
|
401
468
|
* One shard on one channel: warm (once per profile), then the mode's entries.
|
|
402
469
|
* @param {Channel} channel @param {Mode} mode @param {string} slug @param {string} profile
|
|
403
470
|
*/
|
|
404
471
|
async function proveShard(channel, mode, slug, profile) {
|
|
405
472
|
// beside its own profile, so a different --jobs layout (a cold profile) warms again
|
|
406
|
-
const warmFile = join(`${profile}.warm-${slug}.json`);
|
|
473
|
+
const warmFile = join(oneOrigin ? `${profile}.warm-${channel}-${slug}.json` : `${profile}.warm-${slug}.json`);
|
|
407
474
|
const results = [];
|
|
408
475
|
/** @type {Set<string> | undefined} */
|
|
409
476
|
let warm;
|
|
410
477
|
if (existsSync(warmFile)) warm = new Set(/** @type {string[]} */ (JSON.parse(readFileSync(warmFile, 'utf8'))));
|
|
478
|
+
else if (cold) { log(`${channel}-${slug}: --cold, never visited on this profile`); warm = new Set(); }
|
|
411
479
|
else {
|
|
412
480
|
const label = `${channel}-warm-${slug}`;
|
|
413
481
|
// Two visits: the first installs the worker (a fresh page isn't controlled), the second reads through it. A staging-like
|
|
@@ -439,10 +507,11 @@ function record(channel, mode, slug, entry, visit, warm, extra = {}) {
|
|
|
439
507
|
const label = `${channel}-${mode}-${slug}-${entry}`;
|
|
440
508
|
writeFileSync(join(out, `${label}-requests.json`), JSON.stringify(visit.rows));
|
|
441
509
|
writeFileSync(join(out, `${label}-screens.json`), JSON.stringify({ samples: visit.samples, console: visit.consoleLines }));
|
|
442
|
-
const layout = channel === 'staging' && mode === 'offline' && (entry === 'deck' || extra.walkthrough === true);
|
|
510
|
+
const layout = channel === 'staging' && mode === 'offline' && WORD_CELLS > 1 && (entry === 'deck' || extra.walkthrough === true); // a one-cell world (--cells=1) enters no grid
|
|
443
511
|
const failures = judge({ shard: slug, channel, mode, entry, rows: visit.rows, samples: visit.samples,
|
|
444
512
|
outcome: visit.outcome, ...warm === undefined ? {} : { warm }, layout, proofError: visit.proofError, leaks: visit.leaks,
|
|
445
|
-
requireWorld: requireWorld && !mode.startsWith('warm'),
|
|
513
|
+
requireWorld: requireWorld && !mode.startsWith('warm'), placed: gridPlaces(slug, CATALOGUE),
|
|
514
|
+
linked: entry === 'deck' && (OPEN_PLOTS.includes(slug) || visit.consoleLines.some(line => line.startsWith('no deck card'))), ...extra });
|
|
446
515
|
if (channel === 'staging' && !visit.world) failures.unshift({ shard: slug, rule: 'proof-not-a-world-build', detail: 'the page had no __WS_WORLD__ stamp' });
|
|
447
516
|
const result = { shard: slug, channel, mode, entry, outcome: visit.outcome, ms: visit.ms, lastCard: visit.lastCard, served: servedCounts(visit.rows),
|
|
448
517
|
swSoloReads: visit.rows.filter(row => row.origin === 'sw' && /serverWorker|serverRuntime|\/assets\/spawn\/server\//u.test(row.url)).length,
|
|
@@ -471,14 +540,15 @@ try {
|
|
|
471
540
|
const offline = await enter({ channel: 'staging', profile, slug: walkthrough, mode: 'offline', entry: 'deck', label: `staging-walk-offline-${walkthrough}` });
|
|
472
541
|
results.push(record('staging', 'offline', walkthrough, 'deck', offline, warm, { walkthrough: true }));
|
|
473
542
|
} else {
|
|
474
|
-
const channels = /** @type {Channel[]} */ (channelArg === 'both' ? ['preview', 'staging'] : [channelArg]);
|
|
543
|
+
const channels = /** @type {Channel[]} */ (oneOrigin ? ['preview', 'staging', 'preview'] : channelArg === 'both' ? ['preview', 'staging'] : [channelArg]);
|
|
475
544
|
for (const channel of channels) {
|
|
476
545
|
const mode = /** @type {Mode} */ (modeArg);
|
|
477
546
|
if (channel === 'preview' && mode === 'nobackend') { log('preview has no world: --mode=nobackend skipped'); continue; }
|
|
547
|
+
if (oneOrigin) { stampOn = channel === 'staging'; await switchChannel(join(out, 'profile-one-origin'), channel); }
|
|
478
548
|
const queue = [...shards];
|
|
479
549
|
const worker = async (/** @type {number} */ lane) => {
|
|
480
550
|
for (let slug = queue.shift(); slug !== undefined; slug = queue.shift()) {
|
|
481
|
-
const profile = join(out, jobs > 1 ? `profile-${channel}-${slug}` : `profile-${channel}`);
|
|
551
|
+
const profile = join(out, oneOrigin ? 'profile-one-origin' : jobs > 1 ? `profile-${channel}-${slug}` : `profile-${channel}`);
|
|
482
552
|
try { results.push(...await proveShard(channel, mode, slug, profile)); } catch (error) { log(`lane ${String(lane)} ${slug} broke: ${String(error)}`); results.push({ shard: slug, channel, mode, entry: 'deck', outcome: 'error', ms: 0, lastCard: '', served: {}, swSoloReads: 0, caches: {}, world: false, failures: [{ shard: slug, rule: 'proof-error', detail: String(error).slice(0, 300) }] }); }
|
|
483
553
|
}
|
|
484
554
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { existsSync, readFileSync } from 'node:fs';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { resolve } from 'node:path';
|
|
6
|
-
import { outputFormat, platformFileFamiliesFormat } from './
|
|
6
|
+
import { outputFormat, platformFileFamiliesFormat } from './node-format.mjs';
|
|
7
7
|
import { shardOutputs } from './shard-outputs.mjs';
|
|
8
8
|
|
|
9
9
|
const {parseOutputIndex}=outputFormat;
|
|
@@ -7,9 +7,12 @@ export interface ContentStore {
|
|
|
7
7
|
exists: (key: string) => Promise<boolean>;
|
|
8
8
|
put: (puts: readonly Put[]) => Promise<void>;
|
|
9
9
|
read: (key: string, origin: string) => Promise<Read>;
|
|
10
|
+
sets?: () => Promise<string[]>;
|
|
11
|
+
copy?: (from: string, to: string, headers: Headers, bytes: number) => Promise<void>;
|
|
10
12
|
}
|
|
11
13
|
export interface ContentSummary {
|
|
12
14
|
set: string; base: string; files: number; bytes: number; uploaded: number; uploadedBytes: number; held: number;
|
|
15
|
+
copied: number; copiedBytes: number;
|
|
13
16
|
kinds: Record<string, { files: number; bytes: number }>; cors: string;
|
|
14
17
|
}
|
|
15
18
|
export const BUCKET: string;
|
|
@@ -18,6 +21,7 @@ export const CONTENT_ROOT: string;
|
|
|
18
21
|
export const GAME_ORIGIN: string;
|
|
19
22
|
export const KIND_NAMES: readonly Kind[];
|
|
20
23
|
export function contentHeaders(key: string): Headers;
|
|
24
|
+
export const UNREAD_PACK: RegExp;
|
|
21
25
|
export function contentKind(path: string, shards: ReadonlySet<string>): Kind | undefined;
|
|
22
26
|
export function contentKey(set: string, path: string): string;
|
|
23
27
|
export function contentBaseOf(set: string): string;
|
|
@@ -27,4 +31,8 @@ export function contentIndex(set: string, files: readonly ContentFile[]): Buffer
|
|
|
27
31
|
export function readBack(store: ContentStore, key: string, expected: string, origin: string, sleep: (ms: number) => Promise<void>): Promise<number>;
|
|
28
32
|
export function publishContent(options: { dir: string; store: ContentStore; scratch: string; origin?: string; dryRun?: boolean; log: (line: string) => void; sleep?: (ms: number) => Promise<void> }): Promise<ContentSummary>;
|
|
29
33
|
export function sampleContent(options: { dir: string; store: ContentStore; count: number; origins: readonly string[]; log: (line: string) => void; sleep?: (ms: number) => Promise<void> }): Promise<{ set: string; checked: Record<string, number> }>;
|
|
30
|
-
export
|
|
34
|
+
export const DONOR_SETS: number;
|
|
35
|
+
export const COPY_SAMPLE: number;
|
|
36
|
+
export function copyFromSets(options: { set: string; missing: readonly ContentFile[]; store: ContentStore; origin: string; log: (line: string) => void; sleep: (ms: number) => Promise<void> }): Promise<ContentFile[]>;
|
|
37
|
+
export function r2Copies(env: NodeJS.ProcessEnv): { sets: () => Promise<string[]>; copy: (from: string, to: string, headers: Headers, bytes: number) => Promise<void>; put: (puts: readonly Put[]) => Promise<void>; secrets: string[]; close: () => void } | undefined;
|
|
38
|
+
export function r2Content(options: { root: string; scratch: string; token?: string; fetch?: typeof fetch; copies?: Pick<ContentStore, 'sets' | 'copy'> & { put?: ContentStore['put'] }; exec?: (file: string, args: string[], options: { cwd: string; env: NodeJS.ProcessEnv; timeout?: number }, secrets: string[]) => string }): ContentStore;
|