spike(modules): carry /public/atlas/* behind the proposed module surface

THROWAWAY BRANCH — evidence for the Phase 1 contract, never merged. See
modules/uo/SPIKE.md and docs/website/MODULE_API.md Part 7.

The six public spawn-atlas routes now live in modules/uo/, reached only through
the ctx/register surface, with the client half loading as a prebuilt ESM chunk.
All three exit criteria met:

  • zero internal-file imports from the module into core; the built chunk has
    zero bare import specifiers and bundles no React
  • routes.manifest.json AND routes.guards.json are byte-identical
  • /uo/atlas renders from /modules/uo/entry.js under script-src 'self' with
    zero CSP violation reports

729 core tests and 81 module tests pass. Verified end to end against the real
database: the schema fragment replays after core's, onBoot runs the atlas
refresh, and the six API URLs answer unchanged.

Two things the spike changed in the contract:

  • ctx.express / ctx.validator. A module lives outside server/, so Node never
    reaches server/node_modules and require('express') fails outright — the
    server-side twin of the one-React rule, which §2.6 had only for the client.
  • window.__rg.jsxRuntime, so a module can build with the automatic JSX
    runtime its tooling already assumes rather than being forced to classic.

And it confirmed §6.1 empirically: regenerating the OpenAPI spec silently
deleted all 361 lines of the atlas paths with "Swagger-autogen: Success", while
the route manifest kept all six in the same run. That is exactly the
static-analysis-vs-runtime split the fragment merge exists to prevent.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-08-10 05:29:35 -05:00
parent f1dda8fe66
commit bf470c7658
55 changed files with 4638 additions and 601 deletions

View File

@@ -11201,367 +11201,6 @@
]
}
},
"/api/v1/public/atlas/champions": {
"get": {
"tags": [
"Public · Atlas"
],
"summary": "Configured champion altars (the roster, not the live board)",
"description": "Where the altars are and what each one summons — \"there is an Unholy Terror altar in Deceit\". `randomType` marks altars whose champion is drawn at activation. Do not conflate this with GET /public/shard/champs, which is the live sidecar-fed board (\"it is on level 3 right now\").",
"parameters": [
{
"name": "facet",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Limit to one facet."
}
],
"responses": {
"200": {
"description": "Altars, by facet then name",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AtlasChampion"
}
}
}
}
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
},
"503": {
"description": "Service Unavailable"
}
}
}
},
"/api/v1/public/atlas/creatures": {
"get": {
"tags": [
"Public · Atlas"
],
"summary": "Search the bestiary (paginated)",
"description": "Every creature the shard spawns, most numerous first. `total` is how many can be alive at once across all spawners; `points` is how many spawners mention it; `facets` maps facet name to that creature\\'s share on it. Static content parsed from the shard\\'s ServUO tree — unaffected by the shard being offline.",
"parameters": [
{
"name": "q",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Substring match on the creature name (max 60 chars)."
},
{
"name": "facet",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Limit to creatures spawning on this facet. Facet names come from the shard's own files; an unknown one returns an empty page."
},
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "Page size, 1..100 (default 50)."
},
{
"name": "offset",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "Rows to skip (default 0)."
}
],
"responses": {
"200": {
"description": "A page of creatures plus the unpaginated total",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AtlasCreaturePage"
}
}
}
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "The atlas feature is gated above this caller",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "The atlas feature is disabled",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"500": {
"description": "Internal Server Error"
},
"503": {
"description": "Service Unavailable"
}
}
}
},
"/api/v1/public/atlas/creatures/{slug}": {
"get": {
"tags": [
"Public · Atlas"
],
"summary": "One creature: where it spawns, and what spawns with it",
"description": "The answer the atlas exists to give. `places` is the aggregate — \"lizardman → Shrines, Isamu-Jima, Yew\" — resolved by point-in-rect against the shard\\'s own region rectangles, falling back to the nearest landmark, else \"Wilderness\". `spawners` lists the individual spawn points (bounded; `spawnersTruncated` says when the list was cut), and `alsoHere` is what shares those spawners.",
"parameters": [
{
"name": "slug",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "Creature slug, e.g. lizardman."
},
{
"name": "facet",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Restrict places and spawners to one facet."
},
{
"name": "points",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "Max spawners to return, 1..1000 (default 200)."
}
],
"responses": {
"200": {
"description": "The creature",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AtlasCreature"
}
}
}
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "No such creature in this atlas (or the feature is disabled)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"500": {
"description": "Internal Server Error"
},
"503": {
"description": "Service Unavailable"
}
}
}
},
"/api/v1/public/atlas/landmarks": {
"get": {
"tags": [
"Public · Atlas"
],
"summary": "Points of interest (dungeon levels, town markers)",
"description": "From the shard\\'s Data/Locations files. `group` is the innermost enclosing parent (\"Covetous\"), which is the label worth showing over the individual marker (\"Level 1\").",
"parameters": [
{
"name": "facet",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Limit to one facet."
},
{
"name": "q",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Substring match on the landmark name or its group."
}
],
"responses": {
"200": {
"description": "Landmarks, by facet then group",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AtlasLandmark"
}
}
}
}
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
},
"503": {
"description": "Service Unavailable"
}
}
}
},
"/api/v1/public/atlas/meta": {
"get": {
"tags": [
"Public · Atlas"
],
"summary": "What atlas is loaded: facets, counts, when it was imported",
"description": "Drives the facet filter and the \"parsed from the shard\\'s own files on <date>\" line. Reports the game world only — the ServUO path, the per-file hashes and any pending refresh are operator detail and live on the admin status route.",
"responses": {
"200": {
"description": "Atlas metadata",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AtlasMeta"
}
}
}
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
},
"503": {
"description": "Service Unavailable"
}
}
}
},
"/api/v1/public/atlas/regions": {
"get": {
"tags": [
"Public · Atlas"
],
"summary": "Named regions and their rectangles",
"description": "Flattened out of the shard\\'s nested Regions.xml. `priority` and the rectangles are what placed each spawn point, kept so the placement can be re-derived rather than taken on trust.",
"parameters": [
{
"name": "facet",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Limit to one facet."
},
{
"name": "q",
"in": "query",
"required": false,
"schema": {
"type": "string"
},
"description": "Substring match on the region name."
}
],
"responses": {
"200": {
"description": "Regions, by facet then name",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/AtlasRegion"
}
}
}
}
},
"400": {
"description": "Bad Request"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
},
"503": {
"description": "Service Unavailable"
}
}
}
},
"/api/v1/public/contact": {
"post": {
"tags": [