@wildshard/engine 0.1.22 → 0.1.24
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 +15 -0
- package/index.html +17 -4
- package/lint/engine-sides.json +9 -0
- package/lint/sim-players.json +2 -13
- package/package.json +36 -3
- package/scripts/apfs-clone.mjs +5 -2
- package/scripts/app-build/catalogue.ts +39 -8
- package/scripts/app-build/serviceWorker.ts +4 -1
- package/scripts/app-build/splitOutput.mjs +33 -11
- package/scripts/app-build/titlePreloads.mjs +8 -5
- package/scripts/bake-road-surfaces.entry.ts +18 -0
- package/scripts/bake-road-surfaces.mjs +44 -0
- package/scripts/changelog.mjs +2 -1
- package/scripts/ci-pack.mjs +3 -3
- package/scripts/engine-ci-shard.mjs +11 -0
- package/scripts/fight-page-census.mjs +131 -0
- package/scripts/goldens/board.py +44 -11
- package/scripts/goldens/capture.mjs +18 -6
- package/scripts/goldens/native-residency.d.mts +2 -0
- package/scripts/goldens/native-residency.mjs +31 -4
- package/scripts/grid-road-lag.mjs +209 -0
- package/scripts/keep-copy.mjs +172 -0
- package/scripts/land.d.mts +4 -1
- package/scripts/land.mjs +121 -9
- package/scripts/lane-live.mjs +136 -0
- package/scripts/leftovers-report.mjs +47 -0
- package/scripts/loading-card-proof.mjs +42 -9
- package/scripts/loading-flow/benchmax.mjs +59 -7
- package/scripts/loading-flow/stalls.d.mts +2 -0
- package/scripts/loading-flow/stalls.mjs +13 -0
- package/scripts/map-hash.mjs +1 -1
- package/scripts/mmo-bots.mjs +5 -3
- package/scripts/mmo-grid-proof.mjs +74 -0
- package/scripts/mmo-seat-proof.mjs +43 -0
- package/scripts/nightly-heads.ts +13 -13
- package/scripts/nightly-model.ts +26 -12
- package/scripts/nightly-tag.mjs +2 -4
- package/scripts/nightly.proof.ts +18 -5
- package/scripts/nightly.ts +13 -8
- package/scripts/no-astc-boot.mjs +77 -0
- package/scripts/page-release/content.mjs +19 -10
- package/scripts/page-release/flow.d.mts +3 -2
- package/scripts/page-release/flow.mjs +31 -21
- package/scripts/page-release/packs.d.mts +5 -0
- package/scripts/page-release/packs.mjs +13 -3
- package/scripts/page-release/preview.d.mts +2 -0
- package/scripts/page-release/preview.mjs +74 -0
- package/scripts/page-release.mjs +13 -5
- package/scripts/physics-route.json +6 -6
- package/scripts/pins-reuse.mjs +1 -0
- package/scripts/pins-staging.ts +54 -0
- package/scripts/pins.ts +5 -0
- package/scripts/ring3.proof.ts +71 -0
- package/scripts/ring3.ts +100 -0
- package/scripts/road-drive-proof.mjs +269 -0
- package/scripts/road-memory-probe.mjs +129 -0
- package/scripts/scratch-dir.mjs +33 -14
- package/scripts/scratch-sweep.mjs +15 -23
- package/scripts/server-release/github.mjs +59 -26
- package/scripts/server-release/items.d.mts +7 -0
- package/scripts/server-release/items.mjs +28 -0
- package/scripts/server-release/publish.mjs +24 -2
- package/scripts/server-release/sign.mjs +8 -4
- package/scripts/side-parity.mjs +1 -1
- package/scripts/test-products.json +1 -0
- package/scripts/test_prebuilt_output.py +3 -1
- package/scripts/tsconfig.json +2 -0
- package/scripts/turn-in-shots.mjs +83 -0
- package/scripts/vitest-bench-observe-proof.py +168 -0
- package/scripts/vitest-bench.py +122 -77
- package/scripts/vitest-ci-files.ts +5 -1
- package/scripts/vps/rebuild.sh +3 -1
- package/scripts/vps/wildshard-config +106 -1
- package/scripts/warm-native-chrome.mjs +9 -3
- package/scripts/worker-client-fights.mjs +9 -3
- package/scripts/worktree-reap.mjs +36 -140
- package/scripts/worktree.mjs +92 -12
- package/scripts/zone-gate-proof.mjs +93 -0
- package/src/client/engine/audio/audioLog.ts +7 -2
- package/src/client/engine/boot/diagnostics.ts +69 -1
- package/src/client/engine/boot/sw.ts +3 -1
- package/src/client/engine/core/ktx2.ts +33 -10
- package/src/client/engine/core/ktx2Zstd.ts +2 -1
- package/src/client/engine/models/place.ts +7 -5
- package/src/client/engine/pwa/sw.js +83 -10
- package/src/client/engine/render/dataLook.ts +14 -7
- package/src/client/engine/render/lookLight.ts +64 -20
- package/src/client/engine/render/precompile.ts +6 -0
- package/src/client/engine/render/tiers.ts +9 -0
- package/src/client/engine/ui/Loading.ts +6 -8
- package/src/client/engine/ui/lookLightOption.ts +1 -1
- package/src/client/engine/ui/playerReload.ts +5 -5
- package/src/client/game/audio/cueDirector.ts +2 -1
- package/src/client/game/boot/bytes.generated.ts +4 -1
- package/src/client/game/boot/versions.generated.ts +8 -5
- package/src/client/game/boss/arenaRoom.ts +4 -3
- package/src/client/game/boss/roamingProjection.ts +1 -1
- package/src/client/game/devScene/hook.ts +1 -1
- package/src/client/game/devScene/liveLook.ts +1 -1
- package/src/client/game/grid/cellClip.ts +70 -6
- package/src/client/game/grid/dataCellKit.ts +9 -1
- package/src/client/game/grid/gateCard.css +9 -0
- package/src/client/game/grid/gateCard.ts +67 -0
- package/src/client/game/grid/live.ts +17 -3
- package/src/client/game/grid/liveSession.ts +15 -5
- package/src/client/game/grid/neighbourLife.ts +10 -1
- package/src/client/game/grid/neighbourPanels.ts +29 -2
- package/src/client/game/grid/pageEntry.ts +21 -0
- package/src/client/game/grid/products.ts +21 -7
- package/src/client/game/grid/regionalWorld.ts +5 -0
- package/src/client/game/grid/roadCompressedSurfaces.ts +69 -0
- package/src/client/game/grid/roadLook.ts +5 -73
- package/src/client/game/grid/roadLookPlatform.ts +11 -6
- package/src/client/game/grid/roadSurfaceMaps.ts +80 -0
- package/src/client/game/grid/roadTilePool.ts +4 -0
- package/src/client/game/grid/session.ts +58 -16
- package/src/client/game/grid/softWallLook.ts +6 -1
- package/src/client/game/plugin/ui.ts +3 -0
- package/src/client/game/population/signals.ts +1 -1
- package/src/client/game/quest/chapterDirector.ts +1 -0
- package/src/client/game/session/play.ts +3 -0
- package/src/client/game/shardfile/clientBossTelegraph.ts +4 -3
- package/src/client/game/shardfile/clientSource.ts +5 -2
- package/src/client/game/shardfile/clientWorker.ts +25 -8
- package/src/client/game/shardfile/look.ts +1 -1
- package/src/client/game/shardfile/runtimeProduct.ts +9 -5
- package/src/client/game/shardfile/slabLibrary.ts +37 -0
- package/src/client/game/shardfile/slabRanges.ts +145 -0
- package/src/client/game/shardfile/wirePage.ts +5 -2
- package/src/client/game/shardfile/worldSceneTextures.ts +15 -9
- package/src/client/host/online/shell.ts +2 -2
- package/src/client/host/standalone/shell.ts +4 -1
- package/src/cook/game/cookWorker.ts +8 -5
- package/src/cook/game/tierTextures.ts +5 -3
- package/src/server/engine/net/simWorld.ts +3 -4
- package/src/server/game/grid/cellHome.ts +58 -0
- package/src/server/game/grid/simulation.ts +32 -8
- package/src/server/game/plugin/mover.ts +18 -14
- package/src/server/game/plugin/simulation.ts +2 -0
- package/src/server/game/shardfile/dataRespawn.ts +47 -0
- package/src/server/game/shardfile/declaredKitItems.ts +31 -7
- package/src/server/host/bake/headlessWorker.ts +3 -3
- package/src/server/host/dedicated/cellWorker.ts +4 -2
- package/src/server/host/dedicated/main.ts +7 -4
- package/src/server/host/dedicated/packReader.ts +15 -2
- package/src/server/host/dedicated/playerStore.ts +1 -1
- package/src/server/host/headlessRuntime.ts +11 -6
- package/src/server/host/standalone/cellWorld.ts +20 -6
- package/src/server/host/standalone/gridServer.ts +20 -6
- package/src/server/host/standalone/roadWorld.ts +36 -0
- package/src/server/host/standalone/serverHost.ts +2 -2
- package/src/shared/engine/entities/AnimalSim.ts +10 -0
- package/src/shared/engine/physics/gridBorders.ts +15 -1
- package/src/shared/engine/physics/transferWalls.ts +9 -4
- package/src/shared/engine/sim/snapshot.ts +5 -5
- package/src/shared/game/grid/allocator.ts +8 -1
- package/src/shared/game/grid/gateCount.ts +27 -0
- package/src/shared/game/grid/zoneWalls.ts +64 -0
- package/src/shared/game/ledger.ts +13 -4
- package/src/shared/game/loot/platformCatalogue.ts +14 -0
- package/src/shared/game/quest/ledger.ts +3 -3
- package/src/shared/game/shardfile/items.ts +9 -1
- package/src/shared/game/strings.ts +2 -0
- package/src/shared/host/headlessJourney.ts +3 -3
- package/src/shared/host/headlessTape.ts +7 -6
- package/src/shared/host/releaseRows.ts +4 -1
- package/src/shared/host/standalone/harnessPlace.ts +4 -0
- package/src/test/engine/simState.ts +134 -0
- package/src/test/game/builtProduct.ts +6 -0
- package/src/test/game/headless/admittedProductCache.ts +61 -0
- package/src/test/game/headless/checkedReplayPipeline.ts +21 -0
- package/src/test/game/headless/nativeBounds.ts +27 -0
- package/src/test/game/headless/processUsage.ts +22 -0
- package/src/test/game/headless/productSession.ts +39 -0
- package/src/test/game/headless/ropeBodies.ts +60 -0
- package/src/test/game/headless/worker.ts +34 -0
- package/src/test/game/headlessNative.ts +114 -0
- package/src/test/game/headlessWorker.ts +43 -0
- package/src/test/tsconfig.game.json +3 -0
|
@@ -201,8 +201,29 @@ try {
|
|
|
201
201
|
Reflect.set(window,'__nativeCopy',original);
|
|
202
202
|
navigator.clipboard.writeText=text=>{
|
|
203
203
|
const raw=/** @type {import('../src/shared/engine/boot/timing').BootTiming} */(Reflect.get(window,'__bootTiming')).read();
|
|
204
|
-
const
|
|
205
|
-
|
|
204
|
+
const spans=raw.entries.filter(row=>row.end!==null&&row.end>row.start).sort((a,b)=>(b.end??0)-b.start-((a.end??0)-a.start)).slice(0,15);
|
|
205
|
+
const duration=(/** @type {Readonly<Record<string,unknown>>} */row)=>Number(row.duration??Number(row.responseEnd??0)-Number(row.startTime??0));
|
|
206
|
+
const resources=[...raw.resources].sort((a,b)=>duration(b)-duration(a)).slice(0,10);
|
|
207
|
+
const network=raw.resources.filter(row=>Number(row.transferSize)>0),cache=raw.resources.filter(row=>row.transferSize===0&&Number(row.encodedBodySize)>0);
|
|
208
|
+
const end=Math.max(0,...raw.entries.filter(row=>row.realm==='page').map(row=>row.end??row.start));
|
|
209
|
+
const edges=[{at:0,change:0},{at:end,change:0}];
|
|
210
|
+
const cover=(/** @type {unknown} */start,/** @type {unknown} */finish)=>{
|
|
211
|
+
if(typeof start!=='number'||typeof finish!=='number'||!Number.isFinite(start)||!Number.isFinite(finish))return;
|
|
212
|
+
const left=Math.max(0,start),right=Math.min(end,finish);
|
|
213
|
+
if(right>left)edges.push({at:left,change:1},{at:right,change:-1});
|
|
214
|
+
};
|
|
215
|
+
for(const row of raw.resources)cover(row.pageStart??(row.realm==='page'?row.startTime:undefined),row.pageEnd??(row.realm==='page'?row.responseEnd:undefined));
|
|
216
|
+
if(raw.navigation!==undefined)cover(raw.navigation.startTime??0,raw.navigation.responseEnd);
|
|
217
|
+
const gaps=/** @type {Array<[number,number]>} */([]);
|
|
218
|
+
let active=0,previous=0;
|
|
219
|
+
for(const edge of edges.sort((a,b)=>a.at-b.at)){
|
|
220
|
+
if(active===0&&edge.at-previous>500)gaps.push([previous/1000,(edge.at-previous)/1000]);
|
|
221
|
+
active+=edge.change;previous=edge.at;
|
|
222
|
+
}
|
|
223
|
+
const expected={entries:raw.entries.length,resources:raw.resources.length,
|
|
224
|
+
spans:spans.map(row=>`[${row.realm}] ${(row.start/1000).toFixed(2)} + ${(((row.end??0)-row.start)/1000).toFixed(2)}`),
|
|
225
|
+
slow:resources.map(row=>`${Number(row.transferSize)>0?row.transferSize:row.encodedBodySize??0} B ${(duration(row)/1000).toFixed(2)} s ${Number(row.transferSize)>0?'network':row.transferSize===0&&Number(row.encodedBodySize)>0?'cache':'unknown'}`),
|
|
226
|
+
gaps,totals:`network ${network.length} / ${network.reduce((sum,row)=>sum+Number(row.transferSize),0)} B; cache ${cache.length} / ${cache.reduce((sum,row)=>sum+Number(row.encodedBodySize),0)} B`};
|
|
206
227
|
const receipt={text,expected,settled:false,success:false};Reflect.set(window,'__copyReceipt',receipt);
|
|
207
228
|
return original(text).then(()=>{receipt.settled=true;receipt.success=true;return undefined;},(/** @type {unknown} */error)=>{receipt.settled=true;throw error;});
|
|
208
229
|
};
|
|
@@ -215,13 +236,25 @@ try {
|
|
|
215
236
|
const native=await navigator.clipboard.readText();
|
|
216
237
|
if(native!==receipt.text)return {ok:false,reason:'native readback differs'};
|
|
217
238
|
const marker='timeline (LS1):\n',at=native.indexOf(marker);
|
|
218
|
-
if(at===-1)return {ok:false,reason:'no
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
reason:
|
|
239
|
+
if(at===-1)return {ok:false,reason:'no timeline digest'};
|
|
240
|
+
const expected=receipt.expected,bytes=new TextEncoder().encode(native).byteLength;
|
|
241
|
+
const gapText=native.split('\n').find(line=>line.startsWith('request-free gaps >0.5 s'))?.split(': ')[1];
|
|
242
|
+
const gaps=/** @type {Array<[number,number]>} */([]);
|
|
243
|
+
for(const item of gapText===undefined||gapText==='none'?[]:gapText.split(', ')){
|
|
244
|
+
const match=/^(\d+(?:\.\d+)?)\+(\d+(?:\.\d+)?)(?: every (\d+(?:\.\d+)?) x(\d+))?$/u.exec(item);
|
|
245
|
+
if(match===null)return {ok:false,reason:'unreadable gap interval'};
|
|
246
|
+
for(let index=0;index<Number(match[4]??1);index++)gaps.push([Number(match[1])+index*Number(match[3]??0),Number(match[2])]);
|
|
247
|
+
}
|
|
248
|
+
const gapsMatch=gaps.length===expected.gaps.length&&gaps.every(([start,ms],index)=>{
|
|
249
|
+
const held=expected.gaps[index];return held!==undefined&&start.toFixed(3)===held[0].toFixed(3)&&ms.toFixed(3)===held[1].toFixed(3);
|
|
250
|
+
});
|
|
251
|
+
const complete=native.includes(`counts: ${expected.entries} spans (`)&&native.includes(`${expected.resources} resources;`)
|
|
252
|
+
&&native.includes('longest spans (start s + duration s):')&&native.includes('slowest resources (bytes, duration s, source):')
|
|
253
|
+
&&native.includes('request-free gaps >0.5 s')&&!native.includes('"entries":')
|
|
254
|
+
&&expected.spans.every((/** @type {string} */fact)=>native.includes(fact))
|
|
255
|
+
&&expected.slow.every((/** @type {string} */fact)=>native.includes(fact))&&native.includes(expected.totals)&&gapsMatch;
|
|
256
|
+
return {ok:complete&&bytes<6000&&document.querySelector('.ws-load-copy')?.textContent==='Copied',
|
|
257
|
+
reason:complete?`compact safe report: ${bytes} bytes, ${expected.entries} spans, ${expected.resources} resources`:'missing compact timeline facts'};
|
|
225
258
|
});
|
|
226
259
|
if(!copied.ok)faults.push(`copy diagnostics: ${copied.reason}`);
|
|
227
260
|
console.log(`${tag}: native copy ${copied.ok?'ok':'FAILED'} · ${copied.reason}`);
|
|
@@ -13,16 +13,18 @@
|
|
|
13
13
|
// --window 1496x717@2: a desktop window (Jake's Mac, 2992x1434 device pixels) on the desktop tier instead of the phone (NB5).
|
|
14
14
|
// --dpr: the render scale the game draws at (Graphics' saved pick; the viewport stays a 2x phone); NB5 reads 1 and 2.
|
|
15
15
|
// --seconds 600: NINE-DRAGON-BENCHMAX NB5's sustained run, printed per minute.
|
|
16
|
+
// --warm-base <url>: revisit on the same origin with another build, retaining the native caches.
|
|
17
|
+
// --assert-home-spans: NB13 refuses an unnamed home interval longer than one second.
|
|
16
18
|
import { writeFileSync } from 'node:fs';
|
|
17
19
|
import { parseArgs } from 'node:util';
|
|
18
20
|
import { chromium, devices } from 'playwright';
|
|
19
21
|
import { KEYCHAIN_ARGS } from '../chromium-keychain.mjs';
|
|
20
22
|
import { NAME_ASKED, developerSettings, saveFixture, levelDownloadFixtures, hideDeveloperOverlays } from '../debug-settings.mjs';
|
|
21
|
-
import { bootTimelineEntries, clockMarkExpression, profileAnchor, profileIdle, stageStalls, STALL_IDLE_SHARE, STALL_WINDOW_MS } from './stalls.mjs';
|
|
23
|
+
import { bootTimelineEntries, clockMarkExpression, profileAnchor, profileIdle, stageStalls, stageGaps, STALL_IDLE_SHARE, STALL_WINDOW_MS } from './stalls.mjs';
|
|
22
24
|
|
|
23
25
|
const { values } = parseArgs({ options: { base: { type: 'string' }, shard: { type: 'string', default: 'Nine' }, throttle: { type: 'string', default: '4' },
|
|
24
26
|
seconds: { type: 'string', default: '60' }, json: { type: 'string' }, profile: { type: 'string' },
|
|
25
|
-
dpr: { type: 'string', default: '2' }, window: { type: 'string' } } });
|
|
27
|
+
dpr: { type: 'string', default: '2' }, window: { type: 'string' }, 'warm-base': {type: 'string'}, 'assert-home-spans': {type: 'boolean', default: false} } });
|
|
26
28
|
if (values.base === undefined) { console.error('usage: benchmax.mjs --base <url> [--shard <card title regex>] [--throttle 4] [--seconds 60] [--dpr 2] [--json <file>] [--profile <file>]'); process.exit(2); }
|
|
27
29
|
// --window <css W>x<css H>@<scale>: a desktop browser window instead of the phone (NB5, Jake's Mac: 1496x717@2 is 2992x1434), desktop tier
|
|
28
30
|
const desktop = /^(\d+)x(\d+)@([\d.]+)$/u.exec(values.window ?? '');
|
|
@@ -37,6 +39,8 @@ try {
|
|
|
37
39
|
: await browser.newContext({ viewport: { width: Number(desktop[1]), height: Number(desktop[2]) }, deviceScaleFactor: Number(desktop[3]) });
|
|
38
40
|
await developerSettings(context, { tier: desktop === null ? 'phone' : 'desktop', volume: 0 });
|
|
39
41
|
await saveFixture(context, { scope: 'global', key: 'gfx', data: { dpr: values.dpr ?? '2', aa: 'auto' } });
|
|
42
|
+
// MOBILE-GRAPHICS MG8: the phone's pixel density is Settings ▸ Graphics' device knob now; the old `gfx` pick alone left --dpr 1 drawing at 2
|
|
43
|
+
await saveFixture(context, { scope: 'device', key: 'gfx.knob.density', data: Number(values.dpr ?? '2') });
|
|
40
44
|
for (const fixture of levelDownloadFixtures('packs')) await saveFixture(context, fixture);
|
|
41
45
|
// a phone's first PLAY goes straight to Driftwood's first-play card (MOBILE-GRAPHICS MG5): this device has done it
|
|
42
46
|
await saveFixture(context, { scope: 'device', key: 'firstPlayDone', data: true });
|
|
@@ -52,8 +56,24 @@ try {
|
|
|
52
56
|
/** @param {string} selector */
|
|
53
57
|
const tap = selector => page.evaluate(`document.querySelector(${JSON.stringify(selector)})?.click()`);
|
|
54
58
|
|
|
59
|
+
const visits = values['warm-base'] === undefined ? [base] : [base, values['warm-base']];
|
|
60
|
+
for (const [visit, visitBase] of visits.entries()) {
|
|
61
|
+
if (visit > 0) {
|
|
62
|
+
// Adopt the next build's document while keeping Cache Storage and disk state.
|
|
63
|
+
await page.evaluate(async () => { for (const registration of await navigator.serviceWorker.getRegistrations()) await registration.unregister(); });
|
|
64
|
+
await page.goto('about:blank');
|
|
65
|
+
}
|
|
66
|
+
await cdp.send('Network.enable');
|
|
67
|
+
/** @type {{url: string, fromServiceWorker: boolean, fromDiskCache: boolean}[]} */
|
|
68
|
+
const transfers = [];
|
|
69
|
+
/** @param {import('playwright').Request} request */
|
|
70
|
+
const workerRequest = request => { if (request.serviceWorker() !== null) transfers.push({url: request.url(), fromServiceWorker: false, fromDiskCache: false}); };
|
|
71
|
+
context.on('request', workerRequest);
|
|
72
|
+
/** @param {{type: string, response: {url: string, fromServiceWorker?: boolean, fromDiskCache?: boolean}}} event */
|
|
73
|
+
const resource = event => { if (event.type !== 'Preflight') transfers.push({url: event.response.url, fromServiceWorker: event.response.fromServiceWorker === true, fromDiskCache: event.response.fromDiskCache === true}); };
|
|
74
|
+
cdp.on('Network.responseReceived', resource);
|
|
55
75
|
// the title, as Jake enters a shard: SHARD SELECT, the card, ENTER WORLD (scripts/loading-flow/drive.mjs's route)
|
|
56
|
-
await page.goto(`${base}/`);
|
|
76
|
+
await page.goto(visitBase === base ? `${base}/` : visitBase);
|
|
57
77
|
if (!await until(`!!document.querySelector('.ws-main-select')?.getClientRects().length`, 120_000)) throw new Error('title never ready');
|
|
58
78
|
await sleep(1500);
|
|
59
79
|
await tap('.ws-main-select');
|
|
@@ -62,6 +82,8 @@ try {
|
|
|
62
82
|
const titles = await page.evaluate(`[...document.querySelectorAll('.ws-menu-card')].map(c => (c.querySelector('b')?.textContent ?? c.textContent ?? '').trim().slice(0, 40))`);
|
|
63
83
|
const target = titles.findIndex((/** @type {string} */ title) => shard.test(title));
|
|
64
84
|
if (target === -1) throw new Error(`no card matches ${shard} in ${JSON.stringify(titles)}`);
|
|
85
|
+
// Only the requested shard: opening the deck may prefetch the default card.
|
|
86
|
+
transfers.length = 0;
|
|
65
87
|
await tap(`.ws-menu-dots i[data-i="${target}"]`);
|
|
66
88
|
if (!await until(`document.querySelector('.ws-menu-card.selected')?.dataset.i === '${target}' && !document.querySelector('.ws-menu-play')?.disabled`, 15_000)) throw new Error(`${titles[target]} never selectable`);
|
|
67
89
|
await sleep(800);
|
|
@@ -99,7 +121,7 @@ try {
|
|
|
99
121
|
if (ready.start + ready.ms - at >= 100) gaps.push({ from: at - ready.start, ms: ready.start + ready.ms - at });
|
|
100
122
|
}
|
|
101
123
|
const control = entries.find(e => e.operation === 'app:control-ready')?.start ?? Number.NaN, first = Math.min(...stage.map(e => e.start));
|
|
102
|
-
const timeline = entries.map(e => ({ op: e.operation, realm: e.realm, start: Math.round(e.start), ms: e.end === null ? null : Math.round(e.end - e.start), result: e.result }));
|
|
124
|
+
const timeline = entries.map(e => ({ op: e.operation, realm: e.realm, start: Math.round(e.start), ms: e.end === null ? null : Math.round(e.end - e.start), result: e.result, detail: e.detail }));
|
|
103
125
|
// NB3: readyFrame's named parts of 100 ms or more (spans and waits), in start order
|
|
104
126
|
const readyParts = ready === undefined ? [] : done.filter(e => !e.op.startsWith('stage:') && !e.op.startsWith('game-stage:') && e.ms >= 100
|
|
105
127
|
&& e.start >= ready.start && e.start < ready.start + ready.ms).map(e => ({ op: e.op, from: e.start - ready.start, ms: e.ms }));
|
|
@@ -118,7 +140,8 @@ try {
|
|
|
118
140
|
.map(e => ({ n: n.split('.').pop(), start: Math.round(e.startTime), ms: Math.round(e.duration), key: e.detail?.key, layer: e.detail?.layer })));
|
|
119
141
|
const tileAttach = { raw, warm, tiles: attaches.length, span: attachSpan, contents: [...byContent.values()].sort((a, b) => b.ms - a.ms),
|
|
120
142
|
slowest: [...attaches].sort((a, b) => b.duration - a.duration).slice(0, 5).map(a => ({ key: a.detail?.key, layer: a.detail?.layer, ms: Math.round(a.duration), contents: a.detail?.contents })) };
|
|
121
|
-
|
|
143
|
+
const resources = performance.getEntriesByType('resource').map(r => ({url: r.name, start: r.startTime, transfer: r.transferSize, bytes: r.decodedBodySize}));
|
|
144
|
+
return { resources, workerResources: timing?.resources?.filter(r => r.realm !== 'page') ?? [], phases: { control, firstStage: first }, stage, waits, readyGaps: gaps, readyParts, scriptMemory, tileAttach, timeline };
|
|
122
145
|
})()`);
|
|
123
146
|
|
|
124
147
|
// the play: walk 10 s, then the hoverboard at boost; the game's own frame ring, read every 250 ms
|
|
@@ -182,7 +205,7 @@ try {
|
|
|
182
205
|
const s = ms => `${(ms / 1000).toFixed(1)} s`;
|
|
183
206
|
/** @param {number} n */
|
|
184
207
|
const f = n => n.toFixed(1);
|
|
185
|
-
console.log(`benchmax: ${titles[target]} at ${
|
|
208
|
+
console.log(`benchmax: ${titles[target]} at ${visitBase}, Chromium headless, CPU x${throttle}, ${desktop === null ? '402x874 @2 (phone)' : `${desktop[1]}x${desktop[2]} @${desktop[3]} (desktop)`}, packs, ${visit === 0 ? 'cold' : 'warm next build'}`);
|
|
186
209
|
console.log(`control ${s(load.phases.control)} after the world page's navigation · its first boot stage at ${s(load.phases.firstStage)}`);
|
|
187
210
|
console.log('stages, longest first:'); for (const e of load.stage.slice(0, 10)) console.log(` ${e.op.slice(6).padEnd(16)} ${s(e.ms)}`);
|
|
188
211
|
console.log('named waits >= 200 ms:'); for (const e of load.waits.slice(0, 10)) console.log(` ${e.op.slice(5, 90).padEnd(60)} ${s(e.ms)}`);
|
|
@@ -193,6 +216,28 @@ try {
|
|
|
193
216
|
console.log(` geometry warms: prepare ${ta.warm.prepare.n} · ${s(ta.warm.prepare.ms)} · parked draws ${ta.warm.draws.n} · ${s(ta.warm.draws.ms)}`);
|
|
194
217
|
for (const row of ta.slowest.slice(0, 2)) console.log(` slowest tile ${row.key} ${row.layer} ${s(row.ms)}: ${Object.entries(row.contents ?? {}).sort((a, b) => b[1] - a[1]).slice(0, 4).map(([id, ms]) => `${id.slice(0, 28)} ${ms} ms`).join(', ')}`);
|
|
195
218
|
const bank = (/** @type {{ hits: number, misses: number, retained: number } | null} */ m) => m === null ? 'n/a' : `hits ${m.hits} · misses ${m.misses} · retained ${m.retained}`;
|
|
219
|
+
const home = /** @type {{op: string, start: number, ms: number}[]} */ (load.stage).find(row => row.op === 'stage:home');
|
|
220
|
+
/** @type {{op: string, realm: string, start: number, ms: number | null}[]} */
|
|
221
|
+
const timeline = load.timeline;
|
|
222
|
+
const homeGaps = stageGaps(timeline.map(row => ({operation: row.op, realm: row.realm, start: row.start, end: row.ms === null ? null : row.start + row.ms})), 'home');
|
|
223
|
+
load.homeGaps = homeGaps;
|
|
224
|
+
/** @type {Map<string, {url: string, read: number, decode: number}>} */
|
|
225
|
+
const homeTextures = new Map();
|
|
226
|
+
for (const part of timeline) {
|
|
227
|
+
if (home === undefined || part.start >= home.start + home.ms || part.start + (part.ms ?? 0) <= home.start) continue;
|
|
228
|
+
const match = /^texture:(read|decode) (.+)$/u.exec(part.op), url = match?.[2];
|
|
229
|
+
if (url === undefined) continue;
|
|
230
|
+
const record = homeTextures.get(url) ?? {url, read: 0, decode: 0};
|
|
231
|
+
if (match?.[1] === 'read') record.read += part.ms ?? 0; else record.decode += part.ms ?? 0;
|
|
232
|
+
homeTextures.set(url, record);
|
|
233
|
+
}
|
|
234
|
+
load.homeTextures = [...homeTextures.values()];
|
|
235
|
+
console.log(`home texture files (${homeTextures.size}), read / decode:`);
|
|
236
|
+
for (const file of homeTextures.values()) console.log(` ${file.url} · ${s(file.read)} / ${s(file.decode)}`);
|
|
237
|
+
console.log('home operations >= 100 ms:');
|
|
238
|
+
for (const part of timeline.filter(row => home !== undefined && (row.ms ?? 0) >= 100 && row.start >= home.start && row.start < home.start + home.ms && !/^(?:stage:|game-stage:|app:|sw:)/u.test(row.op)).sort((a, b) => (b.ms ?? 0) - (a.ms ?? 0)).slice(0, 16)) console.log(` ${part.op} · ${s(part.ms ?? 0)}`);
|
|
239
|
+
console.log(`home unlogged >= 100 ms: ${homeGaps.filter(row => row.end - row.start >= 100).map(row => `${s(row.end - row.start)} at +${s(row.start - (home?.start ?? 0))}`).join(', ') || 'none'}`);
|
|
240
|
+
if (values['assert-home-spans'] && (home === undefined || homeGaps.some(row => row.end - row.start > 1000))) { console.error('NB13: home has an unnamed stretch over 1 s (or no completed home stage)'); process.exitCode = 1; }
|
|
196
241
|
console.log(`script memory bank: at control ${bank(load.scriptMemory)} · after play ${bank(play.scriptMemory)}`);
|
|
197
242
|
console.log(`readyFrame unlogged >= 100 ms: ${load.readyGaps.length === 0 ? 'none' : load.readyGaps.map((/** @type {{ ms: number, from: number }} */ g) => `${s(g.ms)} at +${s(g.from)}`).join(', ')}`);
|
|
198
243
|
console.log(`play ${seconds} s: ${f(play.all.fps)} fps · frame p50 ${f(play.all.p50)} / p95 ${f(play.all.p95)} ms · gpu~ p50 ${f(play.all.gpu50)} / p95 ${f(play.all.gpu95)} ms · ${play.draws} draws · ${(play.triangles / 1e6).toFixed(2)} M tris · pixel ratio ${play.pixelRatio}`);
|
|
@@ -200,5 +245,12 @@ try {
|
|
|
200
245
|
console.log(`shadow pass: ${shadow.draws} of ${shadow.allDraws} draws · ${(shadow.triangles / 1e6).toFixed(2)} of ${(shadow.allTriangles / 1e6).toFixed(2)} M tris`);
|
|
201
246
|
play.minutes.forEach((/** @type {{ fps: number, p95: number, gpu95: number, draws95: number, tris95: number }} */ m, /** @type {number} */ i) => { console.log(` minute ${String(i + 1).padStart(2)}: ${f(m.fps)} fps · p95 ${f(m.p95)} ms · gpu~ p95 ${f(m.gpu95)} ms · draws p95 ${m.draws95} · tris p95 ${(m.tris95 / 1e6).toFixed(2)} M`); });
|
|
202
247
|
if (seconds <= 120) play.tens.forEach((/** @type {{ fps: number, p95: number, gpu95: number }} */ t, /** @type {number} */ i) => { console.log(` ${String(i * 10).padStart(3)}-${String(i * 10 + 10).padEnd(3)} s: ${f(t.fps)} fps · p95 ${f(t.p95)} ms · gpu~ p95 ${f(t.gpu95)} ms`); });
|
|
203
|
-
|
|
248
|
+
cdp.off('Network.responseReceived', resource);
|
|
249
|
+
context.off('request', workerRequest);
|
|
250
|
+
const resources = await page.evaluate(() => performance.getEntriesByType('resource').map(r => ({url: r.name, start: r.startTime, bytes: /** @type {PerformanceResourceTiming} */ (r).decodedBodySize})));
|
|
251
|
+
const network = transfers.filter(row => !row.fromServiceWorker && !row.fromDiskCache);
|
|
252
|
+
const cacheCheck = {spawnParts: network.filter(row => /\/assets\/spawn\/parts\/.*\.pack\.br/u.test(row.url)).length, paint: network.filter(row => /\/assets\/nine-dragon\/paint\/.*\.phone\.webp/u.test(row.url)).length};
|
|
253
|
+
console.log(`network: ${cacheCheck.spawnParts} spawn parts, ${cacheCheck.paint} phone paint files`);
|
|
254
|
+
if (values.json !== undefined) writeFileSync(visit === 0 ? values.json : values.json.replace(/(\.json)?$/u, '-warm.json'), `${JSON.stringify({ shard: titles[target], base: visitBase, throttle, dpr: values.dpr, load, play, shadow, where, cacheCheck, transfers, resources }, null, 1)}\n`);
|
|
255
|
+
}
|
|
204
256
|
} finally { await browser.close(); }
|
|
@@ -25,6 +25,8 @@ export function idleWithin(spans: readonly Span[], holes: readonly Span[], from:
|
|
|
25
25
|
export function busiestWindow(spans: readonly Span[], width: number): { at: number; ms: number };
|
|
26
26
|
/** Each listed stage's worst window of idle main thread with no page `wait:` entry open. */
|
|
27
27
|
export function stageStalls(entries: readonly StallEntry[], idle: readonly Span[], stages?: readonly string[]): StageStall[];
|
|
28
|
+
/** Uncovered wall-clock intervals inside a completed stage, ignoring broad parent envelopes. */
|
|
29
|
+
export function stageGaps(entries: readonly StallEntry[], stage: string): Span[];
|
|
28
30
|
/** Stage stalls at or over the share, as fault lines. */
|
|
29
31
|
export function stallFaults(entries: readonly StallEntry[], idle: readonly Span[]): string[];
|
|
30
32
|
/** Where the profile's clock meets the page's, from the clock mark's first sample. */
|
|
@@ -73,6 +73,19 @@ export function stageStalls(entries, idle, stages = STALL_STAGES) {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/** Wall-clock gaps between named operations inside one completed stage.
|
|
77
|
+
* Stage/app envelopes cannot explain their own contents; parallel operations
|
|
78
|
+
* cover their union, clipped to the stage. This reports CPU work as well as IO.
|
|
79
|
+
* @param {readonly StallEntry[]} entries @param {string} stage @returns {Span[]} */
|
|
80
|
+
export function stageGaps(entries, stage) {
|
|
81
|
+
const own = entries.find(row => row.realm === 'page' && row.operation === `stage:${stage}` && row.end !== null);
|
|
82
|
+
if (own === undefined || own.end === null) return [];
|
|
83
|
+
const named = entries.filter(row => row.realm === 'page' && row.end !== null
|
|
84
|
+
&& !/^(?:stage:|game-stage:|app:|sw:)/u.test(row.operation))
|
|
85
|
+
.map(row => ({start: row.start, end: row.end ?? row.start}));
|
|
86
|
+
return idleWithin([{start: own.start, end: own.end}], named, own.start, own.end);
|
|
87
|
+
}
|
|
88
|
+
|
|
76
89
|
/** Stage stalls as fault lines: a window whose unexplained idle reaches STALL_IDLE_SHARE of it.
|
|
77
90
|
* @param {readonly StallEntry[]} entries @param {readonly Span[]} idle @returns {string[]} */
|
|
78
91
|
export function stallFaults(entries, idle) {
|
package/scripts/map-hash.mjs
CHANGED
|
@@ -10,12 +10,12 @@ import { shardSourceDir, shardSourceFolders } from './shard-outputs.mjs';
|
|
|
10
10
|
|
|
11
11
|
// Sharp resolves from this file: engine's own devDependency here, the consumer's through the optional
|
|
12
12
|
// `sharp` peer when a shard repo or sharddev runs this script from its install of engine.
|
|
13
|
-
const sharp = createRequire(import.meta.url)('sharp');
|
|
14
13
|
|
|
15
14
|
/** Hash decoded sRGB RGBA8 pixels and their dimensions, independent of image encoding and metadata.
|
|
16
15
|
* This binds a stamp to its raster; world freshness still requires the official map bake.
|
|
17
16
|
* @param {string} image @returns {Promise<string>} */
|
|
18
17
|
export async function mapPixelHash(image) {
|
|
18
|
+
const sharp = createRequire(import.meta.url)('sharp');
|
|
19
19
|
// Decode these exact bytes: libvips' filename cache can retain a previous
|
|
20
20
|
// raster when an official bake replaces the same path within one clock tick.
|
|
21
21
|
const { data, info } = await sharp(readFileSync(image), { limitInputPixels: 4096 * 4096, animated: false, failOn: 'warning' })
|
package/scripts/mmo-bots.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// MMO-PLAN MP0.4: real-socket bots from this Mac (J202), against an isolated production-shaped replica or the staging socket.
|
|
3
3
|
// Never production (J205): there is no flag for it, and the bots refuse any socket but loopback and staging.
|
|
4
4
|
// node scripts/mmo-bots.mjs replica [--bots 32] [--seconds 120] [--seats 32] [--workers 4] [--cells driftwood-isle] [--database <url>]
|
|
5
|
+
// node scripts/mmo-bots.mjs replica --spread --cells driftwood-isle,nalati-grasslands (MP1.7: local cell distribution)
|
|
5
6
|
// node scripts/mmo-bots.mjs replica --remote wildshard [--cpus 9-13] ... (MP1.2: the replica on the box's cores, bots on this Mac)
|
|
6
7
|
// node scripts/mmo-bots.mjs replica [--remote wildshard] --server-from <main commit> ... (MP1.2: that commit's server code)
|
|
7
8
|
// node scripts/mmo-bots.mjs replica --remote wildshard-agent --bots-on-host [--bot-cpus 14-15] ... (MP1.2: bots on the box too)
|
|
@@ -49,7 +50,8 @@ const { values } = parseArgs({ args: rest, options: { bots: { type: 'string' },
|
|
|
49
50
|
cells: { type: 'string', default: 'driftwood-isle' }, database: { type: 'string', default: 'memory:' }, keep: { type: 'boolean', default: false },
|
|
50
51
|
remote: { type: 'string' }, cpus: { type: 'string', default: '9-13' }, 'server-from': { type: 'string' },
|
|
51
52
|
'bots-on-host': { type: 'boolean', default: false }, 'bot-cpus': { type: 'string', default: '14-15' }, tailnet: { type: 'boolean', default: false },
|
|
52
|
-
'work-dir': { type: 'string' } } });
|
|
53
|
+
'work-dir': { type: 'string' }, spread: { type: 'boolean', default: false } } });
|
|
54
|
+
if (values.spread && (mode !== 'replica' || values.remote !== undefined)) throw new Error('--spread is for a local replica');
|
|
53
55
|
const serverFrom = values['server-from'];
|
|
54
56
|
if (serverFrom !== undefined && (mode !== 'replica' || !/^[0-9a-f]{40}$/u.test(serverFrom))) throw new Error('--server-from is a full commit, for a replica');
|
|
55
57
|
// These reach the host's shell inside the replica's env line: only slugs and whole numbers.
|
|
@@ -227,7 +229,7 @@ if (botsOnHost && hostSsh !== null) {
|
|
|
227
229
|
const code = await new Promise(resolve => {
|
|
228
230
|
const child = botsOnHost && remote !== undefined
|
|
229
231
|
? spawn('ssh', ['-o', 'BatchMode=yes', ...ALIVE, remote, `cd ${away}/bots && exec taskset -c ${values['bot-cpus']} node "$HOME/${away}/bots/mmoBots.mjs" ${botArgs.join(' ')} "$HOME/${away}/bots.json" forwarded`], { stdio: ['ignore', 'pipe', 'inherit'] })
|
|
230
|
-
: spawn(process.execPath, [join(out, 'mmoBots.mjs'), ...botArgs, result, mode === 'replica' ? 'forwarded' : 'own'], { stdio: ['ignore', 'pipe', 'inherit'] });
|
|
232
|
+
: spawn(process.execPath, [join(out, 'mmoBots.mjs'), ...botArgs, result, mode === 'replica' ? 'forwarded' : 'own', values.spread ? values.cells : ''], { stdio: ['ignore', 'pipe', 'inherit'] });
|
|
231
233
|
botsChild = child;
|
|
232
234
|
child.stdout.on('data', (/** @type {Buffer} */ chunk) => { process.stdout.write(chunk); writeFileSync(join(work, 'bots.log'), chunk, { flag: 'a' }); });
|
|
233
235
|
child.on('exit', resolve);
|
|
@@ -235,7 +237,7 @@ const code = await new Promise(resolve => {
|
|
|
235
237
|
if (botsOnHost && hostSsh !== null) writeFileSync(result, hostSsh(`cat ${away}/bots.json`));
|
|
236
238
|
const after = mode === 'staging' ? await health() : null;
|
|
237
239
|
await stopRoom();
|
|
238
|
-
const full = readings.slice(playing).filter(row => row.players === bots);
|
|
240
|
+
const full = readings.slice(playing).filter(row => values.spread ? row.players > 0 : row.players === bots);
|
|
239
241
|
const report = { ...JSON.parse(readFileSync(result, 'utf8')), mode, exit: code, ...(serverFrom === undefined ? {} : { serverFrom }), ...(remote === undefined ? {} : { remote, cpus: values.cpus }),
|
|
240
242
|
...(botsOnHost ? { botsOnHost, botCpus: values['bot-cpus'] } : {}),
|
|
241
243
|
...(mode === 'staging' ? { stagingAfter: after } : {}),
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// oxlint-disable promise/prefer-await-to-callbacks -- Browser events, audio sources and the frame cap require browser callbacks.
|
|
2
|
+
// Manual MMO-PLAN GO8 proof: staging only, 30 fps, no physical phone.
|
|
3
|
+
// node scripts/mmo-grid-proof.mjs chromium|webkit tmp/<lane>/grid
|
|
4
|
+
import assert from 'node:assert/strict';
|
|
5
|
+
import {mkdirSync,writeFileSync} from 'node:fs';
|
|
6
|
+
import {join} from 'node:path';
|
|
7
|
+
import {chromium,webkit} from 'playwright';
|
|
8
|
+
import {KEYCHAIN_ARGS} from './chromium-keychain.mjs';
|
|
9
|
+
import {saveFixture} from './debug-settings.mjs';
|
|
10
|
+
import {guardStagingSockets,playerNameSource} from './staging-proof-lines.mjs';
|
|
11
|
+
import {FLOOR_GRID_ENTER} from './frame-floor-navigation.mjs';
|
|
12
|
+
|
|
13
|
+
/** Synthetic PCM only: headless proofs never open a real microphone. */
|
|
14
|
+
function proofMicrophone(){
|
|
15
|
+
if(!navigator.mediaDevices)return;
|
|
16
|
+
navigator.mediaDevices.getUserMedia=()=>{
|
|
17
|
+
const audio=new AudioContext(),osc=audio.createOscillator(),gain=audio.createGain(),dest=audio.createMediaStreamDestination();
|
|
18
|
+
Reflect.set(window,'__mmoAudio',{audio,osc,gain,dest});
|
|
19
|
+
osc.connect(gain);gain.connect(dest);osc.start();gain.gain.value=.6;
|
|
20
|
+
setInterval(()=>{gain.gain.value=gain.gain.value>0?0:.6;},600);
|
|
21
|
+
return audio.resume().then(()=>dest.stream);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const engine=process.argv[2],out=process.argv[3];
|
|
26
|
+
assert.ok(engine==='chromium'||engine==='webkit');assert.ok(out?.startsWith('tmp/'));mkdirSync(out,{recursive:true});
|
|
27
|
+
const signed=await(await fetch('https://packs.wildshard.io/releases/staging.json')).json(),release=JSON.parse(signed.body);
|
|
28
|
+
assert.equal(release.channel,'staging');assert.equal(release.socket,'wss://rooms-staging.wildshard.io');
|
|
29
|
+
const version=await(await fetch('https://staging.wildshard.io/version.json')).json();assert.equal(version.build,release.engineBuild);
|
|
30
|
+
const browser=await(engine==='webkit'?webkit:chromium).launch({headless:true,args:engine==='webkit'?[]:[...KEYCHAIN_ARGS,'--use-angle=metal']});
|
|
31
|
+
/** @type {string[]} */ const faults=[];
|
|
32
|
+
/** @type {{engine:string,build:string,serial:number,coldTitle?:boolean,visibleAfterPlay?:boolean,leaveMs?:number,errors?:string[],locations?:{select:{inside:string|null,level:string|undefined},infinite:{inside:string|null,level:string|undefined}},chat?:boolean,voiceBothWays?:boolean}} */
|
|
33
|
+
const report={engine,build:version.build,serial:release.serial};
|
|
34
|
+
try {
|
|
35
|
+
const page=async()=>{const c=await browser.newContext({viewport:{width:960,height:600}});await c.grantPermissions(['microphone'],{origin:'https://staging.wildshard.io'});await saveFixture(c,{scope:'device',key:'devMode',data:true});await c.addInitScript(guardStagingSockets,release.socket);await c.addInitScript(proofMicrophone);await c.addInitScript(()=>{window.requestAnimationFrame=callback=>window.setTimeout(()=>callback(performance.now()),1000/30);window.cancelAnimationFrame=id=>window.clearTimeout(id);});const p=await c.newPage();p.on('pageerror',e=>faults.push(e.message));return p;};
|
|
36
|
+
const a=await page(),b=await page(),tag=Date.now().toString(36).slice(-5),nameA=`Seat ${tag} A`,nameB=`Seat ${tag} B`;
|
|
37
|
+
await a.goto('https://staging.wildshard.io/?chunk=driftwood-isle&fps=30&mute=1&nolock=1');
|
|
38
|
+
await a.locator('.ws-main-select').waitFor({timeout:45000});
|
|
39
|
+
report.coldTitle=await a.evaluate(()=>!window.__workerClient&&!window.__wildshard?.world);
|
|
40
|
+
assert.equal(report.coldTitle,true);console.log('PASS cold title has no world or seat');
|
|
41
|
+
await b.goto('https://staging.wildshard.io/?fps=30&mute=1&nolock=1');await b.locator('.ws-main-grid').waitFor({timeout:45000});await b.locator('.ws-main-grid').click();
|
|
42
|
+
/** @param {import('playwright').Page} p @param {string} name */
|
|
43
|
+
const named=async(p,name)=>{await p.locator('#ws-name-box input').waitFor({timeout:90000});await p.locator('#ws-name-box input').fill(name);await p.locator('#ws-name-box button[type=submit]').click();};
|
|
44
|
+
/** @param {import('playwright').Page} p @param {string} name @param {boolean} [alreadyNamed] */
|
|
45
|
+
const enter=async(p,name,alreadyNamed=false)=>{if(!alreadyNamed)await named(p,name);await p.waitForFunction(()=>window.__workerClient&&window.__wildshard?.world?.player,undefined,{timeout:90000});await p.evaluate(FLOOR_GRID_ENTER);await p.waitForFunction(()=>(window.__workerClient?.().frames??0)>30,undefined,{timeout:30000});};
|
|
46
|
+
await enter(b,nameB);console.log('observer seated');
|
|
47
|
+
const before=await b.evaluate(()=>window.__onlinePlayers?.()??[]);assert.equal(before.some(r=>new RegExp(playerNameSource(nameA),'u').test(r.name)),false);
|
|
48
|
+
await a.locator('.ws-main-select').click();await named(a,nameA);await a.locator('.ws-menu-play').click();await enter(a,nameA,true);console.log('subject seated after Play');
|
|
49
|
+
await b.waitForFunction(source=>window.__onlinePlayers?.().some(r=>new RegExp(source,'u').test(r.name)),playerNameSource(nameA),{timeout:15000});
|
|
50
|
+
report.visibleAfterPlay=true;
|
|
51
|
+
/** @param {import('playwright').Page} p */
|
|
52
|
+
const where=async p=>{const value=await p.evaluate(()=>({inside:(/** @type {{state:()=>{inside:string|null}}} */(window.__wildshard.shard.grid)).state().inside,level:window.__wildshard.world?.game.level.id}));return value;};
|
|
53
|
+
report.locations={select:await where(a),infinite:await where(b)};assert.equal(report.locations.select.inside,'driftwood-isle');assert.equal(report.locations.infinite.inside,'driftwood-isle');
|
|
54
|
+
await a.waitForFunction(source=>window.__onlinePlayers?.().some(r=>new RegExp(source,'u').test(r.name)&&r.modelled),playerNameSource(nameB),{timeout:15000});
|
|
55
|
+
/** @param {import('playwright').Page} p @param {string} line */
|
|
56
|
+
const say=async(p,line)=>{await p.locator('#ws-chat input').fill(line);await p.locator('#ws-chat input').press('Enter');};
|
|
57
|
+
await say(a,`grid A ${tag}`);await b.locator('#ws-chat',{hasText:`grid A ${tag}`}).waitFor({timeout:10000});await say(b,`grid B ${tag}`);await a.locator('#ws-chat',{hasText:`grid B ${tag}`}).waitFor({timeout:10000});report.chat=true;console.log('PASS both grid entry routes, bodies and chat');
|
|
58
|
+
for(const p of[a,b]){
|
|
59
|
+
await p.locator('#ws-voice').waitFor({timeout:30000});
|
|
60
|
+
await p.evaluate(proofMicrophone);
|
|
61
|
+
await p.locator('#ws-voice').click();
|
|
62
|
+
await p.locator('#ws-voice[data-state=on]').waitFor({timeout:30000}).catch(async(/** @type {unknown} */ error)=>{
|
|
63
|
+
console.log(JSON.stringify(await p.evaluate(()=>{
|
|
64
|
+
const button=document.querySelector('#ws-voice');
|
|
65
|
+
return {voice:button instanceof HTMLElement?button.dataset.state:undefined,tip:document.querySelector('#ws-voice-tip')?.textContent,mock:navigator.mediaDevices?.getUserMedia.toString().includes('AudioContext')};
|
|
66
|
+
})));
|
|
67
|
+
throw error;
|
|
68
|
+
});
|
|
69
|
+
await p.locator('#ws-chat input').click();
|
|
70
|
+
}
|
|
71
|
+
await a.locator('#ws-voice-peers button[data-linked=true]').waitFor({timeout:45000});await b.locator('#ws-voice-peers button[data-linked=true]').waitFor({timeout:45000});
|
|
72
|
+
for(const p of[a,b])await p.locator('#ws-voice-peers button[data-speaking=true]').waitFor({timeout:20000}).catch(async(/** @type {unknown} */ error)=>{console.log(JSON.stringify(await p.evaluate(()=>({audio:Reflect.get(window,'__mmoAudio')?.audio?.state,peers:document.querySelector('#ws-voice-peers')?.textContent}))));throw error;});report.voiceBothWays=true;
|
|
73
|
+
report.errors=faults;assert.deepEqual(faults,[]);console.log(JSON.stringify(report));writeFileSync(join(out,`grid-${engine}.json`),JSON.stringify(report,null,2));
|
|
74
|
+
} finally {await browser.close();}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// oxlint-disable promise/prefer-await-to-callbacks -- Browser events and the requestAnimationFrame cap require browser callback APIs.
|
|
2
|
+
// Manual MMO-PLAN GO1 proof: staging only, capped at 30 fps; both browsers close on every outcome.
|
|
3
|
+
// node scripts/mmo-seat-proof.mjs chromium|webkit tmp/<lane>/seat
|
|
4
|
+
import assert from 'node:assert/strict';
|
|
5
|
+
import {mkdirSync,writeFileSync} from 'node:fs';
|
|
6
|
+
import {join} from 'node:path';
|
|
7
|
+
import {chromium,webkit} from 'playwright';
|
|
8
|
+
import {KEYCHAIN_ARGS} from './chromium-keychain.mjs';
|
|
9
|
+
import {saveFixture} from './debug-settings.mjs';
|
|
10
|
+
import {guardStagingSockets,playerNameSource} from './staging-proof-lines.mjs';
|
|
11
|
+
import {FLOOR_GRID_ENTER} from './frame-floor-navigation.mjs';
|
|
12
|
+
|
|
13
|
+
const engine=process.argv[2],out=process.argv[3];
|
|
14
|
+
assert.ok(engine==='chromium'||engine==='webkit');assert.ok(out?.startsWith('tmp/'));mkdirSync(out,{recursive:true});
|
|
15
|
+
const signed=await(await fetch('https://packs.wildshard.io/releases/staging.json')).json(),release=JSON.parse(signed.body);
|
|
16
|
+
assert.equal(release.channel,'staging');assert.equal(release.socket,'wss://rooms-staging.wildshard.io');
|
|
17
|
+
const version=await(await fetch('https://staging.wildshard.io/version.json')).json();assert.equal(version.build,release.engineBuild);
|
|
18
|
+
const browser=await(engine==='webkit'?webkit:chromium).launch({headless:true,args:engine==='webkit'?[]:[...KEYCHAIN_ARGS,'--use-angle=metal']});
|
|
19
|
+
/** @type {string[]} */ const faults=[];
|
|
20
|
+
/** @type {{engine:string,build:string,serial:number,coldTitle?:boolean,visibleAfterPlay?:boolean,leaveMs?:number,errors?:string[]}} */
|
|
21
|
+
const report={engine,build:version.build,serial:release.serial};
|
|
22
|
+
try {
|
|
23
|
+
const page=async()=>{const c=await browser.newContext({viewport:{width:960,height:600}});await saveFixture(c,{scope:'device',key:'devMode',data:true});await c.addInitScript(guardStagingSockets,release.socket);await c.addInitScript(()=>{window.requestAnimationFrame=callback=>window.setTimeout(()=>callback(performance.now()),1000/30);window.cancelAnimationFrame=id=>window.clearTimeout(id);});const p=await c.newPage();p.on('pageerror',e=>faults.push(e.message));return p;};
|
|
24
|
+
const a=await page(),b=await page(),tag=Date.now().toString(36).slice(-5),nameA=`Seat ${tag} A`,nameB=`Seat ${tag} B`;
|
|
25
|
+
await a.goto('https://staging.wildshard.io/?chunk=driftwood-isle&fps=30&mute=1&nolock=1');
|
|
26
|
+
await a.locator('.ws-main-select').waitFor({timeout:45000});
|
|
27
|
+
report.coldTitle=await a.evaluate(()=>!window.__workerClient&&!window.__wildshard?.world);
|
|
28
|
+
assert.equal(report.coldTitle,true);console.log('PASS cold title has no world or seat');
|
|
29
|
+
await b.goto('https://staging.wildshard.io/?chunk=driftwood-isle&fps=30&mute=1&nolock=1&skipintro=1');
|
|
30
|
+
/** @param {import('playwright').Page} p @param {string} name */
|
|
31
|
+
const named=async(p,name)=>{await p.locator('#ws-name-box input').waitFor({timeout:90000});await p.locator('#ws-name-box input').fill(name);await p.locator('#ws-name-box button[type=submit]').click();};
|
|
32
|
+
/** @param {import('playwright').Page} p @param {string} name @param {boolean} [alreadyNamed] */
|
|
33
|
+
const enter=async(p,name,alreadyNamed=false)=>{if(!alreadyNamed)await named(p,name);await p.waitForFunction(()=>window.__workerClient&&window.__wildshard?.world?.player,undefined,{timeout:90000});await p.evaluate(FLOOR_GRID_ENTER);await p.waitForFunction(()=>(window.__workerClient?.().frames??0)>30,undefined,{timeout:30000});};
|
|
34
|
+
await enter(b,nameB);console.log('observer seated');
|
|
35
|
+
const before=await b.evaluate(()=>window.__onlinePlayers?.()??[]);assert.equal(before.some(r=>new RegExp(playerNameSource(nameA),'u').test(r.name)),false);
|
|
36
|
+
await a.locator('.ws-main-select').click();await named(a,nameA);await a.locator('.ws-menu-play').click();await enter(a,nameA,true);console.log('subject seated after Play');
|
|
37
|
+
await b.waitForFunction(source=>window.__onlinePlayers?.().some(r=>new RegExp(source,'u').test(r.name)),playerNameSource(nameA),{timeout:15000});
|
|
38
|
+
report.visibleAfterPlay=true;
|
|
39
|
+
await a.keyboard.press('Escape');await a.getByRole('button',{name:/exit to main/iu}).click();
|
|
40
|
+
const start=Date.now();await b.waitForFunction(source=>!window.__onlinePlayers?.().some(r=>new RegExp(source,'u').test(r.name)),playerNameSource(nameA),{timeout:5000});
|
|
41
|
+
report.leaveMs=Date.now()-start;report.errors=faults;assert.deepEqual(faults,[]);console.log(JSON.stringify(report));
|
|
42
|
+
writeFileSync(join(out,`seat-${engine}.json`),JSON.stringify(report,null,2));
|
|
43
|
+
} finally {await browser.close();}
|
package/scripts/nightly-heads.ts
CHANGED
|
@@ -17,17 +17,12 @@ import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
|
17
17
|
|
|
18
18
|
await import('./bake-loader.mjs');
|
|
19
19
|
const {folderStore} = await import('../src/cook/game/packStore.ts');
|
|
20
|
-
const {objectHeaders} = await import('../src/cook/game/cookWorker.ts');
|
|
20
|
+
const {objectHeaders, DEFAULT_LIMITS} = await import('../src/cook/game/cookWorker.ts');
|
|
21
21
|
const {addStoredShards} = await import('./app-build/catalogue.ts');
|
|
22
22
|
const {bareSlug} = await import('../src/shared/game/grid/catalogueSlot.ts');
|
|
23
23
|
const [browserName, groupText, directory = 'tmp/nightly/reports', only] = process.argv.slice(2);
|
|
24
24
|
if (browserName !== 'chromium' && browserName !== 'webkit') throw new Error('Choose chromium or webkit');
|
|
25
25
|
const expected = plan(), selected = partition(expected.heads, Number(groupText));
|
|
26
|
-
// SDK hover-row contract: inspect real admitted metadata at actual gameplay.
|
|
27
|
-
const paddingProofHeads: readonly string[] = ['template', 'blender-template', 'pastel-plain', 'ink-cel-valley'];
|
|
28
|
-
for (const slug of [...paddingProofHeads, 'open-plot-ember-forge', 'driftwood-isle']) {
|
|
29
|
-
if (!expected.heads.some(head => head.slug === slug)) throw new Error(`Hover contract head is missing: ${slug}`);
|
|
30
|
-
}
|
|
31
26
|
if (only !== undefined && !selected.some(row => row.slug === only)) throw new Error('Head outside partition');
|
|
32
27
|
const out = resolvePath(directory), root = process.cwd(), dist = join(root, 'dist');
|
|
33
28
|
mkdirSync(out, {recursive: true});
|
|
@@ -49,7 +44,7 @@ try {
|
|
|
49
44
|
const phase = async (name: string, run: () => unknown): Promise<boolean> => {
|
|
50
45
|
const started = Date.now();
|
|
51
46
|
try {const detail = await run(); result.phases.push({name, ok: true, ms: Date.now() - started, detail}); checkpoint(); return true;}
|
|
52
|
-
catch (error) {result.phases.push({name, ok: false, ms: Date.now() - started, error: String(error).slice(0, 4000)}); checkpoint(); return false;}
|
|
47
|
+
catch (error) {result.phases.push({name, ok: false, ms: Date.now() - started, error: (error instanceof Error ? error.stack ?? String(error) : String(error)).slice(0, 4000)}); checkpoint(); return false;}
|
|
53
48
|
};
|
|
54
49
|
const cooked = join(work, head.slug), evidence = join(work, `${head.slug}-evidence`);
|
|
55
50
|
mkdirSync(evidence);
|
|
@@ -64,8 +59,11 @@ try {
|
|
|
64
59
|
};
|
|
65
60
|
try {
|
|
66
61
|
if (!await phase('cook', () => {
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
// Exercise the production worker's time allowance, including cold phone
|
|
63
|
+
// ASTC encodes. The old private 300 s cap was half its current limit.
|
|
64
|
+
const timeout = DEFAULT_LIMITS.seconds * 1000;
|
|
65
|
+
execFileSync(process.execPath, ['scripts/ring-cook.mjs', '--ring2', `--only=${head.slug}`, `--out=${cooked}`, `--build=${build}`, `--timeout-ms=${timeout}`],
|
|
66
|
+
{stdio: 'inherit', timeout: timeout + 30_000});
|
|
69
67
|
const cookedReceipt = (read(join(cooked, 'receipt.json')) as {indexes: CookIndex[]});
|
|
70
68
|
const index = cookedReceipt.indexes[0];
|
|
71
69
|
if (index?.hash !== head.hash || index.slug !== head.slug || index.build !== build || index.keys.length === 0) throw new Error('Wrong or empty cooked product');
|
|
@@ -95,7 +93,7 @@ try {
|
|
|
95
93
|
if (bankText === undefined) throw new Error('Missing build bank');
|
|
96
94
|
const bank = JSON.parse(bankText) as {spawnManifests: {client: Record<string, unknown>}};
|
|
97
95
|
for (const slug of Object.keys(bank.spawnManifests.client)) if (bareSlug(slug) === bareSlug(head.slug)) delete bank.spawnManifests.client[slug];
|
|
98
|
-
writeFileSync(join(dist, 'index.html'), originalHTML.replace(expression, (_, before, _body, after) => `${before}${JSON.stringify(bank)}${after}`));
|
|
96
|
+
writeFileSync(join(dist, 'index.html'), originalHTML.replace(expression, (_, before, _body, after) => `${before}${JSON.stringify(bank).replaceAll('<', String.raw`\u003c`)}${after}`));
|
|
99
97
|
const added = await addStoredShards(dist, [head], store,
|
|
100
98
|
hash => Promise.resolve(readFileSync(join(process.env.WILDSHARD_PIN_CACHE ?? join(homedir(), '.cache/wildshard/pins'), `${hash}.tar`))),
|
|
101
99
|
{base: `http://127.0.0.1:${address.port}`, shards: []}, live);
|
|
@@ -111,13 +109,15 @@ try {
|
|
|
111
109
|
await phase('boot', async () => {
|
|
112
110
|
const boot = await bootCase(activeBrowser, url, mode, evidence, route, true, async page => {
|
|
113
111
|
await phase('hover', async () => {
|
|
114
|
-
|
|
112
|
+
// J352: these product boots are inside a zone, whose cruise is
|
|
113
|
+
// 14 m/s. Road cruise is exercised by the grid tests.
|
|
114
|
+
const expectedCap = 14;
|
|
115
115
|
const actualCap = await page.evaluate(() => {
|
|
116
116
|
const player = window.__wildshard?.world?.player;
|
|
117
117
|
if (player === undefined) throw new Error('Hover metadata has no entered player');
|
|
118
118
|
return player.hoverSpeedLimit?.() ?? 14;
|
|
119
119
|
});
|
|
120
|
-
if (
|
|
120
|
+
if (actualCap !== expectedCap) throw new Error(`${head.slug}: admitted hover cap ${actualCap} differs from ${expectedCap}`);
|
|
121
121
|
const control = page.locator('.ws-touch-hover');
|
|
122
122
|
await control.tap({timeout: 5000});
|
|
123
123
|
await page.waitForFunction(() => {
|
|
@@ -160,7 +160,7 @@ try {
|
|
|
160
160
|
});
|
|
161
161
|
await phase('explorer', async () => {await sweepExplorer(activeBrowser, url, route, evidence, true); return {route, rendered: true};});
|
|
162
162
|
} catch (error) {
|
|
163
|
-
if (!result.phases.some(row => row.name === 'boot')) result.phases.push({name: 'boot', ok: false, error: String(error).slice(0, 4000)});
|
|
163
|
+
if (!result.phases.some(row => row.name === 'boot')) result.phases.push({name: 'boot', ok: false, error: (error instanceof Error ? error.stack ?? String(error) : String(error)).slice(0, 4000)});
|
|
164
164
|
checkpoint();
|
|
165
165
|
} finally {
|
|
166
166
|
await browser?.close().catch(retirementFailed);
|
package/scripts/nightly-model.ts
CHANGED
|
@@ -9,15 +9,17 @@ export interface Phase {name: string; ok: boolean; error?: string; ms?: number;
|
|
|
9
9
|
export interface HeadResult extends Head {phases: Phase[]}
|
|
10
10
|
export interface HeadsReport extends Plan {kind: 'heads'; browser: string; group: number; results: HeadResult[]}
|
|
11
11
|
export interface TestFile {path: string; ok: boolean; assertions: number; skipped: number}
|
|
12
|
-
export interface TestsReport extends Plan {kind: 'tests'; exitCode: number; kitExitCode: number; totalTests: number; files: TestFile[]}
|
|
12
|
+
export interface TestsReport extends Plan {kind: 'tests'; group: number; groups: number; exitCode: number; kitExitCode: number; totalTests: number; files: TestFile[]}
|
|
13
13
|
export type Receipt = HeadsReport | TestsReport;
|
|
14
14
|
export interface Failure {key: string; error: string}
|
|
15
15
|
export interface Row extends Head {browser: string; phase: string; ok: boolean; error?: string}
|
|
16
16
|
export interface Verdict {version: number; sha: string; pins: string; testList: string; ok: boolean; tag: string; rows: Row[]; failures: Failure[];
|
|
17
|
+
tests: {group: number; ok: boolean; files: number; assertions: number}[];
|
|
17
18
|
run?: string | null; baseline: {sha: string; run: string | null} | null; newFailures: string[]; resolved: string[]}
|
|
18
19
|
export const browsers = ['chromium', 'webkit'];
|
|
19
20
|
export const phases = ['cook', 'boot', 'hover', 'draw', 'explorer'];
|
|
20
21
|
export const groups = 4;
|
|
22
|
+
export const testGroups = 2;
|
|
21
23
|
export const digest = (value: unknown): string => createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
22
24
|
export const read = (path: string): unknown => JSON.parse(readFileSync(path, 'utf8'));
|
|
23
25
|
|
|
@@ -30,7 +32,7 @@ export function plan(root = process.cwd()): Plan {
|
|
|
30
32
|
if (shards.some(row => !/^[a-z0-9-]+$/u.test(row.slug) || !/^[a-f0-9]{64}$/u.test(row.hash))) throw new Error('Unsafe pinned head');
|
|
31
33
|
if (tests.length === 0 || new Set(tests).size !== tests.length) throw new Error('Empty or duplicate Ring 2 list');
|
|
32
34
|
const heads = [...shards].sort((a, b) => a.slug.localeCompare(b.slug));
|
|
33
|
-
return {version:
|
|
35
|
+
return {version: 2, sha: execFileSync('git', ['rev-parse', 'HEAD'], {cwd: root, encoding: 'utf8'}).trim(),
|
|
34
36
|
pins: digest(shards), testList: digest(tests), heads, tests};
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -61,23 +63,31 @@ export function verdict(expected: Plan, reports: Receipt[], previous?: Verdict,
|
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
const suites = reports.filter((row): row is TestsReport => row.version === expected.version && row.kind === 'tests' && row.sha === expected.sha && row.pins === expected.pins && row.testList === expected.testList);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
if (suites.length !== testGroups || suites.some(suite => suite.groups !== testGroups || !Number.isInteger(suite.group) || suite.group < 0 || suite.group >= testGroups)) failures.push({key: 'shared/tests', error: `Expected exactly ${testGroups} suite partitions, got ${suites.length}`});
|
|
67
|
+
const tests: Verdict['tests'] = [];
|
|
68
|
+
for (let group = 0; group < testGroups; group++) {
|
|
69
|
+
const matching = suites.filter(suite => suite.group === group), suite = matching[0];
|
|
70
|
+
const assertions = suite?.files.reduce((sum, file) => sum + file.assertions, 0) ?? 0;
|
|
71
|
+
tests.push({group, ok: matching.length === 1 && suite?.groups === testGroups && suite.exitCode === 0 && suite.kitExitCode === 0 && suite.totalTests > 0 && assertions > 0 && suite.files.length > 0 && suite.files.every(file => file.ok), files: suite?.files.length ?? 0, assertions});
|
|
72
|
+
if (matching.length !== 1 || suite === undefined) failures.push({key: `shared/tests/${group}`, error: `Expected one partition receipt, got ${matching.length}`});
|
|
73
|
+
else if (suite.exitCode !== 0 || suite.kitExitCode !== 0 || suite.totalTests < 1 || suite.files.length === 0 || assertions < 1) failures.push({key: `shared/tests/${group}`, error: `Vitest exit ${suite.exitCode}, kit exit ${suite.kitExitCode}, ${suite.totalTests} tests, ${assertions} passing assertions`});
|
|
74
|
+
}
|
|
75
|
+
const files = suites.flatMap(suite => suite.files);
|
|
76
|
+
if (new Set(files.map(file => file.path)).size !== files.length) failures.push({key: 'shared/tests/duplicates', error: 'A test file appeared in more than one suite partition'});
|
|
77
|
+
if (suites.length > 0) {
|
|
68
78
|
for (const path of expected.tests) {
|
|
69
|
-
const executions =
|
|
79
|
+
const executions = files.filter(row => row.path === path);
|
|
70
80
|
const [run] = executions;
|
|
71
81
|
if (executions.length !== 1 || run === undefined || !run.ok || run.assertions < 1 || run.skipped !== 0) failures.push({key: `shared/${path}`, error: 'Listed test missing, skipped or failed'});
|
|
72
82
|
}
|
|
73
|
-
for (const file of
|
|
83
|
+
for (const file of files.filter(row => !row.ok)) {
|
|
74
84
|
if (!failures.some(row => row.key === `shared/${file.path}`)) failures.push({key: `shared/${file.path}`, error: 'Suite failure outside the slow-test list'});
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
|
-
const baseline = previous?.version === 1 && Array.isArray(previous.failures) ? previous : undefined;
|
|
87
|
+
const baseline = (previous?.version === 1 || previous?.version === 2) && Array.isArray(previous.failures) ? previous : undefined;
|
|
78
88
|
const old = new Set(baseline?.failures.map(row => row.key)), current = new Set(failures.map(row => row.key));
|
|
79
|
-
return {version:
|
|
80
|
-
ok: failures.length === 0, tag: failures.length === 0 ? 'eligible' : 'HOLD', rows, failures,
|
|
89
|
+
return {version: expected.version, sha: expected.sha, pins: expected.pins, testList: expected.testList,
|
|
90
|
+
ok: failures.length === 0, tag: failures.length === 0 ? 'eligible' : 'HOLD', rows, tests, failures,
|
|
81
91
|
baseline: baseline === undefined ? null : {sha: baseline.sha, run: baseline.run ?? null},
|
|
82
92
|
newFailures: failures.filter(row => !old.has(row.key)).map(row => row.key),
|
|
83
93
|
resolved: [...old].filter(key => !current.has(key))};
|
|
@@ -93,6 +103,8 @@ export function markdown(report: Verdict): string {
|
|
|
93
103
|
const rows = report.rows.filter(row => row.browser === browser && row.slug === slug);
|
|
94
104
|
lines.push(`| ${slug} @ ${rows[0]?.hash.slice(0, 12)} | ${browser} | ${phases.map(phase => rows.find(row => row.phase === phase)?.ok ? 'pass' : '**RED**').join(' | ')} |`);
|
|
95
105
|
}
|
|
106
|
+
lines.push('', '## Shared suite', '', '| Partition | Files | Passing assertions | Verdict |', '| --- | --- | --- | --- |',
|
|
107
|
+
...report.tests.map(suite => `| ${suite.group + 1}/${testGroups} | ${suite.files} | ${suite.assertions} | ${suite.ok ? 'pass' : '**RED**'} |`));
|
|
96
108
|
lines.push('', '## Failures', '');
|
|
97
109
|
if (report.failures.length === 0) lines.push('None.');
|
|
98
110
|
for (const failure of report.failures) lines.push(`- ${report.newFailures.includes(failure.key) ? 'NEW' : 'existing'} \`${failure.key}\`: ${failure.error.replaceAll(/[\r\n|<>]/gu, ' ').slice(0, 1500)}`);
|
|
@@ -103,9 +115,11 @@ export function markdown(report: Verdict): string {
|
|
|
103
115
|
export function requireGreen(report: Verdict, expected: Plan): void {
|
|
104
116
|
const keys = expected.heads.flatMap(head => browsers.flatMap(browser => phases.map(phase => `${browser}/${head.slug}@${head.hash}/${phase}`)));
|
|
105
117
|
const actual = report.rows?.map(row => `${row.browser}/${row.slug}@${row.hash}/${row.phase}`) ?? [];
|
|
118
|
+
const suites = report.tests ?? [];
|
|
106
119
|
if (report.version !== expected.version || !report.ok || report.tag !== 'eligible' || report.sha !== expected.sha || report.pins !== expected.pins || report.testList !== expected.testList ||
|
|
107
120
|
!Array.isArray(report.failures) || report.failures.length > 0 || actual.length !== keys.length || new Set(actual).size !== keys.length ||
|
|
108
|
-
keys.some(key => !actual.includes(key)) || report.rows.some(row => !row.ok)
|
|
121
|
+
keys.some(key => !actual.includes(key)) || report.rows.some(row => !row.ok) || suites.length !== testGroups ||
|
|
122
|
+
new Set(suites.map(suite => suite.group)).size !== testGroups || suites.some(suite => !Number.isInteger(suite.group) || suite.group < 0 || suite.group >= testGroups || !suite.ok || suite.files < 1 || suite.assertions < 1)) {
|
|
109
123
|
throw new Error('J167: complete green nightly for this exact commit and pins required; tag held');
|
|
110
124
|
}
|
|
111
125
|
}
|