@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// DEVICE-TELEMETRY DT5 (meta docs/plans/DEVICE-TELEMETRY-PLAN.md): the last N connects' devices from a door's journal, as a table.
|
|
3
|
+
// The door writes one `client.device` JSON line per connect (src/server/host/dedicated/world.ts, src/shared/engine/net/deviceWord.ts).
|
|
4
|
+
// ssh wildshard-agent journalctl -u wildshard-server@staging --since today -o cat | node scripts/devices.mjs --last 20
|
|
5
|
+
// node scripts/devices.mjs --last 20 journal.txt (a saved journal)
|
|
6
|
+
// node scripts/devices.mjs --json < journal.txt (the lines themselves)
|
|
7
|
+
// Read-only: it reads text and prints. Lines carry device characteristics, the Name and the secret-keyed body id, never an address.
|
|
8
|
+
import { readFileSync } from 'node:fs';
|
|
9
|
+
|
|
10
|
+
const COLUMNS = [['name', 14], ['body', 12], ['model', 16], ['platform', 10], ['platformVersion', 8], ['browser', 24], ['gpu', 36], ['screen', 10], ['dpr', 5], ['memory', 4], ['cores', 4], ['clientBuild', 12]];
|
|
11
|
+
|
|
12
|
+
/** The `client.device` lines in a journal's text, oldest first; anything else on a line (a journal prefix) is skipped. */
|
|
13
|
+
export function deviceLines(text) {
|
|
14
|
+
const out = [];
|
|
15
|
+
for (const raw of text.split('\n')) {
|
|
16
|
+
const at = raw.indexOf('{"at":"client.device"');
|
|
17
|
+
if (at === -1) continue;
|
|
18
|
+
try { out.push(JSON.parse(raw.slice(at))); } catch { /* a cut line */ }
|
|
19
|
+
}
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The lines as a fixed-width table. */
|
|
24
|
+
export function deviceTable(lines) {
|
|
25
|
+
const cell = (value, width) => { const said = value === undefined ? '-' : String(value); return (said.length > width ? `${said.slice(0, width - 1)}~` : said).padEnd(width); };
|
|
26
|
+
const head = COLUMNS.map(([name, width]) => cell(name, width)).join(' ');
|
|
27
|
+
return [head, ...lines.map(line => COLUMNS.map(([name, width]) => cell(line[name], width)).join(' '))].join('\n');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function main(argv) {
|
|
31
|
+
const lastAt = argv.indexOf('--last'), last = lastAt === -1 ? 20 : Number(argv[lastAt + 1] ?? 20);
|
|
32
|
+
const files = argv.filter((arg, index) => !arg.startsWith('--') && index !== lastAt + 1);
|
|
33
|
+
const text = files.length === 0 ? readFileSync(0, 'utf8') : files.map(file => readFileSync(file, 'utf8')).join('\n');
|
|
34
|
+
const lines = deviceLines(text).slice(-Math.max(1, last));
|
|
35
|
+
if (argv.includes('--json')) { for (const line of lines) console.log(JSON.stringify(line)); return; }
|
|
36
|
+
console.log(lines.length === 0 ? 'no client.device lines (a door from before DEVICE-TELEMETRY writes none)' : deviceTable(lines));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (import.meta.url === `file://${process.argv[1]}`) main(process.argv.slice(2));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// HOW-WE-BUILD ENG-16: types for scripts/devserver-client.mjs.
|
|
2
2
|
/** The release asset's name; sharddev's `DEV_CLIENT_ASSET` reads the same. */
|
|
3
3
|
export declare const DEV_CLIENT_ASSET: string;
|
|
4
|
-
/**
|
|
5
|
-
export declare
|
|
4
|
+
/** SA43: the preparation client's asset; sharddev's `PREPARATION_CLIENT_ASSET` reads the same. */
|
|
5
|
+
export declare const PREPARATION_CLIENT_ASSET: string;
|
|
6
|
+
/** Prune a devserver build (or a preparation-only production build) in place to the client an author's page reads. */
|
|
7
|
+
export declare function pruneDevserverClient(client: string, kind?: 'devserver' | 'preparation'): void;
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
// programs, drafts, trailers and source maps. The author's own shard comes from `wildshard dev`'s build.
|
|
10
10
|
//
|
|
11
11
|
// python3 scripts/heavy-lane.py build -- node scripts/devserver-client.mjs --out <devserver-client.tar.gz> [--keep <folder>]
|
|
12
|
+
//
|
|
13
|
+
// SHARD-AUTHORING SA43: `--kind preparation` packs the client `wildshard prepare` records in, `preparation-client.tar.gz`:
|
|
14
|
+
// the production build (DEVSERVER off, the production renderer and its revision) made with `WILDSHARD_PREPARATION_ONLY=1`,
|
|
15
|
+
// so it owns the author's inline draft as `wildshard dev`'s page does, pruned the same way. check-devserver refuses to
|
|
16
|
+
// release it; it is only ever a release asset beside the devserver client.
|
|
12
17
|
import { execFileSync, spawnSync } from 'node:child_process';
|
|
13
18
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs';
|
|
14
19
|
import { join, relative, resolve } from 'node:path';
|
|
@@ -17,16 +22,25 @@ import { pathToFileURL } from 'node:url';
|
|
|
17
22
|
const ROOT = resolve(import.meta.dirname, '..');
|
|
18
23
|
/** The release asset's name; sharddev's `DEV_CLIENT_ASSET` reads the same. */
|
|
19
24
|
export const DEV_CLIENT_ASSET = 'devserver-client.tar.gz';
|
|
25
|
+
/** SA43: the preparation client's asset; sharddev's `PREPARATION_CLIENT_ASSET` reads the same. */
|
|
26
|
+
export const PREPARATION_CLIENT_ASSET = 'preparation-client.tar.gz';
|
|
27
|
+
/** @typedef {'devserver' | 'preparation'} ClientKind */
|
|
20
28
|
/** Top-level paths (and `assets/` folders) a devserver page never reads. */
|
|
21
29
|
const DROP_TOP = ['programs', 'drafts', 'trailer-15.mp4', 'trailer-30.mp4'];
|
|
22
30
|
const DROP_ASSETS = ['driftwood-isle', 'far-reach', 'nalati', 'nine-dragon', 'pine-hollow', 'sunscar-dunes', 'practice'];
|
|
23
31
|
/** `assets/gpu/` (KTX2 stand-ins): the shards' own folders go; the engine's `tex`, `models` and `horizon` stay. */
|
|
24
32
|
const DROP_GPU = ['baked', 'far-reach', 'nalati', 'nine-dragon', 'pine-hollow'];
|
|
25
33
|
|
|
26
|
-
/** Prune a devserver build in place to the client an author's page reads.
|
|
27
|
-
|
|
34
|
+
/** Prune a devserver build (or, SA43, a preparation-only production build) in place to the client an author's page reads.
|
|
35
|
+
* @param {string} client @param {ClientKind} [kind] */
|
|
36
|
+
export function pruneDevserverClient(client, kind = 'devserver') {
|
|
28
37
|
const flags = JSON.parse(readFileSync(join(client, 'build-flags.json'), 'utf8'));
|
|
29
|
-
if (flags?.devserver !== true) throw new Error('devserver-client: the build is not in devserver mode');
|
|
38
|
+
if (kind === 'devserver' && flags?.devserver !== true) throw new Error('devserver-client: the build is not in devserver mode');
|
|
39
|
+
if (kind === 'preparation') {
|
|
40
|
+
const versionFile = join(client, 'version.json');
|
|
41
|
+
const version = existsSync(versionFile) ? JSON.parse(readFileSync(versionFile, 'utf8')) : undefined;
|
|
42
|
+
if (flags?.devserver !== false || version?.preparationOnly !== true) throw new Error('devserver-client: the build is not a preparation-only production build');
|
|
43
|
+
}
|
|
30
44
|
for (const name of DROP_TOP) rmSync(join(client, name), { recursive: true, force: true });
|
|
31
45
|
for (const name of DROP_ASSETS) rmSync(join(client, 'assets', name), { recursive: true, force: true });
|
|
32
46
|
for (const name of DROP_GPU) rmSync(join(client, 'assets', 'gpu', name), { recursive: true, force: true });
|
|
@@ -47,15 +61,18 @@ const bytesOf = folder => readdirSync(folder, { recursive: true, withFileTypes:
|
|
|
47
61
|
|
|
48
62
|
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
49
63
|
const args = process.argv.slice(2), option = (/** @type {string} */ name) => { const at = args.indexOf(`--${name}`); return at === -1 ? undefined : args[at + 1]; };
|
|
50
|
-
const
|
|
64
|
+
const kind = /** @type {ClientKind} */ (option('kind') ?? 'devserver');
|
|
65
|
+
if (kind !== 'devserver' && kind !== 'preparation') throw new Error(`devserver-client: --kind is devserver or preparation, not ${String(kind)}`);
|
|
66
|
+
const out = resolve(option('out') ?? join('tmp', 'devserver-client', kind === 'devserver' ? DEV_CLIENT_ASSET : PREPARATION_CLIENT_ASSET));
|
|
51
67
|
const client = resolve(option('keep') ?? join(ROOT, 'tmp', 'devserver-client', 'client'));
|
|
52
68
|
if (relative(ROOT, client).startsWith('..')) throw new Error('devserver-client: the build folder must be inside this checkout (build-app defers its public copy there)');
|
|
53
69
|
rmSync(client, { recursive: true, force: true });
|
|
54
|
-
const built = spawnSync(process.execPath, ['scripts/build-app.mjs', '--mode', 'devserver', '--outDir', client], {
|
|
55
|
-
cwd: ROOT, stdio: 'inherit', env: { ...process.env, WILDSHARD_CATALOGUE: process.env.WILDSHARD_CATALOGUE ?? 'test/pins/catalogue.json'
|
|
70
|
+
const built = spawnSync(process.execPath, ['scripts/build-app.mjs', '--mode', kind === 'devserver' ? 'devserver' : 'production', '--outDir', client], {
|
|
71
|
+
cwd: ROOT, stdio: 'inherit', env: { ...process.env, WILDSHARD_CATALOGUE: process.env.WILDSHARD_CATALOGUE ?? 'test/pins/catalogue.json',
|
|
72
|
+
...(kind === 'preparation' ? { WILDSHARD_PREPARATION_ONLY: '1' } : {}) } });
|
|
56
73
|
if (built.status !== 0) throw new Error(`devserver-client: build-app exited ${String(built.status)}`);
|
|
57
74
|
const before = bytesOf(client);
|
|
58
|
-
pruneDevserverClient(client);
|
|
75
|
+
pruneDevserverClient(client, kind);
|
|
59
76
|
mkdirSync(resolve(out, '..'), { recursive: true });
|
|
60
77
|
// the same bytes for the same tree: sorted names, no owners or times (as the dedicated bundle is packed in server-release.yml)
|
|
61
78
|
const tar = spawnSync('tar', ['--version'], { encoding: 'utf8' }).stdout.includes('GNU') ? 'tar' : 'gtar';
|
|
@@ -63,6 +80,6 @@ if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(resolve(p
|
|
|
63
80
|
execFileSync('bash', ['-c', gnu
|
|
64
81
|
? `set -euo pipefail; ${tar} --sort=name --mtime='@0' --owner=0 --group=0 --numeric-owner -cf - -C "$1" . | gzip -n > "$2"`
|
|
65
82
|
: 'set -euo pipefail; tar -cf - -C "$1" . | gzip -n > "$2"', 'pack', client, out], { stdio: 'inherit' });
|
|
66
|
-
console.log(`devserver-client: ${(before / 1e6).toFixed(0)} MB built, ${(bytesOf(client) / 1e6).toFixed(0)} MB kept, ${(statSync(out).size / 1e6).toFixed(1)} MB packed: ${out}`);
|
|
83
|
+
console.log(`devserver-client (${kind}): ${(before / 1e6).toFixed(0)} MB built, ${(bytesOf(client) / 1e6).toFixed(0)} MB kept, ${(statSync(out).size / 1e6).toFixed(1)} MB packed: ${out}`);
|
|
67
84
|
if (option('keep') === undefined) rmSync(client, { recursive: true, force: true });
|
|
68
85
|
}
|
|
@@ -10,18 +10,18 @@ const root=mkdtempSync(join(directory,'run-'));
|
|
|
10
10
|
/** @param {string[]} args */
|
|
11
11
|
const git=args=>execFileSync('git',['-c','user.name=Docs proof','-c','user.email=proof@example.test',...args],{cwd:root,encoding:'utf8'}).trim();
|
|
12
12
|
try{
|
|
13
|
-
git(['init','--quiet','--initial-branch=main']);mkdirSync(join(root,'
|
|
14
|
-
copyFileSync('
|
|
13
|
+
git(['init','--quiet','--initial-branch=main']);mkdirSync(join(root,'kit/scripts'),{recursive:true});mkdirSync(join(root,'docs/tasks/asks'),{recursive:true});mkdirSync(join(root,'docs/plans'),{recursive:true});
|
|
14
|
+
copyFileSync('kit/scripts/asks.mjs',join(root,'kit/scripts/asks.mjs'));
|
|
15
15
|
writeFileSync(join(root,'docs/plans/actual.md'),'# Real plan');
|
|
16
16
|
writeFileSync(join(root,'docs/tasks/asks/A1.md'),'# A1\n\n**Status:** folded into actual\n\n**Ask:** Original recorded request\n');
|
|
17
17
|
git(['add','src','docs']);git(['commit','--quiet','-m','valid docs']);
|
|
18
|
-
assert.equal(spawnSync(process.execPath,['
|
|
18
|
+
assert.equal(spawnSync(process.execPath,['kit/scripts/asks.mjs','check','--all'],{cwd:root}).status,0);
|
|
19
19
|
unlinkSync(join(root,'docs/plans/actual.md'));git(['add','docs/plans/actual.md']);git(['commit','--quiet','-m','remove referenced plan']);
|
|
20
|
-
const invalid=spawnSync(process.execPath,['
|
|
20
|
+
const invalid=spawnSync(process.execPath,['kit/scripts/asks.mjs','check','--all'],{cwd:root,encoding:'utf8'});
|
|
21
21
|
assert.notEqual(invalid.status,0,'An empty Git index must not hide a committed dead ask target');
|
|
22
22
|
assert.match(invalid.stderr,/existing ask|plan/u);
|
|
23
|
-
writeFileSync(join(root,'docs/HOST-BAR.md'),'lint/
|
|
24
|
-
writeFileSync(join(root,'src/read-doc.mjs'),"import assert from 'node:assert/strict';import {readFileSync} from 'node:fs';assert.ok(readFileSync('docs/HOST-BAR.md','utf8').includes('lint/
|
|
23
|
+
writeFileSync(join(root,'docs/HOST-BAR.md'),'lint/host-register.json');
|
|
24
|
+
writeFileSync(join(root,'src/read-doc.mjs'),"import assert from 'node:assert/strict';import {readFileSync} from 'node:fs';assert.ok(readFileSync('docs/HOST-BAR.md','utf8').includes('lint/host-register.json'));");
|
|
25
25
|
git(['add','src/read-doc.mjs','docs/HOST-BAR.md']);git(['commit','--quiet','-m','document consumer']);
|
|
26
26
|
execFileSync(process.execPath,['src/read-doc.mjs'],{cwd:root});const before=git(['rev-parse','HEAD']);
|
|
27
27
|
writeFileSync(join(root,'docs/HOST-BAR.md'),'missing authority');git(['add','docs/HOST-BAR.md']);git(['commit','--quiet','-m','break documented contract']);
|
package/scripts/doctor-proof.mjs
CHANGED
|
@@ -62,7 +62,7 @@ const pages = spawn(process.execPath, ['scripts/preview-server.mjs', '--outDir',
|
|
|
62
62
|
for (let tries = 0; tries < 100 && !(await fetch(`http://127.0.0.1:${String(PAGE_PORT)}/version.json`).then(found => found.ok).catch(() => false)); tries++) await sleep(100);
|
|
63
63
|
const base = `http://127.0.0.1:${String(PAGE_PORT)}`;
|
|
64
64
|
|
|
65
|
-
const browser = await (engine === 'webkit' ? webkit : chromium).launch(engine === 'webkit' ? {} : { args: ['--use-mock-keychain', '--password-store=basic'] });
|
|
65
|
+
const browser = await (engine === 'webkit' ? webkit : chromium).launch(engine === 'webkit' ? {} : { args: ['--use-mock-keychain', '--password-store=basic', '--mute-audio'] });
|
|
66
66
|
const device = engine === 'webkit' ? devices['iPhone 13'] : devices['Pixel 7'];
|
|
67
67
|
const failures = /** @type {string[]} */ ([]), results = /** @type {Record<string, unknown>} */ ({});
|
|
68
68
|
/** @param {boolean} ok @param {string} what */
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// T2E-2 (TEMPLATE-E2E-PLAN): the Template 2 smoke's fault drill. Each step of the smoke has a fault planted in the real
|
|
3
|
+
// source that should turn that step, and no earlier one, red. The drill plants one fault at a time, runs the smoke
|
|
4
|
+
// (`--project template-2`), puts the source back, and checks which step failed first.
|
|
5
|
+
//
|
|
6
|
+
// node scripts/e2e-faults.mjs every fault, one smoke run each (about 1.5 min each)
|
|
7
|
+
// node scripts/e2e-faults.mjs <id>... only these
|
|
8
|
+
//
|
|
9
|
+
// Run it in a worktree you own: it rewrites tracked source for the length of a run and restores the bytes it read,
|
|
10
|
+
// also on Ctrl-C. Each run builds the client cold and checks the served build holds this plant and no other. Steps 4
|
|
11
|
+
// (the bag key unbound) and 5 (the attack dropped) join once Template 2 carries a pickup and a weapon (shard-format
|
|
12
|
+
// S2-1, S2-2).
|
|
13
|
+
import { spawnSync } from 'node:child_process';
|
|
14
|
+
import { existsSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
15
|
+
import { join, resolve as resolvePath } from 'node:path';
|
|
16
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
17
|
+
import { CLIENT_DIR, E2E_DIR, STATE_FILE } from './e2e-paths.mjs';
|
|
18
|
+
|
|
19
|
+
const root = resolvePath(import.meta.dirname, '..');
|
|
20
|
+
const REPORT = `${E2E_DIR}/faults-report.json`;
|
|
21
|
+
/** The planted file's path and both texts, while a plant stands. */
|
|
22
|
+
const PLANTED = `${E2E_DIR}/faults-planted.json`;
|
|
23
|
+
|
|
24
|
+
/** @typedef {{ id: string, step: string, why: string, file: string, find: string, plant: string }} Fault */
|
|
25
|
+
/** @type {readonly Fault[]} */
|
|
26
|
+
const FAULTS = [
|
|
27
|
+
{ id: 'use-unbound', step: '3.', why: 'E is bound to nothing in play',
|
|
28
|
+
file: 'src/client/game/inputContexts.ts', find: "dodge: ['KeyV', 'AltLeft'], use: ['KeyE'],", plant: "dodge: ['KeyV', 'AltLeft'], use: ['e2e-fault-use-unbound'],"
|
|
29
|
+
},
|
|
30
|
+
{ id: 'door-hook-stubbed', step: '3.', why: "the door's scene (blender.door.toggle) runs nothing",
|
|
31
|
+
file: 'src/server/game/plugin/simulation.ts', find: 'seats.step(); createQuestScriptPorts(lane, hooks, actors).scene(row.scene, player); return true;', plant: "seats.step(); Reflect.set(globalThis, 'e2eFault', 'e2e-fault-door-hook-stubbed'); return true;"
|
|
32
|
+
},
|
|
33
|
+
// The door's state is its shared field, `blender.door.open` (id 101). Leaving only the quest's `blender.door` flag out of
|
|
34
|
+
// the snapshot stays green: the quest earns it again from that field as the world restores.
|
|
35
|
+
{ id: 'save-skips-door', step: '7.', why: "the save keeps the door's field (blender.door.open, 101) at its default",
|
|
36
|
+
file: 'src/shared/engine/script/state.ts', find: 'shared: [...this.shared], players:',
|
|
37
|
+
plant: "shared: (Reflect.set(globalThis, 'e2eFault', 'e2e-fault-save-skips-door'), this.shared.map((value, index) => this.declaration.shared[index]?.id === 101 ? 0 : value)), players:"
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
/** @param {string} text @param {string} part */
|
|
42
|
+
const count = (text, part) => text.split(part).length - 1;
|
|
43
|
+
|
|
44
|
+
/** Every fault's marker: a string its plant carries that survives the bundle. @param {Fault} fault */
|
|
45
|
+
const marker = fault => `e2e-fault-${fault.id}`;
|
|
46
|
+
|
|
47
|
+
/** The markers the served client holds: the smoke's JavaScript under CLIENT_DIR. @returns {Set<string>} */
|
|
48
|
+
function served() {
|
|
49
|
+
const found = new Set();
|
|
50
|
+
/** @param {string} dir */
|
|
51
|
+
const walk = dir => {
|
|
52
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
53
|
+
const path = join(dir, entry.name);
|
|
54
|
+
if (entry.isDirectory()) walk(path);
|
|
55
|
+
else if (entry.name.endsWith('.js')) { const text = readFileSync(path, 'utf8'); for (const fault of FAULTS) if (text.includes(marker(fault))) found.add(fault.id); }
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
walk(join(root, CLIENT_DIR));
|
|
59
|
+
return found;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** This worktree's watcher, as the smoke drives it. @param {'ready'|'stop'} command */
|
|
63
|
+
function client(command) {
|
|
64
|
+
const run = spawnSync(process.execPath, ['--import', './scripts/format-hook.mjs', 'scripts/e2e-client.mjs', command], { cwd: root, encoding: 'utf8' });
|
|
65
|
+
interrupted(run);
|
|
66
|
+
if (run.status !== 0) throw new Error(`e2e-faults: e2e-client ${command} failed\n${run.stdout}\n${run.stderr}`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** @param {number} ms */
|
|
70
|
+
const pause = ms => { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms); };
|
|
71
|
+
/** @param {number} pid */
|
|
72
|
+
const alive = pid => { try { process.kill(pid, 0); return true; } catch { return false; } };
|
|
73
|
+
|
|
74
|
+
/** Wait until this worktree's watcher has exited: the next ready builds the source as it now stands. */
|
|
75
|
+
function stopClient() {
|
|
76
|
+
const state = join(root, STATE_FILE), pid = existsSync(state) ? Number(JSON.parse(readFileSync(state, 'utf8')).pid) : undefined;
|
|
77
|
+
client('stop');
|
|
78
|
+
const running = () => pid !== undefined && alive(pid);
|
|
79
|
+
for (let wait = 0; wait < 300 && running(); wait += 1) pause(100);
|
|
80
|
+
if (running()) throw new Error(`e2e-faults: the watcher (pid ${String(pid)}) did not stop in 30 s`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Puts a planted file back from its recovery record, if one is left, and only while it still holds the plant: an edit
|
|
84
|
+
* made since is kept, and named. @returns {string|undefined} a warning */
|
|
85
|
+
function recover() {
|
|
86
|
+
const record = join(root, PLANTED);
|
|
87
|
+
if (!existsSync(record)) return undefined;
|
|
88
|
+
const { file, before, planted } = JSON.parse(readFileSync(record, 'utf8')), path = join(root, file);
|
|
89
|
+
const now = readFileSync(path, 'utf8');
|
|
90
|
+
rmSync(record, { force: true });
|
|
91
|
+
if (now === before) return undefined;
|
|
92
|
+
if (now === planted) { writeFileSync(path, before); return undefined; }
|
|
93
|
+
return `e2e-faults: ${file} changed during the drill, so its plant was left for you to take out`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A Ctrl-C reaches the child, not this process (spawnSync blocks its handlers): stop on the child's signal. @param {import('node:child_process').SpawnSyncReturns<string>} run */
|
|
97
|
+
function interrupted(run) {
|
|
98
|
+
if (run.signal === null && run.status !== 130) return;
|
|
99
|
+
const warning = recover();
|
|
100
|
+
if (warning !== undefined) console.error(warning);
|
|
101
|
+
try { client('stop'); } catch { /* the stop is best effort here */ }
|
|
102
|
+
process.exit(130);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Every test.step at the top level of a result; the first red one is the step the fault reddened. @param {any} suite @returns {any[]} */
|
|
106
|
+
const resultsOf = suite => [...(suite.specs ?? []).flatMap((/** @type {any} */ spec) => spec.tests).flatMap((/** @type {any} */ test) => test.results), ...(suite.suites ?? []).flatMap(resultsOf)];
|
|
107
|
+
|
|
108
|
+
/** @param {Fault} fault */
|
|
109
|
+
function drill(fault) {
|
|
110
|
+
const path = join(root, fault.file), before = readFileSync(path, 'utf8');
|
|
111
|
+
if (count(before, fault.find) !== 1) return { ok: false, detail: `${fault.file} no longer holds the line to plant in once` };
|
|
112
|
+
if (!fault.plant.includes(marker(fault))) return { ok: false, detail: `its plant carries no ${marker(fault)}` };
|
|
113
|
+
const planted = before.replace(fault.find, fault.plant);
|
|
114
|
+
// A warm watcher can miss a write and restore made seconds apart (its file events are not reliable), so each drill
|
|
115
|
+
// builds cold, about 25 s: a fresh watcher before the plant and another after the restore.
|
|
116
|
+
stopClient();
|
|
117
|
+
// Written first, so a drill killed mid-run is put right by the next one.
|
|
118
|
+
writeFileSync(join(root, PLANTED), JSON.stringify({ file: fault.file, before, planted }));
|
|
119
|
+
writeFileSync(path, planted);
|
|
120
|
+
rmSync(join(root, REPORT), { force: true });
|
|
121
|
+
const started = performance.now();
|
|
122
|
+
let run, warning;
|
|
123
|
+
try {
|
|
124
|
+
// A drill is only as good as the build it ran: the served client must hold this plant and no other.
|
|
125
|
+
client('ready');
|
|
126
|
+
const held = [...served()];
|
|
127
|
+
if (held.length !== 1 || held[0] !== fault.id) return { ok: false, detail: `the served client holds [${held.join(', ')}], not just this plant` };
|
|
128
|
+
run = spawnSync('pnpm', ['exec', 'playwright', 'test', '--config', 'src/e2e/playwright.config.ts', '--project', 'template-2', '--reporter', 'json'],
|
|
129
|
+
{ cwd: root, encoding: 'utf8', env: { ...process.env, PLAYWRIGHT_JSON_OUTPUT_NAME: join(root, REPORT) }, maxBuffer: 64 * 1024 * 1024 });
|
|
130
|
+
interrupted(run);
|
|
131
|
+
} finally {
|
|
132
|
+
warning = recover();
|
|
133
|
+
stopClient();
|
|
134
|
+
}
|
|
135
|
+
if (warning !== undefined) throw new Error(warning);
|
|
136
|
+
const seconds = ((performance.now() - started) / 1000).toFixed(1);
|
|
137
|
+
if (run.status === 0) return { ok: false, detail: `the smoke stayed green (${seconds} s)` };
|
|
138
|
+
if (!existsSync(join(root, REPORT))) return { ok: false, detail: `no report (exit ${String(run.status)})\n${(run.stderr ?? run.error?.message ?? '').slice(-2000)}` };
|
|
139
|
+
const results = resultsOf(JSON.parse(readFileSync(join(root, REPORT), 'utf8')));
|
|
140
|
+
const red = results.flatMap((/** @type {any} */ result) => result.steps ?? []).find((/** @type {any} */ step) => step.error !== undefined);
|
|
141
|
+
if (red === undefined) return { ok: false, detail: `red outside any step (${seconds} s): ${String(results[0]?.error?.message ?? '').split('\n')[0]}` };
|
|
142
|
+
const message = stripVTControlCharacters(String(red.error?.message ?? '')).split('\n').find(line => line.trim() !== '') ?? '';
|
|
143
|
+
return { ok: String(red.title).startsWith(fault.step), detail: `red at "${String(red.title)}" (want step ${fault.step}) in ${seconds} s: ${message.trim()}` };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const asked = process.argv.slice(2);
|
|
147
|
+
const unknown = asked.filter(id => !FAULTS.some(fault => fault.id === id));
|
|
148
|
+
if (unknown.length > 0) throw new Error(`e2e-faults: no fault ${unknown.join(', ')}; known: ${FAULTS.map(fault => fault.id).join(', ')}`);
|
|
149
|
+
const leftover = recover();
|
|
150
|
+
if (leftover !== undefined) throw new Error(leftover);
|
|
151
|
+
let failed = 0;
|
|
152
|
+
for (const fault of FAULTS.filter(row => asked.length === 0 || asked.includes(row.id))) {
|
|
153
|
+
/** @type {{ ok: boolean, detail: string }} */
|
|
154
|
+
let result;
|
|
155
|
+
try { result = drill(fault); } catch (error) { result = { ok: false, detail: error instanceof Error ? error.message : String(error) }; }
|
|
156
|
+
if (!result.ok) failed += 1;
|
|
157
|
+
console.log(`${result.ok ? 'RED AS PLANTED' : 'DRILL FAILED'} ${fault.id} (${fault.why}): ${result.detail}`);
|
|
158
|
+
}
|
|
159
|
+
process.exit(failed === 0 ? 0 : 1);
|
|
@@ -15,7 +15,7 @@ import {VOICE_FULL_M} from '../src/client/engine/net/voiceNear.ts';
|
|
|
15
15
|
const [base,build,key,out=new URL('../tmp/e7-voice-staging/',import.meta.url).pathname]=process.argv.slice(2);
|
|
16
16
|
assert.equal(new URL(base).origin,'https://staging.wildshard.io','J205 requires the isolated staging page');
|
|
17
17
|
assert.match(build,/^[a-f0-9]{40}$/u);assert.match(key,/^[a-f0-9]+$/u);mkdirSync(out,{recursive:true});
|
|
18
|
-
const releaseURL='https://
|
|
18
|
+
const releaseURL='https://packs.wildshard.io/releases/staging.json',sockets=['wss://rooms-staging.wildshard.io','wss://wildshard.tailb41b20.ts.net:8443'];
|
|
19
19
|
const signed=await(await fetch(releaseURL,{cache:'no-store',redirect:'error',signal:AbortSignal.timeout(30000)})).json();
|
|
20
20
|
assert.ok(verify(null,Buffer.from(signed.body),createPublicKey({key:Buffer.from(key,'hex'),format:'der',type:'spki'}),Buffer.from(signed.signature,'hex')));
|
|
21
21
|
const release=JSON.parse(signed.body);assert.equal(release.channel,'staging');assert.equal(release.engineBuild,build);const socket=release.socket.replace(/\/$/u,'');assert.ok(sockets.includes(socket),socket);
|
|
@@ -37,7 +37,7 @@ export function pushGuards(changed) {
|
|
|
37
37
|
return [
|
|
38
38
|
...(changed.some(file => /^src\/(?:format|sdk|sharddev)\//u.test(file)) ? ['test/schema-reference.test.ts'] : []),
|
|
39
39
|
'test/host-callbacks.test.ts', 'test/shardfile-boundaries.test.ts',
|
|
40
|
-
'test/
|
|
40
|
+
'test/manifest-declarations.test.ts',
|
|
41
41
|
];
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -203,7 +203,7 @@ export function deriveGitDiscovery(view,path) {
|
|
|
203
203
|
genShards(process.cwd());
|
|
204
204
|
console.log(JSON.stringify(Object.fromEntries(outputs.map(file=>[file,createHash('sha256').update(readFileSync(file)).digest('hex')]))));
|
|
205
205
|
`;
|
|
206
|
-
const output=execFileSync(process.execPath,['--experimental-transform-types','--import','./scripts/
|
|
206
|
+
const output=execFileSync(process.execPath,['--experimental-transform-types','--import','./scripts/node-format.mjs','--input-type=module','--eval',source,'--',JSON.stringify(job.nativeOutputs)],{cwd:view.root,encoding:'utf8',maxBuffer:8*1024*1024,
|
|
207
207
|
env:{...process.env,WS_GIT_CHECK_ROOT:view.root,WS_GIT_CHECK_REV:view.revision}});
|
|
208
208
|
const line=output.trim().split('\n').at(-1);
|
|
209
209
|
if(line===undefined)throw new Error('Missing generated-output proof');
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
// and turns the board back on. ON_FOOT: a board that shows in the frame. It stows Sky's fan and fills its hover decks, and
|
|
19
19
|
// its goldens have neither, so a player hovering there for its streaming steps off for the shot.
|
|
20
20
|
import {chromium,webkit,devices} from 'playwright';
|
|
21
|
-
import {readFileSync,writeFileSync,mkdirSync} from 'node:fs';
|
|
21
|
+
import {existsSync,readFileSync,statSync,writeFileSync,mkdirSync} from 'node:fs';
|
|
22
22
|
import {readFile} from 'node:fs/promises';
|
|
23
|
-
import {saveFixture,developerSettings,hideDeveloperOverlays,levelDownloadFixtures} from '../debug-settings.mjs';
|
|
23
|
+
import {saveFixture,developerSettings,hideDeveloperOverlays,levelDownloadFixtures,NAME_ASKED} from '../debug-settings.mjs';
|
|
24
24
|
import {loadingCardIndex} from '../loading-benchmark/catalogue.mjs';
|
|
25
25
|
import {pressEscape} from '../parity/browser-escape.mjs';
|
|
26
26
|
import {KEYCHAIN_ARGS} from '../chromium-keychain.mjs';
|
|
@@ -49,6 +49,10 @@ const hideAstc=()=>{const ext='WEBGL_compressed_texture_astc';for(const gl of [W
|
|
|
49
49
|
gl.prototype.getSupportedExtensions=function(){return getSupportedExtensions.call(this)?.filter(name=>name!==ext)??null;};}};
|
|
50
50
|
// --level-download=packs|shardfile (DL16): Debug ▸ Loading & memory ▸ Level download for every capture (default: the build's)
|
|
51
51
|
const LEVEL_DOWNLOAD=arg('level-download','');if(!['','packs','shardfile'].includes(LEVEL_DOWNLOAD))throw Error(`--level-download=${LEVEL_DOWNLOAD}`);
|
|
52
|
+
// --serve-over=<dir> (S12c): answer a request whose path is a file under <dir> from that file, so a cook's phone textures (laid
|
|
53
|
+
// out at the URLs they stand in for) are judged on a served build. Pair it with --level-download=shardfile: a pack part is not a request.
|
|
54
|
+
const SERVE_OVER=arg('serve-over',''),overHits=new Set();
|
|
55
|
+
const DIRECT=process.argv.includes('--direct');
|
|
52
56
|
mkdirSync(root,{recursive:true});
|
|
53
57
|
|
|
54
58
|
// --engine=webkit: Playwright's WebKit (muted by the game's volume 0; its Escape is a plain key press)
|
|
@@ -90,6 +94,7 @@ try{for(const slug of slugs){
|
|
|
90
94
|
await developerSettings(context,{tier:'phone',volume:0,time:'midday',weather:'clear'});
|
|
91
95
|
await saveFixture(context,{scope:'global',key:'gfx',data:{dpr:'2',aa:'auto'}});
|
|
92
96
|
await saveFixture(context,{scope:'device',key:'debug.global.holdLoading',data:'off'});
|
|
97
|
+
await saveFixture(context,NAME_ASKED);// MP2.4: the Name prompt otherwise covers SHARD SELECT
|
|
93
98
|
if (LEVEL_DOWNLOAD!=='') for (const fixture of levelDownloadFixtures(LEVEL_DOWNLOAD)) await saveFixture(context,fixture);
|
|
94
99
|
// --device-save=<key>=<value>: a Debug row's device slot for a look A / B (D227's debug.gltfMips=on); repeatable
|
|
95
100
|
for (const pair of process.argv.filter(x=>x.startsWith('--device-save=')).map(x=>x.slice(14))) {
|
|
@@ -98,6 +103,8 @@ try{for(const slug of slugs){
|
|
|
98
103
|
}
|
|
99
104
|
await context.addInitScript(hideDeveloperOverlays);
|
|
100
105
|
if(NO_ASTC)await context.addInitScript(hideAstc);
|
|
106
|
+
if(SERVE_OVER)await context.route(()=>true,async route=>{const path=new URL(route.request().url()).pathname,file=`${SERVE_OVER}${decodeURIComponent(path)}`;
|
|
107
|
+
if(!path.includes('..')&&existsSync(file)&&statSync(file).isFile()){overHits.add(path);await route.fulfill({status:200,body:readFileSync(file),headers:{'content-type':'application/octet-stream'}});}else await route.fallback();});
|
|
101
108
|
await context.addInitScript(textures=>{window.__wildshardHarness={seed:357,capture:null,...(textures===''?{}:{textures})};},TEXTURES);
|
|
102
109
|
if (slug==='nine-dragon-stack'&&nativeBinding!==null) await context.addInitScript(`window.__installGoldenResidency=()=>window.__goldenResidencyPromise??=(async()=>{
|
|
103
110
|
try {
|
|
@@ -120,7 +127,9 @@ try{for(const slug of slugs){
|
|
|
120
127
|
const version=await(await page.request.get(new URL('/version.json',base).href)).json();
|
|
121
128
|
const actual=goldenPreviewIdentity(version,arg('sha',''));
|
|
122
129
|
if(actual.build!==source.build)throw Error(`Preview changed from ${source.build} to ${actual.build}`);row.build=actual.build;
|
|
123
|
-
|
|
130
|
+
// --direct (S12c): enter by the shard's own URL (`?chunk=<slug>`), as scripts/tier-textures-proof.mjs does. Since J300's Shard select
|
|
131
|
+
// enters the grid at a shard's cell (a42f92b6), the title's card no longer reaches a grid-hosted shard's one-shard page.
|
|
132
|
+
await page.goto(DIRECT?`${base.replace(/\/$/u,'')}/?chunk=${slug}&skipintro&mute=1&nolock=1`:base,{waitUntil:'load'});
|
|
124
133
|
if (slug==='nine-dragon-stack'&&nativeBinding!==null) {
|
|
125
134
|
// The per-document DOM-ready hook also covers SHARD SELECT's fresh-page
|
|
126
135
|
// navigation. The title's explicit handshake precedes every menu action.
|
|
@@ -129,13 +138,16 @@ try{for(const slug of slugs){
|
|
|
129
138
|
const failure=await page.evaluate(()=>window.__goldenResidencyFailure);if(failure)throw new Error(failure);
|
|
130
139
|
row.nativeBinding={...nativeBinding,installed:'per-document-dom-ready-before-world-entry'};
|
|
131
140
|
}
|
|
141
|
+
let clicker;if(DIRECT)clicker=setInterval(()=>{void page.locator('.ws-load-play').click({timeout:500}).catch(()=>undefined);},1000);else{
|
|
132
142
|
await page.locator('.ws-main-select').click();
|
|
133
143
|
const names=await page.locator('.ws-menu-card b').allTextContents();
|
|
134
144
|
await page.locator(`.ws-menu-dots i[data-i="${loadingCardIndex(names,slug)}"]`).click();
|
|
135
145
|
// ENTER WORLD, the one entry (the shardfile, G531; QD7 LD5 removed the LEGACY / SHARDFILE pair)
|
|
136
146
|
const button=page.locator('.ws-menu-play');
|
|
137
147
|
if(await button.isDisabled())throw Error(`${mode} entry disabled`);await button.click();
|
|
148
|
+
}
|
|
138
149
|
await page.waitForFunction(()=>!!window.__wildshard?.world?.hud?.entered&&!document.querySelector('.ws-load')&&window.__wildshard.world.game.frameGate(),undefined,{timeout:180000});
|
|
150
|
+
clearInterval(clicker);
|
|
139
151
|
if (slug==='nine-dragon-stack'&&nativeBinding!==null) {
|
|
140
152
|
await page.waitForFunction(()=>window.__goldenResidency!==undefined||window.__goldenResidencyFailure!==undefined);
|
|
141
153
|
const failure=await page.evaluate(()=>window.__goldenResidencyFailure);if(failure)throw new Error(failure);
|
|
@@ -208,7 +220,7 @@ try{for(const slug of slugs){
|
|
|
208
220
|
}
|
|
209
221
|
row.status=row.errors.length===0?'complete':'errors';
|
|
210
222
|
}catch(error){row.status='failed';row.failure=String(error);if(page)await page.screenshot({path:`${dir}/failure.jpg`,type:'jpeg',quality:80,scale:'css'}).catch(()=>{});}
|
|
211
|
-
finally{rows.push(row);writeFileSync(`${root}/receipts-${slug}.json`,JSON.stringify(row,null,1));writeFileSync(`${root}/receipts.json`,JSON.stringify(rows,null,2));await context.close();
|
|
212
|
-
console.log(JSON.stringify({slug,status:row.status,poses:row.poses.length,idle:row.poses.map(p=>p.idle.settled),failure:row.failure,errors:row.errors.slice(0,3),warnings:Object.values(row.warnings).reduce((n,c)=>n+c,0)}));}
|
|
223
|
+
finally{if(SERVE_OVER)row.servedOver=[...overHits].sort();rows.push(row);writeFileSync(`${root}/receipts-${slug}.json`,JSON.stringify(row,null,1));writeFileSync(`${root}/receipts.json`,JSON.stringify(rows,null,2));await context.close();
|
|
224
|
+
console.log(JSON.stringify({slug,status:row.status,poses:row.poses.length,idle:row.poses.map(p=>p.idle.settled),failure:row.failure,errors:row.errors.slice(0,3),warnings:Object.values(row.warnings).reduce((n,c)=>n+c,0),...(SERVE_OVER?{servedOver:overHits.size}:{})}));}
|
|
213
225
|
if(row.status==='failed')process.exitCode=1;
|
|
214
226
|
}}finally{try{await browser.close();}finally{await owner?.close();}}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// GRID-CROSSING GC17: GC3's crossing run every night and after every staging release, from this Mac until MAC-MINI-RUNNER MR7 takes it.
|
|
3
|
+
// One call decides what is due and runs it (a launchd agent calls it every hour):
|
|
4
|
+
// release staging's signed release file (packs.wildshard.io/releases/staging.json) names a serial no run has read: the online walks
|
|
5
|
+
// (`grid-crossing-qa.mjs`, Driftwood's exits, Chromium and WebKit, desktop and phone) on staging
|
|
6
|
+
// nightly after 03:00 (this Mac's clock) and none yet today: the every-pair tour (`grid-crossing-tour.mjs`, Chromium desktop) on preview
|
|
7
|
+
// Each run writes `grid-crossing-report.mjs`'s report under <root>/<kind>-<stamp>/report and checks the ratchet: a pair worse than
|
|
8
|
+
// `test/grid-crossing-ratchet.json` is red. Every run appends one line to ~/.cache/wildshard/lane-receipts.log (`grid-nightly DONE` or
|
|
9
|
+
// `grid-nightly RED`, naming the red pairs), which the coordinator reads to open a QA-FEEDBACK row. State (the last serial and night) is
|
|
10
|
+
// <root>/state.json.
|
|
11
|
+
// node scripts/grid-crossing-nightly.mjs [--root=<dir>] [--force=release|nightly] [--dry-run]
|
|
12
|
+
// --root defaults to ~/.cache/wildshard/plan-artifacts/grid/nightly. --dry-run prints what is due and runs nothing.
|
|
13
|
+
import { spawnSync } from 'node:child_process';
|
|
14
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
15
|
+
import { homedir } from 'node:os';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
|
|
18
|
+
/** @param {string} name @param {string} fallback */
|
|
19
|
+
const flag = (name, fallback) => process.argv.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3) ?? fallback;
|
|
20
|
+
const root = flag('root', join(homedir(), '.cache/wildshard/plan-artifacts/grid/nightly')), force = flag('force', ''), dry = process.argv.includes('--dry-run');
|
|
21
|
+
const RECEIPTS = join(homedir(), '.cache/wildshard/lane-receipts.log'), STATE = join(root, 'state.json'), here = join(import.meta.dirname, '..');
|
|
22
|
+
mkdirSync(root, { recursive: true });
|
|
23
|
+
/** @type {{ serial: number | null, night: string | null }} */
|
|
24
|
+
const state = existsSync(STATE) ? JSON.parse(readFileSync(STATE, 'utf8')) : { serial: null, night: null };
|
|
25
|
+
|
|
26
|
+
const now = new Date(), pad = (/** @type {number} */ n) => String(n).padStart(2, '0');
|
|
27
|
+
const today = `${String(now.getFullYear())}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`, stamp = `${today}T${pad(now.getHours())}${pad(now.getMinutes())}`;
|
|
28
|
+
const signed = /** @type {{ body: string }} */ (await (await fetch('https://packs.wildshard.io/releases/staging.json', { cache: 'no-store' })).json());
|
|
29
|
+
const serial = /** @type {{ serial: number }} */ (JSON.parse(signed.body)).serial;
|
|
30
|
+
|
|
31
|
+
/** @type {('release' | 'nightly')[]} */
|
|
32
|
+
const due = [];
|
|
33
|
+
if (force === 'release' || (force === '' && Number.isFinite(serial) && serial !== state.serial)) due.push('release');
|
|
34
|
+
if (force === 'nightly' || (force === '' && now.getHours() >= 3 && state.night !== today)) due.push('nightly');
|
|
35
|
+
console.log(`grid-crossing nightly: staging serial ${String(serial)} (last read ${String(state.serial)}), night ${today} (last ${String(state.night)}); due: ${due.join(', ') || 'nothing'}`);
|
|
36
|
+
if (dry || due.length === 0) process.exit(0);
|
|
37
|
+
|
|
38
|
+
/** @param {string[]} args */
|
|
39
|
+
const run = (args) => spawnSync(join(here, 'scripts/browser-lane.sh'), ['--max', '90', 'node', ...args], { cwd: here, stdio: 'inherit' }).status;
|
|
40
|
+
const clock = () => { const d = new Date(); return `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())} UTC`; };
|
|
41
|
+
let red = false;
|
|
42
|
+
for (const kind of due) {
|
|
43
|
+
const dir = join(root, `${kind}-${stamp}`);
|
|
44
|
+
mkdirSync(dir, { recursive: true });
|
|
45
|
+
const walked = kind === 'release'
|
|
46
|
+
? run(['scripts/grid-crossing-qa.mjs', '--base=https://staging.wildshard.io', `--out=${join(dir, 'walks')}`])
|
|
47
|
+
: run(['scripts/grid-crossing-tour.mjs', '--base=https://preview.wildshard.io', `--out=${join(dir, 'tour')}`, '--lane=grid-nightly']);
|
|
48
|
+
const runs = kind === 'release' ? join(dir, 'walks/rows.json') : join(dir, 'tour');
|
|
49
|
+
const report = spawnSync('node', ['scripts/grid-crossing-report.mjs', join(dir, 'report'), `--runs=${runs}`], { cwd: here, encoding: 'utf8' });
|
|
50
|
+
writeFileSync(join(dir, 'report.log'), `${report.stdout}${report.stderr}`);
|
|
51
|
+
const worse = report.stdout.split('\n').filter(line => line.startsWith('WORSE ')).slice(0, 8).join('; ');
|
|
52
|
+
const ok = report.status === 0;
|
|
53
|
+
red ||= !ok;
|
|
54
|
+
const what = kind === 'release' ? `staging serial ${String(serial)} walks` : 'preview every-pair tour';
|
|
55
|
+
appendFileSync(RECEIPTS, `${clock()} grid-nightly ${ok ? 'DONE' : 'RED'}: GC17 ${kind} ${what}, ${ok ? 'no pair worse than the ratchet' : `ratchet broken: ${worse || 'see report.log'}`}${walked === 0 ? '' : ' (the run itself exited non-zero)'}, ${join(dir, 'report/report.html')}\n`);
|
|
56
|
+
if (kind === 'release') state.serial = serial; else state.night = today;
|
|
57
|
+
writeFileSync(STATE, `${JSON.stringify(state, null, 2)}\n`);
|
|
58
|
+
}
|
|
59
|
+
process.exit(red ? 1 : 0);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// GRID-CROSSING GC1: the crossing harness, one command. It runs `grid-crossing-walk-proof.mjs` (enter the grid by the deck card,
|
|
3
|
+
// approach a named neighbour's entryway, then walk out, boost back home and boost out, by real input) in Chromium and WebKit at the
|
|
4
|
+
// desktop and phone layouts, one after another inside the browser lane, and writes one JSON row per browser and layout to
|
|
5
|
+
// <out>/rows.json: per leg the time from the line to control, the worst stop, frames over 50 and 100 ms, programs linked, and the
|
|
6
|
+
// page's memory at control (JS heap, the grid's resident and playing MB, the memory warning), plus each run's shots under <out>/<run>/.
|
|
7
|
+
// Staging, preview or a loopback page only (the walk proof refuses production, J205).
|
|
8
|
+
// node scripts/grid-crossing-qa.mjs --base=https://staging.wildshard.io [--to=sunscar|pine|farreach|nalati|nightmarket]
|
|
9
|
+
// [--engines=chromium,webkit] [--layouts=desktop,phone] [--out=~/.cache/wildshard/plan-artifacts/grid-crossing/<stamp>]
|
|
10
|
+
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import { homedir } from 'node:os';
|
|
13
|
+
import { join, resolve as absolute } from 'node:path';
|
|
14
|
+
|
|
15
|
+
/** @param {string} name @param {string} fallback */
|
|
16
|
+
const flag = (name, fallback) => process.argv.find(arg => arg.startsWith(`--${name}=`))?.slice(name.length + 3) ?? fallback;
|
|
17
|
+
const base = flag('base', ''), to = flag('to', 'sunscar');
|
|
18
|
+
if (base === '') throw new Error('usage: grid-crossing-qa.mjs --base=<staging, preview or loopback url> [--to=…] [--engines=…] [--layouts=…] [--out=…]');
|
|
19
|
+
const stamp = new Date().toISOString().replaceAll(/[:.]/gu, '-').slice(0, 19);
|
|
20
|
+
const out = absolute(flag('out', join(homedir(), '.cache/wildshard/plan-artifacts/grid-crossing', `${stamp}-${to}`)));
|
|
21
|
+
mkdirSync(out, { recursive: true });
|
|
22
|
+
const root = join(import.meta.dirname, '..');
|
|
23
|
+
/** @type {Record<string, unknown>[]} */
|
|
24
|
+
const rows = [];
|
|
25
|
+
for (const engine of flag('engines', 'chromium,webkit').split(',')) {
|
|
26
|
+
for (const layout of flag('layouts', 'desktop,phone').split(',')) {
|
|
27
|
+
const run = `${engine}-${layout}`, dir = join(out, run);
|
|
28
|
+
const args = [join(root, 'scripts/grid-crossing-walk-proof.mjs'), 'x', dir, 'x', `--base=${base}`, `--to=${to}`, `--engine=${engine}`, `--out=${dir}`,
|
|
29
|
+
...layout === 'phone' ? ['--layout=phone'] : []];
|
|
30
|
+
const done = spawnSync(join(root, 'scripts/browser-lane.sh'), ['--max', '20', process.execPath, ...args], { cwd: root, stdio: 'inherit' });
|
|
31
|
+
const file = join(dir, `${engine}-gc15c-walk.json`);
|
|
32
|
+
/** @type {any} */
|
|
33
|
+
const walk = existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : null;
|
|
34
|
+
rows.push({ run, engine, layout, base, to, pass: done.status === 0, playToReadyMs: walk?.playToReadyMs ?? null, memoryAtHome: walk?.memoryAtHome ?? null,
|
|
35
|
+
legs: (walk?.legs ?? []).map((/** @type {any} */ leg) => ({ name: leg.name, from: leg.from, target: leg.target, boost: leg.boost, borderToControlMs: leg.borderToControlMs, enteredAtMs: leg.enteredAtMs, controlAtMs: leg.controlAtMs,
|
|
36
|
+
worstStopMs: leg.worstStopMs, jumps: leg.jumps, over50: leg.over50, over100: leg.over100, worstFrameMs: leg.worstFrameMs, programLinks: leg.programLinks,
|
|
37
|
+
memory: leg.events?.find((/** @type {any} */ event) => event.control === true)?.memory ?? null })),
|
|
38
|
+
failed: (walk?.steps ?? []).filter((/** @type {any} */ step) => !step.ok).map((/** @type {any} */ step) => step.step) });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
writeFileSync(join(out, 'rows.json'), `${JSON.stringify(rows, null, 2)}\n`);
|
|
42
|
+
for (const row of rows) console.log(`${row.pass === true ? 'PASS' : 'FAIL'} ${String(row.run)} ${JSON.stringify(row.failed)}`);
|
|
43
|
+
console.log(`grid-crossing qa: ${out}/rows.json`);
|
|
44
|
+
process.exit(rows.every(row => row.pass === true) ? 0 : 1);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface PairNumbers { ok: boolean; borderToControlMs?: number | null; freezeMs?: number | null; wallMs?: number | null; over50?: number | null }
|
|
2
|
+
export type Ratchet = Record<string, PairNumbers>;
|
|
3
|
+
export declare const MEASURES: { readonly borderToControlMs: { slack: number; factor: number }; readonly freezeMs: { slack: number; factor: number }; readonly wallMs: { slack: number; factor: number }; readonly over50: { slack: number; factor: number } };
|
|
4
|
+
export declare function pairKey(site: string, run: string, from: string, to: string): string;
|
|
5
|
+
export declare function worse(ratchet: Ratchet, now: Record<string, PairNumbers>): { key: string; measure: string; held: unknown; now: unknown }[];
|
|
6
|
+
export declare function tighten(ratchet: Ratchet, now: Record<string, PairNumbers>): Ratchet;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// GRID-CROSSING GC3: the per-pair ratchet (`test/grid-crossing-ratchet.json`). Each crossing run (site, browser and layout, from
|
|
2
|
+
// cell to cell) keeps its best-known numbers; a later run may only match or beat them, within a noise allowance. Tightening only
|
|
3
|
+
// ever lowers a number (or turns a failed pair into a passing one), so the ratchet moves toward the goal table and never back.
|
|
4
|
+
|
|
5
|
+
/** The measures a pair is held to, and the noise a run may add before it counts as worse. */
|
|
6
|
+
export const MEASURES = /** @type {const} */ ({ borderToControlMs: { slack: 1500, factor: 1.5 }, freezeMs: { slack: 500, factor: 1.5 }, wallMs: { slack: 500, factor: 1.5 }, over50: { slack: 3, factor: 1.5 } });
|
|
7
|
+
|
|
8
|
+
/** @typedef {{ ok: boolean, borderToControlMs?: number | null, freezeMs?: number | null, wallMs?: number | null, over50?: number | null }} PairNumbers */
|
|
9
|
+
/** @typedef {Record<string, PairNumbers>} Ratchet */
|
|
10
|
+
|
|
11
|
+
/** The ratchet key of one crossing. @param {string} site @param {string} run @param {string} from @param {string} to */
|
|
12
|
+
export const pairKey = (site, run, from, to) => `${site}/${run}/${from}:${to}`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What got worse than the ratchet: a pair that passed now fails, or a measure past `max(held × factor, held + slack)`. A pair the
|
|
16
|
+
* ratchet doesn't hold, or a run that didn't try a held pair, is not worse (a partial run passes).
|
|
17
|
+
* @param {Ratchet} ratchet @param {Record<string, PairNumbers>} now @returns {{ key: string, measure: string, held: unknown, now: unknown }[]}
|
|
18
|
+
*/
|
|
19
|
+
export function worse(ratchet, now) {
|
|
20
|
+
/** @type {{ key: string, measure: string, held: unknown, now: unknown }[]} */
|
|
21
|
+
const found = [];
|
|
22
|
+
for (const [key, run] of Object.entries(now)) {
|
|
23
|
+
const held = ratchet[key];
|
|
24
|
+
if (held === undefined) continue;
|
|
25
|
+
if (held.ok && !run.ok) { found.push({ key, measure: 'ok', held: true, now: false }); continue; }
|
|
26
|
+
if (!run.ok) continue;
|
|
27
|
+
for (const [measure, { slack, factor }] of Object.entries(MEASURES)) {
|
|
28
|
+
const was = held[/** @type {keyof PairNumbers} */ (measure)], is = run[/** @type {keyof PairNumbers} */ (measure)];
|
|
29
|
+
if (typeof was !== 'number' || typeof is !== 'number') continue;
|
|
30
|
+
if (is > Math.max(was * factor, was + slack)) found.push({ key, measure, held: was, now: is });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return found;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The ratchet after a run: new pairs join, a pair that now passes is held to passing, and each measure only goes down. @param {Ratchet} ratchet @param {Record<string, PairNumbers>} now @returns {Ratchet} */
|
|
37
|
+
export function tighten(ratchet, now) {
|
|
38
|
+
/** @type {Ratchet} */
|
|
39
|
+
const next = { ...ratchet };
|
|
40
|
+
for (const [key, run] of Object.entries(now)) {
|
|
41
|
+
const held = next[key];
|
|
42
|
+
if (held === undefined || (!held.ok && run.ok)) { next[key] = { ...run }; continue; }
|
|
43
|
+
if (!run.ok) continue;
|
|
44
|
+
/** @type {PairNumbers} */ const kept = { ...held };
|
|
45
|
+
for (const measure of Object.keys(MEASURES)) {
|
|
46
|
+
const name = /** @type {'borderToControlMs' | 'freezeMs' | 'wallMs' | 'over50'} */ (measure), was = held[name], is = run[name];
|
|
47
|
+
if (typeof is === 'number' && (typeof was !== 'number' || is < was)) kept[name] = is;
|
|
48
|
+
}
|
|
49
|
+
next[key] = kept;
|
|
50
|
+
}
|
|
51
|
+
return Object.fromEntries(Object.entries(next).sort(([a], [b]) => a.localeCompare(b)));
|
|
52
|
+
}
|