@wildshard/engine 0.1.15 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/index.html +157 -11
- package/lint/engine-sides.json +23 -0
- package/lint/host-callback-syntax.mjs +2 -1
- package/lint/host-callbacks.mjs +3 -3
- package/lint/host-files.mjs +5 -4
- package/lint/host-register.json +496 -0
- package/lint/no-base64.mjs +3 -1
- package/lint/ratchet.json +2 -2
- package/lint/shard-imports.d.mts +1 -0
- package/lint/shard-imports.mjs +60 -13
- package/lint/shard-source.d.mts +9 -0
- package/lint/shard-source.mjs +91 -0
- package/lint/shardfile-boundaries.mjs +10 -8
- package/lint/sim-closure.mjs +6 -3
- package/lint/wildshard-plugin.d.ts +4 -0
- package/lint/wildshard-plugin.js +44 -27
- package/package.json +24 -6
- package/scripts/app-build/buildIdentity.d.mts +3 -1
- package/scripts/app-build/buildIdentity.mjs +25 -5
- package/scripts/app-build/builtAt.d.mts +4 -0
- package/scripts/app-build/builtAt.mjs +21 -0
- package/scripts/app-build/outputProducts.d.mts +3 -0
- package/scripts/app-build/outputProducts.mjs +31 -0
- package/scripts/app-build/serviceWorker.ts +16 -2
- package/scripts/app-build/versionFiles.ts +2 -1
- package/scripts/app-build-pipeline.mjs +7 -1
- package/scripts/audio-download-proof.mjs +843 -0
- package/scripts/build-app.mjs +4 -0
- package/scripts/build-mirror.d.mts +2 -0
- package/scripts/build-mirror.mjs +5 -4
- package/scripts/built-product.mjs +3 -3
- package/scripts/cell-mem/metrics-preload.mjs +65 -0
- package/scripts/cell-mem-bench.mjs +130 -0
- package/scripts/check-chunks.mjs +2 -1
- package/scripts/check-devserver.mjs +1 -1
- package/scripts/chromium-keychain-check.mjs +4 -2
- package/scripts/chromium-keychain.mjs +3 -1
- package/scripts/cook.mjs +7 -3
- package/scripts/devices.d.mts +4 -0
- package/scripts/devices.mjs +39 -0
- package/scripts/devserver-client.d.mts +7 -0
- package/scripts/devserver-client.mjs +85 -0
- package/scripts/doctor-proof.mjs +1 -1
- package/scripts/e2e-faults.mjs +159 -0
- package/scripts/engine-ci-budget.ts +7 -1
- package/scripts/format-lock.mjs +20 -11
- package/scripts/generate-title-launch.mjs +3 -2
- package/scripts/grid-crossing-walk-proof.mjs +30 -11
- package/scripts/heavy-lane.py +25 -1
- package/scripts/host-ruler/register-migrate.mjs +242 -0
- package/scripts/host-ruler/register.d.mts +36 -0
- package/scripts/host-ruler/register.mjs +116 -0
- package/scripts/host-ruler/roots.d.mts +29 -0
- package/scripts/host-ruler/roots.mjs +333 -0
- package/scripts/host-ruler/server-roots.d.mts +23 -0
- package/scripts/host-ruler/server-roots.mjs +272 -0
- package/scripts/main-watch.d.mts +1 -1
- package/scripts/main-watch.mjs +10 -6
- package/scripts/map-hash.mjs +3 -6
- package/scripts/memory-proof.mjs +158 -0
- package/scripts/mmo-bots.mjs +2 -2
- package/scripts/offline-proof-rules.d.mts +5 -2
- package/scripts/offline-proof-rules.mjs +43 -6
- package/scripts/offline-proof.mjs +15 -6
- package/scripts/online-rig.mjs +4 -4
- package/scripts/page-release/flow.d.mts +1 -0
- package/scripts/page-release/flow.mjs +6 -2
- package/scripts/page-release.mjs +5 -1
- package/scripts/physics-route.json +0 -71
- package/scripts/pins-catalogue.ts +103 -0
- package/scripts/pins-reuse.mjs +3 -1
- package/scripts/pins.ts +22 -14
- package/scripts/preview-grid.ts +203 -0
- package/scripts/road-preload-proof.mjs +167 -0
- package/scripts/server-release/publish.mjs +2 -2
- package/scripts/server-release/served-slug.d.mts +2 -0
- package/scripts/server-release/served-slug.mjs +10 -0
- package/scripts/server-release/sign.d.mts +1 -0
- package/scripts/server-release/sign.mjs +3 -7
- package/scripts/shard-components.mjs +0 -2
- package/scripts/shard-outputs.d.mts +8 -0
- package/scripts/shard-outputs.mjs +45 -11
- package/scripts/side-parity.d.mts +2 -1
- package/scripts/side-parity.mjs +25 -4
- package/scripts/test-amber.d.mts +1 -0
- package/scripts/test-amber.mjs +10 -0
- package/scripts/test-products.json +3 -3
- package/scripts/tier-textures-proof.mjs +101 -0
- package/scripts/tier-textures.mjs +60 -0
- package/scripts/tracked-public.d.mts +1 -0
- package/scripts/tracked-public.mjs +17 -0
- package/scripts/tsconfig.json +1 -0
- package/scripts/vps/wildshard-config +79 -23
- package/scripts/worker-client-play.mjs +1 -0
- package/scripts/worker-client-proof.mjs +1 -1
- package/scripts/worker-client-slug.mjs +44 -0
- package/src/cli/engine.mjs +8 -0
- package/src/client/app/bootRoute.ts +4 -1
- package/src/client/app/dropModal.ts +15 -2
- package/src/client/app/entry.ts +96 -13
- package/src/client/app/slugPath.ts +5 -0
- package/src/client/engine/audio/Audio.ts +20 -2
- package/src/client/engine/boot/bakedTextures.ts +3 -2
- package/src/client/engine/boot/bootTrace.ts +6 -1
- package/src/client/engine/boot/bytes.ts +4 -3
- package/src/client/engine/boot/clearDownloads.ts +1 -1
- package/src/client/engine/boot/contentRead.ts +4 -0
- package/src/client/engine/boot/dropNotice.ts +20 -6
- package/src/client/engine/boot/gpuFiles.ts +25 -2
- package/src/client/engine/boot/lastEnd.ts +8 -2
- package/src/client/engine/boot/parsedPages.ts +127 -58
- package/src/client/engine/boot/shardPrefetch.ts +7 -1
- package/src/client/engine/boot/sw.ts +19 -0
- package/src/client/engine/build.d.ts +2 -0
- package/src/client/engine/core/Game.ts +29 -3
- package/src/client/engine/core/GpuRecovery.ts +7 -0
- package/src/client/engine/core/Volumetrics.ts +5 -0
- package/src/client/engine/core/assets.ts +27 -20
- package/src/client/engine/core/bootstrap.ts +5 -3
- package/src/client/engine/core/ktx2.ts +84 -11
- package/src/client/engine/debug/probe.ts +18 -1
- package/src/client/engine/explore/Compare.ts +2 -2
- package/src/client/engine/explore/TouchFly.ts +3 -5
- package/src/client/engine/fx/LightPool.ts +41 -1
- package/src/client/engine/input/dom.ts +12 -0
- package/src/client/engine/net/predictor.ts +6 -2
- package/src/client/engine/player/Player.ts +10 -2
- package/src/client/engine/player/TouchControls.ts +12 -4
- package/src/client/engine/pwa/sw.js +59 -11
- package/src/client/engine/render/drawCheck.ts +96 -0
- package/src/client/engine/render/precompile.ts +20 -14
- package/src/client/engine/saves/staleBuildNote.ts +46 -0
- package/src/client/engine/telemetry/browserErrors.ts +161 -21
- package/src/client/engine/telemetry/deviceSnapshot.ts +155 -0
- package/src/client/engine/telemetry/screenOutbox.ts +61 -0
- package/src/client/engine/telemetry/staleBuildReport.ts +12 -0
- package/src/client/engine/ui/DeathFade.ts +99 -11
- package/src/client/engine/ui/ErrorModal.ts +13 -6
- package/src/client/engine/ui/Feedback.ts +2 -1
- package/src/client/engine/ui/Loading.ts +10 -6
- package/src/client/engine/ui/Map.ts +2 -1
- package/src/client/engine/ui/WeaponStrip.ts +2 -1
- package/src/client/engine/ui/backGuard.ts +104 -0
- package/src/client/engine/ui/hudAdapters.ts +30 -4
- package/src/client/engine/ui/loading.css +17 -0
- package/src/client/engine/ui/namePrompt.ts +6 -5
- package/src/client/engine/ui/styles/combat.css +12 -0
- package/src/client/engine/ui/styles/namePrompt.css +4 -2
- package/src/client/game/boot/audio.generated.ts +0 -396
- package/src/client/game/boot/bytes.generated.ts +42 -71
- package/src/client/game/boot/versions.generated.ts +0 -13
- package/src/client/game/compendium/keepsakes.ts +16 -6
- package/src/client/game/grapple/tool.ts +10 -7
- package/src/client/game/grid/area.ts +38 -0
- package/src/client/game/grid/cellLoading.ts +23 -12
- package/src/client/game/grid/cellScreens.ts +39 -74
- package/src/client/game/grid/live.ts +28 -2
- package/src/client/game/grid/liveSession.ts +54 -10
- package/src/client/game/grid/menu.ts +4 -0
- package/src/client/game/grid/nearPlaceholderPlan.ts +8 -0
- package/src/client/game/grid/nearPlaceholderView.ts +9 -3
- package/src/client/game/grid/neighbourPanels.ts +10 -1
- package/src/client/game/grid/oneWayIn.ts +92 -27
- package/src/client/game/grid/pageEntry.ts +19 -0
- package/src/client/game/grid/pageShell.ts +1 -1
- package/src/client/game/grid/placedCards.ts +55 -0
- package/src/client/game/grid/placedCells.ts +131 -0
- package/src/client/game/grid/plotAudio.ts +114 -0
- package/src/client/game/grid/products.ts +55 -5
- package/src/client/game/grid/regionalRuntime.ts +6 -0
- package/src/client/game/grid/regionalWorld.ts +15 -2
- package/src/client/game/grid/roadCull.ts +44 -14
- package/src/client/game/grid/roadLookPlatform.ts +2 -2
- package/src/client/game/grid/roadTileBacking.ts +13 -3
- package/src/client/game/grid/session.ts +47 -22
- package/src/client/game/grid/shardfileFar.ts +9 -3
- package/src/client/game/grid/spawnGround.ts +68 -0
- package/src/client/game/grid/voidLook.ts +29 -23
- package/src/client/game/loot/runtime.ts +3 -1
- package/src/client/game/mainMenu.ts +14 -6
- package/src/client/game/riding/hud.ts +6 -4
- package/src/client/game/session/finish.ts +22 -4
- package/src/client/game/session/play.ts +8 -2
- package/src/client/game/session/session.ts +4 -1
- package/src/client/game/shard/titleList.ts +6 -2
- package/src/client/game/shardfile/clientWorker.ts +43 -13
- package/src/client/game/shardfile/serverRoute.ts +10 -22
- package/src/client/game/slugPage.css +11 -0
- package/src/client/game/slugPage.ts +84 -0
- package/src/client/game/systems/viewmodel/heldView.ts +6 -3
- package/src/client/game/titleDeck.ts +56 -32
- package/src/client/host/online/doctor.ts +7 -6
- package/src/client/host/online/linkScreens.ts +16 -0
- package/src/client/host/online/release.ts +51 -5
- package/src/client/host/online/shell.ts +62 -27
- package/src/client/host/standalone/shell.ts +7 -3
- package/src/cook/game/audioReport.ts +57 -0
- package/src/cook/game/entryTotals.ts +26 -6
- package/src/cook/game/installedRuntimeReads.ts +3 -0
- package/src/cook/game/shardCook.ts +38 -8
- package/src/cook/game/tierTextures.ts +276 -0
- package/src/e2e/smoke/game.ts +19 -14
- package/src/e2e/smoke/page-globals.d.ts +9 -8
- package/src/e2e/smoke/template2.spec.ts +8 -7
- package/src/server/engine/sim/respawn.ts +6 -1
- package/src/server/engine/sim.ts +3 -0
- package/src/server/game/grid/simulation.ts +35 -0
- package/src/server/game/loot/harvest.ts +2 -0
- package/src/server/game/loot/keepsakeProgression.ts +40 -0
- package/src/server/game/loot/playerOwned.ts +5 -1
- package/src/server/game/plugin/simulation.ts +4 -0
- package/src/server/game/population/nativeBake.ts +2 -1
- package/src/server/game/quest/chapterRecords.ts +2 -0
- package/src/server/game/quest/serverChapters.ts +4 -0
- package/src/server/game/quest/serverDoors.ts +11 -5
- package/src/server/game/roomRespawn.ts +4 -0
- package/src/server/game/shardfile/installedSides.ts +18 -0
- package/src/server/game/shardfile/nativeAssemblyHosts.ts +19 -10
- package/src/server/game/shardfile/nativeAssemblyInput.ts +1 -4
- package/src/server/host/bake/headlessWorker.ts +5 -1
- package/src/server/host/dedicated/cellHost.ts +98 -29
- package/src/server/host/dedicated/cellProtocol.ts +11 -1
- package/src/server/host/dedicated/cellWorker.ts +9 -3
- package/src/server/host/dedicated/crossing.ts +6 -2
- package/src/server/host/dedicated/dedicatedRoom.ts +21 -8
- package/src/server/host/dedicated/gridCells.ts +52 -9
- package/src/server/host/dedicated/main.ts +31 -12
- package/src/server/host/dedicated/placementFile.ts +56 -0
- package/src/server/host/dedicated/releaseFile.ts +17 -10
- package/src/server/host/dedicated/roadRoom.ts +21 -5
- package/src/server/host/dedicated/socketTransport.ts +2 -1
- package/src/server/host/dedicated/workerTable.ts +13 -1
- package/src/server/host/dedicated/world.ts +111 -10
- package/src/server/host/headlessRuntime.ts +10 -5
- package/src/server/host/installers.ts +62 -0
- package/src/server/host/openWorld.ts +59 -0
- package/src/server/host/ropeDecks.ts +2 -0
- package/src/server/host/standalone/cellWorld.ts +25 -19
- package/src/server/host/standalone/fallFloor.ts +2 -2
- package/src/server/host/standalone/gridServer.ts +7 -4
- package/src/server/host/standalone/roadWorld.ts +41 -4
- package/src/shared/engine/audio/bootAudio.ts +33 -0
- package/src/shared/engine/level/spec.ts +3 -3
- package/src/shared/engine/net/acts.ts +3 -0
- package/src/shared/engine/net/deviceWord.ts +138 -0
- package/src/shared/engine/net/socketFrames.ts +7 -4
- package/src/shared/engine/physics/query.ts +27 -0
- package/src/shared/engine/physics/terrain.ts +19 -28
- package/src/shared/engine/saves/saves.lock.json +15 -0
- package/src/shared/engine/sim/actRoutes.ts +2 -0
- package/src/shared/game/compendium/keepsakeProgression.ts +24 -0
- package/src/shared/game/grid/catalogue.ts +12 -5
- package/src/shared/game/grid/catalogueSlot.ts +18 -0
- package/src/shared/game/grid/farProxy.ts +6 -5
- package/src/shared/game/grid/pageMode.ts +1 -1
- package/src/shared/game/grid/placementRows.ts +33 -0
- package/src/shared/game/grid/roadLayout.ts +26 -3
- package/src/shared/game/grid/singleplayer.json +0 -13
- package/src/shared/game/grid/voidFloor.ts +122 -0
- package/src/shared/game/strings.ts +15 -0
- package/src/shared/host/standalone/netInput.ts +2 -1
package/scripts/main-watch.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ export interface State {judged:number[];dispatched:string[]}
|
|
|
3
3
|
export interface Verdict {kind:'green'|'red'|'superseded'|'dispatch';run:Run;from?:string|null;by?:string}
|
|
4
4
|
export interface Pane {pane_id:string;label?:string;cwd?:string;foreground_cwd?:string}
|
|
5
5
|
export interface Io {
|
|
6
|
-
repo:string;state:string;runs:()=>Run[];failed:(id:number)=>string[];
|
|
6
|
+
repo:string;state:string;runs:()=>Run[];failed:(id:number)=>string[];annotations:(id:number)=>string;tip:()=>string;
|
|
7
7
|
commits:(from:string|null,to:string)=>string[];contains:(ancestor:string,descendant:string)=>boolean;
|
|
8
8
|
receipts:()=>string;receipt:(line:string)=>void;panes:()=>Pane[];send:(pane:string,text:string)=>boolean;dispatch:()=>void;
|
|
9
9
|
}
|
package/scripts/main-watch.mjs
CHANGED
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
// (~/.cache/wildshard/main-watch.json) keeps the judged run ids, so a run is reported once however often this runs.
|
|
15
15
|
// A green run that carries AMBER files (J295: a test file over its time budget, scripts/test-amber.mjs) also gives
|
|
16
16
|
// one `main AMBER <sha> <file> <ms>/<budget>` receipt per file: the coordinator hands each out as a queue-skipping
|
|
17
|
-
// fix row the same day (meta HOW-WE-BUILD-PLAN.md).
|
|
17
|
+
// fix row the same day (meta HOW-WE-BUILD-PLAN.md). AUDIO AU6 (J303): a shard whose audio is over 6 MB gives the same
|
|
18
|
+
// kind of receipt, `main AMBER <sha> audio <shard> <tier> <MB>/6.00 MB`, from the cook report's test; never a red main.
|
|
18
19
|
import {execFileSync} from 'node:child_process';
|
|
19
20
|
import {appendFileSync,existsSync,mkdirSync,readFileSync,renameSync,rmSync,writeFileSync} from 'node:fs';
|
|
20
21
|
import {homedir} from 'node:os';
|
|
21
22
|
import {dirname,join,resolve} from 'node:path';
|
|
22
23
|
import {setTimeout} from 'node:timers/promises';
|
|
23
24
|
import {pathToFileURL} from 'node:url';
|
|
24
|
-
import {AMBER,parseAmber} from './test-amber.mjs';
|
|
25
|
+
import {AMBER,parseAmber,parseAudioAmber} from './test-amber.mjs';
|
|
25
26
|
|
|
26
27
|
export const REPO='project-wildshard/engine';
|
|
27
28
|
const KEEP=500;
|
|
@@ -134,10 +135,10 @@ export function liveIo(env=process.env){
|
|
|
134
135
|
.filter((/** @type {Run} */row)=>row.event==='push'||row.event==='workflow_dispatch')),
|
|
135
136
|
failed:(/** @type {number} */id)=>/** @type {{name:string,conclusion:string|null}[]} */(JSON.parse(run('gh',['api',`repos/${repo}/actions/runs/${id}/jobs?per_page=100`])).jobs)
|
|
136
137
|
.filter(job=>job.conclusion==='failure'||job.conclusion==='timed_out').map(job=>job.name),
|
|
137
|
-
// The AMBER
|
|
138
|
-
|
|
138
|
+
// The annotations (their AMBER lines) on a run's blocking tests and its timings job; quarantine's are its own (J193).
|
|
139
|
+
annotations:(/** @type {number} */id)=>/** @type {{id:number,name:string}[]} */(JSON.parse(run('gh',['api',`repos/${repo}/actions/runs/${id}/jobs?per_page=100`])).jobs)
|
|
139
140
|
.filter(job=>job.name.startsWith('tests')||job.name==='timings')
|
|
140
|
-
.map(job=>/** @type {{message:string}[]} */(JSON.parse(run('gh',['api',`repos/${repo}/check-runs/${job.id}/annotations?per_page=100`]))).map(row=>row.message).join('\n')).join('\n')
|
|
141
|
+
.map(job=>/** @type {{message:string}[]} */(JSON.parse(run('gh',['api',`repos/${repo}/check-runs/${job.id}/annotations?per_page=100`]))).map(row=>row.message).join('\n')).join('\n'),
|
|
141
142
|
tip:()=>{run('git',['fetch','--quiet','origin','main']);return run('git',['rev-parse','origin/main']).trim();},
|
|
142
143
|
commits:(/** @type {string|null} */from,/** @type {string} */to)=>{
|
|
143
144
|
try{return run('git',['rev-list','--max-count=200',from===null?to:`${from}..${to}`]).trim().split('\n').filter(Boolean);}catch{return [to];}
|
|
@@ -185,8 +186,11 @@ export function sweep(io,hint={}){
|
|
|
185
186
|
if(verdict.kind==='green'){
|
|
186
187
|
lines.push(`main green ${short(run.head_sha)} (run ${run.id}; ${range}; landed by ${named})`);
|
|
187
188
|
/** @type {{file:string,ms:number,budget:number}[]} */let ambers=[];
|
|
188
|
-
|
|
189
|
+
/** @type {ReturnType<typeof parseAudioAmber>} */let audio=[];
|
|
190
|
+
try{const text=io.annotations(run.id);ambers=parseAmber(text);audio=parseAudioAmber(text);}catch(error){lines.push(`main AMBER ${short(run.head_sha)} unknown (run ${run.id}; its annotations were unreadable: ${error instanceof Error?error.message.split('\n')[0]:String(error)})`);}
|
|
189
191
|
for(const row of ambers)lines.push(`main AMBER ${short(run.head_sha)} ${row.file} ${row.ms}/${row.budget} (run ${run.id}; J295: a queue-skipping fix row today; red at ${AMBER.redFactor}x, after ${AMBER.redAfterHours} h or ${AMBER.redAfterRuns} amber main runs)`);
|
|
192
|
+
const mb=(/** @type {number} */bytes)=>(bytes/1e6).toFixed(2);
|
|
193
|
+
for(const row of audio)lines.push(`main AMBER ${short(run.head_sha)} audio ${row.shard} ${row.tier} ${mb(row.bytes)} MB/${mb(row.budget)} MB (run ${run.id}; J303${row.level==='red'?`, over the ${mb(row.red)} MB red line`:''}: its AUDIO-PLAN source pass; never a red main)`);
|
|
190
194
|
}
|
|
191
195
|
else{
|
|
192
196
|
const failed=io.failed(run.id).join(' | ')||'see the run',url=`https://github.com/${io.repo}/actions/runs/${run.id}`,panes=io.panes();
|
package/scripts/map-hash.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { createHash } from 'node:crypto';
|
|
|
6
6
|
import { createRequire } from 'node:module';
|
|
7
7
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
8
8
|
import { join, relative, resolve } from 'node:path';
|
|
9
|
+
import { shardSourceDir, shardSourceFolders } from './shard-outputs.mjs';
|
|
9
10
|
|
|
10
11
|
// Sharp resolves from this file: engine's own devDependency here, the consumer's through the optional
|
|
11
12
|
// `sharp` peer when a shard repo or sharddev runs this script from its install of engine.
|
|
@@ -125,13 +126,9 @@ export function mapTilesHash(shardDir) {
|
|
|
125
126
|
return hash.digest('hex');
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
/** Every shard folder with a shardfile project. @param {string} repoRoot @returns {{slug: string, dir: string}[]} */
|
|
129
|
+
/** Every shard folder with a shardfile project: under src/shards, or a single-shard repo's src/ (SA42). @param {string} repoRoot @returns {{slug: string, dir: string}[]} */
|
|
129
130
|
export function mapShards(repoRoot) {
|
|
130
|
-
|
|
131
|
-
return readdirSync(shards, { withFileTypes: true })
|
|
132
|
-
.filter((entry) => entry.isDirectory() && existsSync(join(shards, entry.name, 'shard.config.ts')))
|
|
133
|
-
.map((entry) => ({ slug: entry.name, dir: join(shards, entry.name) }))
|
|
134
|
-
.sort((a, b) => a.slug.localeCompare(b.slug));
|
|
131
|
+
return shardSourceFolders(repoRoot, ['shard.config.ts']).map((slug) => ({ slug, dir: shardSourceDir(repoRoot, slug) }));
|
|
135
132
|
}
|
|
136
133
|
|
|
137
134
|
/** Publish one official map bake and its existing authored-product companion together.
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// IOSMEM (meta PAGE-SIZE-PLAN): the iPhone page-memory proof for Driftwood Isle, after WILDSHARD-GAME-8G (Jake 2026-11-13:
|
|
3
|
+
// staging v0.1.16 restarted while Playing on Driftwood on his iPhone 17 Pro, the page killed for memory). One command reads
|
|
4
|
+
// the page's memory at boot (title), in Playing on Driftwood, and at Driftwood's west edge where Sunscar's cell prepares:
|
|
5
|
+
// the owner ledger (`__wildshard.memory()`, GPU and RAM bytes by owner and kind), three.js's counts, the texture form this
|
|
6
|
+
// device loads, the grid's resident cells and claims, the JS heap (Chromium) and, on Chromium, the renderer and GPU
|
|
7
|
+
// process footprints. Phone tier, iPhone 17 Pro viewport (402x874, 3x pixel density), headless.
|
|
8
|
+
// scripts/browser-lane.sh node scripts/memory-proof.mjs --base=<staging or loopback url> [--engine=chromium|webkit]
|
|
9
|
+
// [--out=tmp/<lane>/memory-proof] [--label=<name>] [--edge=0] [--budget-mb=<n>]
|
|
10
|
+
// --budget-mb fails the run (exit 1) when the ledger's GPU+RAM peak passes n MB: the gate a later lane can hold.
|
|
11
|
+
import { spawnSync } from 'node:child_process';
|
|
12
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import { join, resolve as absolute } from 'node:path';
|
|
14
|
+
import { chromium, webkit } from 'playwright';
|
|
15
|
+
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
16
|
+
import { saveFixture } from './debug-settings.mjs';
|
|
17
|
+
import { pageMemoryAttributionExpression } from './memory-report-snapshot.mjs';
|
|
18
|
+
|
|
19
|
+
/** @type {Record<string, string>} */
|
|
20
|
+
const args = Object.fromEntries(process.argv.slice(2).map(arg => /^--([^=]+)(?:=(.*))?$/u.exec(arg)).filter(match => match !== null).map(match => [match[1], match.at(2) ?? '1']));
|
|
21
|
+
const base = (args.base ?? '').replace(/\/$/u, '');
|
|
22
|
+
if (!/^https:\/\/(staging|preview)\.wildshard\.io$|^http:\/\/(127\.0\.0\.1|localhost):\d+$/u.test(base)) throw new Error('--base takes staging, preview or a loopback page: never production (J205)');
|
|
23
|
+
const engineName = args.engine ?? 'chromium';
|
|
24
|
+
if (engineName !== 'chromium' && engineName !== 'webkit') throw new Error(`No engine ${engineName}`);
|
|
25
|
+
const label = args.label ?? `${engineName}-${new URL(base).host.replaceAll(/[^a-z0-9]+/giu, '-')}`;
|
|
26
|
+
const out = absolute(args.out ?? 'tmp/memory-proof');
|
|
27
|
+
const budgetMB = args['budget-mb'] === undefined ? null : Number(args['budget-mb']);
|
|
28
|
+
const edge = args.edge !== '0';
|
|
29
|
+
mkdirSync(out, { recursive: true });
|
|
30
|
+
const MB = 1048576;
|
|
31
|
+
/** @param {number} ms */
|
|
32
|
+
const sleep = ms => new Promise(resolve => { setTimeout(resolve, ms); });
|
|
33
|
+
|
|
34
|
+
const FOOTPRINT = String.raw`
|
|
35
|
+
import ctypes, json, sys
|
|
36
|
+
class R(ctypes.Structure):
|
|
37
|
+
_fields_ = [('uuid', ctypes.c_ubyte * 16)] + [(n, ctypes.c_uint64) for n in ('user_time','system_time','pkg_idle_wkups','interrupt_wkups','pageins','wired_size','resident_size','phys_footprint','proc_start_abstime','proc_exit_abstime')]
|
|
38
|
+
lib = ctypes.CDLL('/usr/lib/libproc.dylib'); out = {}
|
|
39
|
+
for p in sys.argv[1:]:
|
|
40
|
+
u = R()
|
|
41
|
+
out[p] = u.phys_footprint if lib.proc_pid_rusage(int(p), 0, ctypes.byref(u)) == 0 else None
|
|
42
|
+
print(json.dumps(out))
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
/** In-page reader: plain data only, never a resource getter that could rebuild a retired resource. */
|
|
46
|
+
const PAGE_READ = `(() => {
|
|
47
|
+
const api = window.__wildshard, mem = (() => { try { return ${pageMemoryAttributionExpression}; } catch (e) { return { error: String(e) }; } })();
|
|
48
|
+
const group = (rows, key) => { const m = new Map(); for (const r of rows) { const k = key(r); const v = m.get(k) ?? { bytes: 0, n: 0 }; v.bytes += r.bytes; v.n++; m.set(k, v); }
|
|
49
|
+
return [...m.entries()].map(([k, v]) => ({ k, mb: Math.round(v.bytes / 1048576 * 10) / 10, n: v.n })).sort((a, b) => b.mb - a.mb).slice(0, 25); };
|
|
50
|
+
const rows = Array.isArray(mem?.allocations) ? mem.allocations : [];
|
|
51
|
+
let grid = null; try { const g = api?.shard?.grid; if (g) { const st = g.state(), res = g.residency?.();
|
|
52
|
+
grid = { inside: st.inside, home: st.home, feet: st.feet, residentMB: st.residentMB, playingMB: st.playingMB, strips: st.strips,
|
|
53
|
+
cells: st.cells.map(c => ({ slug: c.slug, cell: c.cell, shows: c.shows, drawn: c.drawn })), rings: { far: st.rings.far, l1: st.rings.l1, l0: st.rings.l0, inFlight: st.rings.inFlight, queued: st.rings.queued },
|
|
54
|
+
near: st.near, claims: res ? res.claims.map(c => ({ id: c.id ?? c.instance ?? c.key, bytes: c.bytes, kind: c.kind ?? c.category })) : null, cost: res?.cost ?? null }; } } catch (e) { grid = { error: String(e).slice(0, 200) }; }
|
|
55
|
+
let three = null; try { const r = api.requireWorld().game.renderer; three = { textures: r.info.memory.textures, geometries: r.info.memory.geometries, programs: r.info.programs?.length ?? null, pixelRatio: r.getPixelRatio() }; } catch {}
|
|
56
|
+
let textures = null; try { const t = api.textures?.(); textures = t ? { mode: t.mode, why: t.why, families: t.probe?.families ?? null } : null; } catch (e) { textures = { error: String(e).slice(0, 120) }; }
|
|
57
|
+
let audio = null; try { audio = api.requireWorld().audio.census(); } catch {}
|
|
58
|
+
return { href: location.href, heapMB: performance.memory ? Math.round(performance.memory.usedJSHeapSize / 1048576) : null,
|
|
59
|
+
totalsMB: mem?.totals ? { gpu: Math.round(mem.totals.gpu / 1048576), ram: Math.round(mem.totals.ram / 1048576) } : null,
|
|
60
|
+
unattributedMB: mem?.unattributed ? { gpu: Math.round(mem.unattributed.gpu / 1048576), ram: Math.round(mem.unattributed.ram / 1048576) } : null,
|
|
61
|
+
byOwner: group(rows, r => r.domain + ' ' + r.owner), byKind: group(rows, r => r.domain + ' ' + r.kind), byAsset: group(rows, r => r.domain + ' ' + r.owner + ' ' + r.asset),
|
|
62
|
+
// PZ22: each texture of 1 MB or more, whole, so a texture form change is read per texture, not only in the total
|
|
63
|
+
texRows: rows.filter(r => r.domain === 'gpu' && r.kind === 'texture' && r.bytes >= 1048576).sort((a, b) => b.bytes - a.bytes).slice(0, 40).map(r => JSON.parse(JSON.stringify(r))),
|
|
64
|
+
three, textures, grid, audio };
|
|
65
|
+
})()`;
|
|
66
|
+
|
|
67
|
+
/** @type {Record<string, unknown>} */
|
|
68
|
+
const result = { lane: 'opus-iosmem', engine: engineName, base, label, at: new Date().toISOString(), phases: [], errors: [] };
|
|
69
|
+
const browser = await (engineName === 'webkit' ? webkit : chromium).launch({ headless: true,
|
|
70
|
+
args: engineName === 'chromium' ? [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist', '--enable-precise-memory-info'] : [] });
|
|
71
|
+
let code = 0;
|
|
72
|
+
try {
|
|
73
|
+
const context = await browser.newContext({ viewport: { width: 402, height: 874 }, deviceScaleFactor: 3, isMobile: engineName === 'chromium', hasTouch: true,
|
|
74
|
+
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/27.0.1 Mobile/15E148 Safari/604.1' });
|
|
75
|
+
await saveFixture(context, { scope: 'device', key: 'firstPlayDone', data: true });
|
|
76
|
+
await saveFixture(context, { scope: 'device', key: 'devMode', data: true });
|
|
77
|
+
await saveFixture(context, { scope: 'global', key: 'settings', merge: true, data: { tier: 'phone', volume: 0 } });
|
|
78
|
+
await context.route('**/api/errors', route => route.fulfill({ status: 204, body: '' }));
|
|
79
|
+
const page = await context.newPage(); page.setDefaultTimeout(240_000);
|
|
80
|
+
page.on('pageerror', error => { /** @type {string[]} */ (result.errors).push(error.message.slice(0, 240)); });
|
|
81
|
+
const cdp = engineName === 'chromium' ? await browser.newBrowserCDPSession() : null;
|
|
82
|
+
const pageCdp = engineName === 'chromium' ? await context.newCDPSession(page) : null;
|
|
83
|
+
const heapProfile = args['heap-profile'] !== undefined && pageCdp !== null;
|
|
84
|
+
/** Chromium only: the live JS heap after a full collection, so garbage awaiting GC is told apart from what is held. */
|
|
85
|
+
const heapAfterGc = async () => { if (pageCdp === null) return null; await pageCdp.send('HeapProfiler.collectGarbage'); return Math.round((await pageCdp.send('Runtime.getHeapUsage')).usedSize / MB); };
|
|
86
|
+
const footprint = async () => {
|
|
87
|
+
if (cdp === null) return null;
|
|
88
|
+
const info = await cdp.send('SystemInfo.getProcessInfo'), pids = info.processInfo.filter(row => row.type === 'renderer' || row.type === 'GPU');
|
|
89
|
+
const sizes = JSON.parse(spawnSync('python3', ['-c', FOOTPRINT, ...pids.map(row => String(row.id))], { encoding: 'utf8' }).stdout || '{}');
|
|
90
|
+
const mb = (/** @type {string} */ type) => Math.round(pids.filter(row => row.type === type).reduce((sum, row) => sum + (sizes[String(row.id)] ?? 0), 0) / MB);
|
|
91
|
+
return { rendererMB: mb('renderer'), gpuMB: mb('GPU') };
|
|
92
|
+
};
|
|
93
|
+
const phase = async (/** @type {string} */ name) => {
|
|
94
|
+
const row = { phase: name, ...await page.evaluate(PAGE_READ), process: await footprint(), heapAfterGcMB: await heapAfterGc() };
|
|
95
|
+
row.processAfterGc = pageCdp === null ? null : await footprint();
|
|
96
|
+
/** @type {unknown[]} */ (result.phases).push(row);
|
|
97
|
+
await page.screenshot({ path: join(out, `${label}-${name}.jpg`), type: 'jpeg', quality: 60 }).catch(() => undefined);
|
|
98
|
+
const t = row.totalsMB;
|
|
99
|
+
console.log(`${name}: ledger gpu ${t?.gpu ?? '?'} MB ram ${t?.ram ?? '?'} MB, heap ${row.heapMB ?? '-'} MB (after GC ${row.heapAfterGcMB ?? '-'}), process ${JSON.stringify(row.process)}, three ${JSON.stringify(row.three)}, tex ${row.textures?.mode ?? '?'}, cells ${row.grid?.cells?.map((/** @type {any} */ c) => `${c.slug}:${JSON.stringify(c.shows)}`).join(' ') ?? '-'}`);
|
|
100
|
+
for (const top of row.byOwner.slice(0, 8)) console.log(` ${top.k} ${top.mb} MB (${top.n})`);
|
|
101
|
+
return row;
|
|
102
|
+
};
|
|
103
|
+
await page.goto(`${base}/?mute=1&nolock=1`, { waitUntil: 'load' });
|
|
104
|
+
await page.locator('.ws-main-select').waitFor({ state: 'visible', timeout: 120_000 });
|
|
105
|
+
await sleep(3000);
|
|
106
|
+
await phase('boot');
|
|
107
|
+
await page.locator('.ws-main-select').click();
|
|
108
|
+
if (await page.locator('#ws-name-box input').waitFor({ timeout: 15_000 }).then(() => true).catch(() => false)) { await page.locator('#ws-name-box input').fill('memproof'); await page.locator('#ws-name-box button[type=submit]').click(); }
|
|
109
|
+
await page.locator('.ws-menu-card').first().waitFor({ state: 'visible', timeout: 30_000 });
|
|
110
|
+
const index = await page.evaluate(() => [...document.querySelectorAll('.ws-menu-card')].findIndex(row => (row.textContent ?? '').includes('Driftwood Isle')));
|
|
111
|
+
if (index < 0) throw new Error('No Driftwood Isle card');
|
|
112
|
+
await page.locator('.ws-menu-dots i').nth(index).click();
|
|
113
|
+
if (heapProfile) { await pageCdp.send('HeapProfiler.enable'); await pageCdp.send('HeapProfiler.startSampling', { samplingInterval: 65536, includeObjectsCollectedByMajorGC: args['heap-profile'] === 'alloc', includeObjectsCollectedByMinorGC: args['heap-profile'] === 'alloc' }); }
|
|
114
|
+
await page.locator('.ws-menu-play').click();
|
|
115
|
+
await page.waitForFunction(() => /** @type {any} */ (window).__wildshard?.shard?.grid?.state?.().live?.live?.gameplayReady === true, undefined, { timeout: 240_000, polling: 250 });
|
|
116
|
+
await sleep(2000);
|
|
117
|
+
await page.getByText('DONE', { exact: true }).click({ timeout: 2000 }).catch(() => undefined);
|
|
118
|
+
await sleep(10_000);
|
|
119
|
+
await phase('playing');
|
|
120
|
+
// 40 s more without moving: a page that keeps growing while the player stands still is the leak, not the walk.
|
|
121
|
+
/** @type {unknown[]} */ const still = []; result.still = still;
|
|
122
|
+
for (let i = 0; i < 4; i++) { await sleep(10_000); const at = await page.evaluate(() => ({ heapMB: (() => { const memory = /** @type {any} */ (performance).memory; return memory ? Math.round(memory.usedJSHeapSize / 1048576) : null; })(), loading: /** @type {any} */ (window).__wildshard.shard.grid.state().cells.filter((/** @type {any} */ c) => c.shows === 'loading').length })); still.push({ s: (i + 1) * 10, ...at, process: await footprint() }); console.log(`still +${(i + 1) * 10}s ${JSON.stringify(still.at(-1))}`); }
|
|
123
|
+
await phase('still');
|
|
124
|
+
if (heapProfile) {
|
|
125
|
+
const { profile } = await pageCdp.send('HeapProfiler.stopSampling');
|
|
126
|
+
/** @type {Map<string, number>} */ const self = new Map(), total = new Map();
|
|
127
|
+
const walk = (/** @type {any} */ node, /** @type {string[]} */ stack) => {
|
|
128
|
+
const f = node.callFrame, key = `${f.functionName === '' ? '(anon)' : f.functionName} ${f.url.split('/').pop()}:${f.lineNumber + 1}:${f.columnNumber + 1}`;
|
|
129
|
+
self.set(key, (self.get(key) ?? 0) + node.selfSize);
|
|
130
|
+
const next = [...stack, key]; for (const k of new Set(next)) total.set(k, (total.get(k) ?? 0) + node.selfSize);
|
|
131
|
+
for (const child of node.children) walk(child, next);
|
|
132
|
+
};
|
|
133
|
+
walk(profile.head, []);
|
|
134
|
+
const top = (/** @type {Map<string, number>} */ m) => [...m.entries()].sort((a, b) => b[1] - a[1]).slice(0, 60).map(([k, b]) => ({ k, mb: Math.round(b / MB * 10) / 10 }));
|
|
135
|
+
result.heapSelf = top(self); result.heapTotal = top(total);
|
|
136
|
+
console.log('heap self (live sampled):'); for (const row of /** @type {any[]} */ (result.heapSelf).slice(0, 25)) console.log(` ${row.mb} MB ${row.k}`);
|
|
137
|
+
}
|
|
138
|
+
if (edge) {
|
|
139
|
+
// Driftwood's west entryway toward Sunscar (grid-crossing-walk-proof's approach), placed by the harness pose, then 20 s for the neighbour to prepare.
|
|
140
|
+
for (const [x, z] of [[-235, -194], [-235, 0], [-245, 0]]) {
|
|
141
|
+
// the online page's server owns the position: place tells it (probe.ts `told`)
|
|
142
|
+
await page.evaluate(([px, pz]) => { const p = /** @type {any} */ (window).__wildshard.world.player; p.spawn(px, pz, p.yaw, Math.max(p.position.y, 0.5)); p.link?.place?.(p.position.x, p.position.y, p.position.z, p.yaw); }, [x, z]);
|
|
143
|
+
await sleep(4000);
|
|
144
|
+
}
|
|
145
|
+
await sleep(16_000);
|
|
146
|
+
await phase('edge');
|
|
147
|
+
}
|
|
148
|
+
const peak = Math.max(...(/** @type {any[]} */ (result.phases)).map(row => (row.totalsMB?.gpu ?? 0) + (row.totalsMB?.ram ?? 0)));
|
|
149
|
+
result.peakLedgerMB = peak;
|
|
150
|
+
if (budgetMB !== null && peak > budgetMB) { code = 1; console.log(`FAIL ledger peak ${peak} MB > budget ${budgetMB} MB`); }
|
|
151
|
+
await context.close();
|
|
152
|
+
} catch (error) { code = 1; /** @type {string[]} */ (result.errors).push(String(error).slice(0, 400)); console.log(`FAIL ${String(error).slice(0, 400)}`); }
|
|
153
|
+
finally {
|
|
154
|
+
writeFileSync(join(out, `${label}.json`), `${JSON.stringify(result, null, 2)}\n`);
|
|
155
|
+
await browser.close();
|
|
156
|
+
}
|
|
157
|
+
console.log(`memory proof ${label}: ${code === 0 ? 'done' : 'FAIL'} → ${join(out, `${label}.json`)}`);
|
|
158
|
+
process.exit(code);
|
package/scripts/mmo-bots.mjs
CHANGED
|
@@ -96,7 +96,7 @@ mkdirSync(tree, { recursive: true });
|
|
|
96
96
|
const source = serverFrom ?? release.engineBuild;
|
|
97
97
|
if (serverFrom !== undefined) try { git(['merge-base', '--is-ancestor', release.engineBuild, serverFrom]); } catch { throw new Error(`--server-from ${serverFrom} does not descend from the release's ${release.engineBuild}`); }
|
|
98
98
|
execFileSync('tar', ['-x', '-C', tree], { input: git(['archive', source]) });
|
|
99
|
-
for (const name of ['mmoBotsEntry.ts', 'mmoBotsGuard.ts']) copyFileSync(join(ROOT, 'test/fixtures/dedicated', name), join(tree, 'test/fixtures/dedicated', name));
|
|
99
|
+
for (const name of ['mmoBotsEntry.ts', 'mmoBotsGuard.ts', 'mmoBotsStats.ts']) copyFileSync(join(ROOT, 'test/fixtures/dedicated', name), join(tree, 'test/fixtures/dedicated', name));
|
|
100
100
|
let begun = performance.now();
|
|
101
101
|
// CI=1 keeps the install non-interactive; --config.ci=false keeps the global store on, which pnpm drops under ci (GVS G9)
|
|
102
102
|
execFileSync('pnpm', ['install', '--frozen-lockfile', '--prefer-offline', '--ignore-scripts', '--reporter=silent', '--config.ci=false'], { cwd: tree, stdio: 'inherit', env: { ...process.env, CI: '1' } });
|
|
@@ -232,7 +232,7 @@ const report = { ...JSON.parse(readFileSync(result, 'utf8')), mode, exit: code,
|
|
|
232
232
|
...(full.length === 0 ? {} : { server: { windows: full.length, worstP95: Math.max(...full.map(row => row.p95)), meanP95: Number((full.reduce((sum, row) => sum + row.p95, 0) / full.length).toFixed(3)),
|
|
233
233
|
max: Math.max(...full.map(row => row.max)), drops: full.reduce((sum, row) => sum + row.drops, 0), minTicksPerSecond: Math.min(...full.map(row => row.ticksPerSecond)), rssMB: Math.round(Math.max(...full.map(row => row.rss)) / 1048576) } }) };
|
|
234
234
|
writeFileSync(join(work, 'report.json'), `${JSON.stringify(report, null, 2)}\n`);
|
|
235
|
-
note({ step: 'done', exit: code, seated: report.seated, steady: report.steady, walked: report.walked, sawEveryone: report.sawEveryone, server: report.server ?? null, report: join(work, 'report.json') });
|
|
235
|
+
note({ step: 'done', exit: code, seated: report.seated, steady: report.steady, walked: report.walked, sawEveryone: report.sawEveryone, interArrivalMs: report.interArrivalMs ?? null, server: report.server ?? null, report: join(work, 'report.json') });
|
|
236
236
|
process.exitCode = Number(code);
|
|
237
237
|
} finally {
|
|
238
238
|
await stopRoom();
|
|
@@ -4,10 +4,12 @@ export interface RequestRow {
|
|
|
4
4
|
}
|
|
5
5
|
export interface ScreenSample { t: number; phase: string; step: string; card: boolean; title: boolean; player: boolean; failCard: string; text: string }
|
|
6
6
|
export interface Failure { shard: string; rule: string; url?: string; detail?: string }
|
|
7
|
-
export type Outcome = 'play' | 'seat-wait' | 'title' | 'stalled' | 'error' | 'no-resume';
|
|
7
|
+
export type Outcome = 'play' | 'seat-wait' | 'title' | 'stalled' | 'error' | 'no-resume' | 'outside-world';
|
|
8
8
|
export const DECK_SHARDS: readonly { slug: string; card: string }[];
|
|
9
9
|
export const OPEN_PLOTS: readonly string[];
|
|
10
10
|
export const ALL_SHARDS: readonly string[];
|
|
11
|
+
export function gridPlaces(slug: string, catalogue: { grid?: { cells?: readonly { slug?: unknown }[] } }): boolean;
|
|
12
|
+
export function screenKey(screen: { phase: string; step: string; error: string; failCard: string; title: boolean; player: boolean; progress: string }): string;
|
|
11
13
|
export const SOLO_ONLY: RegExp;
|
|
12
14
|
export const CLIENT_MANIFEST: RegExp;
|
|
13
15
|
export const GRID_LAYOUT: RegExp;
|
|
@@ -15,9 +17,10 @@ export const RAW_STRINGS: readonly string[];
|
|
|
15
17
|
export const CRITICAL_PHASES: readonly string[];
|
|
16
18
|
export function mayFail(url: string): boolean;
|
|
17
19
|
export function pathOf(url: string): string;
|
|
20
|
+
export function textureForm(path: string): { name: string; form: 'img' | 'ktx2' } | undefined;
|
|
18
21
|
export function judge(run: {
|
|
19
22
|
shard: string; channel: 'staging' | 'preview'; mode: string; entry: string; rows: readonly RequestRow[];
|
|
20
23
|
samples: readonly ScreenSample[]; outcome: Outcome; warm?: ReadonlySet<string>; layout?: boolean; walkthrough?: boolean;
|
|
21
|
-
requireWorld?: boolean; proofError?: string; leaks?: number;
|
|
24
|
+
requireWorld?: boolean; proofError?: string; leaks?: number; placed?: boolean;
|
|
22
25
|
}): Failure[];
|
|
23
26
|
export function servedCounts(rows: readonly RequestRow[]): Record<string, number>;
|
|
@@ -10,7 +10,11 @@ export const DECK_SHARDS = Object.freeze([
|
|
|
10
10
|
{ slug: 'pastel-plain', card: 'Pastel Plain' }, { slug: 'ink-cel-valley', card: 'Ink & Cel Valley' },
|
|
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
|
-
export const OPEN_PLOTS = Object.freeze(['open-plot-
|
|
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
|
|
|
@@ -33,7 +37,15 @@ export const CRITICAL_PHASES = Object.freeze(['start', 'download', 'load', 'none
|
|
|
33
37
|
* text: string }} 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
|
|
@@ -45,6 +57,16 @@ export function mayFail(url) {
|
|
|
45
57
|
|| host === 'api.wildshard.io' || host.endsWith('.sentry.io') || host.endsWith('.ingest.sentry.io');
|
|
46
58
|
}
|
|
47
59
|
|
|
60
|
+
/** OF17: a texture's name in either form, `/assets/<name>.<webp|jpg|png>` (the image) or `/assets/gpu/<name>-<hash8>.ktx2`
|
|
61
|
+
* (its KTX2 stand-in), or undefined for any other path. @param {string} path
|
|
62
|
+
* @returns {{ name: string, form: 'img' | 'ktx2' } | undefined} */
|
|
63
|
+
export function textureForm(path) {
|
|
64
|
+
const ktx2 = /^\/assets\/gpu\/(.+)-[0-9a-f]{8}\.ktx2$/u.exec(path);
|
|
65
|
+
if (ktx2?.[1] !== undefined) return { name: ktx2[1], form: 'ktx2' };
|
|
66
|
+
const image = /^\/assets\/(?!gpu\/)(.+)\.(?:webp|jpe?g|png)$/u.exec(path);
|
|
67
|
+
return image?.[1] === undefined ? undefined : { name: image[1], form: 'img' };
|
|
68
|
+
}
|
|
69
|
+
|
|
48
70
|
/** A URL's path, the key the warm visit's read set holds. @param {string} url */
|
|
49
71
|
export const pathOf = url => new URL(url).pathname;
|
|
50
72
|
|
|
@@ -55,7 +77,7 @@ const failed = row => (row.servedBy === 'failed' && row.fail !== 'net::ERR_ABORT
|
|
|
55
77
|
* The red rules of one entry. `warm` is the paths the warm visit read (undefined for the warm visit itself).
|
|
56
78
|
* @param {{ shard: string, channel: 'staging' | 'preview', mode: string, entry: string, rows: readonly RequestRow[],
|
|
57
79
|
* samples: readonly ScreenSample[], outcome: Outcome, warm?: ReadonlySet<string>, layout?: boolean, walkthrough?: boolean,
|
|
58
|
-
* requireWorld?: boolean, proofError?: string, leaks?: number }} run
|
|
80
|
+
* requireWorld?: boolean, proofError?: string, leaks?: number, placed?: boolean }} run
|
|
59
81
|
* @returns {Failure[]}
|
|
60
82
|
*/
|
|
61
83
|
export function judge(run) {
|
|
@@ -94,14 +116,18 @@ export function judge(run) {
|
|
|
94
116
|
}
|
|
95
117
|
if (run.outcome === 'no-resume') out.push({ shard, rule: 'no-resume', detail: 'reopening the page showed the title, not the shard' });
|
|
96
118
|
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)` });
|
|
97
|
-
if (run.requireWorld === true && run.outcome !== 'play') out.push({ shard, rule: 'not-in-world', detail: run.outcome });
|
|
119
|
+
if (run.requireWorld === true && run.outcome !== 'play' && !(run.outcome === 'outside-world' && run.placed === false)) out.push({ shard, rule: 'not-in-world', detail: run.outcome });
|
|
120
|
+
// 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"
|
|
121
|
+
// is the right end there, and wrong for a placed shard or a build with no world (preview opens every shard).
|
|
122
|
+
if (run.outcome === 'outside-world' && !(channel === 'staging' && run.placed === false))
|
|
123
|
+
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' });
|
|
98
124
|
// 6. A load that never finished with nothing else to blame.
|
|
99
125
|
if (run.outcome === 'stalled' && out.length === 0) {
|
|
100
126
|
const last = samples.at(-1);
|
|
101
127
|
out.push({ shard, rule: 'stalled', detail: `${last?.phase ?? '?'}/${last?.step ?? '?'}` });
|
|
102
128
|
}
|
|
103
|
-
// 7. OF20: an offline entry reads the grid layout from the cache, and reads it at all.
|
|
104
|
-
if (run.layout === true) {
|
|
129
|
+
// 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).
|
|
130
|
+
if (run.layout === true && run.outcome !== 'outside-world') {
|
|
105
131
|
const layout = rows.filter(row => row.origin === 'page' && GRID_LAYOUT.test(pathOf(row.url)));
|
|
106
132
|
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)' });
|
|
107
133
|
for (const row of layout) if (row.servedBy !== 'service-worker') out.push({ shard, rule: 'grid-layout-not-cached', url: row.url, detail: row.servedBy });
|
|
@@ -111,6 +137,17 @@ export function judge(run) {
|
|
|
111
137
|
if (run.outcome !== 'play') out.push({ shard, rule: 'walkthrough-not-in-world', detail: run.outcome });
|
|
112
138
|
if (!samples.some(sample => sample.player && sample.failCard !== '')) out.push({ shard, rule: 'walkthrough-no-connection-card' });
|
|
113
139
|
}
|
|
140
|
+
// 9. OF17: one texture form per device and tier. An image the warm visit read only as its KTX2 stand-in is never held.
|
|
141
|
+
if (warm !== undefined) {
|
|
142
|
+
/** @type {Record<'img' | 'ktx2', Set<string>>} */
|
|
143
|
+
const read = { img: new Set(), ktx2: new Set() };
|
|
144
|
+
for (const path of warm) { const texture = textureForm(path); if (texture !== undefined) read[texture.form].add(texture.name); }
|
|
145
|
+
for (const row of rows) {
|
|
146
|
+
const texture = row.origin === 'page' ? textureForm(pathOf(row.url)) : undefined;
|
|
147
|
+
if (texture?.form === 'img' && read.ktx2.has(texture.name) && !read.img.has(texture.name))
|
|
148
|
+
out.push({ shard, rule: 'texture-form-not-warm', url: row.url, detail: `${row.phase}/${row.step}: the warm visit read its KTX2 stand-in` });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
114
151
|
return out;
|
|
115
152
|
}
|
|
116
153
|
|
|
@@ -44,7 +44,7 @@ import { join, resolve as resolvePath } from 'node:path';
|
|
|
44
44
|
import { chromium } from 'playwright';
|
|
45
45
|
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
46
46
|
import { saveFixture } from './debug-settings.mjs';
|
|
47
|
-
import { ALL_SHARDS, DECK_SHARDS, judge, OPEN_PLOTS, pathOf, servedCounts } from './offline-proof-rules.mjs';
|
|
47
|
+
import { ALL_SHARDS, DECK_SHARDS, gridPlaces, judge, OPEN_PLOTS, pathOf, screenKey, servedCounts } from './offline-proof-rules.mjs';
|
|
48
48
|
import { CHANNELS, RELEASE_PUBLIC_KEY } from './page-release/flow.mjs';
|
|
49
49
|
|
|
50
50
|
/** @typedef {import('./offline-proof-rules.mjs').RequestRow} RequestRow */
|
|
@@ -77,6 +77,9 @@ const report = argv.includes('--report');
|
|
|
77
77
|
const out = resolvePath(ROOT, option('out') ?? join('tmp', 'offline-proof', new Date().toISOString().replaceAll(/[:.]/gu, '-')));
|
|
78
78
|
mkdirSync(out, { recursive: true });
|
|
79
79
|
const STAGING = CHANNELS.staging;
|
|
80
|
+
/** 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
|
|
81
|
+
* tree (the default, or a `--base` served from it), not a build of another commit. */
|
|
82
|
+
const CATALOGUE = JSON.parse(readFileSync(join(ROOT, 'src/shared/game/grid/singleplayer.json'), 'utf8'));
|
|
80
83
|
/** The stand-in door's world word: every proof shard on staging's grid. */
|
|
81
84
|
const WORLD_WORD = Buffer.concat([Buffer.from([9]), Buffer.from(JSON.stringify({ cells: 20, shards: [...ALL_SHARDS] }))]);
|
|
82
85
|
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';
|
|
@@ -200,6 +203,8 @@ const readScreen = () => {
|
|
|
200
203
|
card, title: title && !card, player: world?.player !== undefined && world.player !== null && !card,
|
|
201
204
|
phase: card ? (on instanceof HTMLElement ? on.dataset.phase ?? 'none' : 'none') : title ? 'title' : 'page',
|
|
202
205
|
step: load instanceof HTMLElement ? load.dataset.step ?? '' : '',
|
|
206
|
+
// OF5b: the card's progress counters, which hold still while it waits on the seat (its clock and time-left never do)
|
|
207
|
+
progress: load instanceof HTMLElement ? [load.dataset.setup, load.dataset.readBytes, load.dataset.streamedBytes, load.dataset.spawnFilesDone, load.dataset.serverFiles].join('|') : '',
|
|
203
208
|
error: (document.querySelector('.ws-load-error')?.textContent ?? '').replaceAll(/\s+/gu, ' ').slice(0, 300),
|
|
204
209
|
// oxlint-disable-next-line unicorn/prefer-dom-node-text-content -- the text a player sees, not hidden templates
|
|
205
210
|
failCard: fail instanceof HTMLElement ? fail.innerText.replaceAll(/\s+/gu, ' ').slice(0, 300) : '',
|
|
@@ -303,7 +308,8 @@ async function enter(run) {
|
|
|
303
308
|
try {
|
|
304
309
|
const open = OPEN_PLOTS.includes(slug) && entry === 'deck' ? `/?chunk=${slug}&skipintro&mute=1` : '/?mute=1';
|
|
305
310
|
// a deep link is the entry itself: its reads are the card's from the first one
|
|
306
|
-
|
|
311
|
+
let linked = open !== '/?mute=1';
|
|
312
|
+
if (linked) phase = 'none';
|
|
307
313
|
const hitsBefore = stamperHits;
|
|
308
314
|
proxyOffline = mode === 'offline' && channel === 'staging' && jobs === 1;
|
|
309
315
|
leakFrom = () => stamperHits - hitsBefore;
|
|
@@ -321,7 +327,7 @@ async function enter(run) {
|
|
|
321
327
|
if (index === -1) {
|
|
322
328
|
// a shard this build's deck doesn't show (Pastel Plain, Ink & Cel): the deep link with Developer on, as for Open Plots
|
|
323
329
|
consoleLines.push(`no deck card "${card}" (deck: ${names.join(', ')}): entered by ?chunk=`);
|
|
324
|
-
phase = 'none';
|
|
330
|
+
phase = 'none'; linked = true;
|
|
325
331
|
await page.goto(new URL(`/?chunk=${slug}&skipintro&mute=1`, ORIGINS[channel]).href, { waitUntil: 'commit', timeout: 60_000 });
|
|
326
332
|
} else {
|
|
327
333
|
await page.locator(`.ws-menu-dots i[data-i="${String(index)}"]`).click();
|
|
@@ -338,15 +344,18 @@ async function enter(run) {
|
|
|
338
344
|
if (screen === undefined) continue;
|
|
339
345
|
if (await page.locator('.ws-load-play').isVisible().catch(() => false)) await page.locator('.ws-load-play').click({ timeout: 3000 }).catch(() => undefined);
|
|
340
346
|
cardSeen ||= screen.card;
|
|
341
|
-
const now =
|
|
347
|
+
const now = screenKey(screen);
|
|
342
348
|
if (now !== key) { key = now; changed = Date.now(); }
|
|
343
349
|
if (screen.player) { outcome = 'play'; break; }
|
|
344
350
|
if (screen.error !== '') { outcome = 'error'; break; }
|
|
345
351
|
if (cardSeen && screen.title) { outcome = 'title'; break; }
|
|
346
352
|
if (!cardSeen && screen.title && entry === 'resume' && at() - tappedAt > 20_000) { outcome = 'no-resume'; break; }
|
|
353
|
+
// OF3: a world build's title after a link to a shard its grid doesn't place (judged against the catalogue)
|
|
354
|
+
// (a link's answer only: a closed deck card shows the same badge)
|
|
355
|
+
if (linked && !cardSeen && screen.title && /not in this world yet/iu.test(screen.text) && at() - tappedAt > 5000) { outcome = 'outside-world'; break; }
|
|
347
356
|
// a staging-like page waits on the seat, which the stand-in door never gives
|
|
348
357
|
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 :
|
|
358
|
+
if (Date.now() - changed > (mode === 'slow' ? 90_000 : 60_000) || at() - tappedAt > limit) { outcome = 'stalled'; break; }
|
|
350
359
|
}
|
|
351
360
|
outcomeMs = at() - tappedAt;
|
|
352
361
|
await shot(outcome);
|
|
@@ -442,7 +451,7 @@ function record(channel, mode, slug, entry, visit, warm, extra = {}) {
|
|
|
442
451
|
const layout = channel === 'staging' && mode === 'offline' && (entry === 'deck' || extra.walkthrough === true);
|
|
443
452
|
const failures = judge({ shard: slug, channel, mode, entry, rows: visit.rows, samples: visit.samples,
|
|
444
453
|
outcome: visit.outcome, ...warm === undefined ? {} : { warm }, layout, proofError: visit.proofError, leaks: visit.leaks,
|
|
445
|
-
requireWorld: requireWorld && !mode.startsWith('warm'), ...extra });
|
|
454
|
+
requireWorld: requireWorld && !mode.startsWith('warm'), placed: gridPlaces(slug, CATALOGUE), ...extra });
|
|
446
455
|
if (channel === 'staging' && !visit.world) failures.unshift({ shard: slug, rule: 'proof-not-a-world-build', detail: 'the page had no __WS_WORLD__ stamp' });
|
|
447
456
|
const result = { shard: slug, channel, mode, entry, outcome: visit.outcome, ms: visit.ms, lastCard: visit.lastCard, served: servedCounts(visit.rows),
|
|
448
457
|
swSoloReads: visit.rows.filter(row => row.origin === 'sw' && /serverWorker|serverRuntime|\/assets\/spawn\/server\//u.test(row.url)).length,
|
package/scripts/online-rig.mjs
CHANGED
|
@@ -46,11 +46,11 @@ export async function intoWorld(page) {
|
|
|
46
46
|
|
|
47
47
|
/** `pgBin` 'memory:' keeps the saves in the server's memory, for a proof that never reads them back (voice-proof.mjs): no Postgres.
|
|
48
48
|
* `more` are other shards the release names, `cells` the server's `WORLD_CELLS` (default `shard`), and `socket` the address the
|
|
49
|
-
* release names when a proof puts its own front door before the server (grid-gate-proof.mjs). `crossing` sets
|
|
50
|
-
* (GC15): each worker hosts the road between its cells from the grid pack the bake left in this checkout (grid-crossing-walk-proof.mjs),
|
|
49
|
+
* release names when a proof puts its own front door before the server (grid-gate-proof.mjs). `crossing` (on by default, GC35 / J322; false sets
|
|
50
|
+
* `WORLD_CROSSING=off`, a bench's lone cells) is `WORLD_CROSSING=worker` (GC15): each worker hosts the road between its cells from the grid pack the bake left in this checkout (grid-crossing-walk-proof.mjs),
|
|
51
51
|
* and `workers` sets `WORLD_WORKERS` (the rig's release is production's, 4 by default; staging runs 2).
|
|
52
52
|
* @param {{ dist: string, nextDist?: string, work: string, keyFile: string, pgBin: string, pgData: string, shard?: string, seats?: number, more?: string[], cells?: string, socket?: string, crossing?: boolean, workers?: number }} options */
|
|
53
|
-
export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgData, shard = 'driftwood-isle', seats, more = [], cells = shard, socket = `ws://127.0.0.1:${String(WORLD_PORT)}/`, crossing =
|
|
53
|
+
export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgData, shard = 'driftwood-isle', seats, more = [], cells = shard, socket = `ws://127.0.0.1:${String(WORLD_PORT)}/`, crossing = true, workers }) {
|
|
54
54
|
const memory = pgBin === 'memory:';
|
|
55
55
|
const key = JSON.parse(readFileSync(keyFile, 'utf8')), build = buildOf(dist), nextBuild = nextDist === '' ? '' : buildOf(nextDist), DATABASE = memory ? 'memory:' : database('saves_online');
|
|
56
56
|
mkdirSync(work, { recursive: true });
|
|
@@ -81,7 +81,7 @@ export async function openRig({ dist, nextDist = '', work, keyFile, pgBin, pgDat
|
|
|
81
81
|
|
|
82
82
|
const world = (running = build) => {
|
|
83
83
|
const room = spawn(process.execPath, [join(server, 'main.mjs')], { cwd: ROOT, stdio: ['ignore', 'pipe', 'pipe'],
|
|
84
|
-
env: { ...process.env, RELEASE_URL: `http://127.0.0.1:${String(RELEASE_PORT)}/release.json`, RELEASE_PUBLIC_KEY: key.public, PACK_ORIGIN: `file://${origin}/`, PACK_CACHE: join(work, 'packs'), DATABASE_URL: DATABASE, SEAT_SECRET: 'online-proof', HOST: '127.0.0.1', PORT: String(WORLD_PORT), ALLOWED_ORIGINS: `http://127.0.0.1:${String(PAGE_PORT)}`, WILDSHARD_BUILD: running, WORLD_CELLS: cells, RELEASE_POLL_MS: '500', GRACE_MS: '6000', ...seats === undefined ? {} : { WORLD_SEATS: String(seats) },
|
|
84
|
+
env: { ...process.env, RELEASE_URL: `http://127.0.0.1:${String(RELEASE_PORT)}/release.json`, RELEASE_PUBLIC_KEY: key.public, PACK_ORIGIN: `file://${origin}/`, PACK_CACHE: join(work, 'packs'), DATABASE_URL: DATABASE, SEAT_SECRET: 'online-proof', HOST: '127.0.0.1', PORT: String(WORLD_PORT), ALLOWED_ORIGINS: `http://127.0.0.1:${String(PAGE_PORT)}`, WILDSHARD_BUILD: running, WORLD_CELLS: cells, RELEASE_POLL_MS: '500', GRACE_MS: '6000', ...seats === undefined ? {} : { WORLD_SEATS: String(seats) }, WORLD_CROSSING: crossing ? 'worker' : 'off', ...workers === undefined ? {} : { WORLD_WORKERS: String(workers) } } });
|
|
85
85
|
room.stdout.pipe(log, { end: false }); room.stderr.pipe(log, { end: false });
|
|
86
86
|
return room;
|
|
87
87
|
};
|
|
@@ -106,6 +106,8 @@ export class RefusedError extends Error {
|
|
|
106
106
|
* @property {number} [pollMs]
|
|
107
107
|
* @property {boolean} [afterStagingProofs] Production go-live: the strict staging proofs passed on this build.
|
|
108
108
|
* @property {string} [releaseKey] Defaults to RELEASE_PUBLIC_KEY; tests sign with their own.
|
|
109
|
+
* @property {string} [catalogue] Preview only (SA35): the catalogue the page bakes, staging's borrowed grid (scripts/preview-grid.ts);
|
|
110
|
+
* default the pinned `test/pins/catalogue.json`.
|
|
109
111
|
*/
|
|
110
112
|
|
|
111
113
|
const sha256 = (/** @type {Uint8Array} */ bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
@@ -136,13 +138,14 @@ export async function runPhase(phase, deps) {
|
|
|
136
138
|
if (deps.git.head() !== deps.build) refuse(`HEAD ${deps.git.head()} is not build ${deps.build}`);
|
|
137
139
|
if (!deps.git.clean()) refuse('the release tree is not clean (one clean clone per channel)');
|
|
138
140
|
if (!(deps.manifest.saveEpoch >= 1)) refuse('save-epoch.json must be at least 1');
|
|
141
|
+
if (deps.catalogue !== undefined && !channel.solo) refuse(`--catalogue is preview's (SA35): ${channel.channel} bakes the pinned catalogue`);
|
|
139
142
|
deps.log(`${channel.channel} ${phase} ${deps.build} v${deps.manifest.version} epoch ${deps.manifest.saveEpoch} on ${deps.host.name}${dry ? ' (dry run)' : ''}`);
|
|
140
143
|
|
|
141
144
|
if (phase === 'build') {
|
|
142
145
|
const env = buildEnv(channel, deps);
|
|
143
146
|
for (const line of deps.host.describe('prepare', context)) plan(line);
|
|
144
147
|
if (!dry) await deps.host.prepare(context);
|
|
145
|
-
plan(`run pnpm build:game with ${channel.solo ? 'no release file (solo)' : `WILDSHARD_RELEASE_URL=${env.WILDSHARD_RELEASE_URL}`} WS_BUILD_ID=${deps.build} WS_CHANNEL=${channel.channel}`);
|
|
148
|
+
plan(`run pnpm build:game with ${channel.solo ? 'no release file (solo)' : `WILDSHARD_RELEASE_URL=${env.WILDSHARD_RELEASE_URL}`} WILDSHARD_CATALOGUE=${env.WILDSHARD_CATALOGUE} WS_BUILD_ID=${deps.build} WS_CHANNEL=${channel.channel}`);
|
|
146
149
|
if (!dry) deps.run('pnpm', ['build:game'], {...env, ...deps.host.buildEnv(context)});
|
|
147
150
|
// PAGE-SIZE PZ4: build:game splits the page (dist/) from its content (dist-content/). No channel stamps a contentBase
|
|
148
151
|
// yet, so each page still serves its own content: join the two before packaging, until PZ8 ships the split.
|
|
@@ -247,7 +250,8 @@ export async function runPhase(phase, deps) {
|
|
|
247
250
|
/** @param {ChannelConfig} channel @param {Deps} deps @returns {Record<string, string>} */
|
|
248
251
|
export function buildEnv(channel, deps) {
|
|
249
252
|
const common = {
|
|
250
|
-
|
|
253
|
+
// SA35: preview bakes the grid it borrowed from staging when the workflow names one; staging and production bake the pin.
|
|
254
|
+
WS_BUILD_ID: deps.build, WILDSHARD_CATALOGUE: (channel.solo ? deps.catalogue : undefined) ?? 'test/pins/catalogue.json',
|
|
251
255
|
WS_PREVIOUS_DEPLOY_ORIGIN: channel.origin, WS_RELEASE: '1', WS_CHANNEL: channel.channel,
|
|
252
256
|
// API-CLOUDFLARE AC11: errors, telemetry and the inbox go to the api-server Worker on every channel.
|
|
253
257
|
VITE_API_ORIGIN: API_ORIGIN,
|
package/scripts/page-release.mjs
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
// --after-staging-proofs production go-live: the strict staging proofs passed on this exact build
|
|
13
13
|
// --content upload: publish the page's content set to packs.wildshard.io first (PAGE-SIZE PZ2,
|
|
14
14
|
// page-release/content.mjs); off until PZ4 and PZ6 stamp contentBase into the page
|
|
15
|
+
// --catalogue=<file> preview build: bake this catalogue, the grid borrowed from staging (SHARD-AUTHORING SA35,
|
|
16
|
+
// scripts/preview-grid.ts); default test/pins/catalogue.json. Refused on staging and production
|
|
15
17
|
//
|
|
16
18
|
// The flow and its gates are scripts/page-release/flow.mjs; the page hosts are scripts/page-release/hosts/*.mjs.
|
|
17
19
|
// Phase results go to <root>/tmp/page-release/<channel>-<sha>.json, which the next phase reads.
|
|
@@ -31,7 +33,7 @@ const value = (/** @type {string} */ name) => flag(name)?.split('=').slice(1).jo
|
|
|
31
33
|
const [channel, phaseList] = args.filter(arg => !arg.startsWith('--'));
|
|
32
34
|
const hostName = value('host') ?? 'workers';
|
|
33
35
|
if (channel === undefined || phaseList === undefined || hostName !== 'workers') {
|
|
34
|
-
console.error('usage: node scripts/page-release.mjs <preview|staging|production> <build|upload|check|go-live>[,...] [--host=workers] [--root=<dir>] [--dry-run] [--wait=<minutes>] [--after-staging-proofs] [--content]');
|
|
36
|
+
console.error('usage: node scripts/page-release.mjs <preview|staging|production> <build|upload|check|go-live>[,...] [--host=workers] [--root=<dir>] [--dry-run] [--wait=<minutes>] [--after-staging-proofs] [--content] [--catalogue=<file>]');
|
|
35
37
|
process.exit(2);
|
|
36
38
|
}
|
|
37
39
|
const git = (/** @type {string[]} */ argv, /** @type {string} */ cwd) => execFileSync('git', argv, {cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe']}).trim();
|
|
@@ -90,6 +92,8 @@ try {
|
|
|
90
92
|
dryRun: flag('dry-run') !== undefined,
|
|
91
93
|
waitMs: Number(value('wait') ?? 45) * 60_000,
|
|
92
94
|
afterStagingProofs: flag('after-staging-proofs') !== undefined,
|
|
95
|
+
// the build runs in `root`, so a relative path is the caller's
|
|
96
|
+
...(value('catalogue') === undefined ? {} : {catalogue: resolve(value('catalogue') ?? '')}),
|
|
93
97
|
});
|
|
94
98
|
if (refusals.length > 0) log(`DRY-RUN ${channel} ${phase}: ${refusals.length} gate(s) would refuse today`);
|
|
95
99
|
}
|