Commit graph

676 commits

Author SHA1 Message Date
jvanvik
08eb349d87 Merge upstream: POP standards, latency contracts, device transfer, typed links and NOC downgrades (3.4.0, 3.5.0)
Some checks are pending
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / gate (push) Waiting to run
Container image / test (push) Blocked by required conditions
Container image / publish (push) Blocked by required conditions
Conflicts, file by file:
- CHANGELOG.md: the fork's Unreleased bullets on top; 3.5.0 and 3.4.0 exactly as upstream has them.
- src/i18n/en.js, site/i18n/{de,es,fr,it,pt}.js: merged label by label, sorted; the labels each side dropped stay dropped.
- src/agent/10-domains.js, 30-docs.js, 40-read.js: both sides' enums, state docs and tables (popStd as the build standard, popTiers, ip4, mp).
- src/agent/20-commands.js: the fork's wording on accept and upRouter, upstream's acceptFix, utilityKitAll/New and pt*; theme, session and transfer acts in the local table.
- src/game/60-features/80-new-game.js: ip4, rgen and mp next to popTiers.
- src/game/80-simulation/29-route-core.js, 30-compute.js: the route core takes both SATN and the spill tiers (TT).
- src/game/80-simulation/40-billing.js: upstream's gulfPair and borderShut; linkCut() is built on borderShut, linkDown() keeps express and satellite.
- src/game/80-simulation/50-sanitize.js: PNI bundles up to PNI_LAG_MAX next to the fork's link kinds; popStdSanitize then ptSanitize; mpSanitize then lcSanitize.
- src/game/80-simulation/75-customer-lifecycle.js: clGrow() stops at a type's most (#137) and at an IPv4 block that is not free (#150).
- src/game/90-actions/60-links.js: rmLink keeps the express guard and moves on to the next parallel link (#119).
- src/game/90-actions/85-routing-and-routers.js: rmRouter checks the PNIs on its routers (#323), upRouter keeps own().
- src/game/90-actions/89-game-and-settings.js: the menu keeps the build standard and session tiles and gains Send to another device.
- src/game/93-ui/40-hud-and-panels.js, 70-link-panels.js: offers show both the IPv4 note and Buy and sign; link headers name their cities, the closed-border section reads in dark mode; the express count stays.
- src/game/93-ui/50-city-panel.js: the teleport section and Link to a city.
- src/game/94-dashboard/40-connections.js: upstream's per-table next port size replaces the fork's own 400G guard.
- src/game/94-dashboard/90-noc-window.js, 96-map/95-clicks.js, 99-loop.js: both sides' acts and boot steps.
- src/styles/40-modal.css: the dark-mode tag tokens and the transfer textarea.
- tests/mcp-commands.test.js: both sides' sample args.

Interaction fixes:
- POP standards and the build standard: a POP marked as a kind keeps its kind's routers (ptKind). The build
  standard's router jobs and the intern's model swaps leave it alone; every other target still applies. Both sheets say so.
- Spill tiers: pathMs() fills a path's ground latency and satellite edges too, so a tier's detour costs users its
  latency (it went uncharged before).
- Send to another device: a session network goes by the session's own #mp= link; its save file is called a copy.
- Buy and sign (#241) does not buy for an offer whose IPv4 block does not fit.
- Dark mode: the closed-border title and the renewal ticks use the dark-aware red (upstream's #292 test follows).
- Server-run tables: the new acts classified (pt*, acceptFix and utilityKitAll quote their cost); mp-sim fixtures
  written again with tests/lib/mp-sim-fixtures.js.

Review fixes:
- POP standards: ptSave, ptApply, ptPlan, ptAll and popStdSet find a POP with own(), so 'toString' is no POP (also
  decomToggle, decomGo, dkStay).
- Server-run envelope: an arg value that names anything on Object.prototype is refused, in args, drafts and
  ctx.win.ui.
- Decommissioning a POP drops its POP-standard mark, so live state stays what a reload makes of it (the T2 gate
  refused later pt* acts).
- acceptFix, ptApply, ptAll and utilityKitAll take a quote within 1% (quoteNear), like utilityKit and bstdApply:
  router prices drift daily.
- The transfer paste box reads in dark mode (--text, as input.t).
- A session's #mp= link pasted under From another device opens it (saved, then loaded again with it), in MP builds.
- The express and satellite circuit panels name their cities as links (#196); a circuit shows the closed-border
  section (#329).
- CHANGELOG: the fork's 400G connections bullet goes (3.5.0 ships it); bullets for POP kinds, the session link and Buy
  and sign's IPv4 check.
2026-11-12 00:52:42 +01:00
Frederic Jung
9c26d03952
Conferences stop notifying once you are Tier 1 (#101)
After the Tier 1 goal, the 30-day reminders, the report (and its coin sound)
on the day and the sales engineer's booking notes are no longer shown or
logged. Registering, sponsoring, the glow, raffles and capacity deals work as
before, and the Deals tab still lists conferences.

Fixes #101
2026-11-11 18:37:18 +01:00
Frederic Jung
2b8bd1c402
Start a link by typing the city it goes to (#343)
A POP's Infra tab gets Link to a city: it opens the city finder in link
mode, which offers only cities a link from there could end in, and picking
one (or Enter) opens the same link window as dragging between the two on the
map. Much easier than finding a far-away city on a crowded phone screen.

Fixes #343
2026-11-11 15:44:38 +01:00
Frederic Jung
c52e7c7747
Downgrade and chase connections from the NOC dashboard (#336)
The Connections tab now has the POP panel's shrink buttons next to the
upgrades: a downgrade to the next smaller port for transit, PNIs and IX
ports, one LAG member less (also for NNIs), and Chase it for a PNI that is on
order or waiting for a bigger port. Same actions and conditions as the panel;
the NOC pop-out window runs them in the game.

Fixes #336
2026-11-11 15:44:28 +01:00
Germain Carré
e2b3615a19
Keep the Connections list working with 400G fabric ports (#342) 2026-11-11 15:35:50 +01:00
Frederic Jung
e27e9e3066
Keep hand-listed alien waves on the market (#340)
With the capacity market selling alien waves (or pairs), its daily pass set
every fiber's listing to what the thresholds allowed: 128 waves listed by hand
came back as 96 (after the 25% kept back), or were taken off entirely when
the route's demand was below the minimum or the price below the floor.

A listing now remembers how much was listed by hand (l.list.hw / hp). The
broker lists its own share on top, capped at what the fiber has free; sales
use up the broker's share first; switching a product or route off keeps the
hand-listed part. cmClean() checks the new fields, so old saves load as before.

Fixes #340
2026-11-11 12:06:23 +01:00
Frederic Jung
1ccdda171b
Send a network to another device through the share sheet instead of QR codes (#263)
QR codes do not scale: a played network takes several, a big one dozens. The
save file now goes through the device's own share sheet (AirDrop, Quick Share,
a chat with yourself, email), whatever its size, and opens on the other device
with Import a save. Chromium refuses to share .json files, so there the same
file goes as .txt, which Import a save now takes too. The whole-network link
stays for copy and paste. The file is prepared before the tap, because a share
sheet only opens straight from a user's gesture.
2026-11-10 13:19:00 +01:00
Frederic Jung
79426f7a00
Move a network to another device with QR codes or a link (#263)
No server and no account: the network travels gzipped in the fragment of a
link, which browsers never send anywhere. One link carries all of it, to copy
or share; QR codes carry it in parts that a phone's own camera app opens one
after another, and the receiving page collects them in any order, then imports
the network like a save file. To keep the codes few they leave out the charts'
history and the news log (a year-old network: 4 codes instead of 10); the link
carries everything. The QR encoder is a small built-in one, checked against the
reference implementation for every mask.
2026-11-10 12:31:40 +01:00
Frederic Jung
e8cbb9b440
Merge branch 'claude/latency-contracts' into trial
# Conflicts:
#	.claude/skills/gameplay-rules/SKILL.md
#	CHANGELOG.md
#	tests/day-steps.test.js
#	tests/route-fuzz.test.js
2026-11-10 09:36:11 +00:00
Frederic Jung
12ce66b33a
Merge remote-tracking branch 'origin/main' into claude/latency-contracts
# Conflicts:
#	CHANGELOG.md
2026-11-10 09:33:49 +00:00
Frederic Jung
d2e642adb9
Merge remote-tracking branch 'origin/main' into claude/bulk-actions 2026-11-10 09:23:29 +00:00
Frederic Jung
a98e34711b
Keep puzzles and scenarios on plain shares; per-city share sums; tests follow the new traffic split
Puzzles, Architect runs and scenarios keep the table's split (their references and
pars were made with it). Week 2026-W44's reference now wins on day 185 (offers draw
from the wider campus list). The cache planner sums each city's own split.
2026-11-10 08:37:31 +00:00
Frederic Jung
69cdb3e372
Grow sideways in the late game: localised eyeball traffic, spread AI campuses, PNIs by router, spill tiers
Traffic to networks that sell to homes now starts where their users live (#48),
giant AI circuits come from campuses in 34 metros and less often from crowded
ones (#61), a PNI bundles eight members per router up to 32 (#323), and
RouteScript spill tiers move overflow onto detours within a latency budget (#136).
2026-11-10 07:25:21 +00:00
Frederic Jung
d8223bad04
Tests: route fuzz compares the customer catalog, day steps waits longer for its trial
A new customer type changes which offers a seeded late-game draws, so the
fuzz games cannot play move for move like main (as with a world change), and
the sales-trial race in day-steps comes on day 46 instead of before day 20.
2026-11-10 07:14:36 +00:00
Frederic Jung
32b0b282f8
Bulk actions for the late game: POP standards, kit everywhere, buy on signing, network search
- POP standards by kind (micro, medium, regional hub), one button per POP and one per kind in Utilities (#315)
- Redundancy kit at every POP from Utilities, and in the intern's template (#317)
- Offers that need a generator, second router or second site can buy it and sign (#241)
- The intern's Light more fiber order can leave new fiber dark (#316)
- Search and connected-only filter for a POP's transit, exchange, PNI and cache lists (#199)
- The link panel moves on to the next parallel link after a decommission (#119)
2026-11-10 07:03:57 +00:00
Frederic Jung
e51510a115
Strict latency contracts: big late-game customers who pay for a latency SLA (#137)
From customer level 7, low-latency wholesale routes ask for 1.6 or 3.2 Tbps
between two cities with the latency limit trading links already have
(REQS.lat on the circuit latency compute() measures). They pay about three
times a hyperscaler DCI per Gbps on the same route, never grow past 3.2 Tbps,
and every day over the limit after the provisioning grace credits a day's fee
and costs extra patience. New rule F9 in gameplay-rules.
2026-11-10 06:56:02 +00:00
Frederic Jung
d086fcbd92
Show traffic, price per Gbps and path terms on renewal haggles; link panel city names open the city
Renewal haggles in Deals now show booked and served Gbps (sites for SD-WAN), the
price per Gbps now and asked, and the latency limit and path terms the customer
signed for, each ticked as the network stands today (#292).

The two city names in the header of wave, dark fiber and virtual circuit panels
are buttons that open that city (#196).
2026-11-10 06:51:34 +00:00
Frederic Jung
36629195cc
Say why a link is down when a closed border took it (#329)
The Gulf spat and Russia's sovereign internet drill take links down in
linkDown(), and the map draws them broken, but the link panels only
explained cuts and incidents, so a Doha–Abu Dhabi wave looked healthy
in its panel with no way to fix it. The panels now show a 'Border
closed' section with the days left, and the wave and dark fiber modals
warn before leasing across the closed Qatar border.
2026-11-10 02:02:10 +00:00
jvanvik
9601345201 Review fixes for the small-fix batch
Some checks failed
CI / plan (push) Has been cancelled
CI / build (push) Has been cancelled
CI / translations (push) Has been cancelled
CI / part (push) Has been cancelled
CI / test (push) Has been cancelled
CI / timings (push) Has been cancelled
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.
2026-11-09 23:43:53 +01:00
jvanvik
417160f383 Build standard: a Broadband: IPv6-only row, rolled out by the button and the intern (#150)
The owed follow-up to IPv6-only broadband (next-session item 4). A new POP
target, v6, shown and planned only while IPv4 is scarce (rule ip4): bstdPlan()
makes a job per broadband city still on dual stack (ip6Todo()), the most
dual-stack homes first (the most behind CGNAT, the most addresses freed), each
calling ACT.ip6Go(). Its price is the whole swap (ip6Cost(), the city panel's
own figure); its mo is the IPv4 bill's change, counted one city after another
on a copy so the sum is all of them done.

ip6Go() pays nothing at the start (the routers are paid day by day), so these
jobs are marked later: the button and the std order start one only with the
whole swap in hand on top of what the swaps under way still owe (ip6Owed(),
X.can's new owed argument for the floor), and the order counts the whole swap
against its month's budget (not in what the shift paid up front). The button's
toast counts started swaps whole, as the quote did.

The sheet shows the row and a note only while ip4On(); bstdLine() counts it;
the MCP docs (bstdSet, bstdApply, popStd) name it. Strings in all six
dictionaries. Tests: tests/bstd-ipv6-only.test.js (order and price, the
button, budget and floor, rule off, saves, the sheet at 360 px portrait and
landscape in every language).
2026-11-09 23:02:19 +01:00
jvanvik
02b6c24d7b Intern: write the shift log as a reload keeps it, and drop opsTidy()
The day's log named every order that ran out of budget, and the week's tally
got an empty list for a job with no place (a rushed repair, a route server);
a reload keeps three places a kind and no empty lists, so opsTidy() trimmed
live state after every shift. The shift now writes it that way itself: the
broken orders are cut to three ([...X.broke].slice(0,3)), and W.wh[k] is made
only for a job that names a place. tests/canonical-state.test.js passes
without opsTidy() (a year of the big network with everything on, checked
every day), so it is gone.
2026-11-09 23:02:05 +01:00
jvanvik
286ae48207 Build standard: never take a fiber dark under a customer's wave; the intern no longer skips leased pairs and IRUs
The build standard's Apply could swap the line system on a fiber that carries a
sold alien wave or a Lambda Bazaar managed wave, taking those customers dark for
a day with no warning. The intern refused any fiber with any customer on it,
leased pairs and IRUs included, though a line-system swap cannot touch them.

One helper next to fiberOk(), dfWaveCust(), says whether a customer rides the
fiber's line system (every fiber type but glass: dfpair, pairs, capfib), and both
bstdDarkOk() and opsDarkPre() use it. bstdPlan() holds such a fiber (J.held) and
lists it in J.wv; the sheet and the MCP quote give that reason. The link
panel's own upgrade button (ACT.upSys) still swaps with a warning toast.
2026-11-09 23:02:02 +01:00
jvanvik
1f76639b8f Selective peers will not meet you where a satellite is your only way out (#83)
An island or remote town that only satellite circuits join to the rest of
your network (satOnly: no built wave, fiber, cable or pie dish there, its
fastest circuit otherwise) is a place many selective networks will not
peer: they would hand you traffic for your whole network to haul through
orbit. Like remote peering, the verdict is stable per network (a hash):
60 in 100 selective networks refuse a GEO hop, 15 in 100 a MEO one, and
every network that minds MEO minds GEO too. It is judged on what is built,
never on today's cuts, so the single-spur trap does not also pause your
peering mid-outage.

peerOk refuses new IX sessions and PNIs there with one line naming the
orbit and the circuit's round trip; ixSessions leaves an existing session
out while the island is satellite-only, without deleting it from S.peers,
so it carries again once a wave or cable is lit. Existing PNIs stay. No new
state, nothing for saves.
2026-11-09 23:01:51 +01:00
jvanvik
ae78e82ddb Express lightpaths: regen cards for their channels, and dirty connectors dim them (#58)
A regen site added to a fiber that already carries expresses now charges a
regen card for every express channel in that glass, as it does for the
fiber's own channels. One helper, regenAddCost(), prices it for the action,
the fiber panel's button and the MCP dry-run quote, so the three agree.
Lighting an express over existing regen sites already paid its cards
(xpCost); only adding a site later was free for them.

A dirty connector on a fiber is in the glass, so it now dims the expresses
riding that fiber by the same factor (capOf multiplies xpG by xpGlassF over
the express's fibers), and the express's panel names the fiber. The other
link-degrading incidents (MTU mismatch, microbursts, a marginal optic's CRC
errors) belong to the fiber's own routers and optics, which an express
bypasses, as the optic-failure incident already treats them, so they leave
expresses alone. The incident marks the connector with loss.glass=true;
sanitize keeps the flag only when it is true, so an old save's loss loads
as router-side, as it behaved before. A fiber that only carries expresses
can now get the dirty connector too (never the router-side variants), like
the backhoe and amp-hut incidents already find it.
2026-11-09 23:01:46 +01:00
jvanvik
2dc8274f34 The no-cable hint in the link window names the satellite (#83)
Upstream 3.3's hint for a coast where no subsea cable lands (#321) said only a
cable of your own could get to Iqaluit or Adamstown, and left satellites out at
Pevek, though a teleport reaches all three. Once teleports are on sale (level
2) and a bird you may rent from sees the city, the 'own' case says a satellite
circuit or a cable of your own can get there (a new string), and every case
adds the satellite line: the city panel's 'Your teleports can reach' with a
button per teleport to its order sheet (satOpen), or where to build one. Not
in puzzles, and not before level 2, like the rest of the satellites.
2026-11-09 23:01:43 +01:00
jvanvik
7930d332f1 IPv4 notices in the notifications open the address space (#150)
The IPv4 toasts (CGNAT, out of IPv4, a renewal that could not grow, an
IPv6-only city done) carry an Address space button, but openOf() did not know
ip4Open, so their line in the NOC's notifications had no Open. It now maps to
a log target of its own, 'ip4', like 'ops' for opsOpen: Open runs ip4Open, the
bank scrolled to its Address space (just the bank if IPv4 is off since).
sanitize() keeps the new target. ip4Open is also on the NOC window's list of
actions it may run in the game, should a dashboard tab ever draw it.
2026-11-09 23:01:43 +01:00
jvanvik
27ffa33d7c Dark mode: red text and the market's heat tags read on the dark panels (#80)
Red warning text used var(--bad), 3.8 to 4.8:1 on the dark cards and tints.
Every text use now takes var(--tx-red,var(--bad)): light mode keeps --bad,
dark gets #FF8E9B (5.65:1 or better on paper, soft and every tint). --bad
stays the fill under white letters (buttons, counters, bars).

Lambda Bazaar's Hot and Cool tags kept their light pastel chips at night.
They now use the dark tints (--tint-o, --tint-b) with --tx-amber and a new
--tx-blue, keeping the same colours by day.

The dark-mode test checks the tags, the text tokens on every dark card, that
no tag keeps a bare pastel fill, and that no red text in --bad is left in the
styles or the game's markup.
2026-11-09 23:01:43 +01:00
jvanvik
3e30621684 Test timings of the server-run engine's tests and the built-ins test
Some checks failed
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / gate (push) Has been cancelled
Container image / test (push) Has been cancelled
Container image / publish (push) Has been cancelled
Seconds per file from a full npm test --timings run on this machine
(every file at once), for the shard split.
2026-11-09 22:22:40 +01:00
jvanvik
77f4035853 Six actions look up their city among the network's own POPs only
launchBB, addSite, addRouter, upRouter, addGen and myIxUp read S.pops[city]
(S.myIx[city]) without checking the key, so a city named '__proto__' found
Object.prototype and wrote to it (launchBB left Object.prototype.bb behind,
and every for…in after it saw that), and 'constructor' spent cash on
statics of Object. Only an MCP agent or a request to a server-run network
can send such a city; the page's own buttons never do. Each now takes the
POP only when it is an own key (own(), as sanitize() does).

tests/act-args-builtins.test.js sends every action an agent may send with
'__proto__', 'constructor' and 'prototype' in each usual arg and checks
that the page's built-ins stay as they were; without this change it finds
exactly these six. No state, strings or saves change.

Performance on the big network against 61e31c5 (npm run perf, headless,
median of 15 runs, ms):

| What | Base | This | Change | p |
|---|--:|--:|--:|--:|
| Routing: compute() | 25.4 | 28.1 | +11% | 0.90 |
| One game day: dayTick() | 27.8 | 28.7 | +3% | 0.77 |
| An action: after() | 1.82 | 1.77 | -3% | 0.77 |
| Side panel and left list | 58.8 | 57.1 | -3% | 0.013 |
| NOC dashboard tabs | 95.9 | 95.9 | +0% | 1.00 |
| Map at three zoom levels | 3.49 | 3.30 | -6% | 0.53 |
| The NOC intern's shift: opsDay() | 3.45 | 3.52 | +2% | 0.80 |

Routing results are identical to the base; no slowdowns beyond noise.
2026-11-09 22:18:56 +01:00
jvanvik
9597d89079 Server-run engine: review fixes
The review of track T2 found these; each has a test in tests/mp-sim-*.

- Built-ins: an arg, array entry or draft that is '__proto__', 'constructor'
  or 'prototype' is refused by the envelope check and again by the realm
  (free text may still say them). After every realm call the trampoline
  checks the realm's built-ins against what they were at load; a realm
  whose built-ins changed answers {srvErr, polluted} and is replaced from
  the worker's mark like one that timed out. S as one JSON per key is a
  null-prototype object, so the epilogue's for…in never reads a prototype.
- A realm that cannot be built again is never used again: rebuild() tries
  once more without the packed R, and when that fails too the network is
  dropped (NO_REALM), and the engine tells the host (opts.onLost).
- A mark that fails or runs out of time changes nothing: it clears the old
  mark first, the realm is built again from its own save, never from an
  older mark, and the reply names the mark. A day rebuilds only from its
  own attempt's mark.
- A day whose alone or nets is not a list is refused whole (ERR); a throw
  in a load or day step answers that call, never ends the worker.
- An exit counts against the session the worker was running (the worker
  says so before each job and step), else as before. Workers of their own
  are capped (opts.maxOwn, 4): past that a session is given up.
- A worker that exits before it is ready is started again after a pause
  that doubles; after 5 in a row every call answers SIM_DOWN.
- The game text is read and compiled once, in createEngine: a src/ that
  does not compile throws there, and every worker, also one started after
  an exit, runs the game engine.simId names.
- A damaged route memory never breaks a save that loads (routed from
  nothing, logged), and only a server network loads (S.mp.sim, Normal).
- Routing memory (UI.rk, UI.rkR) is kept by the in-place restore and
  carried in rt (rk), so a reloaded or rolled-back network skips the same
  routings as the one that kept going.
- A fresh realm takes over the fx of the one it replaces (the mark's after
  a failed call, all of them after a read): badges, windows and toasts
  waiting for a page are not lost to a timeout.
- Windows: the stand-in elements answer querySelector from what was
  written (a [data-x] marker) and have a working classList, never the
  inert proxy that said every window is open. A request's ctx may name the
  open window, ctx.win = {k, ui} (mp-sim-acts.js WINDOWS: bstd, routing,
  charter, ops, pie), with the view state only the page holds (the
  intern's POP, the pie window's tab and POP), checked in the realm. This
  is an addition to the contract of design 5.8 that the page (T4) sends.
  The stand-in is hidden again after an act.
- xpBuild's via is a TEXT arg (256): a six-span express fits.
- actDone, askDone and pulled carry ms, the worker time of the call;
  engine.mem() and engine.has(code, nid) are public; prefs() passes a
  realm's err through; after close() every call rejects CLOSED.
- The fake engine fails as the engine does (NO_REALM, ERR, a load without
  a save, a day of an unknown session or naming an unloaded network,
  GAVE_UP, SIM_DOWN, CLOSED, onLost), its greet says its one-shots once and
  never 'told'; a test runs the same edge calls on both.
- SIM_DRAFT is built from DRAFT_TYPES.
2026-11-09 22:16:52 +01:00
jvanvik
3b8c331556 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.
2026-11-09 20:47:42 +01:00
jvanvik
72f31e809b Server-run engine: every call answers, and a crashing load gets its own worker
A load whose networks did not all check out could hang its session for good, a
worker could spin on a job it could never run, a session whose load crashed its
worker never got a worker of its own, and an unload followed at once by a load
(a language change) lost the session's place or never answered. Fixed:

- Worker: a load call is checked whole before it touches anything. One that
  names no network, or one twice, is refused (ERR) and every realm stays as it
  was. A network without a save now answers err (broken) like one whose save
  does not load, and the others load. A network marked loading with no load
  under way answers NO_REALM instead of waiting for ever.
- Worker: it goes on only while something ran. If a job were ever still
  waiting when nothing could run, it is answered (ERR, logged) rather than left
  pending, and the worker no longer busy-loops on it.
- Engine: a session is on its worker from the moment its load is sent. A worker
  exit counts against the sessions whose load was under way (else against every
  session it held), so a save that crashes its worker gets a worker of its own
  after two exits and is given up (GAVE_UP) after a third, while the sessions
  that only shared the worker lose their realms but not their place in the pool.
  Loads under way count for placement.
- Engine: an unload no longer drops the placement of a session whose next load
  is under way, so an unload and a load sent back to back stay on one worker; a
  worker of its own is retired only when no call is pending on it (a pending
  call there used to never settle).
- Engine: a message that cannot be sent rejects (ERR) and leaves nothing pending.
- Realm: a what-if puts UI.hotMap back too (teSlop's trial left its own).
- Realm: a network in a language this server has no dictionary for plays in
  English, as the page does, instead of loading broken.

Tests (tests/mp-sim-engine.test.js): a malformed load changes nothing and every
call of the session answers within 3 s, with the workers idle after; an unload
and a load back to back keep the session on its worker; a session whose load
takes its worker down twice gets a worker of its own, then GAVE_UP, while the
bystander is never blamed; an ask leaves UI.hotMap as it was; a network in an
unknown language loads in English. Each fails on the engine before this change
(the worker's alone: the hang; the engine's alone: the placement and the exits;
the realm's alone: teSlop's hotMap and the language).

The two drafts no test played are played now (tests/mp-sim-acts.test.js): a
premium border crossing into Hong Kong (buildLink with cnPrem) and the AI's own
script deployed as it wrote it while it drops most of the traffic (teDeploy with
slop, on a small network with one capped transit port), each compared byte for
byte with the page's clicks, and both read in the DRAFTS check (nothing is left
unplayed).

Runs, each file alone under an 8G cap: mp-sim-engine 16/16 (11.6 s),
mp-sim-contract 8/8, mp-sim-acts 5 + 1 todo (10.9 s), mp-sim-determinism 6/6
(53.4 s).
2026-11-09 20:47:31 +01:00
jvanvik
c5c7ea9508 Server-run engine: a restored network plays on exactly as before
A network loaded from its checkpoint drifted from the one that never stopped:
after a checkpoint on day 1, 2 or 5 its R differed at once (bizDem at Ashburn
6426 against 26, then cityDem, citySrv, tNet), and from the next day S too
(cash, eyeball growth). Three causes, each shown by a probe:

- R after a day is the R of the day's last routing, made before the day's end
  changed S (customers who left or signed, moods, bills, transit history) and
  routed from the memory of the R before it. srvLoad routed the saved S again
  from R's own memory: another R, which the next day reads (sfOf for eyeball
  growth, the peering share). Every compute() in the realm now keeps, for the
  R it makes, S as it routed it (one JSON per top-level key, 0.8 ms big) and
  the memory it started from. rt carries that routing point (pt: the memory,
  the keys that changed since, the keys S did not have then), and srvLoad
  routes that S again from it: the same R, byte for byte. The old restore test
  checkpointed after day 10, where a failure or event routed again at the end
  of the day and nothing changed after it: it passed by luck.
- The sales desk's tried offers (UI.slTried, an offer that did not fit waits a
  week) live outside S. A fresh realm forgot them and the desk tried other
  offers. rt carries them (sl); a day mark keeps them and the in-place restore
  after a throw puts them back (before, a parsed S dropped them).
- A save and a reload give some keys back in another key order (a customer's
  defaults go last, the intern's week tally in its own order), and the week's
  report lists the tally in that order. At a checkpoint rt carries the live
  text of each such key (ord, srvGate's round trip, about 8 ms), taken on load
  only where it holds what sanitize() made of the save. A fresh realm after a
  timeout takes the mark's own text the same way (live).

The plain game drifts across a save and a reload too (jsdom: from the first
day after it; the page routes a reloaded S with an empty R and keeps no desk
memory): a game property, so the engine carries what is missing.

The envelope keeps its shape {s, uidN, rt, last, day}; rt keeps R's own route
memory, so an older checkpoint loads as before (close, not exact). Big network:
the checkpoint grows from about 42-49 KB gzip to 54-79 KB (rt 7-29 KB; the
whole R would be 375 KB), srvSave from 2-2.5 ms to 7-8 ms, a load by one
routing. A day with its mark costs the same (big 39.8 -> 37.8 ms, busy
90.0 -> 88.8 ms, within noise: the day mark joins per-key JSON now, which pays
for the routing point).

Tests: the restore test checkpoints after days 1, 2, 5 and 10 of the scenic big
network and of the same network busy (intern on every order, the desk signing
on its own, failures, events, an attack), those after days 2 and 10 right after
an action and a what-if (sent to the copies too), each compared byte for byte
at once and 10 days later (SIM_LONG: after every day to 30, 60 checkpoints). It
fails on the old engine, and without any one of the three parts. The retry test
plays busy networks (fails without the desk memory in srvRestore). The market
checkpoint compares bytes too; canon() is gone.
2026-11-09 20:16:38 +01:00
jvanvik
065c922287 Server-run play, part 2: the engine
The engine that runs every network of a server session (server-sim design,
section 4): each network in its own vm realm, realms in a small pool of
worker threads, a promise API for the session host. Nothing uses it yet;
the plain build and the game are unchanged (no file under src/).

- scripts/lib/mp-sim-realm.js: one network in a DONT_CONTEXTIFY realm
  running the plain page's game (never the MP page's client folder), with
  recording DOM stand-ins, no-op timers that count, and the srv... calls:
  load from a checkpoint (route memory seeded, then routed), begin a new
  network, marks and restores, the day as a page runs it, the action
  pipeline with drafts, arming, the sanitize gate and rollback, what-ifs
  that put S, R, the dice and uidN back, pulls with top-level key diffs,
  slim R and flow records on demand, fx captured and bounded, saves, cards.
- scripts/lib/mp-sim-worker.js: realms per session in one worker, days one
  network at a time with other messages between them, loads and unloads
  waiting for a session's day, time limits; a throw goes back to the mark
  in place, a timeout gets a fresh realm (new epoch) carrying the old R, a
  day is retried once and the network broken after a second failure.
- scripts/lib/mp-sim-engine.js: createEngine() with the fake engine's API,
  placement by realm count, every pending call rejected when its worker
  exits, a worker of its own after two exits in an hour; snapWith() joins
  the host's clock, roster and since to a realm's snapshot.
- Contract: a pulled snapshot is the realm's half (the host adds clock,
  roster, since); haptic fx carry milliseconds; the fake engine follows,
  with close() and snapWith(). The button crawl moved to tests/lib.
- Tests: realm vs jsdom byte for byte over 60 scenic big-network days with
  actions; restore; retry after a throw or a timeout; realm order; a timer
  audit and the gate over a sweep of sent buttons (SIM_LONG=1: a year and
  every button); captures, rollbacks, asks, selection reports, ordering,
  bounds, pollution, worker exits; the act tables against the game.

The gate found two keys the game writes in a shape a reload repairs (buyTE's
S.te, mkLeave's S.monkey): game fixes for the integrator, kept visible as a
todo test and a list in the audit.

Rebased onto the 3.3.0 merge (61e31c5): the engine itself needed no change. A
realm still routes in the game's own code (no route worker, no saves), the
route cache that now keeps list orders from day to day leaves a checkpoint and a
retry the same, and the capacity market and moved customers play in a realm as
on a page, under the strict gate. The tests needed three things: an old save's
first days earn the new traffic badges, which the unwatched network's snapshot
keeps; the restore test compares JSON text with sorted keys instead of a
deep-equal of two networks (a diff of gigabytes when they differ); and the crawl
opens the windows that move a customer, with a new test playing the market's and
the path moves' acts, 40 days of sales and a checkpoint against the page.
2026-11-09 19:30:38 +01:00
jvanvik
61e31c53d3 Merge upstream: Lambda Bazaar, traffic badges, moving customers and faster routing (3.3.0)
Some checks are pending
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / gate (push) Waiting to run
Container image / test (push) Blocked by required conditions
Container image / publish (push) Blocked by required conditions
CHANGELOG.md: upstream's released sections as they are; main's 11 Unreleased bullets kept under Unreleased.
scripts/lib/route-fuzz.js: upstream's skip of dashboard tabs the base lacks, plus main's trimming of args the base's buttons lack.
src/game/10-catalog/40-ports.js: upstream's one-pass portsAt(); an express still takes ports per channel at its ends.
src/game/10-catalog/60-reach-and-subsea.js: upstream's dfLit/dfCap0/dfOn (managed waves carved out); capOf() keeps xp and sat.
src/game/60-features/80-new-game.js: upstream's vol and cm in a new game, with main's ip4, rgen, mp and saved-shape fields.
src/game/60-features/95-standing-orders.js: upstream's portsAt, cachePlan and promiseCheck, inside main's build-standard routers order, optup marks, opsDarkPre and decom gone list; opsPairs still leaves satellites out.
src/game/80-simulation/30-compute.js: upstream's routing core; main's satellite edges (SATN) pass into it, express risks and sat/ip4 money stay.
src/game/80-simulation/29-route-core.js: main's satellite latency note moved into the core, where upstream moved the flow loop.
src/game/80-simulation/40-billing.js: main's linkCut() and xp/sat in linkDown(), with upstream's dfOn().
src/game/80-simulation/50-sanitize.js: upstream's cmClean listings and cmFix/volFix; main keeps the xp/sat kinds, mpSanitize, ip4Fix and satSanitize.
src/game/80-simulation/60-requirements.js: upstream's shared diversity graph; an express link carries the list of trenches it rides.
src/game/91-save.js: upstream's saves in the worker, except a multiplayer session network, whose text is made on the page (mpSave) so the server gets the very save the slot holds; bootNotes() kept.
src/game/91-slots.js: upstream's slot text and day, with main's mp badge on a slot.
src/game/93-ui/70-link-panels.js: a fiber says both its managed waves and the expresses it carries.
src/game/94-dashboard/60-dashboard.js: upstream's carried tile, main's themed demand line.
src/game/95-modals/70-link-modal.js: main's Express tab, then upstream's hint for a coast no cable lands on (#321).

After the merge:
- Moving a circuit: a path over an express shares the trenches of the fibers it rides, so it is never called fully diverse from a path along them (test in express-fiber).
- The capacity market and moving customers leave the slots expresses hold (test in express-fiber; no code change needed).
- The NOC log keeps only the kinds a reload keeps: the market's info/warn news is a plain line, live as after a reload.
- New acts classified for server-run play: market and path moves sent, marketOpen and pathOpen local; pathPin's path may be longer than 64 characters.
- Server-play fixtures written again (new cm and vol fields); the dark-mode test reads mapStill()'s three states.
- A big multiplayer network that moved on still pushes its save to the server (test in multiplayer).
- The full suite ran on jsdom 31.0.0 and playwright-core 1.65.0, the versions the merged lockfile pins.
2026-11-09 19:04:21 +01:00
Frederic Jung
1579f3743b
Merge pull request #311 from thesysadmindev/move-customer-path 2026-11-09 13:15:55 +00:00
Frederic Jung
4630ba99af
Clear the open code scanning alerts
- auto-release.yml: the by-hand test run passes github.sha (what it got anyway) instead of an
  output that also reads workflow_run.head_sha, so CI never checks out a ref a workflow_run
  handed over in a job that uses caches (cache poisoning, 7 alerts in ci.yml).
- tests/harness.js: the script splitter also matches end tags like </SCRIPT > (bad HTML
  filtering regexp).
- Tests paste the fixture saves into the page with lit(), which escapes what could end a
  script or a string, instead of plain JSON.stringify (improper code sanitization).
2026-11-09 12:36:08 +00:00
Frederic Jung
f00bc733d0
Two CSS checks read jsdom 31 as well as 30
jsdom 31 (#327) serializes calc() with its terms sorted and expands the
overflow shorthand into overflow-y; the diagnostic readout and puzzle
dock tests now accept both.
2026-11-09 13:30:28 +01:00
Frederic Jung
d6b08dded3
Kept exit orders also check each exit's kind
An exit that turned from an exchange into a PNI at the same place in the list, city and
preference kept the order made for the exchange, which sorts behind a PNI at the same
distance, so the cached routing could differ from routing without the cache (#320 review).
The exit signature now includes the kind. Also drops the unused e.vis.
2026-11-09 10:40:39 +00:00
Frederic Jung
249ad4d478
Merge pull request #320 from antt0n/perf/routing-core 2026-11-09 10:21:20 +00:00
Christopher Hawker
3554e9f700 Moving waves checks the room the broker would sell: bandwidth for managed waves, and what is kept back
Managed waves need a channel as big as the wave and their bandwidth spare after your own traffic and
the share kept back, on leased fiber too. A move bumps CM_V so their capacity follows them, merging
needs the same size, and alien waves leave the kept-back channels alone. Pinned customers' badges
share one path graph per routing result.
2026-11-09 16:45:08 +11:00
Christopher Hawker
93d7c87dc7 Move a customer to another path between the same two POPs
Alien waves and leased fiber pairs sit on one fiber (b.link), so they move to
another working fiber between the same cities, under the rules for selling
capacity on it. Circuits have no link of their own, so moving one pins it to a
list of cities (b.pin), which routing follows while every link on it is up. When
one is down the circuit follows routing, and it comes back by itself.

The window lists the most diverse options first, compared by trench. Moves are
free and instant, and contracts keep their price.
2026-11-09 16:23:59 +11:00
Frederic Jung
1e15c61e3d
Merge remote-tracking branch 'origin/main' into claude/fix-321
# Conflicts:
#	CHANGELOG.md
2026-11-08 18:20:34 +00:00
Frederic Jung
71e7dcec59
Say how to reach a coast where no subsea cable lands yet (#321)
Iqaluit, Adamstown, Murmansk and the Russian Arctic towns have a beach but
no cable, so the link modal listed nobody to hop through ("Cables from
Iqaluit reach . Hop through one of those."), and from the other side it
suggested hops that could never get there. Now it says to go overland when
a road leads in, or that only your own cable reaches it, with the own-cable
button (or its level hint) underneath.
2026-11-08 17:57:32 +00:00
Frederic Jung
d971ded259
Hold the lay ship through a construction delay instead of restarting the lay (#322)
A delay that hit your own subsea cable while it was being laid moved the
whole laying stretch later: the ship vanished, the laid km went back to
zero and the survey and factory could be hurried and paid for again. The
delay now holds the ship where it is (l.lay: start, share laid, resume
day), so laying picks up after the delay. Old saves without the field lay
as before; sanitize() repairs or drops it.
2026-11-08 17:57:27 +00:00
Frederic Jung
4292cd4c74
Merge pull request #319 from antt0n/perf/intern-and-promises 2026-11-08 11:00:54 +00:00
Antoine
44116103be
The intern and customers' promises counted once per network: ports, caches and PNIs in one pass, shared searches
The game plays exactly as before.

* The NOC intern plans every POP in one pass: portsAt() counts router ports for all cities at once (routers, ports
  and cache orders; the ports job keeps ports in use and reserved by city between two jobs), cachePlan() sorts the
  boxes by POP once and cityShSum() sums a city's shares once per table, pniFlows() reads every POP's flows from
  routing's columns (R.flc) in one pass and pniWant() gives the weekly PNI round its sort key from typed columns.
  pniBatchRun() lets a frame through every few networks; pniQuote() looks existing PNIs and ports up from the batch.
* A dark fiber's capacity asks optG() once per run of identical optics (dfLit()); linkDown() and ownGlass() ask
  dfOn(), whether it carries anything for you, without the sum unless an optic is out or managed waves are sold on
  it. terrIslands() tests !l.sub first.
* Latency: latGraph() lists each city's links once in S.links order (typed arrays), latRun() is the same search with
  the same sums, latPairs() searches once per city for a boutique's finance routes and the latency offers.
* Diverse paths: divGraph()/divOn() number the cities and risks once; promiseCheck() shares a diversity graph, the
  land islands and one latency search per origin across every customer when the intern weighs taking a fiber out,
  and spots0() shares the graph for sovereign offers.

Tests: day-steps (cache planner, ports at every POP and flows from columns equal the old ways; the PNI round through
pniBatchRun), fiber-lit-and-latency (with failed optics and managed waves), shared-promise-checks, intern-personas.
2026-11-07 23:55:37 +01:00
Antoine
1edf0abb54
Routing core made once, list orders kept, and Auto-TE's detour searches cut: same routing, much less work
The game plays exactly as before.

* The core of compute() (rankPass, directPass, sendGroup, send, push, carry, altPath) is ROUTE in 29-route-core.js,
  built once by routeCore(): made inside compute() they were new functions every call and V8 threw away their code.
  Exits are read by number from typed columns (USED, CAPX, CIX, HPX, VISX), each list is an object of one shape.
* The route cache keeps, for each list and source city, the order routing tries it (xOrder()); a list whose exits,
  cities and preferences are unchanged on the same graph keeps its orders when other exits change (rcExitKeep()).
* Auto-TE: pairs with no detour are marked (TEF), exits that cannot help are skipped (dud()), one failed search
  answers the next ones, dijkstraTo() searches in arrays kept between calls, teSearch() runs on the graph as flat
  arrays and picks up where the last search from the same POP stopped.
* The PNI/IX tie-break (#298) reaches the core.

Tests: route-cache, routing-reference, speed (the fast core against the plain path, Auto-TE on crowded meshes with
POPs outside the core, picked-up searches counted).
2026-11-07 23:51:35 +01:00
Antoine
b9d6319302
The page stays free while big networks play: ambient map at 30 fps, saves in the worker, less to carry back
The game plays exactly as before; only what holds the page changes.

* mapStill() tells three cases apart: still (drawn once a second), ambient (only the animation clock moved: drawn at
  most every 29 ms, so 30 fps on 60 and 120 Hz screens) and moving (camera, pointer, selection, network: every frame).
  The animations follow the clock, so they keep their speed.
* save() skips the storage write when the text is the one the slot already holds (SLOT.txt) and no write is on its
  way; leaving the page still writes. A big autosave that moved on is packed, turned into text, stamped and
  compressed in the route worker (rwSave(), rwGzip()); the page only writes what comes back. A lost worker hands its
  pending saves back to the page (rwSaveBack(), rwGzBack()).
* Less crosses back from the worker: R.efg stays there while R is its own last answer (RW.wR, efg 0), R.egDesc comes
  as 0 or as the entries that changed (rwDescOut()/rwDescIn()), what crossed each link travels as typed arrays decoded
  on demand (rwLOut()/rwLIn()), and the full ports (hotMap) come along with R. Every message is read in order
  (rwMsg()), so both sides always hold the same last answer.
* Idle frames build the diverse-paths map and the latency floors a millisecond at a time (diversityWarm(),
  latWarm()), before the first offer asks.
* Diagnostic info shows how fast days really come: speed asked, speed held, how long a day takes (15-day-pace.js).
* perf-bench: "The NOC intern's shift: opsDay()" and, in Chromium, "One game day in play: page time only", a day
  played with the real route worker counting only the time it holds the page.

Tests: frame-pacing, day-pace, save-size, persist, route-worker (efg as typed arrays, hotMap from the worker),
day-steps (a second page plays the worker: answers without R.egDesc, with only its changes, posts without R.efg,
renewal haggles answered through the worker), intern-dark-fiber-worker, webgl-zoom-sprites, speed.
2026-11-07 22:22:51 +01:00
Frederic Jung
2f738dceda
Lambda Bazaar: a capacity market for your dark fiber
A new NOC tab sells spectrum, managed 100G, 400G, 800G and 1.6T waves, and dark pair IRUs on every route you hold
fiber on. Demand per route moves every day (its own cycle, noise, and news: fiber cuts, hyperscalers, AI clusters,
rivals lighting glass, mergers) and grows about 15% a year, with buyers moving to bigger waves over the years and
carriers on your glass asking to move up a size. You choose what to keep back for your own traffic, from what demand
the broker lists, and the price it never sells below. Managed waves come out of capacity you lit; prices follow the
fiber's cost, how hot and how full the route is, and its latency (400G at 2.7x 100G on land, 3.8x subsea). A Cable
broker pays 3% instead of 10% and sees each route's forecast and routes worth building.

Rule F5 now bounds sales by the moving market; new rule F8 covers managed waves. The route fuzz skips dashboard tabs
main does not have yet.
2026-11-07 13:34:41 +01:00