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:
parent
9104480463
commit
3c23c51902
92 changed files with 4887 additions and 300 deletions
|
|
@ -3,7 +3,7 @@
|
|||
"info": {
|
||||
"title": "UPSTREAM API",
|
||||
"version": "1.0.0",
|
||||
"description": "Generated by tools/gen-openapi.js from server/routes. Every response carries serverTime; errors use the { error: { code, message, details } } envelope. Codes: bad_request, validation_failed, unauthorized, invalid_credentials, forbidden, not_found, method_not_allowed, conflict, request_in_progress, idempotency_key_reuse, payload_too_large, rate_limited, internal_error, signup_closed, username_taken, world_full, unknown_building, not_buildable, max_level, requirements_not_met, already_queued, queue_full, not_enough_resources, peering_office_required, already_in_alliance, not_in_alliance, alliance_name_taken, alliance_tag_taken, alliance_full, invite_expired, leader_must_transfer, notes_full, diplomacy_invalid, diplomacy_pending, proposal_exists, proposal_expired, unknown_unit, not_researchable, not_enough_units, units_offline, invalid_target, target_protected, protection_active, out_of_range, footprint_too_low, cannot_takeover, recall_expired, capacity_exceeded, no_transport_link, trade_ratio, offer_closed, own_offer, trade_out_of_range, world_ended, backbone_closed"
|
||||
"description": "Generated by tools/gen-openapi.js from server/routes. Every response carries serverTime; errors use the { error: { code, message, details } } envelope. Codes: bad_request, validation_failed, unauthorized, invalid_credentials, forbidden, not_found, method_not_allowed, conflict, request_in_progress, idempotency_key_reuse, payload_too_large, rate_limited, internal_error, signup_closed, username_taken, world_full, unknown_building, not_buildable, max_level, requirements_not_met, already_queued, queue_full, not_enough_resources, peering_office_required, already_in_alliance, not_in_alliance, alliance_name_taken, alliance_tag_taken, alliance_full, invite_expired, leader_must_transfer, notes_full, diplomacy_invalid, diplomacy_pending, proposal_exists, proposal_expired, unknown_unit, not_researchable, not_enough_units, units_offline, invalid_target, target_protected, protection_active, out_of_range, footprint_too_low, cannot_takeover, recall_expired, capacity_exceeded, no_transport_link, trade_ratio, offer_closed, own_offer, trade_out_of_range, no_room_for_goods, world_ended, backbone_closed"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
|
@ -2885,7 +2885,7 @@
|
|||
},
|
||||
"/backbone/{id}/ship": {
|
||||
"post": {
|
||||
"summary": "Send resources from one of your POPs to a landing site your alliance holds (a transport: Internet exchange links, 500 each)",
|
||||
"summary": "Send resources from one of your POPs to a landing site your alliance holds (a transport: Internet exchange links, 1000 each at world speed 1, times the world speed)",
|
||||
"tags": [
|
||||
"world"
|
||||
],
|
||||
|
|
@ -3004,6 +3004,116 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/backbone/{id}/withdraw": {
|
||||
"post": {
|
||||
"summary": "Call units of one of your POPs home from a landing site's garrison (default: all of them). Only their owner can; works whoever holds the site now. Station units with POST /movements type reinforce at the site's x,y (members of the holding alliance only)",
|
||||
"tags": [
|
||||
"world"
|
||||
],
|
||||
"operationId": "postBackboneIdWithdraw",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"fromTownId"
|
||||
],
|
||||
"properties": {
|
||||
"fromTownId": {
|
||||
"type": "integer",
|
||||
"minimum": 1
|
||||
},
|
||||
"units": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"description": "defaults to the whole group"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearer": []
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/GarrisonWithdrawn"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Error codes: unauthorized",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Error codes: not_found, unknown_unit",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Error codes: conflict, not_enough_units, world_ended",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Error codes: idempotency_key_reuse, validation_failed",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Error codes: internal_error",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/diplomacy/proposals/{proposalId}": {
|
||||
"delete": {
|
||||
"summary": "Withdraw a proposal your alliance made (needs diplomacy)",
|
||||
|
|
@ -7109,7 +7219,7 @@
|
|||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Error codes: capacity_exceeded, no_transport_link, not_enough_resources, offer_closed, own_offer, trade_out_of_range, world_ended",
|
||||
"description": "Error codes: capacity_exceeded, no_room_for_goods, no_transport_link, not_enough_resources, offer_closed, own_offer, trade_out_of_range, world_ended",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
|
|
@ -7850,6 +7960,26 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"escrow": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fiber": {
|
||||
"type": "number"
|
||||
},
|
||||
"hardware": {
|
||||
"type": "number"
|
||||
},
|
||||
"capital": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"fiber",
|
||||
"hardware",
|
||||
"capital"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"military": {
|
||||
"$ref": "#/components/schemas/TownMilitary"
|
||||
}
|
||||
|
|
@ -7870,7 +8000,8 @@
|
|||
"buildings",
|
||||
"queue",
|
||||
"queueSlots",
|
||||
"bonus"
|
||||
"bonus",
|
||||
"escrow"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
|
|
@ -9717,6 +9848,35 @@
|
|||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"garrisoned": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"siteId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"x": {
|
||||
"type": "integer"
|
||||
},
|
||||
"y": {
|
||||
"type": "integer"
|
||||
},
|
||||
"units": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"description": "unit id -> count"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"siteId",
|
||||
"x",
|
||||
"y",
|
||||
"units"
|
||||
],
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -9724,7 +9884,8 @@
|
|||
"online",
|
||||
"offlineSince",
|
||||
"stationedHere",
|
||||
"stationedAway"
|
||||
"stationedAway",
|
||||
"garrisoned"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
|
|
@ -10181,6 +10342,10 @@
|
|||
"type": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"shieldUntil": {
|
||||
"type": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"level": {
|
||||
"type": "integer"
|
||||
},
|
||||
|
|
@ -10234,6 +10399,7 @@
|
|||
"holder",
|
||||
"takenBy",
|
||||
"takenAt",
|
||||
"shieldUntil",
|
||||
"level",
|
||||
"maxLevel",
|
||||
"progress",
|
||||
|
|
@ -10370,13 +10536,17 @@
|
|||
},
|
||||
"canAttack": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"canReinforce": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"holder",
|
||||
"canBuild",
|
||||
"canShip",
|
||||
"canAttack"
|
||||
"canAttack",
|
||||
"canReinforce"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
|
|
@ -10410,6 +10580,69 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"defence": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"static": {
|
||||
"type": "number"
|
||||
},
|
||||
"garrison": {
|
||||
"type": "number"
|
||||
},
|
||||
"total": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"static",
|
||||
"garrison",
|
||||
"total"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"garrison": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ownerTownId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"townName": {
|
||||
"type": "string",
|
||||
"nullable": true
|
||||
},
|
||||
"operator": {
|
||||
"type": "object",
|
||||
"nullable": true,
|
||||
"additionalProperties": true
|
||||
},
|
||||
"units": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"online": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"power": {
|
||||
"type": "number"
|
||||
},
|
||||
"mine": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ownerTownId",
|
||||
"townName",
|
||||
"operator",
|
||||
"units",
|
||||
"online",
|
||||
"power",
|
||||
"mine"
|
||||
],
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
@ -10419,6 +10652,39 @@
|
|||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"GarrisonWithdrawn": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"serverTime": {
|
||||
"type": "integer"
|
||||
},
|
||||
"movementId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"siteId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"fromTownId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"units": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"arriveAt": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"serverTime",
|
||||
"movementId",
|
||||
"siteId",
|
||||
"fromTownId",
|
||||
"units",
|
||||
"arriveAt"
|
||||
],
|
||||
"additionalProperties": true
|
||||
},
|
||||
"BackboneBuildStarted": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -10842,6 +11108,10 @@
|
|||
"status": 409,
|
||||
"description": "That POP is too far from the offer (its max distance or your Internet exchange reach)."
|
||||
},
|
||||
"no_room_for_goods": {
|
||||
"status": 409,
|
||||
"description": "Your Rack hall will not have room for the goods when they arrive; make room (spend, or raise the hall) and accept again."
|
||||
},
|
||||
"world_ended": {
|
||||
"status": 409,
|
||||
"description": "This world has ended: it can still be read, but nothing can be changed."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue