Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
20c70f16e6
17 changed files with 260 additions and 26 deletions
40
.github/workflows/ci.yml
vendored
40
.github/workflows/ci.yml
vendored
|
|
@ -8,8 +8,34 @@ on:
|
|||
permissions:
|
||||
contents: read
|
||||
|
||||
# A newer push to the same pull request makes the older run pointless: cancel it instead of queueing behind it.
|
||||
# Runs on main always finish.
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
# The tests in four parts of about equal time, each on its own runner, each running as many files at once as
|
||||
# it has cores (scripts/test.js; the split comes from tests/durations.json).
|
||||
part:
|
||||
name: test ${{ matrix.part }}/4
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
part: [1, 2, 3, 4]
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- uses: actions/setup-node@v7
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm test -- --shard ${{ matrix.part }}/4
|
||||
|
||||
build:
|
||||
name: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
|
@ -18,10 +44,20 @@ jobs:
|
|||
node-version: 24
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm test
|
||||
- name: Build (not deployed — only releases deploy)
|
||||
run: npm run build
|
||||
|
||||
# The one check to look at, named as before: green only when every part and the build are.
|
||||
test:
|
||||
needs: [part, build]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Every part and the build passed
|
||||
run: |
|
||||
echo "parts: ${{ needs.part.result }}, build: ${{ needs.build.result }}"
|
||||
test "${{ needs.part.result }}" = success && test "${{ needs.build.result }}" = success
|
||||
|
||||
translations:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -13,17 +13,20 @@ All notable changes to this project are documented here. The project follows
|
|||
- Waves between Philippine islands now cost more than waves out of the country: Manila to Cebu costs about twice Manila to Hong Kong.
|
||||
- Manila, Cebu and Davao have more people online, in line with their real populations.
|
||||
- Cable names on the map no longer pile on top of each other when you zoom in. Where short cables crowd together, a name that would cover another is left out, and selecting a city shows the names of all its cables.
|
||||
- The intern's PNI order now counts the traffic the PNI list shows at each POP, so it no longer orders a PNI where a network's own cache boxes already serve most of its traffic (#244).
|
||||
- Find any city with the new 🔍 button in the top bar, or press / on a keyboard (#218). Type a city, a country (in your language or in English) or an exchange, and the map jumps there.
|
||||
- Cities on the map now show how big they are: zoomed out, bigger cities are bigger dots and megacities glow; zoomed in, a city's skyline grows from a hut to a megacity's towers. When cities crowd together, the smaller ones step back to a dot until you zoom in, so the map stays readable, and exchanges you haven't joined are quieter tags.
|
||||
|
||||
## [2.2.0] — 2026-10-31
|
||||
|
||||
- DDoS attacks are realistic now: most are small, the big ones are rare, and their size no longer grows with your network, so a big network is no longer hit by floods larger than the internet's record. Attacks go after one customer (gamers and hosting attract the most) or one city's subscribers, last one to three days, and On-call sees about one a month (#242).
|
||||
- A flood now arrives on every port the internet reaches you on, so more POPs and more exits spread it thinner, and a port it fills slows every customer on it. Flowspec and scrubbing behind a full port can no longer empty it (#242).
|
||||
- RTBH now blackholes only the customer under attack, upstream at your transits, most exchanges and about half your private peers: everyone else is saved and the target goes dark until you withdraw it. The IX blackhole button is part of RTBH now, and RouteScript's `blackhole ddos` does the same.
|
||||
- Each router holds a limited number of Flowspec rules, shown in its POP: every attack takes one rule on each router it enters (a carpet bomb takes four), and when they run out, junk passes that router unfiltered. Bigger routers hold more.
|
||||
- Find any city with the new 🔍 button in the top bar, or press / on a keyboard (#218). Type a city, a country (in your language or in English) or an exchange, and the map jumps there.
|
||||
- Cities on the map now show how big they are: zoomed out, bigger cities are bigger dots and megacities glow; zoomed in, a city's skyline grows from a hut to a megacity's towers. When cities crowd together, the smaller ones step back to a dot until you zoom in, so the map stays readable, and exchanges you haven't joined are quieter tags.
|
||||
- An engaged scrubbing center now pulls the whole flood onto its own ingress and cleans up to its size, so your ports stay clear and only the target suffers if the center is too small. On-demand scrubbing takes half the flood on its first day instead of nothing for two days.
|
||||
- Each router holds a limited number of Flowspec rules, shown in its POP: every attack takes one rule on each router it enters (a carpet bomb takes four), and when they run out, junk passes that router unfiltered. Bigger routers hold more.
|
||||
- The NOC's attack card reads like the flood's path: who is hit, which ports are full, what Flowspec and scrubbing do, the result and the one thing to do now. Optional Auto-RTBH and auto-engaged scrubbing switches sit in the NOC, full ports pulse on the map, and Sandbox can send a test flood.
|
||||
- Flood Season starts at customer level 4, so a 10T scrubbing center is within reach for the terabit floods; a flood you blackhole to save everyone else no longer counts as held.
|
||||
|
||||
- The intern's transit order has a new provider choice, Already connected: it only grows the transit you already buy at each POP, the smallest port first, and never signs a new provider, so several upstreams grow together and no customer's "no Cogentle" gets a surprise (#227).
|
||||
- The intern's PNI order now counts the traffic the PNI list shows at each POP, so it no longer orders a PNI where a network's own cache boxes already serve most of its traffic (#244).
|
||||
## [2.1.0] — 2026-10-31
|
||||
|
||||
- Your backbone now runs a technology you choose: plain IGP, LDP/MPLS, RSVP-TE, SR-MPLS or SRv6. Each step up costs plenty and uses less router CPU: label switching makes traffic that only passes through a POP cheaper for its router, and Auto-TE and RouteScript now need RSVP-TE or higher. Routers only run what they support, so a POP with an older router stays outside the backbone, and mixing vendors at the very top of what their routers can do brings interop failures. Networks that already have Auto-TE keep it exactly as it is.
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "seriesoftubes",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "seriesoftubes",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"jsdom": "24.1.3",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "seriesoftubes",
|
||||
"version": "2.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "A cartoon browser game about building the internet.",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": "node scripts/test.js",
|
||||
"test:timings": "node scripts/test-timings.js",
|
||||
"build": "node scripts/build.js",
|
||||
"i18n:check": "node scripts/i18n-check.js",
|
||||
"i18n:fix": "node scripts/i18n-check.js --fix",
|
||||
|
|
|
|||
39
scripts/test-timings.js
Normal file
39
scripts/test-timings.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env node
|
||||
// Times each tests/*.test.js on its own and writes tests/durations.json (seconds per file), which
|
||||
// `npm test -- --shard i/n` uses to split the files into parts of about equal time.
|
||||
// Run it after adding or growing slow tests; it takes a few minutes. Files run as many at once as the
|
||||
// machine has cores, so absolute numbers vary, but their sizes relative to each other are what count.
|
||||
//
|
||||
// npm run test:timings
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
const { spawn } = require('node:child_process');
|
||||
|
||||
const root = path.join(__dirname, '..');
|
||||
const dir = path.join(root, 'tests');
|
||||
const files = fs.readdirSync(dir).filter((f) => f.endsWith('.test.js')).sort().map((f) => 'tests/' + f);
|
||||
const jobs = Math.max(1, parseInt(process.env.TEST_JOBS, 10) || os.availableParallelism());
|
||||
const out = {};
|
||||
let next = 0, failed = 0;
|
||||
|
||||
function run() {
|
||||
if (next >= files.length) return Promise.resolve();
|
||||
const f = files[next++], t = performance.now();
|
||||
return new Promise((res) => {
|
||||
const p = spawn(process.execPath, ['--test', f], { cwd: root, stdio: 'ignore' });
|
||||
p.on('close', (code) => {
|
||||
out[f] = Math.round((performance.now() - t) / 100) / 10;
|
||||
if (code) { failed++; console.log(`✗ ${f} failed (timed anyway)`); }
|
||||
console.log(`${String(out[f]).padStart(6)}s ${f}`);
|
||||
res();
|
||||
});
|
||||
}).then(run);
|
||||
}
|
||||
|
||||
Promise.all(Array.from({ length: jobs }, run)).then(() => {
|
||||
const sorted = Object.fromEntries(Object.keys(out).sort().map((k) => [k, out[k]]));
|
||||
fs.writeFileSync(path.join(dir, 'durations.json'), JSON.stringify(sorted, null, 1) + '\n');
|
||||
const sum = Object.values(out).reduce((a, b) => a + b, 0);
|
||||
console.log(`${files.length} files, ${Math.round(sum)} s in all; wrote tests/durations.json${failed ? ` (${failed} failed)` : ''}`);
|
||||
});
|
||||
|
|
@ -1,16 +1,62 @@
|
|||
#!/usr/bin/env node
|
||||
// Runs every tests/*.test.js, one file at a time. New test files are picked up on their own, so adding
|
||||
// one never touches package.json (and never conflicts with someone else adding theirs).
|
||||
// Runs every tests/*.test.js, each file in its own process, as many at once as the machine has cores. New test
|
||||
// files are picked up on their own, so adding one never touches package.json (and never conflicts with someone
|
||||
// else adding theirs).
|
||||
//
|
||||
// npm test everything
|
||||
// npm test -- tests/peering.test.js just these files (other arguments go to node --test)
|
||||
// npm test -- --shard 2/4 one of four parts of about equal time (CI runs the four at once)
|
||||
// npm test -- --shard 2/4 --list which files that part holds, without running them
|
||||
// TEST_JOBS=1 npm test one file at a time, as it used to be
|
||||
//
|
||||
// Parts are balanced by tests/durations.json, each file's typical seconds (refresh: npm run test:timings).
|
||||
// A file missing from it counts as a typical one, so a stale list only makes the parts a little uneven.
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
const { spawnSync } = require('node:child_process');
|
||||
|
||||
const dir = path.join(__dirname, '..', 'tests');
|
||||
const root = path.join(__dirname, '..');
|
||||
const dir = path.join(root, 'tests');
|
||||
const args = process.argv.slice(2);
|
||||
const files = args.some((a) => a.endsWith('.test.js')) ? [] :
|
||||
|
||||
const list = args.includes('--list');
|
||||
if (list) args.splice(args.indexOf('--list'), 1);
|
||||
let shard = null;
|
||||
const si = args.indexOf('--shard');
|
||||
if (si >= 0) {
|
||||
const m = /^(\d+)\/(\d+)$/.exec(args[si + 1] || '');
|
||||
if (!m || +m[1] < 1 || +m[1] > +m[2]) { console.error('--shard wants i/n, like 2/4'); process.exit(2); }
|
||||
shard = [+m[1], +m[2]];
|
||||
args.splice(si, 2);
|
||||
}
|
||||
|
||||
let files = args.some((a) => a.endsWith('.test.js')) ? [] :
|
||||
fs.readdirSync(dir).filter((f) => f.endsWith('.test.js')).sort().map((f) => path.join('tests', f));
|
||||
const r = spawnSync(process.execPath, ['--test', '--test-concurrency=1', ...args, ...files], { stdio: 'inherit', cwd: path.join(__dirname, '..') });
|
||||
|
||||
// Longest first, each onto the part with the least so far: parts within a file's length of each other.
|
||||
function part(list, i, n) {
|
||||
let dur = {};
|
||||
try { dur = JSON.parse(fs.readFileSync(path.join(dir, 'durations.json'), 'utf8')); } catch (e) { /* none yet: by count */ }
|
||||
const known = list.map((f) => dur[f.replace(/\\/g, '/')]).filter((s) => s > 0).sort((a, b) => a - b);
|
||||
const typical = known.length ? known[known.length >> 1] : 1;
|
||||
const w = (f) => dur[f.replace(/\\/g, '/')] > 0 ? dur[f.replace(/\\/g, '/')] : typical;
|
||||
const load = Array(n).fill(0), out = Array.from({ length: n }, () => []);
|
||||
for (const f of list.slice().sort((a, b) => w(b) - w(a) || a.localeCompare(b))) {
|
||||
let k = 0;
|
||||
for (let j = 1; j < n; j++) if (load[j] < load[k]) k = j;
|
||||
load[k] += w(f); out[k].push(f);
|
||||
}
|
||||
return out[i - 1].sort();
|
||||
}
|
||||
if (shard && files.length) {
|
||||
files = part(files, shard[0], shard[1]);
|
||||
console.log(`# part ${shard[0]}/${shard[1]}: ${files.length} files`);
|
||||
if (list) { for (const f of files) console.log(f); process.exit(0); }
|
||||
// node --test with no files would run every test it can find: an empty part has nothing to do.
|
||||
if (!files.length) process.exit(0);
|
||||
}
|
||||
|
||||
const jobs = Math.max(1, parseInt(process.env.TEST_JOBS, 10) || os.availableParallelism());
|
||||
const r = spawnSync(process.execPath, ['--test', `--test-concurrency=${jobs}`, ...args, ...files], { stdio: 'inherit', cwd: root });
|
||||
process.exit(r.status ?? 1);
|
||||
|
|
|
|||
|
|
@ -2805,6 +2805,7 @@
|
|||
"notifications.n_min_ago":{"one":"vor {n} Min.","other":"vor {n} Min."},
|
||||
"notifications.nothing_in_the_last_10_minutes":"Nichts in den letzten 10 Minuten.",
|
||||
"notifications.show_all_n":"Alle {n} anzeigen",
|
||||
"ops.already_connected":"Nur bestehende",
|
||||
"ops.annie":"Annie",
|
||||
"ops.annie_d":"Antwortet vom nächstgelegenen Schreibtisch. Liebt billige Ports und volle IXe.",
|
||||
"ops.anycast_annie":"Anycast-Annie",
|
||||
|
|
|
|||
|
|
@ -2803,6 +2803,7 @@
|
|||
"notifications.n_min_ago":{"one":"hace {n} min","other":"hace {n} min"},
|
||||
"notifications.nothing_in_the_last_10_minutes":"Nada en los últimos 10 minutos.",
|
||||
"notifications.show_all_n":"Mostrar las {n}",
|
||||
"ops.already_connected":"Solo los que ya tengo",
|
||||
"ops.annie":"Annie",
|
||||
"ops.annie_d":"Responde desde el escritorio más cercano. Le encantan los puertos baratos y los IX llenos.",
|
||||
"ops.anycast_annie":"Annie Anycast",
|
||||
|
|
|
|||
|
|
@ -2803,6 +2803,7 @@
|
|||
"notifications.n_min_ago":{"one":"il y a {n} min","other":"il y a {n} min"},
|
||||
"notifications.nothing_in_the_last_10_minutes":"Rien ces 10 dernières minutes.",
|
||||
"notifications.show_all_n":"Tout afficher ({n})",
|
||||
"ops.already_connected":"Déjà branchés",
|
||||
"ops.annie":"Annie",
|
||||
"ops.annie_d":"Répond depuis le bureau le plus proche. Adore les ports pas chers et les IX bien remplis.",
|
||||
"ops.anycast_annie":"Annie Anycast",
|
||||
|
|
|
|||
|
|
@ -2803,6 +2803,7 @@
|
|||
"notifications.n_min_ago":{"one":"{n} min fa","other":"{n} min fa"},
|
||||
"notifications.nothing_in_the_last_10_minutes":"Niente negli ultimi 10 minuti.",
|
||||
"notifications.show_all_n":"Mostra tutte e {n}",
|
||||
"ops.already_connected":"Solo quelli già collegati",
|
||||
"ops.annie":"Annie",
|
||||
"ops.annie_d":"Risponde dalla scrivania più vicina. Adora le porte economiche e gli IX pieni.",
|
||||
"ops.anycast_annie":"Annie Anycast",
|
||||
|
|
|
|||
|
|
@ -2803,6 +2803,7 @@
|
|||
"notifications.n_min_ago":{"one":"há {n} min","other":"há {n} min"},
|
||||
"notifications.nothing_in_the_last_10_minutes":"Nada nos últimos 10 minutos.",
|
||||
"notifications.show_all_n":"Mostrar todas as {n}",
|
||||
"ops.already_connected":"Só os já conectados",
|
||||
"ops.annie":"Annie",
|
||||
"ops.annie_d":"Responde da mesa mais próxima. Adora uma porta barata e um IX cheio.",
|
||||
"ops.anycast_annie":"Annie Anycast",
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const INTERNS={
|
|||
// The orders, in the order the panel shows them. pop: can be switched off per POP. cap: default monthly budget, of setup
|
||||
// fees, or (mo) of the running costs the order adds, for caches, which are free to rack but cost rent every month.
|
||||
const OPS=[
|
||||
{k:'transit',i:'📈',pop:1,cap:50000,t:N_('ops.o_transit'),d:N_('ops.o_transit_d'),p:{x:{d:1.5,v:[1.25,1.5,2,3],l:N_('ops.p_x'),f:v=>v+'×'},prov:{d:'cheap',ok:v=>v==='cheap'||(isNet(v)&&!!NET[v].price),l:N_('ops.p_prov')}}},
|
||||
{k:'transit',i:'📈',pop:1,cap:50000,t:N_('ops.o_transit'),d:N_('ops.o_transit_d'),p:{x:{d:1.5,v:[1.25,1.5,2,3],l:N_('ops.p_x'),f:v=>v+'×'},prov:{d:'cheap',ok:v=>v==='cheap'||v==='have'||(isNet(v)&&!!NET[v].price),l:N_('ops.p_prov')}}},
|
||||
{k:'routers',i:'🧠',pop:1,cap:250000,t:N_('ops.o_routers'),d:N_('ops.o_routers_d'),p:{at:{d:80,v:[60,70,80,90],l:N_('ops.p_at'),f:v=>v+'%'},how:{d:'auto',v:['auto','add','swap'],l:N_('ops.p_how'),f:v=>tr({auto:N_('ops.how_auto'),add:N_('ops.how_add'),swap:N_('ops.how_swap')}[v])}}},
|
||||
{k:'caches',i:'📦',pop:1,cap:5000,mo:1,t:N_('ops.o_caches'),d:N_('ops.o_caches_d'),p:{g:{d:5,v:[1,5,10,25,50],l:N_('ops.p_g'),f:v=>fmtG(v)}}},
|
||||
{k:'ix',i:'🔀',t:N_('ops.o_ix'),d:N_('ops.o_ix_d'),p:{}},
|
||||
|
|
@ -137,15 +137,19 @@ const OPS_RUN={
|
|||
for(const c of opsPops('transit')){let ts=S.transit.filter(t=>t.city===c);if(!ts.length)continue;
|
||||
// Thirty days of 95th-percentile-ish history per port; their peaks summed is a safe (high) estimate of the POP's peak.
|
||||
const peak=ts.reduce((a,t)=>a+(t.hist||[]).reduce((m,v)=>Math.max(m,v),0),0);if(!(peak>0))continue;
|
||||
const n=opsProv(c);if(!n)continue;
|
||||
// "Already connected" (#227): only the providers you buy from here, the smallest first, never a new contract.
|
||||
const have=opsP('transit','prov')==='have',n=have?null:opsProv(c);if(!have&&!n)continue;
|
||||
const grow=t=>{const k=t.n||1,up=t.tier+1;
|
||||
if(k<4&&portOk(c,t.tier))return {cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};
|
||||
if(PORT[up]&&portShown(up)&&portOk(c,up))return {cost:PORT[up].setup*k,go:()=>ACT.buyTransit({city:c,net:t.net,tier:up}),w:PORT[t.tier].n+'→'+PORT[up].n};
|
||||
if(k<LAG_MAX&&portOk(c,t.tier))return {cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};return null;};
|
||||
for(let step=0;step<4;step++){const cap=ts.reduce((a,t)=>a+lagCap(PORT[t.tier].g,t.n),0);if(cap>=N*peak)break;
|
||||
const t=ts.find(x=>x.net===n.id);let job=null;
|
||||
if(t){const k=t.n||1,up=t.tier+1;
|
||||
if(k<4&&portOk(c,t.tier))job={cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};
|
||||
else if(PORT[up]&&portShown(up)&&portOk(c,up))job={cost:PORT[up].setup*k,go:()=>ACT.buyTransit({city:c,net:n.id,tier:up}),w:PORT[t.tier].n+'→'+PORT[up].n};
|
||||
else if(k<LAG_MAX&&portOk(c,t.tier))job={cost:PORT[t.tier].setup,go:()=>ACT.lagT({id:t.id,d:1}),w:'+1×'+PORT[t.tier].n};}
|
||||
else{const need=N*peak-cap,ok=PORT.map((P,i)=>i).filter(i=>portShown(i)&&portOk(c,i)),i=ok.find(i=>PORT[i].g>=need)??ok.at(-1);
|
||||
if(i!==undefined)job={cost:PORT[i].setup,go:()=>ACT.buyTransit({city:c,net:n.id,tier:i}),w:'+'+PORT[i].n};}
|
||||
let job=null;
|
||||
if(have){for(const t of ts.slice().sort((a,b)=>lagCap(PORT[a.tier].g,a.n)-lagCap(PORT[b.tier].g,b.n)||transitPerG(NET[a.net],c,!!a.premium)-transitPerG(NET[b.net],c,!!b.premium))){job=grow(t);if(job)break;}}
|
||||
else{const t=ts.find(x=>x.net===n.id);
|
||||
if(t)job=grow(t);
|
||||
else{const need=N*peak-cap,ok=PORT.map((P,i)=>i).filter(i=>portShown(i)&&portOk(c,i)),i=ok.find(i=>PORT[i].g>=need)??ok.at(-1);
|
||||
if(i!==undefined)job={cost:PORT[i].setup,go:()=>ACT.buyTransit({city:c,net:n.id,tier:i}),w:'+'+PORT[i].n};}}
|
||||
if(!job||!X.can('transit',job.cost)||!X.pay('transit',job.go))break;
|
||||
X.did('transit',c+' '+job.w);ts=S.transit.filter(t=>t.city===c);}}},
|
||||
optics(X){const at=opsP('optics','at')/100;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Object.assign(ACT,{
|
|||
toast(esc(tr('ops.fired',{name:nm})),'');after();opsModal();},
|
||||
opsToggle:({k})=>{if(!opsHired()||!own(OPSK,k))return;S.ops.on[k]=!S.ops.on[k];sfx('click');after();opsModal();},
|
||||
opsParam:({k,p})=>{if(!opsHired()||!own(OPSK,k)||!own(OPSK[k].p,p))return;const P=OPSK[k].p[p];let v;
|
||||
if(p==='prov'){const ids=['cheap',...NETS.filter(n=>n.price&&Object.keys(S.pops).some(c=>sellsAt(n,c))).map(n=>n.id)];v=opsCycle(ids,opsP(k,p));}else v=opsCycle(P.v,opsP(k,p));
|
||||
if(p==='prov'){const ids=['cheap','have',...NETS.filter(n=>n.price&&Object.keys(S.pops).some(c=>sellsAt(n,c))).map(n=>n.id)];v=opsCycle(ids,opsP(k,p));}else v=opsCycle(P.v,opsP(k,p));
|
||||
(S.ops.p[k]||(S.ops.p[k]={}))[p]=v;sfx('click');after();opsModal();},
|
||||
opsCap:({k})=>{if(!opsHired()||!own(OPSK,k)||!OPSK[k].cap)return;S.ops.cap[k]=opsCycle(opsCaps(k),opsCap(k));sfx('click');after();opsModal();},
|
||||
opsFloor:()=>{if(!opsHired())return;S.ops.floor=opsCycle(OPS_FLOORS,S.ops.floor);sfx('click');after();opsModal();},
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function opsCard(){if(!S)return '';const last=opsHired()&&S.ops.log[0];
|
|||
<div class="meta">${opsHired()?esc(last?opsEntry(last):tr('ops.l_quiet',{name:opsName()})):opsCanHire()?tr('ops.hire_pitch_short'):tr('ops.locked',{lv:2})}</div>
|
||||
<div class="btns">${btn(opsHired()?tr('ops.standing_orders'):tr('ops.hire_an_intern'),'opsOpen',{},opsHired()?'sm':'pink sm',!opsHired()&&!opsCanHire())}</div></div>`;}
|
||||
const opsEntry=e=>(e.f!==undefined?opsFFLine(e)+' ':'')+(e.r.length||e.f===undefined?opsLine(e):'');
|
||||
function opsVal(k,p){const P=OPSK[k].p[p],v=opsP(k,p);return p==='prov'?(v==='cheap'?tr('ops.cheapest'):NET[v].name):P.f(v);}
|
||||
function opsVal(k,p){const P=OPSK[k].p[p],v=opsP(k,p);return p==='prov'?(v==='cheap'?tr('ops.cheapest'):v==='have'?tr('ops.already_connected'):NET[v].name):P.f(v);}
|
||||
function opsOrderHtml(d){const k=d.k,on=S.ops.on[k],cap=d.cap?opsCap(k):0,sp=S.ops.spent[k]||0,am=Math.round(S.ops.addMo[k]||0);
|
||||
return `<div class="ops-o${on?' on':''}"><div class="ops-h"><span class="ops-i" aria-hidden="true">${d.i}</span><div class="grow"><div class="nm">${tr(d.t)}</div><div class="meta">${tr(d.d)}${k==='caches'?' '+tr('ops.caches_rent',{price:fmt$(CACHE_MO)}):''}</div></div>
|
||||
<button class="b sm ${on?'green':'ghost'}" data-act="opsToggle" data-args='{"k":"${k}"}' aria-pressed="${on}" aria-label="${esc(tr(d.t))}">${on?tr('common.on'):tr('ops.paused')}</button></div>
|
||||
|
|
|
|||
|
|
@ -2804,6 +2804,7 @@
|
|||
"notifications.n_min_ago":{"one":"{n} min ago","other":"{n} min ago"},
|
||||
"notifications.nothing_in_the_last_10_minutes":"Nothing in the last 10 minutes.",
|
||||
"notifications.show_all_n":"Show all {n}",
|
||||
"ops.already_connected":"Already connected",
|
||||
"ops.annie":"Annie",
|
||||
"ops.annie_d":"Answers from whichever desk is closest. Loves a cheap port and a full IX.",
|
||||
"ops.anycast_annie":"Anycast Annie",
|
||||
|
|
|
|||
75
tests/durations.json
Normal file
75
tests/durations.json
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
"tests/any-home-city.test.js": 12.0,
|
||||
"tests/architect.test.js": 20.1,
|
||||
"tests/automation.test.js": 13.8,
|
||||
"tests/backbone-core.test.js": 27.5,
|
||||
"tests/badges-variants.test.js": 20.2,
|
||||
"tests/build.test.js": 1.3,
|
||||
"tests/capacity-deals.test.js": 12.6,
|
||||
"tests/chaos-monkey.test.js": 30.3,
|
||||
"tests/city-size.test.js": 8.5,
|
||||
"tests/compute-idempotent.test.js": 10.4,
|
||||
"tests/ddos-floods.test.js": 22.8,
|
||||
"tests/ddos-model.test.js": 31.7,
|
||||
"tests/eyeballs.test.js": 13.0,
|
||||
"tests/fiber-broker.test.js": 9.7,
|
||||
"tests/find-city.test.js": 9.6,
|
||||
"tests/game.test.js": 42.8,
|
||||
"tests/gameplay-rules.test.js": 42.9,
|
||||
"tests/gangnam.test.js": 12.3,
|
||||
"tests/glowball-sakura-lager.test.js": 15.8,
|
||||
"tests/i18n.test.js": 59.9,
|
||||
"tests/islands-and-arctic.test.js": 13.7,
|
||||
"tests/issues.test.js": 103.0,
|
||||
"tests/language-picker.test.js": 12.5,
|
||||
"tests/latency.test.js": 11.1,
|
||||
"tests/levels.test.js": 16.3,
|
||||
"tests/link-metrics.test.js": 22.0,
|
||||
"tests/link-trial.test.js": 6.4,
|
||||
"tests/load-time.test.js": 102.7,
|
||||
"tests/metric-panel.test.js": 8.1,
|
||||
"tests/modes.test.js": 41.1,
|
||||
"tests/more-cables.test.js": 14.3,
|
||||
"tests/moscow-premium.test.js": 12.0,
|
||||
"tests/networks-list.test.js": 6.4,
|
||||
"tests/new-game-speed.test.js": 10.1,
|
||||
"tests/optic-counts.test.js": 9.7,
|
||||
"tests/own-asn.test.js": 7.9,
|
||||
"tests/pages.test.js": 12.4,
|
||||
"tests/peering-desk.test.js": 13.9,
|
||||
"tests/peering.test.js": 27.6,
|
||||
"tests/perf.test.js": 10.9,
|
||||
"tests/persist.test.js": 16.1,
|
||||
"tests/pni-all.test.js": 12.5,
|
||||
"tests/pni-global.test.js": 17.9,
|
||||
"tests/pni-list.test.js": 15.4,
|
||||
"tests/pnis-and-sold-out.test.js": 11.6,
|
||||
"tests/puzzle-monkey.test.js": 7.9,
|
||||
"tests/puzzles.test.js": 73.3,
|
||||
"tests/regions.test.js": 80.3,
|
||||
"tests/release-story.test.js": 2.8,
|
||||
"tests/report-link.test.js": 12.0,
|
||||
"tests/router-art.test.js": 7.8,
|
||||
"tests/routers-per-pop.test.js": 8.1,
|
||||
"tests/routing-reference.test.js": 11.6,
|
||||
"tests/rules-locked.test.js": 8.4,
|
||||
"tests/rules.test.js": 29.4,
|
||||
"tests/sales-trial.test.js": 33.3,
|
||||
"tests/save-size.test.js": 16.1,
|
||||
"tests/save-slots.test.js": 48.5,
|
||||
"tests/scenarios-playtest.test.js": 113.2,
|
||||
"tests/sea-routing.test.js": 42.6,
|
||||
"tests/services.test.js": 15.7,
|
||||
"tests/specialist.test.js": 14.3,
|
||||
"tests/speed.test.js": 144.6,
|
||||
"tests/standing-orders.test.js": 66.8,
|
||||
"tests/subsea-upgrade-timing.test.js": 13.5,
|
||||
"tests/supply.test.js": 11.0,
|
||||
"tests/tier1-cone.test.js": 19.8,
|
||||
"tests/useless-subsea-upgrades.test.js": 7.2,
|
||||
"tests/utilities-caches.test.js": 9.5,
|
||||
"tests/utilities.test.js": 15.6,
|
||||
"tests/weekly-architect.test.js": 28.7,
|
||||
"tests/weekly-puzzle.test.js": 145.0,
|
||||
"tests/weekly-scenario.test.js": 54.4
|
||||
}
|
||||
|
|
@ -596,6 +596,30 @@ test('#228 the intern names the exchanges it peered at, even one that shares its
|
|||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('#227 transit "Already connected" grows the providers you have, the smallest first, and never signs a new one', t => {
|
||||
const { ev, errors } = game(t, "ACT.buyTransit({city:'fra',net:'ntt',tier:1});compute()");
|
||||
hire(ev); on(ev, 'transit', { x: 1.5, prov: 'have' });
|
||||
const capOf = net => ev(`(()=>{const t=S.transit.find(x=>x.city==='fra'&&x.net==='${net}');return lagCap(PORT[t.tier].g,t.n)})()`);
|
||||
const c0 = capOf('cog'), n0 = capOf('ntt');
|
||||
assert.equal(c0, n0, 'two equal ports to start');
|
||||
ev('for(const t of S.transit)t.hist=[100]'); shift(ev);
|
||||
assert.equal(ev("JSON.stringify(S.transit.filter(t=>t.city==='fra').map(t=>t.net).sort())"), '["cog","ntt"]', 'no new provider');
|
||||
assert.ok(capOf('cog') > c0 && capOf('ntt') > n0, 'both grew, not just one');
|
||||
assert.equal(capOf('cog'), capOf('ntt'), 'evenly, smallest first');
|
||||
// a POP whose only upstream is not the cheapest never gets the cheapest added (Cheapest would buy Cogentle there)
|
||||
ev("ACT.buildPop({city:'ams'});S.pops.ams.rgen=1;ACT.launchBB({city:'ams'});ACT.buyTransit({city:'ams',net:'ntt',tier:1});compute()");
|
||||
assert.equal(ev("cheapestTransit('ams').id"), 'cog');
|
||||
ev("for(const t of S.transit)t.hist=[400]"); ev('S.day++'); shift(ev);
|
||||
assert.equal(ev("JSON.stringify(S.transit.filter(t=>t.city==='ams').map(t=>t.net))"), '["ntt"]');
|
||||
// the setting cycles through it, reads "Already connected" and survives a save
|
||||
ev("S.ops.p.transit.prov='cheap';ACT.opsParam({k:'transit',p:'prov'})");
|
||||
assert.equal(ev("opsP('transit','prov')"), 'have');
|
||||
assert.equal(ev("opsVal('transit','prov')"), 'Already connected');
|
||||
ev('S=migrate(JSON.parse(JSON.stringify(S)))');
|
||||
assert.equal(ev("opsP('transit','prov')"), 'have');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('#244 the PNI order counts the traffic the PNI list shows at that POP, not what cache boxes there already serve', t => {
|
||||
const { ev, errors } = game(t, "ACT.buildPop({city:'ham'});for(const c of ['fra','ham']){S.pops[c].rgen=mainRG(4);S.pops[c].routers=6;if(!S.pops[c].bb)ACT.launchBB({city:c});S.pops[c].bb.d=CITY[c].P*0.9;}UI.pending={a:'fra',b:'ham'};ACT.buildLink({tier:3});closeModal();ACT.buyTransit({city:'fra',net:'cog',tier:3});ACT.buyTransit({city:'ham',net:'cog',tier:3});for(let i=0;i<6;i++)S.caches.push({id:'nfx'+i,city:'ham',net:'nfx'});compute()");
|
||||
// Hamburg's users want a lot from NetChill, but its cache boxes there serve most of it: little is left for a PNI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue