Auto-TE and the chaos monkey's leaving are written as a reload makes them
Two places left a key in a shape that sanitize() repairs on the next load, so
the live game was not its own save (the server-run engine refuses such an
action at its gate, and its strict day check would refuse such a day):
- buyTE wrote S.te as {on, day}; a reload adds script:''. It now writes the
script slot itself (src/game/90-actions/30-route-script-and-tools.js).
- mkLeave turned the monkey off but kept start, until, snip, n, hurt and c;
sanitize() keeps only next and on for a monkey that is away. It now leaves
S.monkey as {next, on:0}, after the toasts that still read the visit's count
(src/game/85-incidents/40-chaos-monkey.js). This covers the visit running
out, the banana and the rules sending it home.
No new state field, nothing for old saves: both keys load as before. Nothing a
player sees changes, so no CHANGELOG bullet.
Tests: tests/backbone-core.test.js (S.te after buyTE equals what a reload makes
of it) and tests/chaos-monkey.test.js (S.monkey after each way home: outlasted,
hurt, sent home by calmer rules, bribed). Both fail without this change. The
server-run tests take their workarounds out: buyTE and the banana pass the gate
and leave the network the page leaves (tests/mp-sim-acts.test.js, the former
todo), the 60-day realm-vs-page plan clicks buyTE on day 21 instead of setting
S.te, and the gate audit no longer excuses either act.
The Pie in the Sky line the review also named (60-pie.js:66, S.monkey.n++ on a
monkey that is away) is not reachable: its only caller fires a laser incident
behind mkOn(), so it is left as it is.
Performance (npm run perf -- --base-ref 61e31c5, headless, big network, median
of 15 runs, ms):
| What | Base | This | Change | p |
|---|--:|--:|--:|--:|
| Routing: compute() | 27.3 | 26.1 | -4% | 0.51 |
| One game day: dayTick() | 29.7 | 30.1 | +1% | 0.71 |
| An action: after() | 1.96 | 1.86 | -5% | 0.48 |
| Side panel and left list | 62.0 | 59.2 | -5% | 0.023 |
| NOC dashboard tabs | 110 | 110 | +0% | 0.93 |
| Map at three zoom levels | 3.69 | 3.90 | +6% | 0.43 |
| The NOC intern's shift: opsDay() | 4.06 | 3.95 | -3% | 0.11 |
Routing results identical to the base; no change beyond noise.
This commit is contained in:
parent
72f31e809b
commit
3b8c331556
6 changed files with 32 additions and 20 deletions
|
|
@ -23,10 +23,6 @@ const { load } = require('./harness');
|
|||
const { CODE, MP, TEST, ROOMY, page, bigScenic, msg, ctxOf, begin, RSIG, checked, differs } = require('./lib/mp-sim-play');
|
||||
|
||||
const LONG = process.env.SIM_LONG === '1';
|
||||
/* Acts the gate refuses because the game leaves a key in a shape sanitize() repairs: game fixes for the integrator (the
|
||||
T2 report has each patch). Take an entry out once its fix is in; any other refusal fails the audit.
|
||||
buyTE writes S.te without its script; mkBanana (mkLeave) keeps a finished visit's fields in S.monkey. */
|
||||
const PENDING = { buyTE: 'te', mkBanana: 'monkey' };
|
||||
const E = createEngine({ workers: 2, test: TEST, timeouts: ROOMY });
|
||||
test.after(() => E.close());
|
||||
// The big network with everything that keeps state between days on: the intern on every order, the sales desk (rep)
|
||||
|
|
@ -62,9 +58,7 @@ test('realm vs jsdom: 60 days of the scenic big network with actions in between,
|
|||
15: () => ({ act: 'renameGo', args: { name: 'Tubular Bells' }, page: () => ev("ACT.renameGo({name:'Tubular Bells'})") }),
|
||||
18: () => ({ act: 'coreUp', args: {}, page: () => ev('ACT.coreUp()') }),
|
||||
19: () => ({ act: 'coreUp', args: {}, page: () => ev('ACT.coreUp()') }),
|
||||
// Auto-TE as buyTE makes it once the game writes S.te in its saved shape (script:'', see the T2 report): today the
|
||||
// gate refuses buyTE, rightly, as a reload adds that script (tests/mp-sim-acts.test.js keeps it as a todo).
|
||||
21: () => ({ setup: "S.te={on:true,day:S.day,script:''};" }),
|
||||
21: () => ({ act: 'buyTE', args: {}, page: () => ev('ACT.buyTE()') }),
|
||||
22: () => ({ act: 'teDeploy', args: { script }, ui: { slop: false }, page: () => ev(`ACT.teDeploy({script:${JSON.stringify(script)}})`) }),
|
||||
};
|
||||
const outcomes = {};
|
||||
|
|
@ -89,7 +83,7 @@ test('realm vs jsdom: 60 days of the scenic big network with actions in between,
|
|||
}
|
||||
}
|
||||
// The plan really played: the network grew, a link went, the script is live.
|
||||
for (const k of ['buildPop@5', 'buildLink@6', 'buyTransit@8', 'rmLink@12', 'renameGo@15', 'teDeploy@22']) assert.equal(outcomes[k], 'applied', k);
|
||||
for (const k of ['buildPop@5', 'buildLink@6', 'buyTransit@8', 'rmLink@12', 'renameGo@15', 'buyTE@21', 'teDeploy@22']) assert.equal(outcomes[k], 'applied', k);
|
||||
assert.equal(ev('S.name'), 'Tubular Bells');
|
||||
assert.equal(ev('!!(S.te&&S.te.on&&S.te.script)'), true, 'RouteScript is deployed');
|
||||
assert.equal(ev('S.biz.filter(b=>b.route===\'scenic\').length') > 0, true, 'scenic circuits played');
|
||||
|
|
@ -329,7 +323,7 @@ test(`timer audit and gate: ${LONG ? 365 : 60} days with everything on, then eve
|
|||
assert.ok(btns.length > 150, `a real sweep: ${btns.length} buttons`);
|
||||
for (const q of ['mktCfg', 'mktHold', 'pathPin']) assert.ok(btns.some(([a]) => a === q), `the crawl found ${q}`);
|
||||
// By default the first three different buttons of each act (about 250); SIM_LONG every one (about 3,000).
|
||||
const seen = new Set(), per = {}, outs = {}, caught = new Set();
|
||||
const seen = new Set(), per = {}, outs = {};
|
||||
for (const [act, args] of btns) {
|
||||
const k = act + JSON.stringify(args);
|
||||
if (seen.has(k) || (!LONG && (per[act] || 0) >= 3)) continue;
|
||||
|
|
@ -339,12 +333,9 @@ test(`timer audit and gate: ${LONG ? 365 : 60} days with everything on, then eve
|
|||
const r = checked(await S2.act(code, nid, body));
|
||||
if (r.t === 'err') { fails++; continue; }
|
||||
outs[r.outcome] = (outs[r.outcome] || 0) + 1;
|
||||
const g = /^sanitize would repair (\w+): (.*)$/.exec(r.why || '');
|
||||
if (g && PENDING[act] === g[2]) { caught.add(act); continue; }
|
||||
assert.equal(g, null, `the gate rolled back ${act} ${JSON.stringify(args)}: ${r.why}`);
|
||||
assert.ok(!/^sanitize would repair/.test(r.why || ''), `the gate rolled back ${act} ${JSON.stringify(args)}: ${r.why}`);
|
||||
if (r.outcome === 'error') assert.fail(`${act} ${JSON.stringify(args)}: ${r.why}`);
|
||||
}
|
||||
if (caught.size) t.diagnostic(`the gate refused, rightly, until the game writes these keys as a reload does (T2 report): ${[...caught].map((a) => a + ' ' + PENDING[a]).join(', ')}`);
|
||||
assert.equal(fails, 0, 'no action timed out or broke its pipeline');
|
||||
assert.ok(outs.applied > 20, `actions applied: ${JSON.stringify(outs)}`);
|
||||
[n, at] = await timers();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue