Phase 4: close loot/refund leaks, landing-site garrisons, speed-scaled shipping, update/offsite tooling, broad e2e

Built:
- Economy: raid loot capped to the room the raiders have at home (rest stays with the victim, "lootLeft" in the report); trade escrow reserves its room so refunds always fit; trade accept refuses with no_room_for_goods when the goods would not fit. Loot destroyed per 30-day run 31-61k -> ~1k, refunds clipped ~27k -> 0 (docs/BALANCE.md, 3 seeds).
- End game: members of the holding alliance garrison landing sites (migration 005_site_garrison.sql), garrison counts in site defence, 72 h capture shield, withdraw route, POP view lists garrisoned units. Shipping capacity scales with world speed (3x world: winner 76-98 -> ~30-36 days after sites open). Bot runs show real contests (84-194 attacks on held sites at 1x).
- Ops: deploy/update.sh (backup, stop, ff-merge, npm ci --ignore-scripts, health check, rollback), deploy/upstream-offsite (rsync only), admin end-world snapshots results, EPIPE fix, docs/workflows/ filled in.
- e2e 62 -> 163 checks: units, raids/reports, alliance+messages, trade, end game, nb, PWA, reconnect, slow polling fallback (opt-in). Two app bugs found: message push ignored, "New" button stayed English.

Tested: npm test 274/274, openapi check, npm run e2e 163/163 (137 s), bot runs 50x30d seeds 1-3 and 140-day/60-day speed-3 end-game runs INVARIANTS OK, adversarial review pass (findings fixed or documented).
NOT tested: update.sh on a real box (systemd, real npm, runuser; stubs only, shellcheck not installed), garrison card/loot text on a phone, Node 22.13, humans. Known leaks left open and documented (BALANCE S6): loot/shipments can still overflow when stock arrives in flight, bounced backbone shipments lose overflow (reported to the sender). Garrison numbers (heldDefenceMult 2, shield 72 h) are first guesses from 2 seeds. Not claimed: balanced.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
jvanvik 2026-10-12 00:58:12 +02:00
parent 9104480463
commit 3c23c51902
92 changed files with 4887 additions and 300 deletions

View file

@ -33,12 +33,18 @@
'wld.ship.head': 'Ship resources', 'wld.ship.no': 'Only members of the holding alliance can ship.', 'wld.ship.go': 'Ship', 'wld.ship.cargo': 'Cargo',
'wld.ship.hint': 'A shipment is a transport: up to {n} per link. It lands in the stockpile, or rides home if the site has changed hands on the way.',
'wld.ship.done': 'Shipment on its way.', 'wld.ledger': 'Who shipped what',
'wld.gar.head': 'Garrison', 'wld.gar.static': 'Static defence', 'wld.gar.units': 'Stationed units', 'wld.gar.total': 'Whole defence', 'wld.gar.empty': 'Nobody has stationed units here. A held site is only as strong as its garrison.',
'wld.gar.hint': 'Members of the alliance can station units here (Station units). They defend together with the static part, draw power from the POP they come from, and a lost wave only kills part of them. A won attack wipes them all.',
'wld.gar.station': 'Station units', 'wld.gar.withdraw': 'Call home', 'wld.gar.withdrawn': 'Units on their way home.', 'wld.gar.offline': 'offline (no power at home)', 'wld.gar.mine': 'yours', 'wld.gar.share': '{p}% of the defence',
'wld.results': 'Final standings', 'wld.rank.operators': 'Operators', 'wld.rank.alliances': 'Alliances', 'wld.rank.attackers': 'Attackers', 'wld.rank.defenders': 'Defenders',
'wld.rank.empty': 'Nobody on this list.', 'wld.rank.totals': '{o} operators in {a} alliances',
'tile.backbone': 'Backbone landing site', 'map.legend.backbone': 'Landing site', 'map.info.openWorld': 'Backbone race',
'map.info.backbone': 'A backbone landing site. The first alliance to build the node here to level {max} wins the world.',
'send.landing.hint': 'A landing site has no garrison: only its static defence counts (a scan shows the number, about {mult} times an incumbent site). Winning makes your alliance the holder.',
'send.landing.hint': 'A landing site is defended by its static defence (a scan shows the number: about {mult} times an incumbent site while nobody holds it, much less once an alliance does) plus the garrison its holders have stationed there. A lost wave only kills part of the garrison, so the next one faces less. Winning wipes the garrison and makes your alliance the holder.',
'send.landing.reinforce': 'Units you station here defend the site together with the other members\' garrison and keep drawing power from the POP they come from. Only members of the holding alliance can. You can call them home at any time from the site sheet; they leave automatically if you leave the alliance.',
'send.invalid.site_shielded': 'The site changed hands recently and cannot be attacked yet (see the site card).', 'wld.shield': 'Protected until {t}',
'send.invalid.not_holder': 'Only members of the alliance that holds the site can station units there.',
'send.transport.rival': 'This is a POP you do not own: the cargo is a gift, and its owner sees an incoming movement until it lands. For a trade use the Internet exchange.',
'send.reason.no_alliance': 'only alliance members can attack a landing site', 'send.reason.own_site': 'your alliance already holds this site',
'send.invalid.no_alliance': 'Join an alliance first.', 'send.invalid.own_site': 'Your alliance holds that site.',
@ -48,6 +54,7 @@
'report.type.landing': 'Landing site attack',
'rep.vs': '{a} vs {d}', 'rep.by': 'By {name}', 'rep.attackerWon': 'Attacker won', 'rep.defenderWon': 'Defender won',
'rep.landing.title': 'Landing site {n}', 'rep.landing.taken': 'Site taken', 'rep.landing.held': 'Site held', 'rep.landing.holder': 'Holder',
'rep.landing.garrisonOf': 'Garrison of {name}',
'rep.landing.takenLine': '{tag} took the site.', 'rep.landing.heldLine': 'The defence held. The site did not change hands.',
'rep.tab.mine': 'My reports', 'rep.tab.alliance': 'Alliance', 'rep.sharedBy': 'shared by {name}',
'rep.folder.none': 'Join an alliance to use the shared folder.', 'rep.folder.empty': 'Nothing shared yet. Open a report and share it with the alliance.',
@ -86,12 +93,18 @@
'wld.ship.head': 'Send ressurser', 'wld.ship.no': 'Bare medlemmer av eieralliansen kan sende.', 'wld.ship.go': 'Send', 'wld.ship.cargo': 'Last',
'wld.ship.hint': 'En forsendelse er en transport: opptil {n} per lenke. Den lander på lageret, eller drar hjem hvis punktet har skiftet eier underveis.',
'wld.ship.done': 'Forsendelsen er på vei.', 'wld.ledger': 'Hvem sendte hva',
'wld.gar.head': 'Garnison', 'wld.gar.static': 'Statisk forsvar', 'wld.gar.units': 'Stasjonerte enheter', 'wld.gar.total': 'Hele forsvaret', 'wld.gar.empty': 'Ingen har stasjonert enheter her. Et holdt punkt er bare så sterkt som garnisonen.',
'wld.gar.hint': 'Medlemmer av alliansen kan stasjonere enheter her (Stasjoner enheter). De forsvarer sammen med den statiske delen, trekker strøm fra POP-en de kommer fra, og en tapt bølge dreper bare en del av dem. Et vunnet angrep tømmer alle.',
'wld.gar.station': 'Stasjoner enheter', 'wld.gar.withdraw': 'Kall hjem', 'wld.gar.withdrawn': 'Enhetene er på vei hjem.', 'wld.gar.offline': 'offline (ingen strøm hjemme)', 'wld.gar.mine': 'dine', 'wld.gar.share': '{p}% av forsvaret',
'wld.results': 'Sluttresultat', 'wld.rank.operators': 'Operatører', 'wld.rank.alliances': 'Allianser', 'wld.rank.attackers': 'Angripere', 'wld.rank.defenders': 'Forsvarere',
'wld.rank.empty': 'Ingen på denne listen.', 'wld.rank.totals': '{o} operatører i {a} allianser',
'tile.backbone': 'Landingspunkt for ryggraden', 'map.legend.backbone': 'Landingspunkt', 'map.info.openWorld': 'Ryggradskappløpet',
'map.info.backbone': 'Et landingspunkt for ryggraden. Første allianse som bygger noden her til nivå {max} vinner verdenen.',
'send.landing.hint': 'Et landingspunkt har ingen garnison: bare det statiske forsvaret teller (en skanning viser tallet, omtrent {mult} ganger et inkumbentpunkt). Seier gjør alliansen din til eier.',
'send.landing.hint': 'Et landingspunkt forsvares av sitt statiske forsvar (en skanning viser tallet: omtrent {mult} ganger et inkumbentpunkt så lenge ingen holder det, mye mindre når en allianse gjør det) pluss garnisonen holderne har stasjonert der. En tapt bølge dreper bare en del av garnisonen, så den neste møter mindre. Seier tømmer garnisonen og gjør alliansen din til eier.',
'send.landing.reinforce': 'Enheter du stasjonerer her forsvarer punktet sammen med garnisonen til de andre medlemmene og trekker fortsatt strøm fra POP-en de kommer fra. Bare medlemmer av eieralliansen kan. Du kan kalle dem hjem når som helst fra punktarket; de går automatisk hjem hvis du forlater alliansen.',
'send.invalid.site_shielded': 'Punktet skiftet eier nylig og kan ikke angripes ennå (se punktkortet).', 'wld.shield': 'Beskyttet til {t}',
'send.invalid.not_holder': 'Bare medlemmer av alliansen som holder punktet kan stasjonere enheter der.',
'send.transport.rival': 'Dette er en POP du ikke eier: lasten er en gave, og eieren ser en innkommende bevegelse til den lander. For handel, bruk Internettknutepunktet.',
'send.reason.no_alliance': 'bare alliansemedlemmer kan angripe et landingspunkt', 'send.reason.own_site': 'alliansen din holder allerede dette punktet',
'send.invalid.no_alliance': 'Bli med i en allianse først.', 'send.invalid.own_site': 'Alliansen din holder det punktet.',
@ -101,6 +114,7 @@
'report.type.landing': 'Angrep på landingspunkt',
'rep.vs': '{a} mot {d}', 'rep.by': 'Av {name}', 'rep.attackerWon': 'Angriper vant', 'rep.defenderWon': 'Forsvarer vant',
'rep.landing.title': 'Landingspunkt {n}', 'rep.landing.taken': 'Punktet ble tatt', 'rep.landing.held': 'Punktet holdt', 'rep.landing.holder': 'Eier',
'rep.landing.garrisonOf': 'Garnisonen til {name}',
'rep.landing.takenLine': '{tag} tok punktet.', 'rep.landing.heldLine': 'Forsvaret holdt. Punktet skiftet ikke eier.',
'rep.tab.mine': 'Mine rapporter', 'rep.tab.alliance': 'Allianse', 'rep.sharedBy': 'delt av {name}',
'rep.folder.none': 'Bli med i en allianse for å bruke den delte mappen.', 'rep.folder.empty': 'Ingenting delt ennå. Åpne en rapport og del den med alliansen.',