@wildshard/engine 0.1.22 → 0.1.23
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 +8 -0
- package/lint/engine-sides.json +2 -0
- package/lint/sim-players.json +2 -13
- package/package.json +9 -2
- 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/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/native-residency.d.mts +1 -0
- package/scripts/goldens/native-residency.mjs +18 -4
- package/scripts/keep-copy.mjs +120 -0
- package/scripts/land.mjs +36 -6
- 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 +57 -7
- package/scripts/loading-flow/stalls.d.mts +2 -0
- package/scripts/loading-flow/stalls.mjs +13 -0
- 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.proof.ts +18 -5
- package/scripts/nightly.ts +13 -8
- package/scripts/no-astc-boot.mjs +77 -0
- 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/scratch-dir.mjs +31 -12
- package/scripts/scratch-sweep.mjs +15 -23
- package/scripts/server-release/items.d.mts +7 -0
- package/scripts/server-release/items.mjs +28 -0
- package/scripts/server-release/publish.mjs +9 -1
- package/scripts/side-parity.mjs +1 -1
- package/scripts/test-products.json +1 -0
- package/scripts/tsconfig.json +2 -0
- package/scripts/vitest-ci-files.ts +5 -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 +15 -131
- package/scripts/worktree.mjs +92 -12
- package/src/client/engine/audio/audioLog.ts +7 -2
- package/src/client/engine/boot/diagnostics.ts +69 -1
- package/src/client/engine/core/ktx2.ts +5 -3
- package/src/client/engine/core/ktx2Zstd.ts +2 -1
- package/src/client/engine/pwa/sw.js +26 -8
- package/src/client/engine/render/dataLook.ts +14 -7
- package/src/client/engine/render/lookLight.ts +64 -20
- package/src/client/engine/ui/Loading.ts +6 -8
- package/src/client/engine/ui/lookLightOption.ts +1 -1
- package/src/client/game/audio/cueDirector.ts +2 -1
- 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/dataCellKit.ts +9 -1
- package/src/client/game/grid/products.ts +21 -7
- package/src/client/game/grid/session.ts +6 -4
- package/src/client/game/population/signals.ts +1 -1
- package/src/client/game/quest/chapterDirector.ts +1 -0
- package/src/client/game/shardfile/clientBossTelegraph.ts +4 -3
- package/src/client/game/shardfile/clientWorker.ts +22 -6
- package/src/client/game/shardfile/look.ts +1 -1
- package/src/client/game/shardfile/runtimeProduct.ts +9 -5
- package/src/client/game/shardfile/wirePage.ts +5 -2
- package/src/client/game/shardfile/worldSceneTextures.ts +15 -9
- 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 +5 -4
- package/src/server/game/plugin/mover.ts +18 -14
- 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 +3 -1
- package/src/server/host/standalone/roadWorld.ts +6 -0
- package/src/shared/engine/physics/gridBorders.ts +15 -1
- package/src/shared/engine/sim/snapshot.ts +5 -5
- 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/host/headlessJourney.ts +3 -3
- package/src/shared/host/headlessTape.ts +7 -6
- package/src/shared/host/releaseRows.ts +4 -1
|
@@ -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/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
|
}
|
package/scripts/nightly.proof.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {join, resolve} from 'node:path';
|
|
|
7
7
|
import {browsers, partition, phases, plan, read, requireBuild, requireGreen, requireLatest, type HeadsReport, type Plan, type TestsReport, type Verdict} from './nightly-model.ts';
|
|
8
8
|
|
|
9
9
|
interface Execution {status: number | null; report: Verdict; summary: string}
|
|
10
|
-
interface Fixture {root: string; heads: HeadsReport[]; suite: TestsReport; expected: Plan;
|
|
10
|
+
interface Fixture {root: string; heads: HeadsReport[]; suite: TestsReport; suites: TestsReport[]; expected: Plan;
|
|
11
11
|
execute: (baseline?: string, env?: NodeJS.ProcessEnv) => Execution; write: (path: string, value: unknown) => void}
|
|
12
12
|
|
|
13
13
|
const cli = resolve('scripts/nightly.ts'), tagger = resolve('scripts/nightly-tag.mjs');
|
|
@@ -23,19 +23,23 @@ function fixture(run: (context: Fixture) => void): void {
|
|
|
23
23
|
const expected = plan(root);
|
|
24
24
|
const heads: HeadsReport[] = browsers.flatMap(browser => Array.from({length: 4}, (_, group) => ({...expected, kind: 'heads' as const, browser, group,
|
|
25
25
|
results: partition(expected.heads, group).map(head => ({slug: head.slug, hash: head.hash, phases: phases.map(name => ({name, ok: true}))}))})));
|
|
26
|
-
const suite: TestsReport = {...expected, kind: 'tests', exitCode: 0, kitExitCode: 0, totalTests: 1, files: [{path: 'test/journey.test.ts', ok: true, assertions: 1, skipped: 0}]};
|
|
26
|
+
const suite: TestsReport = {...expected, kind: 'tests', group: 0, groups: 2, exitCode: 0, kitExitCode: 0, totalTests: 1, files: [{path: 'test/journey.test.ts', ok: true, assertions: 1, skipped: 0}]};
|
|
27
|
+
const suites: TestsReport[] = [suite, {...suite, group: 1, files: [{path: 'test/ordinary.test.ts', ok: true, assertions: 1, skipped: 0}]}];
|
|
27
28
|
const execute = (baseline?: string, env: NodeJS.ProcessEnv = {}): Execution => {
|
|
29
|
+
rmSync(join(root, 'reports'), {recursive: true, force: true});
|
|
28
30
|
for (const report of heads) write(`reports/heads-${report.browser}-${report.group}.json`, report);
|
|
29
|
-
write(
|
|
31
|
+
for (const [index, report] of suites.entries()) write(`reports/tests-${index}.json`, report);
|
|
30
32
|
const child = spawnSync(process.execPath, [cli, 'report', join(root, 'reports'), ...(baseline === undefined ? [] : [baseline])], {cwd: root, encoding: 'utf8', env: {...process.env, ...env}});
|
|
31
33
|
return {status: child.status, report: read(join(root, 'reports/verdict.json')) as Verdict, summary: readFileSync(join(root, 'reports/summary.md'), 'utf8')};
|
|
32
34
|
};
|
|
33
|
-
run({root, heads, suite, expected, execute, write});
|
|
35
|
+
run({root, heads, suite, suites, expected, execute, write});
|
|
34
36
|
} finally {rmSync(root, {recursive: true, force: true});}
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
await test('complete real report files admit the exact commit, but never another commit or repeated row', () => fixture(({expected, execute}) => {
|
|
38
40
|
const result = execute(); assert.equal(result.status, 0); requireGreen(result.report, expected);
|
|
41
|
+
assert.throws(() => requireGreen({...result.report, version: 1}, expected), /J167/u);
|
|
42
|
+
assert.throws(() => requireGreen({...result.report, tests: result.report.tests.slice(0, 1)}, expected), /J167/u);
|
|
39
43
|
requireBuild(`${expected.sha.slice(0, 7)}-proof`, expected);
|
|
40
44
|
assert.throws(() => requireBuild('0000000-stale', expected), /stale/u);
|
|
41
45
|
assert.throws(() => requireGreen(result.report, {...expected, sha: 'wrong'}), /J167/u);
|
|
@@ -64,6 +68,15 @@ await test('ordinary suite skips retain existing policy while listed journeys mu
|
|
|
64
68
|
suite.files.push({path: 'test/ordinary-platform.test.ts', ok: true, assertions: 0, skipped: 1});
|
|
65
69
|
assert.equal(execute().status, 0);
|
|
66
70
|
}));
|
|
71
|
+
await test('missing, duplicate, malformed or overlapping suite partitions hold an otherwise green night', () => {
|
|
72
|
+
const mutations: ((suites: TestsReport[]) => void)[] = [suites => {suites.pop();}, suites => {suites[1].group = 0;}, suites => {suites[1].groups = 1;}, suites => {suites[1].files = [...suites[0].files];}, suites => {suites[1].files = [];}];
|
|
73
|
+
for (const mutate of mutations) fixture(({suites, execute, expected}) => {
|
|
74
|
+
mutate(suites);
|
|
75
|
+
const result = execute();
|
|
76
|
+
assert.equal(result.status, 1);
|
|
77
|
+
assert.throws(() => requireGreen(result.report, expected), /J167/u);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
67
80
|
await test('an empty artifact directory never produces green', () => fixture(({root}) => {
|
|
68
81
|
mkdirSync(join(root, 'empty'));
|
|
69
82
|
const result = spawnSync(process.execPath, [cli, 'report', join(root, 'empty')], {cwd: root, encoding: 'utf8'});
|
|
@@ -77,7 +90,7 @@ await test('a failed Actions job holds the tag even if every uploaded phase pass
|
|
|
77
90
|
}));
|
|
78
91
|
await test('prior nightly failures are compared by head hash, browser and phase', () => fixture(({heads, execute, root, write}) => {
|
|
79
92
|
heads[0].results[0].phases[0].ok = false;
|
|
80
|
-
const first = execute(); write('previous.json', first.report);
|
|
93
|
+
const first = execute(); write('previous.json', {...first.report, version: 1});
|
|
81
94
|
heads[0].results[0].phases[0].ok = true; heads[1].results[0].phases[1].ok = false;
|
|
82
95
|
const next = execute(join(root, 'previous.json'));
|
|
83
96
|
assert.equal(next.report.resolved.length, 1); assert.equal(next.report.newFailures.length, 1);
|
package/scripts/nightly.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {spawnSync} from 'node:child_process';
|
|
3
3
|
import {existsSync, mkdirSync, readdirSync, writeFileSync} from 'node:fs';
|
|
4
4
|
import {join, relative, resolve} from 'node:path';
|
|
5
|
-
import {browsers, groups, markdown, partition, plan, read, requirePublishedGreen, verdict, type Receipt, type TestsReport, type Verdict} from './nightly-model.ts';
|
|
5
|
+
import {browsers, groups, markdown, partition, plan, read, requirePublishedGreen, testGroups, verdict, type Receipt, type TestsReport, type Verdict} from './nightly-model.ts';
|
|
6
6
|
|
|
7
7
|
interface VitestResult {numTotalTests?: number; testResults?: {name: string; status: string; assertionResults?: {status: string}[]}[]}
|
|
8
8
|
|
|
@@ -13,24 +13,29 @@ if (command === 'plan') {
|
|
|
13
13
|
console.log(JSON.stringify({include: browsers.flatMap(browser => Array.from({length: groups}, (_, group) => ({browser, group,
|
|
14
14
|
os: browser === 'webkit' ? 'macos-15' : 'ubuntu-24.04', heads: partition(expected.heads, group).map(row => row.slug).join(',')})))}));
|
|
15
15
|
} else if (command === 'tests') {
|
|
16
|
+
const group = Number(process.env.NIGHTLY_TEST_GROUP ?? '-1');
|
|
17
|
+
if (!Number.isInteger(group) || group < 0 || group >= testGroups) throw new Error('Set NIGHTLY_TEST_GROUP to 0 or 1; the verdict requires both suite partitions');
|
|
16
18
|
mkdirSync(out, {recursive: true});
|
|
17
|
-
const json = join(out,
|
|
19
|
+
const json = join(out, `vitest-${group}.json`);
|
|
18
20
|
const kit = spawnSync('pnpm', ['test:kit'], {stdio: 'inherit', timeout: 120000});
|
|
19
|
-
//
|
|
21
|
+
// The two jobs cover the entire admitted suite once, including every slow
|
|
22
|
+
// Ring 2 entry. Keep each job's existing 25-minute process limit.
|
|
20
23
|
const child = spawnSync('python3', ['scripts/heavy-lane.py', 'full-test', '--', process.execPath, 'scripts/vitest-tmp.ts', 'run',
|
|
21
|
-
'--maxWorkers=2', '--reporter=default', '--reporter=json', `--outputFile.json=${json}`],
|
|
24
|
+
'--maxWorkers=2', `--shard=${group + 1}/${testGroups}`, '--reporter=default', '--reporter=json', `--outputFile.json=${json}`],
|
|
22
25
|
{stdio: 'inherit', timeout: 1500000, env: {...process.env, WS_FULL_SUITE: '1', WILDSHARD_RING: '2'}});
|
|
23
26
|
const raw: VitestResult = existsSync(json) ? (read(json) as VitestResult) : {};
|
|
24
27
|
const files = (raw.testResults ?? []).map(file => ({path: relative(process.cwd(), file.name).replaceAll('\\', '/'),
|
|
25
28
|
ok: file.status !== 'failed' && file.assertionResults?.every(row => row.status !== 'failed') === true,
|
|
26
29
|
assertions: file.assertionResults?.filter(row => row.status === 'passed').length ?? 0,
|
|
27
30
|
skipped: file.assertionResults?.filter(row => row.status !== 'passed' && row.status !== 'failed').length ?? 0}));
|
|
28
|
-
const report: TestsReport = {...expected, kind: 'tests', exitCode: child.status ?? 1, kitExitCode: kit.status ?? 1, totalTests: raw.numTotalTests ?? 0, files};
|
|
29
|
-
write(
|
|
30
|
-
|
|
31
|
+
const report: TestsReport = {...expected, kind: 'tests', group, groups: testGroups, exitCode: child.status ?? 1, kitExitCode: kit.status ?? 1, totalTests: raw.numTotalTests ?? 0, files};
|
|
32
|
+
write(`tests-${group}.json`, report);
|
|
33
|
+
// Listed journeys in either partition are checked together by report;
|
|
34
|
+
// a partition must still fail for any ordinary or listed test failure.
|
|
35
|
+
if (report.exitCode !== 0 || report.kitExitCode !== 0 || report.totalTests < 1 || files.some(file => !file.ok)) process.exitCode = 1;
|
|
31
36
|
} else if (command === 'report') {
|
|
32
37
|
mkdirSync(out, {recursive: true});
|
|
33
|
-
const receipts = readdirSync(out).filter(name => /^(heads-|tests
|
|
38
|
+
const receipts = readdirSync(out).filter(name => /^(heads-|tests[-.])/u.test(name) && name.endsWith('.json')).map(name => (read(join(out, name)) as Receipt));
|
|
34
39
|
const jobs = {plan: process.env.NIGHTLY_PLAN_RESULT, tests: process.env.NIGHTLY_TESTS_RESULT, heads: process.env.NIGHTLY_HEADS_RESULT};
|
|
35
40
|
const report = {...verdict(expected, receipts, baseline !== undefined && existsSync(baseline) ? (read(baseline) as Verdict) : undefined, jobs), run: process.env.GITHUB_RUN_ID ?? null};
|
|
36
41
|
write('verdict.json', report);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// EG-16 (meta docs/plans/test-coverage/ENGINE.md, TEST-COVERAGE row 32): the `--no-astc` boot. A phone with no ASTC draws (BUG-9).
|
|
3
|
+
// Chromium at the phone tier (an iPhone profile), with WEBGL_compressed_texture_astc hidden as capture.mjs --no-astc hides it (S4),
|
|
4
|
+
// enters a head with a phone set by its own URL and holds:
|
|
5
|
+
// hidden textures load as images, the reason names the raw-ASTC veto (src/client/engine/boot/gpuFiles.ts `rawAstcVeto`), no raw
|
|
6
|
+
// ASTC 6x6 file is read, the world is entered with frames running, the frame isn't black, and nothing fatal shows;
|
|
7
|
+
// shown the control: the same page with ASTC reads raw ASTC files, so the hidden pass proves a choice, not an empty table.
|
|
8
|
+
// BUG-9's fault, planted at the source (`rawAstcVeto` returning null), turns the hidden pass red: the page reads Pine's raw ASTC
|
|
9
|
+
// phone set on a GPU that can't sample it. A harness texture pin is no plant: the veto overrules a pin too.
|
|
10
|
+
// scripts/browser-lane.sh node scripts/no-astc-boot.mjs --base=http://127.0.0.1:4401/ [--slug=pine-hollow] [--out=tmp/no-astc]
|
|
11
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { chromium, devices } from 'playwright';
|
|
14
|
+
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
15
|
+
import { frameFailure, screenshotPixels } from './parity/black-frame.mjs';
|
|
16
|
+
|
|
17
|
+
/** @param {string} key @param {string} fallback */
|
|
18
|
+
const arg = (key, fallback) => process.argv.find(value => value.startsWith(`--${key}=`))?.slice(key.length + 3) ?? fallback;
|
|
19
|
+
const base = arg('base', ''), slug = arg('slug', 'pine-hollow'), out = arg('out', 'tmp/no-astc');
|
|
20
|
+
if (!/^http:\/\/(127\.0\.0\.1|localhost)(:\d+)?\/$/u.test(base)) throw new Error('Requires --base=<a local served build>/ (scripts/serve-build.sh)');
|
|
21
|
+
/** The cook's raw ASTC 6x6 files and the hand-made overlays (gpuFiles.ts RAW_ASTC). */
|
|
22
|
+
const RAW_ASTC = /\/astc6\/|\.t[0-9]+-[a-f0-9]{8}\.(?:ktx2|glb)$/u;
|
|
23
|
+
const hideAstc = () => {
|
|
24
|
+
const ext = 'WEBGL_compressed_texture_astc';
|
|
25
|
+
for (const gl of [WebGLRenderingContext, WebGL2RenderingContext]) {
|
|
26
|
+
const proto = gl.prototype, realExtension = Reflect.get(proto, 'getExtension'), realList = Reflect.get(proto, 'getSupportedExtensions');
|
|
27
|
+
proto.getExtension = function getExtension(name) { return name === ext ? null : Reflect.apply(realExtension, this, [name]); };
|
|
28
|
+
proto.getSupportedExtensions = function getSupportedExtensions() { return Reflect.apply(realList, this, [])?.filter(name => name !== ext) ?? null; };
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const angle = process.platform === 'darwin' ? 'metal' : 'swiftshader';
|
|
32
|
+
const browser = await chromium.launch({ args: [...KEYCHAIN_ARGS, '--mute-audio', '--ignore-gpu-blocklist', `--use-angle=${angle}`] });
|
|
33
|
+
const { defaultBrowserType: _engine, ...phone } = devices['iPhone 16 Pro'];
|
|
34
|
+
|
|
35
|
+
/** One boot of `slug` on a fresh phone; what it chose, read and drew. @param {boolean} astc */
|
|
36
|
+
async function boot(astc) {
|
|
37
|
+
const context = await browser.newContext(phone), page = await context.newPage();
|
|
38
|
+
/** @type {string[]} */ const raw = [];
|
|
39
|
+
/** @type {string[]} */ const fatal = [];
|
|
40
|
+
if (!astc) await context.addInitScript(hideAstc);
|
|
41
|
+
page.on('response', response => { const path = new URL(response.url()).pathname; if (RAW_ASTC.test(path)) raw.push(path); });
|
|
42
|
+
page.on('pageerror', error => { fatal.push(error.message.slice(0, 300)); });
|
|
43
|
+
page.on('console', line => { if (line.type() === 'error' || /\brefused\b/iu.test(line.text())) fatal.push(line.text().slice(0, 300)); });
|
|
44
|
+
try {
|
|
45
|
+
await page.goto(new URL(`?chunk=${slug}&skipintro&mute=1&nolock=1`, base).href, { waitUntil: 'load' });
|
|
46
|
+
const play = setInterval(() => { void page.locator('.ws-load-play').click({ timeout: 500 }).catch(() => undefined); }, 1000);
|
|
47
|
+
const entered = await page.waitForFunction(() => window.__wildshard?.world?.hud?.entered === true && document.querySelector('.ws-load') === null && window.__wildshard.world.game.frameGate(), undefined, { timeout: 180_000 })
|
|
48
|
+
.then(() => true, () => false);
|
|
49
|
+
clearInterval(play);
|
|
50
|
+
await page.waitForTimeout(4000);
|
|
51
|
+
const seen = await page.evaluate(() => {
|
|
52
|
+
const api = window.__wildshard, gl = document.createElement('canvas').getContext('webgl2');
|
|
53
|
+
return { textures: api?.textures?.() ?? null, astc: gl?.getExtension('WEBGL_compressed_texture_astc') !== null,
|
|
54
|
+
errors: [...document.querySelectorAll('#wserr,.ws-load-error,.ws-game-dev-alert,[data-boot-fatal]')].map(node => (node.textContent ?? '').slice(0, 200)) };
|
|
55
|
+
});
|
|
56
|
+
const shot = await page.screenshot();
|
|
57
|
+
mkdirSync(out, { recursive: true }); writeFileSync(join(out, `${slug}-${astc ? 'astc' : 'no-astc'}.png`), shot);
|
|
58
|
+
const pixels = await page.evaluate(screenshotPixels, Array.from(shot));
|
|
59
|
+
return { entered, ...seen, raw: raw.length, rawSample: raw.slice(0, 3), black: frameFailure(pixels), darkShare: Math.round(pixels.darkShare * 100) / 100, fatal: [...new Set([...fatal, ...seen.errors])].slice(0, 6) };
|
|
60
|
+
} finally { await context.close(); }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @type {string[]} */ const failures = [];
|
|
64
|
+
const hidden = await boot(false), shown = await boot(true);
|
|
65
|
+
await browser.close();
|
|
66
|
+
/** @param {boolean} ok @param {string} what */
|
|
67
|
+
const check = (ok, what) => { if (!ok) failures.push(what); };
|
|
68
|
+
check(!hidden.astc && shown.astc, 'the extension was not hidden on one page and shown on the other');
|
|
69
|
+
check(hidden.entered, 'no-ASTC: the world never opened');
|
|
70
|
+
check(hidden.textures?.mode === 'img' && /overruled: .*no ASTC/u.test(hidden.textures.why), `no-ASTC: textures are ${JSON.stringify(hidden.textures)}, not images by the raw-ASTC veto`);
|
|
71
|
+
check(hidden.raw === 0, `no-ASTC: read ${hidden.raw} raw ASTC files (${hidden.rawSample.join(', ')})`);
|
|
72
|
+
check(hidden.black === null, `no-ASTC: ${hidden.black}`);
|
|
73
|
+
check(hidden.fatal.length === 0, `no-ASTC: ${hidden.fatal.join(' | ')}`);
|
|
74
|
+
check(shown.entered && shown.raw > 0, `control: with ASTC the page read ${shown.raw} raw ASTC files, so ${slug} has no phone set to choose against`);
|
|
75
|
+
console.log(JSON.stringify({ test: 'no-astc-boot', slug, hidden, shown }, null, 1));
|
|
76
|
+
console.log(failures.length === 0 ? `no-astc-boot green: ${slug} draws on a phone with no ASTC` : `no-astc-boot RED:\n${failures.map(line => ` ${line}`).join('\n')}`);
|
|
77
|
+
process.exit(failures.length === 0 ? 0 : 1);
|
|
@@ -3093,10 +3093,10 @@
|
|
|
3093
3093
|
}
|
|
3094
3094
|
],
|
|
3095
3095
|
"timeout": 40,
|
|
3096
|
-
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev
|
|
3096
|
+
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev 6 pinned). Legs follow shardfile src/tools/brasscap/canyon.ts ROUTES; each ends at its camp's edge (the camp's tent stands on the route's end) and none crosses the gate, which is shut until the camps fall."
|
|
3097
3097
|
},
|
|
3098
3098
|
{
|
|
3099
|
-
"name": "canyon branch to the ledge
|
|
3099
|
+
"name": "canyon branch to the ledge ladder",
|
|
3100
3100
|
"start": {
|
|
3101
3101
|
"x": -2,
|
|
3102
3102
|
"z": -22,
|
|
@@ -3108,12 +3108,12 @@
|
|
|
3108
3108
|
"z": -25.8
|
|
3109
3109
|
},
|
|
3110
3110
|
{
|
|
3111
|
-
"x":
|
|
3112
|
-
"z": -
|
|
3111
|
+
"x": 8.4,
|
|
3112
|
+
"z": -28.4
|
|
3113
3113
|
}
|
|
3114
3114
|
],
|
|
3115
3115
|
"timeout": 30,
|
|
3116
|
-
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev
|
|
3116
|
+
"notes": "Rev 6 (shard-brasscap edbd9bb, TEMPLATE-E2E; camps as rev 5): camp 2's ledge is a 6.5 m block (x 10 to 26, z -43 to -25) reached by a ladder on its west face at (9.55, -28.4); the leg ends at the ladder's foot. BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev 6 pinned). Legs follow shardfile src/tools/brasscap/canyon.ts ROUTES; each ends at its camp's edge (the camp's tent stands on the route's end) and none crosses the gate, which is shut until the camps fall."
|
|
3117
3117
|
},
|
|
3118
3118
|
{
|
|
3119
3119
|
"name": "side canyon into camp 3",
|
|
@@ -3145,7 +3145,7 @@
|
|
|
3145
3145
|
}
|
|
3146
3146
|
],
|
|
3147
3147
|
"timeout": 40,
|
|
3148
|
-
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev
|
|
3148
|
+
"notes": "BRASSCAP ENG-3: from rev 2 the blender-template slug is Brasscap Mesa (rev 6 pinned). Legs follow shardfile src/tools/brasscap/canyon.ts ROUTES; each ends at its camp's edge (the camp's tent stands on the route's end) and none crosses the gate, which is shut until the camps fall."
|
|
3149
3149
|
}
|
|
3150
3150
|
],
|
|
3151
3151
|
"open-plot-frostline-peaks": [
|
package/scripts/pins-reuse.mjs
CHANGED
|
@@ -48,6 +48,7 @@ export const KEY_EXEMPT=Object.freeze({
|
|
|
48
48
|
'scripts/renderer-revision.mjs':'names a printed preparation label only (J262); no byte under out/',
|
|
49
49
|
'src/shared/game/shardfile/ktx2Targets.ts':'hashed already: the validation revision in the key covers src/shared/game/shardfile (S11)',
|
|
50
50
|
'scripts/pins-catalogue.ts':'refresh check only (DEL9): refuses before the pins are written; no byte under out/',
|
|
51
|
+
'scripts/pins-staging.ts':'refresh/export only; selection materializes shardfiles.json already hashed in the key',
|
|
51
52
|
'scripts/server-release/served-slug.mjs':'refresh check only (DEL9): names a slug\'s served folder for the catalogue compare',
|
|
52
53
|
});
|
|
53
54
|
|