Review fixes for the small-fix batch
What an IPv6-only swap still owes is set aside for every job after it, not only for the next swap. The intern's shift reads it once (X.ow in opsShift(), refreshed when the build standard order starts a swap) and every standing order's can() keeps it above the cash floor, whoever started the swap; the sheet's button checks it for every job of the click. Before, the same click or the next shift could spend it (a generator, a line system swap), and the swap then paid its routers under the floor or waited for weeks. ip6Owed() is 0 while IPv4 is plentiful, when the swaps wait anyway. satOnly() counts a fiber or cable to the island only once it has optics of its own: dark glass carries none of the island's traffic, so the selective peers keep refusing and an exchange session there stays paused. ixSessions() looks up the city's satellite circuit once per exchange instead of once per member. The standing-order descriptions of the build standard and the optical upgrade say a customer's wave holds a fiber, not any customer (new labels, every language). The batch's CHANGELOG bullets get first sentences that fit the in-app notes; the satellite bullet says PNIs and your own exchange keep peering, the hint bullet that it shows up to four teleports. German and Italian express.dim use the dictionaries' own words, and the German and Spanish IPv6-only note reads naturally.
This commit is contained in:
parent
9496c26a25
commit
9601345201
17 changed files with 129 additions and 51 deletions
|
|
@ -99,6 +99,60 @@ test("the intern rolls it out within the order's budget and the cash floor, and
|
|||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
// Only Amsterdam has homes to swap: one $12k swap. A quiet lite fiber Frankfurt–Paris for the line-system target.
|
||||
const AMS_ONLY = "S.pops.fra.bb.d=0;S.pops.par.bb.d=0;compute()";
|
||||
const FIBER = "S.links.push({id:'q',a:'fra',b:'par',kind:'df',own:false,sys:'lite',ch:[],km:Math.round(kmBetween('fra','par')),sub:false,cable:null,mo:1000,trench:'q',cut:0,day:0,ready:0,spares:false});compute()";
|
||||
|
||||
test("what a swap still owes stays above the intern's cash floor for every job after it, in every order", (t) => {
|
||||
const { ev, errors } = game(t);
|
||||
ev(AMS_ONLY);
|
||||
ev("ACT.opsHire({id:'annie'});closeModal();for(const k in S.ops.on)S.ops.on[k]=false;S.ops.on.std=true;S.ops.floor=50000;S.ops.cap.std=1e6");
|
||||
std(ev, { v6: true });
|
||||
ev(`S.cash=50000+${COST.ams}+500;opsDay(S.day)`);
|
||||
assert.deepEqual(swapping(ev), ['ams']);
|
||||
assert.equal(ev('ip6Owed()'), COST.ams);
|
||||
// The next day the standard wants a generator at every POP too. The cash above the floor covers one only with the
|
||||
// swap's money: it waits.
|
||||
assert.equal(ev('GEN_COST'), 12000);
|
||||
std(ev, { v6: true, gen: true });
|
||||
ev('S.day++;compute();opsDay(S.day)');
|
||||
assert.deepEqual(J(ev, 'Object.keys(S.pops).filter(c=>S.pops[c].gen)'), []);
|
||||
assert.deepEqual(J(ev, 'S.ops.log[0].r'), [['broke', 1, ['std']]]);
|
||||
// With no income at all, the swap then pays its routers day by day and never takes the cash under the floor.
|
||||
const low = ev('(()=>{let m=S.cash;for(let i=0;i<60;i++){S.day++;ip6Day(S.day);m=Math.min(m,S.cash);}return m;})()');
|
||||
assert.equal(ev('S.pops.ams.bb.v6'), 1);
|
||||
assert.ok(low >= 50000 - 1e-6, 'the floor held: ' + low);
|
||||
// A swap started by hand is owed too, and every order keeps it aside: the routers order here.
|
||||
ev("S.pops.ams.bb.d=600;delete S.pops.ams.bb.v6;compute();ACT.ip6Go({city:'ams'})");
|
||||
assert.equal(ev('!!S.pops.ams.bb.v6e'), true);
|
||||
const owed = ev('ip6Owed()');
|
||||
assert.ok(owed > 0);
|
||||
assert.deepEqual(J(ev, `(()=>{const r=[];for(const d of [-1,0]){S.cash=50000+1000+${owed}+d;r.push(opsShift().can('routers',1000));}return r;})()`), [false, true]);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('the button keeps what a swap it just started owes for the jobs after it in the same click', (t) => {
|
||||
const { ev, dom, errors } = game(t);
|
||||
ev(AMS_ONLY);
|
||||
ev(FIBER);
|
||||
std(ev, { v6: true, sys: 'roadm' });
|
||||
const plan = J(ev, 'bstdPlan(false).map(j=>[j.k,j.w,j.cost])');
|
||||
assert.deepEqual(plan.map((j) => j.slice(0, 2)), [['v6', 'ams IPv6'], ['sys', 'fra|par']], 'the swap first, then the fiber');
|
||||
const sys = plan[1][2];
|
||||
// A dollar short of both: the swap starts, and the fiber waits rather than spend the swap's routers.
|
||||
ev(`S.cash=${COST.ams + sys - 1};ACT.bstdApply({})`);
|
||||
assert.deepEqual(swapping(ev), ['ams']);
|
||||
assert.equal(ev("S.links.find(l=>l.id==='q').sys"), 'lite');
|
||||
assert.equal(ev('S.cash'), COST.ams + sys - 1);
|
||||
assert.ok(dom.window.document.getElementById('toasts').textContent.includes(`One job done for the build standard, ${ev(`fmt$(${COST.ams})`)}. One thing is still below it`), "the toast: the swap, and the fiber still below the standard");
|
||||
// A dollar more, and the next tap swaps the fiber with the swap's routers still in hand.
|
||||
ev('S.cash+=1;ACT.bstdApply({})');
|
||||
assert.equal(ev("S.links.find(l=>l.id==='q').sys"), 'roadm');
|
||||
assert.equal(ev('S.cash'), COST.ams);
|
||||
assert.equal(ev('ip6Owed()'), COST.ams);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('only while IPv4 is scarce: no row, no jobs and no count in the gentler rules; saves keep the target', (t) => {
|
||||
const { ev, dom, errors } = game(t);
|
||||
std(ev, { v6: true });
|
||||
|
|
|
|||
|
|
@ -135,6 +135,20 @@ test('selective peers will not meet you on an island only a satellite reaches: m
|
|||
ev(`S.peers['${k}@suv']=true;compute()`);
|
||||
assert.equal(ev(`ixSessions('suv').has('${k}')`), false);
|
||||
assert.equal(ev(`!!S.peers['${k}@suv']`), true, 'not torn down');
|
||||
// Glass to the island with no optics yet carries nothing: the satellite is still the way out until it is lit.
|
||||
const d1 = "S.links.find(l=>l.id==='d1')";
|
||||
ev("S.links.push({id:'d1',a:'syd',b:'suv',kind:'df',own:false,sys:'roadm',ch:[],km:Math.round(kmBetween('syd','suv')),sub:true,cable:null,mo:1,trench:'d1',cut:0,day:0,ready:0,spares:false,regen:0});compute()");
|
||||
assert.equal(ev(`linkDown(${d1})`), true);
|
||||
assert.equal(ev("satOnly('suv').bird"), 'is18', 'dark glass is no way out');
|
||||
for (const id of geoNo) assert.equal(J(ev, `peerOk('${id}','pni','suv')`).sat, true, id + ' over dark glass');
|
||||
assert.equal(ev(`ixSessions('suv').has('${k}')`), false);
|
||||
const opt = ev(`Object.keys(OPT).find(o=>optG(o,${d1})>0)`);
|
||||
assert.ok(opt, 'an optic that reaches Suva');
|
||||
ev(`${d1}.ch=['${opt}'];compute()`);
|
||||
assert.equal(ev("satOnly('suv')"), null, 'lit');
|
||||
assert.equal(ev(`ixSessions('suv').has('${k}')`), true);
|
||||
ev("S.links=S.links.filter(l=>l.id!=='d1');compute()");
|
||||
assert.equal(ev("satOnly('suv').bird"), 'is18');
|
||||
// The why, in the island's exchange section, at 360 px.
|
||||
ev("UI.sel={type:'city',id:'suv'};UI.tab='peer';renderAll()");
|
||||
assert.ok(ev("$('panel').textContent").includes(`Won't peer in Suva while a GEO satellite is your only way out (${ms} ms there and back)`));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue