11 Commits

Author SHA1 Message Date
76c224fff1 Merge pull request 'chore(cutover): sync main into edge before the Asset Bridge cutover (Phase 9b, 0 of 5)' (#43) from chore/cutover-sync-main into edge
All checks were successful
PR Checks / client-build (pull_request) Successful in 19s
PR Checks / server-tests (pull_request) Successful in 30s
PR Checks / frozen-manifest (pull_request) Successful in 1m30s
Reviewed-on: #43
2026-09-14 23:08:49 +00:00
f9bbc7a90d chore(cutover): sync main into edge before the Asset Bridge cutover
All checks were successful
PR Checks / client-build (pull_request) Successful in 21s
PR Checks / server-tests (pull_request) Successful in 27s
PR Checks / frozen-manifest (pull_request) Successful in -31s
`edge` was BEHIND `main` by two commits — Module-uo#35 (the atlas keeps its
`UniqueId`, and a landmark option value names one landmark) and the Event
System's core re-pin — so merging `edge` into `main` as the Asset Bridge
cutover would have REVERTED a released fix. Phase 9a's walk measured it:
0 of 6,455 spawners carried a `UniqueId` on an `edge` rig even after the
column existed.

## The one conflict, and why the number had to move

Both sides bumped `PARSER_VERSION` 4 -> 5, for different reasons, and main's
5 is RELEASED in v1.2.2: "a point keeps its `UniqueId`". `edge`'s 5 was
phase 7's canonical label order.

Keeping 5 would have made phase 7's change unreachable. `sameSources` gates
on the tree hash and `currentParser` on the stored number; an install that
imported under v1.2.2 already stores 5, so a phase-7 build declaring 5 would
be called current and would never re-read. That is precisely the trap this
constant exists to defeat, so the merged file carries BOTH notes: 5 is main's
released meaning, 6 is phase 7's, with the renumbering explained in place.

Everything else merged clean and keeps #35's files verbatim.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wDDVXWMDz82WqE1i969r4
2026-09-14 17:34:13 -05:00
e7b3412b36 Merge pull request 'fix(assets): a busy shard is not a broken one, and a column that reached no existing install (Phase 9a)' (#42) from feat/asset-bridge-p9 into edge
Reviewed-on: #42
2026-09-14 22:26:29 +00:00
3c087a43cd fix(assets): a busy shard is not a broken one, and a column that reached no existing install (Phase 9a)
All checks were successful
PR Checks / client-build (pull_request) Successful in 21s
PR Checks / frozen-manifest (pull_request) Successful in 1m20s
PR Checks / server-tests (pull_request) Successful in 8m4s
Two defects the Phase 9 acceptance walk found on a real rig, one of them ours and
one of them released (docs/link/v8.md §17.14).

## "The shard is not answering for client files" about a shard that was fine

The status call exhausts its 425 backoff whenever something else holds the
shard's single asset slot -- an import the operator started, or the item-art warm
pass refilling itself after a client patch. Phase 8's panel rendered that with
the same banner as a shard that is down or has the plane switched off, and left
it standing, because the page only re-reads after an action. On the rig it was up
for a quarter of an hour while the warm pass refilled 313 pictures and every
direct call to the same route answered normally.

BUSY now says what it is, and one automatic re-read four seconds later clears the
ordinary case. One per mount, guarded by a ref: a page that retried forever would
be holding the slot it is waiting for. DOWN, DISABLED and NO_IMAGING read exactly
as they did.

## Every spawn-atlas import on an upgraded install has failed since v1.2.0

`shard_spawn_points.unique_id` (Events Phase 12b) was added to the CREATE TABLE
and nowhere else. `CREATE TABLE IF NOT EXISTS` does not add a column to a table
that already exists -- which is what the twenty-odd `ADD COLUMN IF NOT EXISTS`
lines in this same file are for -- so it reached fresh installs and no existing
one, and `replaceAtlas` inserts the column unconditionally:

    Unknown column 'unique_id' in 'INSERT INTO'

No bestiary refresh, no spawn map, no champion altars, on every install whose
tables predate 12b. A fresh install cannot reproduce it and neither can a test
whose schema is this file applied to an empty database; it took a rig with old
tables. Org lead, weighing that it is already released: it ships here on edge
rather than as a hotfix to main.

Verified by dropping the column, rebooting, watching the replay put it back, and
importing 6,455 spawners over the bridge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wDDVXWMDz82WqE1i969r4
2026-09-14 13:07:04 -05:00
5c35b4fe97 Merge pull request 'feat(assets): the panel that operates the client-file imports (Phase 8)' (#41) from feat/asset-bridge-p8 into edge
Reviewed-on: #41
2026-09-14 16:15:15 +00:00
5705aa9c23 ci: re-run the client checks
All checks were successful
PR Checks / server-tests (pull_request) Successful in 27s
PR Checks / frozen-manifest (pull_request) Successful in 1m1s
PR Checks / client-build (pull_request) Successful in 7m59s
Run 68's client-build spent 14m21s in "Set up job" and then failed every step
at 0s with no log uploaded — the runner died during container setup. The same
commit's server-tests and frozen-manifest jobs passed, and frozen-manifest built
this very chunk on the same runner. Nothing in the tree changed; this is the
push the workflow needs to run again (pr-checks has no workflow_dispatch).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wDDVXWMDz82WqE1i969r4
2026-09-14 11:07:51 -05:00
675e879b48 feat(assets): the panel that operates the client-file imports (Phase 8)
Some checks failed
PR Checks / frozen-manifest (pull_request) Successful in 1m3s
PR Checks / server-tests (pull_request) Successful in 8m4s
PR Checks / client-build (pull_request) Failing after 14m21s
Admin -> Client Files: one page over the three things that come out of the
operator's UO client -- creature portraits, item and land pictures, and the
cliloc table. One page rather than three because they are one job: same client
install, same bridge, and all of them change at the same moment, when the
operator patches that client. Boot never asks the shard for any of it, so these
buttons are the only thing that imports.

The cliloc pair had had no UI at all since phase 2. On a bridged install, where
boot deliberately stopped calling the shard, that meant `curl` was the only way
to load 67,496 names.

Update and Re-import everything are section 6's two stages as two buttons rather
than one button and a checkbox, because they cost wildly different things. A
vanished key is reviewed in the page and not in a table -- an asset import only
happens because someone pressed a button here, so the review is already in front
of the person who caused it -- and it shows each key's PICTURE, since
`body/820/a23` names nothing a human recognises. `shard_asset_meta` gained a
`last` block (what the import did, who ran it) so the panel can answer "did last
week's import do anything" without scrolling core's whole activity log.

The live walk against a real shard imported 1,095 portraits in 3.5 s, warmed 313
item pictures in 0.6 s and reloaded 67,496 cliloc rows in 1.7 s -- and found two
DELETIONS that predate this phase and that no test could see, because only a
screen showing the numbers together makes them visible:

  * The body import diffed its manifest against every family's rows. Phase 5 put
    item and land art in the same table, and a body manifest never mentions
    them, so all 313 item pictures were staged for deletion with a sentence
    saying the shard had stopped offering them.
  * An approved vanish unlinked the sprite and kept the row. The catalogue went
    on counting a picture that was gone, the atlas could point a creature page at
    a missing file, and the next forced import offered the same key for review
    again -- reporting "nothing was changed" about a file it had deleted.

Both fixed here, with the removals now inside `saveAssets`'s own transaction.
The same whole-table read made the panel announce a 1,408-row creature catalogue
on an install holding 1,095 portraits and 313 item pictures.

Protocol stays 8 and EXTRACTOR_VERSION stays 3: nothing on the wire changed.

Refs: docs/link/v8.md sections 12.2, 14, 16 (phase 8)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wDDVXWMDz82WqE1i969r4
2026-09-14 08:10:16 -05:00
50f84b5ea3 Merge pull request 'fix(atlas): keep the UniqueId, and make a landmark value name one landmark' (#35) from fix/atlas-unique-id-and-landmark-values into main
Some checks failed
Release / release (push) Successful in 27s
SonarQube / analysis (push) Failing after -59s
Reviewed-on: #35
2026-09-10 02:14:49 +00:00
d6346996d3 fix(atlas): keep the UniqueId, and make a landmark value name one landmark
All checks were successful
PR Checks / client-build (pull_request) Successful in 23s
PR Checks / server-tests (pull_request) Successful in 28s
PR Checks / frozen-manifest (pull_request) Successful in -21s
Two defects the Phase 16b re-verify found in the released v1.2.1 bundle, both
of which make a shipped feature unusable and neither of which any test saw.

## The aggregator discarded the UniqueId

`shard_spawn_points.unique_id` was NULL on all 6,455 rows of a stock 57.4 tree.
`listSpawners` filters `unique_id IS NOT NULL`, so `uo.options.spawners` was an
empty dropdown -- and it is the ONLY option source for the Phase 12b
object-property leases, so no `Spawner.MaxCount` / `MinDelay` / `MaxDelay` lease
could be authored at all, with nothing on the form to say why.

Every part of the path was already right except one line. The spawn files carry
`<UniqueId>` (~6,374 of them), `parsePoints` returns it, the column exists and
the insert passes `p.uniqueId || null`. `buildAtlas` rebuilds each point from an
explicit field list and `uniqueId` was not on it -- the word appears nowhere in
that file. `PARSER_VERSION = 4`'s own note says "a spawn point keeps its
UniqueId, which is what a property lease targets", so the intent shipped as a
comment while the code dropped the field one function later.

`PARSER_VERSION` goes to 5 because the bump is the only thing that re-reads an
already-imported tree: `sameSources` compares the tree's hashes, which have not
changed -- only what is kept from them. Confirmed on the rig, where the boot
after the fix logged `spawn atlas refreshed` on an unchanged tree and the manual
import then correctly answered `unchanged`.

## A landmark option value named 23 places at once

A stock tree has 558 landmarks under 320 distinct `facet/name` pairs.
`Trammel/Entrance` is 23 different dungeons -- Blighted Grove, Covetous, Deceit,
Despise, Destard and so on -- and `landmarkPoint` resolved with `.find()`, so 22
of the 23 were unreachable. An author who picked "Entrance - Destard" got
Blighted Grove, and the run succeeded with no warning. The group was already the
disambiguator: it was shown in the dropdown and left out of the value.

The value is now `facet/group/name`, which is distinct across all 558.
`landmarkPoint` tries that form first and keeps the two-part read as a fallback,
because every event published before this fix stores `facet/name` and a
published version is immutable -- refusing to parse those would break runs
rather than correct them. The fallback keeps the old first-match behaviour
deliberately: it is imprecise in exactly the way it always was, and silently
relocating a live event's spawn point is worse than repeating a known
imprecision. A three-part value whose group is gone REFUSES rather than falling
back to the name, because it asked for one particular place.

## Verification

On the released-artefact rig (installer -> bundle 2026.09.10 -> stock 57.4 tree
-> protocol-7 sidecar -> core at main with this module):

  spawn points     6455 rows, 6364 with a unique_id   (was 0)
  uo.options.spawners   100 options, and `?q=orc` searches them   (was 0)
  uo.options.landmarks  558 options, 558 distinct values          (was 320)
  suite            625 pass, 0 fail

Each new test was confirmed to FAIL without its fix. The atlas one asserts the
field on the AGGREGATOR's output rather than the parser's, which is the whole
point of it -- and the test fixture had no `<UniqueId>` at all until now, which
is exactly why a green suite said nothing. The landmark one asserts an
INEQUALITY between two resolved points rather than a literal value string, so it
survives another change of format as long as two options still address two
places.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wDDVXWMDz82WqE1i969r4
2026-09-09 20:59:49 -05:00
bbaf08f67c Merge pull request 'feat(events): the UO half of the Event System, and the core pin comes home (Phase 16b cutover, 3 of 6)' (#34) from chore/events-cutover-repin into main
Some checks failed
Release / release (push) Failing after -45s
SonarQube / analysis (push) Successful in 2m30s
Reviewed-on: #34
Reviewed-by: Colby Whitlock <whitlocktech@gmail.com>
2026-09-10 01:23:30 +00:00
ea63ad019c chore(ci): the core pin comes home to main (Phase 16b cutover)
All checks were successful
PR Checks / client-build (pull_request) Successful in 18s
PR Checks / server-tests (pull_request) Successful in 23s
PR Checks / frozen-manifest (pull_request) Successful in 49s
`ci/core-ref.json` pointed at a website `edge` sha for the length of the Event
System window (org lead, 2026-09-04), because `api.registerEventActions` exists
only from MODULE_API 1.10.0: under the old `main` pin the frozen-manifest job's
`register()` threw and this module did not load at all, so the job would have
been red by construction for eight phases while a real regression hid behind it.

The cutover put 1.10.0 on `main` (website#199, 655fbf3f), so the pin returns to
a `main` sha -- and this is the same move that turns the Integration kit green,
since `checkCoreApi` asserts equality against whatever core this pin names.

`routes.manifest.json` needed NO regeneration. The frozen-manifest job's own
steps were run against this exact ref -- core's manifest alone, the module
installed, core's manifest again, then `frozenManifest.js --check` -- and it
answered `routes.manifest.json is current, 73 routes, all documented`. So the
file's own "commit both together" instruction had nothing to pair with this
time. website's `main` and `edge` are the identical tree (930422ff), which is
why the measurement taken on the branch holds for the merge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016wDDVXWMDz82WqE1i969r4
2026-09-09 19:48:29 -05:00
20 changed files with 1678 additions and 66 deletions

View File

@@ -13,6 +13,7 @@ module that follows.
│ module-uo (>>> HERE <<<) │
│ shard status · spawn atlas · marketplace │
│ governors · cliloc · town crier · uo-link│
│ client files: portraits, item art, names │
└───────────────────────────────────────────┘
│ server half: routers, models, schema fragment
│ client half: prebuilt ESM chunk, SPA routes + nav
@@ -182,7 +183,7 @@ reaches the container.
|---|---|---|
| `UOLINK_BASE_URL` | — | Default sidecar base URL for a site with nothing saved yet. The admin panel's stored value wins. |
| `UOLINK_WS_URL` | — | Same, for the WebSocket URL. |
| `UOLINK_PROTOCOL` | `3` | Wire protocol this build speaks. Again only a fallback — set it lower only if you deliberately run an older sidecar. |
| `UOLINK_PROTOCOL` | `8` | Wire protocol this build speaks. Again only a fallback — set it lower only if you deliberately run an older sidecar. |
| `TOWNCRIER_DURATION_SEC` | `3600` | How long a published news post's in-game town-crier message stays up (≤ `86400`). |
**The sidecar's auth token is deliberately not here.** It is entered in Admin → Shard, encrypted at

View File

@@ -1,6 +1,6 @@
{
"$comment": "The core this module is proved against. MODULE_API.md §5.3: the frozen-manifest job clones RunicGateway/website at this exact ref, drops this module in as modules/uo and runs CORE's own routeManifest.js — nothing else can answer whether the URLs the module claims are the URLs it actually serves. Pinned rather than tracking `edge` on purpose: core moves for reasons that have nothing to do with this module, and a bump is then a deliberate commit saying which core the module was last proved against, instead of an unexplained red X on someone else's PR. Bump it, regenerate routes.manifest.json, and commit both together. **It points at `edge` for the length of the Event System window** (org lead, 2026-09-04), and that is the one line here a reader should not tidy back. This module registers event actions from EVENTS_PLAN.md Phase 9, and `api.registerEventActions` exists only from MODULE_API 1.10.0 -- under the previous `main` pin `register()` throws and the module does not load at all, so the job would be red by construction for eight phases and would prove nothing while a real regression hid behind it. Phase 16's cutover re-pins it to `main`, which is the same commit that turns the Integration kit green again.",
"$comment": "The core this module is proved against. MODULE_API.md §5.3: the frozen-manifest job clones RunicGateway/website at this exact ref, drops this module in as modules/uo and runs CORE's own routeManifest.js — nothing else can answer whether the URLs the module claims are the URLs it actually serves. Pinned rather than tracking a branch on purpose: core moves for reasons that have nothing to do with this module, and a bump is then a deliberate commit saying which core the module was last proved against, instead of an unexplained red X on someone else's PR. Bump it, regenerate routes.manifest.json, and commit both together. **It pointed at `edge` for the length of the Event System window** (org lead, 2026-09-04), and this commit ends that: `api.registerEventActions` exists only from MODULE_API 1.10.0, so under the previous `main` pin `register()` threw and the module did not load at all the job would have been red by construction for eight phases and would have proved nothing while a real regression hid behind it. The Phase 16b cutover put 1.10.0 on `main`, so the pin comes home, and this is the same move that turns the Integration kit green again. **routes.manifest.json needed NO regeneration**: the job's own steps were run against this exact ref and answered `routes.manifest.json is current — 73 routes, all documented`, so the \"commit both together\" instruction above had nothing to pair with this time.",
"repo": "https://gitea.whitlocktech.com/RunicGateway/website.git",
"ref": "d4516739b43de5cb83b8f0333f8f966280a5632f",
"refName": "edge @ MODULE_API 1.10.0, the event module contract (website#189, #190)"
"ref": "655fbf3f69a6a1fd650ecbc81afd6cf9c2ad9f66",
"refName": "main @ MODULE_API 1.10.0, the Event System cutover (website#199)"
}

View File

@@ -164,6 +164,38 @@ export const admin = {
setPath: (path) => req('/admin/shard/atlas/path', { method: 'PUT', body: { path } }),
},
// The Asset Bridge (docs/link/v8.md §6, §14 — protocol 8 phase 8). Client
// artwork and the cliloc table both come off the operator's own UO client, over
// the same bridge, and boot deliberately never asks the shard for either — so
// these calls are the only thing that imports them, and the panel that makes
// them is where an operator goes after patching their client.
//
// `update` and `reimport` are §6's two stages rather than one call with a flag,
// because they cost wildly different things: an Update that finds the client
// files unchanged transfers nothing, and a re-import fetches every sprite in
// the catalogue. A checkbox spells that difference the same size as the button.
assets: {
status: () => req('/admin/shard/assets'),
update: (approve = false) =>
req('/admin/shard/assets/import', { method: 'POST', body: { approve } }),
reimport: (approve = false) =>
req('/admin/shard/assets/import', { method: 'POST', body: { force: true, approve } }),
// Item and land pictures, which arrive one at a time because a page asked for
// one. The pass runs on its own timer; this is for the operator who has just
// patched a client and would rather not wait for the interval.
warm: (force = false) => req('/admin/shard/assets/warm', { method: 'POST', body: { force } }),
},
clilocs: {
status: () => req('/admin/shard/clilocs'),
import: (opts = {}) =>
req('/admin/shard/clilocs/import', {
method: 'POST',
body: { force: !!opts.force, approve: !!opts.approve },
}),
setPath: (path) => req('/admin/shard/clilocs/path', { method: 'PUT', body: { path } }),
},
// In-game staff operations: write plane + support queue (admin/moderator).
// `actor` is stamped server-side from the session — never sent from here.
shardOps: {

View File

@@ -0,0 +1,31 @@
// ── A label/value line in an admin detail panel ────────────────────────────
//
// Extracted from `SpawnAtlas.jsx` in phase 8, when the Client Files panel needed
// the same thing for the third time. Two copies of twenty lines is a coincidence;
// three is a component, and the reason to make it one here rather than later is
// that these lines are read side by side — an operator moves between Spawn Atlas
// and Client Files doing one job, and a panel whose rows are a few pixels off
// from its neighbour's looks like a different part of the product.
//
// Deliberately not styled through a class: this module ships as a prebuilt chunk
// into core's SPA and owns no stylesheet there (MODULE_API.md §3.2), so its own
// layout is inline and only core's theme VARIABLES are borrowed.
export default function DetailRow({ label, children }) {
return (
<div
className="sans"
style={{
display: 'flex',
alignItems: 'baseline',
justifyContent: 'space-between',
gap: 16,
padding: '7px 0',
borderBottom: '1px solid var(--line)',
fontSize: '0.86rem',
}}
>
<span className="dim">{label}</span>
<span style={{ color: 'var(--head)', textAlign: 'right', wordBreak: 'break-all' }}>{children}</span>
</div>
)
}

View File

@@ -41,6 +41,7 @@ import ShardAdmin from './routes/admin/ShardAdmin.jsx'
import ShardOps from './routes/admin/ShardOps.jsx'
import ShardVisibility from './routes/admin/ShardVisibility.jsx'
import SpawnAtlas from './routes/admin/SpawnAtlas.jsx'
import ClientFiles from './routes/admin/ClientFiles.jsx'
import HousesAdmin from './routes/admin/HousesAdmin.jsx'
import AdminCharacters from './routes/admin/AdminCharacters.jsx'
import AdminCharacter from './routes/admin/AdminCharacter.jsx'
@@ -93,12 +94,14 @@ registry.registerRoutes(ID, {
{ path: 'market/vendors/:serial', element: <MarketVendor /> },
],
admin: [
// Admin-only: the sidecar's configuration, who may see which surface, and
// the atlas import. No `gate` on the other three because AdminLayout already
// requires staff and these carry their own role rows below.
// Admin-only: the sidecar's configuration, who may see which surface, the
// atlas import and the client-file imports. No `gate` on these four because
// AdminLayout already requires staff and they carry their own role rows
// below.
{ path: 'link', element: <ShardAdmin /> },
{ path: 'visibility', element: <ShardVisibility /> },
{ path: 'atlas', element: <SpawnAtlas /> },
{ path: 'files', element: <ClientFiles /> },
{ path: 'ops', element: <ShardOps />, gate: STAFF },
{ path: 'houses', element: <HousesAdmin />, gate: STAFF },
// Self-service, and deliberately ungated: a staff member's own characters
@@ -150,6 +153,7 @@ registry.registerNav(ID, {
{ label: 'Shard (uo-link)', to: '/admin/uo/link', icon: IconShard, group: 'System', order: 8, roles: ['admin'] },
{ label: 'Shard Visibility', to: '/admin/uo/visibility', icon: IconShard, group: 'System', order: 8, roles: ['admin'] },
{ label: 'Spawn Atlas', to: '/admin/uo/atlas', icon: IconShard, group: 'System', order: 8, roles: ['admin'] },
{ label: 'Client Files', to: '/admin/uo/files', icon: IconShard, group: 'System', order: 8, roles: ['admin'] },
// No group: a trailing untitled group of its own, below core's Account row
// rather than beside it (§3.3). One position lower than it sits today, and
// the alternative — letting a module into core's furniture groups — is worse.

View File

@@ -0,0 +1,663 @@
import { useCallback, useEffect, useRef, useState } from 'react'
import api from '../../api.js'
import { ErrorState, Loading } from '../../core.js'
import Row from '../../components/DetailRow.jsx'
import { CreaturePortrait } from '../public/Atlas.jsx'
// ── Admin · Client files ────────────────────────────────────────────────────
//
// Everything on this site that comes out of the operator's own UO client, and
// the buttons that bring it in (docs/link/v8.md §6, §14 — the Asset Bridge,
// phase 8).
//
// Three things, one page, because they are one job. Creature portraits, item and
// land pictures, and the cliloc table all live in files inside a UO client
// install; the shard decodes them and hands them over the bridge; and every one
// of them changes at the same moment, when the operator patches that client. An
// operator who has just done that has exactly one place to come.
//
// **Boot never asks the shard for any of it** (org lead, phase 2 and again in
// phase 7). A client patch is an event the operator knows about and the website
// does not, and a site that re-read 343 MB of client files on every restart to
// discover nothing had changed would be paying for the rare case forever. The
// consequence is the reason this panel exists at all: these buttons are the ONLY
// thing that imports. Nothing here happens on its own except the item-art warm
// pass, which is lazy by design and only fetches what a page has already asked
// for.
//
// **Nothing on this page throws for an operator-visible problem.** A shard that
// is down, an asset plane switched off, a Linux host with no libgdiplus, a client
// with no cliloc file — each is a reported state with a reason naming what to
// fix. A red box that says "500" would be the one thing an operator cannot act
// on, and every one of these states is ordinary.
// ── outcomes ───────────────────────────────────────────────────────────────
//
// An import reports its result rather than throwing, so these are answers, not
// errors. They are written in the operator's terms — what happened to their
// site — rather than in the protocol's.
const ASSET_OUTCOME = {
imported: (r) =>
`Imported — ${r.written?.toLocaleString() ?? 0} picture(s) written, ` +
`${r.assets?.toLocaleString() ?? 0} in the catalogue, ` +
`${r.bodies?.resolved?.toLocaleString() ?? 0} creature(s) matched to a body.`,
unchanged: () =>
'Unchanged — the shards client files match what was imported, so nothing was transferred.',
needsReview: (r) =>
`Waiting for you: ${r.vanishedCount?.toLocaleString() ?? 0} picture(s) this site holds are no` +
' longer offered by the shard.',
unavailable: (r) => `The shard could not serve this: ${r.reason || 'unknown reason'}`,
skipped: () => 'No shard is linked, so there are no client files to read.',
failed: (r) => `The import failed: ${r.reason || 'unknown reason'}`,
}
// The warm pass speaks the same vocabulary as the body import deliberately
// (`skipped` / `unavailable` / `unchanged` / `imported` / `failed`), but its
// numbers mean something different: it is bounded, so "imported" routinely
// leaves work behind and saying so is the difference between a button that looks
// broken and one that is doing what it promised.
const WARM_OUTCOME = {
imported: (r) =>
`Fetched ${r.written?.toLocaleString() ?? 0} picture(s)` +
(r.remaining ? `; ${r.remaining.toLocaleString()} still waiting — press again.` : '.'),
unchanged: () => 'Nothing waiting — every picture a page has asked for is already here.',
unavailable: (r) => `The shard could not serve this: ${r.reason || 'unknown reason'}`,
skipped: () => 'No shard is linked, so there is nothing to fetch.',
failed: (r) => `That did not work: ${r.reason || 'unknown reason'}`,
}
const CLILOC_OUTCOME = {
imported: (r) => `Imported — ${r.count?.toLocaleString() ?? 0} names loaded.`,
unchanged: () => 'Unchanged — the source matches the table that is already loaded.',
needsReview: (r) =>
`Waiting for you: ${r.missingSources?.length ?? 0} overlay file(s) that were loaded last time` +
' are missing.',
unavailable: (r) => `The source could not be read: ${r.reason || 'unknown reason'}`,
skipped: (r) => r.reason || 'There is no cliloc source configured.',
failed: (r) => `The import failed: ${r.reason || 'unknown reason'}`,
}
const describe = (table, result) =>
(table[result?.status] || (() => `Result: ${result?.status}`))(result || {})
const num = (n) => (n == null ? '—' : Number(n).toLocaleString())
const when = (v) => (v ? new Date(v).toLocaleString() : 'Never')
// ── the vanished-key review (§6) ───────────────────────────────────────────
//
// A key the site holds that the shard no longer offers is refused rather than
// applied, because an unmounted client volume and a deliberate client downgrade
// are the same thing from the server and the wrong guess deletes artwork.
//
// It is held in this component's state and not in a table, deliberately (org
// lead, 2026-09-14). The atlas persists its equivalent because BOOT re-parses the
// tree and would otherwise re-prompt on every restart forever; an asset import
// only ever happens because somebody pressed a button on this page, so the
// review is in front of the person who caused it, by construction. Declining is
// therefore not a decision to remember — it is simply not pressing the other
// button.
//
// The pictures matter. `body/820/a23` names nothing a human recognises; the horse
// it is a picture of does, and "is it right that these disappear?" is not a
// question anyone can answer from a list of keys.
function VanishedReview({ review, busy, onApprove, onDismiss }) {
const rows = review.result.vanished || []
const total = review.result.vanishedCount ?? rows.length
return (
<section
style={{
border: '1px solid #c58f4a',
borderRadius: 10,
padding: 16,
background: 'rgba(197,143,74,0.08)',
}}
>
<h3 className="display" style={{ margin: 0, fontSize: '1rem', color: 'var(--head)' }}>
An import is waiting for you
</h3>
<p className="sans" style={{ margin: '6px 0 12px', fontSize: '0.86rem', color: 'var(--muted)', lineHeight: 1.6 }}>
The shard no longer offers <strong>{num(total)}</strong> picture{total === 1 ? '' : 's'} this
site is currently serving, so nothing was changed. That is what a client volume that failed
to mount looks like as well as a deliberate client downgrade, and only you can tell them
apart. Approving re-reads the shard as it is right now if the mount was the problem and you
have since fixed it, what lands is the corrected import, not a deletion.
</p>
<div
style={{
display: 'flex',
flexWrap: 'wrap',
gap: 10,
maxHeight: 260,
overflowY: 'auto',
padding: '4px 0',
}}
>
{rows.map((row) => (
<div key={row.key} style={{ width: 96, textAlign: 'center' }}>
<CreaturePortrait art={row.file} name={row.key} size={48} />
<div
className="sans dim"
style={{ fontSize: '0.7rem', wordBreak: 'break-all', marginTop: 2 }}
title={row.key}
>
{row.key}
</div>
</div>
))}
</div>
{total > rows.length && (
<p className="sans dim" style={{ margin: '10px 0 0', fontSize: '0.8rem' }}>
Showing the first {num(rows.length)} of {num(total)}.
</p>
)}
<div style={{ display: 'flex', gap: 10, marginTop: 14, flexWrap: 'wrap' }}>
<button type="button" className="btn btn-primary btn-sq" disabled={busy} onClick={onApprove}>
Approve and import
</button>
<button type="button" className="btn btn-sq" disabled={busy} onClick={onDismiss}>
Keep the pictures I have
</button>
</div>
</section>
)
}
// What the last import did. Core's activity log records the same action, but it
// is one unfiltered list of every admin action on the site — so the answer to
// "did last week's import actually do anything" is here, beside the button that
// caused it, rather than twenty pages into a log.
function LastImport({ last, at }) {
if (!last) {
return <Row label="Last import">{at ? when(at) : 'No import recorded yet'}</Row>
}
const tally = last.bodies || {}
const unmatched = [
tally.unknown ? `${num(tally.unknown)} unknown to the shard` : '',
tally.notCreature ? `${num(tally.notCreature)} not a creature` : '',
tally.failed ? `${num(tally.failed)} failed` : '',
].filter(Boolean)
return (
<>
<Row label="Last import">
{`${when(last.at || at)}${last.by ? ` · ${last.by}` : ''}${last.force ? ' · full re-import' : ''}`}
</Row>
<Row label="Pictures written">
{`${num(last.written)} written, ${num(last.fetched)} fetched`}
{last.removed ? `, ${num(last.removed)} removed` : ''}
</Row>
{unmatched.length > 0 && (
// Only the creatures that did NOT match, because how many did is the row
// above this block and a number that means "now" should not also appear
// as a number that means "at that import". What is left is the part an
// operator can act on: `unknown` is a spawn file naming a type this
// shard's scripts do not define, which is real drift.
<Row label="Could not be matched">{unmatched.join(', ')}</Row>
)}
</>
)
}
export default function ClientFiles() {
const [assets, setAssets] = useState(null)
const [clilocs, setClilocs] = useState(null)
const [clilocPath, setClilocPath] = useState('')
const [loading, setLoading] = useState(true)
const [error, setError] = useState('')
const [busy, setBusy] = useState(false)
// One message per section: three panels that can each speak means an operator
// must never have to work out which button a sentence belongs to.
const [msg, setMsg] = useState({})
// The in-session reviews, keyed by which plane raised them.
const [review, setReview] = useState({})
// `quiet` re-reads without flipping `loading`, and that distinction is the
// whole difference between a usable panel and a maddening one: `loading`
// replaces the page with a spinner, so refreshing that way after an action
// unmounts everything, throws the operator back to the top of a long page, and
// takes the sentence saying what just happened with it — at the bottom of the
// cliloc section, that means pressing Update appears to do nothing at all.
const load = useCallback(async ({ quiet = false } = {}) => {
if (!quiet) setLoading(true)
setError('')
try {
// Both statuses call the shard, and neither one failing should cost the
// other its panel: an operator whose cliloc file is missing still needs to
// see what the asset import says.
const [a, c] = await Promise.all([
api.admin.assets.status().catch((err) => ({ error: err.message })),
api.admin.clilocs.status().catch((err) => ({ error: err.message })),
])
setAssets(a)
setClilocs(c)
setClilocPath(c?.path || '')
} catch (err) {
setError(err.message || 'Could not load the client-file status.')
} finally {
if (!quiet) setLoading(false)
}
}, [])
useEffect(() => {
load()
}, [load])
// One automatic re-read when the shard answered BUSY (§3.2's single slot),
// and exactly one per mount.
//
// BUSY is not a fault and it is not sticky on the shard — it means something
// else held the asset slot for longer than the client's own 425 backoff, and
// the two things that hold it are both ordinary: an import the operator
// started, and the item-art warm pass refilling itself after a client patch.
// The panel does not poll, so without this the operator is left reading a
// refusal about a shard that was free again seconds later, until they think to
// reload. A second read clears the common case; if it is still busy, the
// sentence says to come back, because a page that retried forever would be
// holding the slot it is waiting for.
const retried = useRef(false)
useEffect(() => {
if (retried.current || busy) return
const stillBusy = assets?.code === 'BUSY' || clilocs?.code === 'BUSY'
if (!stillBusy) return
retried.current = true
const t = setTimeout(() => load({ quiet: true }), 4000)
return () => clearTimeout(t)
}, [assets, clilocs, busy, load])
// Every action shares this: run it, say what it said, then re-read status so
// the panel reflects the world rather than what we assumed happened.
async function run(section, table, fn) {
setBusy(true)
setMsg((m) => ({ ...m, [section]: '' }))
setError('')
try {
const result = await fn()
setMsg((m) => ({ ...m, [section]: describe(table, result) }))
// Set or cleared from the SAME answer, in one place. Clearing separately
// left the review standing after an approve that had already applied — a
// banner asking for a decision that was made ten seconds ago, on pictures
// that are already gone.
setReview((r) => ({
...r,
[section]: result?.status === 'needsReview' ? { result, run: fn } : null,
}))
await load({ quiet: true })
return result
} catch (err) {
setError(err.message || 'That did not work.')
return null
} finally {
setBusy(false)
}
}
async function saveClilocPath() {
setBusy(true)
setMsg((m) => ({ ...m, clilocs: '' }))
setError('')
try {
const fresh = await api.admin.clilocs.setPath(clilocPath.trim())
setClilocs(fresh)
setClilocPath(fresh.path || '')
setMsg((m) => ({
...m,
clilocs:
fresh.source === 'bridge'
? 'Saved. The base table still comes from the shard — this selects where custom/ overlay' +
' files are read from.'
: fresh.path === ''
? 'Path cleared. The loaded table keeps serving; nothing new will be read.'
: fresh.fileReadable
? 'Saved. The file is readable — import when you are ready.'
: 'Saved, but the file could not be read from here. Check the mount and permissions.',
}))
} catch (err) {
setError(err.message || 'Could not save the path.')
} finally {
setBusy(false)
}
}
if (loading) return <Loading />
if (error && !assets && !clilocs) return <ErrorState message={error} />
const loaded = assets?.loaded || null
const shard = assets?.shard || null
const families = shard?.families || []
// Reported by the server rather than inferred from `shard` being null — which
// is also what a linked shard that is simply DOWN looks like, and those two
// want opposite things from this page: one needs its buttons disabled, the
// other needs them available so the operator can retry.
const linked = Boolean(assets?.linked)
const imagingBroken = shard?.imaging && shard.imaging.ok === false
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
<header>
<h2 className="display" style={{ margin: 0, fontSize: '1.3rem', color: 'var(--head)' }}>
Client files
</h2>
<p className="sans" style={{ margin: '6px 0 0', color: 'var(--muted)', fontSize: '0.88rem', lineHeight: 1.6, maxWidth: 760 }}>
Creature portraits, item pictures and the names your shards items and titles are stored
under all come out of the UO client on the shard host. The shard reads and decodes them
itself and hands them over uo-link nothing is converted on a desktop and nothing is
uploaded. They change when you patch that client, which is something only you know about,
so <strong>these buttons are the only thing that imports them</strong>: nothing here
happens on a restart.
</p>
</header>
{(assets?.error || clilocs?.error) && (
<section
style={{ border: '1px solid #d98b84', borderRadius: 10, padding: 16 }}
className="sans"
>
<strong style={{ color: 'var(--head)' }}>Part of this page could not be read.</strong>
<p style={{ margin: '6px 0 0', color: 'var(--muted)', fontSize: '0.86rem', lineHeight: 1.6 }}>
{assets?.error || clilocs?.error} the counts below may be missing. Both status calls
are written never to fail for an ordinary problem (a shard that is down is an ANSWER
here), so this one is worth the server log.
</p>
</section>
)}
{assets?.reason && !shard && (
<section
style={{ border: '1px solid var(--line)', borderRadius: 10, padding: 16 }}
className="sans"
>
{/* BUSY is the one code here that is not a fault, and saying "the shard
is not answering" about it sends an operator to check a shard that is
working. The slot is held by something ordinary — an import running,
or the warm pass — and it frees itself. */}
<strong style={{ color: 'var(--head)' }}>
{assets.code === 'BUSY'
? 'The shard is busy with another client-file request.'
: 'The shard is not answering for client files.'}
</strong>
<p style={{ margin: '6px 0 0', color: 'var(--muted)', fontSize: '0.86rem', lineHeight: 1.6 }}>
{assets.code === 'BUSY'
? 'The shard serves one of these at a time, so an import running now — or the' +
' item-picture pass refilling itself after a client patch — holds it until it is' +
' done. This page re-reads once on its own; if the counts below are still missing' +
' after that, reload in a moment.'
: assets.reason}
{assets.code === 'DISABLED' &&
' — set Bridge.AssetsEnabled on the shard to allow it to read its own client files.'}
</p>
<p style={{ margin: '6px 0 0', color: 'var(--muted)', fontSize: '0.86rem', lineHeight: 1.6 }}>
What is already imported keeps serving; only new imports are affected.
</p>
</section>
)}
{imagingBroken && (
<section
style={{ border: '1px solid #c58f4a', borderRadius: 10, padding: 16, background: 'rgba(197,143,74,0.08)' }}
className="sans"
>
<strong style={{ color: 'var(--head)' }}>The shard host cannot render images.</strong>
<p style={{ margin: '6px 0 0', color: 'var(--muted)', fontSize: '0.86rem', lineHeight: 1.6 }}>
{shard.imaging.reason ||
'A Linux shard host needs libgdiplus before it can decode a single sprite.'}{' '}
Names (the cliloc table) are unaffected and can still be imported they have no pixels
in them.
</p>
</section>
)}
{review.assets && (
<VanishedReview
review={review.assets}
busy={busy}
onApprove={() => run('assets', ASSET_OUTCOME, () => review.assets.run(true))}
onDismiss={() => setReview((r) => ({ ...r, assets: null }))}
/>
)}
{/* ── creature portraits ── */}
<section style={{ border: '1px solid var(--line)', borderRadius: 10, padding: 16 }}>
<h3 className="display" style={{ margin: '0 0 4px', fontSize: '1rem', color: 'var(--head)' }}>
Creature portraits
</h3>
<p className="sans" style={{ margin: '0 0 12px', fontSize: '0.84rem', color: 'var(--muted)', lineHeight: 1.6 }}>
One picture per creature body, imported as a set and shown on the bestiary. Creatures the
client has no artwork for are normal and stay as text a stock client has none for most
ghost and gargoyle bodies. Portraits you drew yourself and named in{' '}
<code>spawnAtlas.art.json</code> always win over an imported one.
</p>
<Row label="Pictures held">{`${num(loaded?.stored)} of ${num(loaded?.assets)} catalogued`}</Row>
<Row label="Creatures matched">{`${num(loaded?.resolved)} of ${num(loaded?.creatures)}`}</Row>
<LastImport last={loaded?.last} at={loaded?.importedAt} />
<Row label="Client files changed since">
{assets?.drift == null
? '—'
: assets.drift
? 'Yes — an update would pick it up'
: 'No'}
</Row>
{shard?.hashing && (
<Row label="Shard is hashing">
Yes it is still fingerprinting its client files in the background. Drift may read as
yes until it finishes.
</Row>
)}
<Row label="Extractor version">
{/* "—" for a version nobody has imported yet reads as a missing value;
it is an answer, and the shard's own version is the useful half of
the sentence on exactly that install. */}
{(loaded?.extractorVersion == null ? 'None' : num(loaded.extractorVersion)) +
' imported' +
(shard?.extractorVersion == null ? '' : ` · ${num(shard.extractorVersion)} on the shard`)}
</Row>
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center', marginTop: 14 }}>
<button
type="button"
className="btn btn-primary btn-sq"
disabled={busy || !linked}
onClick={() => run('assets', ASSET_OUTCOME, (approve = false) => api.admin.assets.update(approve))}
>
{busy ? 'Working…' : 'Update'}
</button>
<button
type="button"
className="btn btn-sq"
disabled={busy || !linked}
onClick={() => run('assets', ASSET_OUTCOME, (approve = false) => api.admin.assets.reimport(approve))}
>
Re-import everything
</button>
</div>
<p className="sans dim" style={{ margin: '10px 0 0', fontSize: '0.8rem', lineHeight: 1.6 }}>
<strong>Update</strong> checks the shards client files first and transfers only the
pictures that actually changed when nothing has, it costs one small round trip.{' '}
<strong>Re-import everything</strong> fetches the whole catalogue again; use it after
restoring a backup or losing the uploads volume, where the database still remembers
pictures that are no longer on disk.
</p>
{msg.assets && (
<p className="sans" style={{ margin: '10px 0 0', fontSize: '0.85rem', color: '#7fd0a4' }}>{msg.assets}</p>
)}
</section>
{/* ── item and land pictures ── */}
<section style={{ border: '1px solid var(--line)', borderRadius: 10, padding: 16 }}>
<h3 className="display" style={{ margin: '0 0 4px', fontSize: '1rem', color: 'var(--head)' }}>
Item and land pictures
</h3>
<p className="sans" style={{ margin: '0 0 12px', fontSize: '0.84rem', color: 'var(--muted)', lineHeight: 1.6 }}>
The pictures beside marketplace listings and on character sheets. These are never imported
as a set there are tens of thousands of item graphics, times every dye colour so they
arrive one at a time, shortly after a page asks for one, and refresh themselves after a
client patch. This is here for the two moments waiting is the wrong answer: you have just
linked a shard, or you have just patched a client and would rather not wait.
</p>
<Row label="Item pictures held">{num(loaded?.items)}</Row>
<Row label="Land pictures held">{num(loaded?.land)}</Row>
<Row label="Shard serves">
{families.length > 0 ? families.join(', ') : '—'}
{shard && !families.includes('static')
? ' — this shards plugin predates item pictures; update the overlay to get them'
: ''}
</Row>
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center', marginTop: 14 }}>
<button
type="button"
className="btn btn-sq"
disabled={busy || !linked}
onClick={() => run('warm', WARM_OUTCOME, () => api.admin.assets.warm(false))}
>
Fetch waiting pictures
</button>
<button
type="button"
className="btn btn-sq"
disabled={busy || !linked}
onClick={() => run('warm', WARM_OUTCOME, () => api.admin.assets.warm(true))}
>
Refresh the ones I have
</button>
</div>
{msg.warm && (
<p className="sans" style={{ margin: '10px 0 0', fontSize: '0.85rem', color: '#7fd0a4' }}>{msg.warm}</p>
)}
</section>
{/* ── the cliloc table ── */}
<section style={{ border: '1px solid var(--line)', borderRadius: 10, padding: 16 }}>
<h3 className="display" style={{ margin: '0 0 4px', fontSize: '1rem', color: 'var(--head)' }}>
Item and title names (clilocs)
</h3>
<p className="sans" style={{ margin: '0 0 12px', fontSize: '0.84rem', color: 'var(--muted)', lineHeight: 1.6 }}>
UO stores most item, title and reward names as numbers, and the words live in the clients
cliloc file. Without this table the marketplace and character sheets show numbers. With a
shard linked the shard decompresses and serves it; otherwise the site reads a file you
point it at below.
</p>
<Row label="Names loaded">{num(clilocs?.count)}</Row>
<Row label="Imported">{when(clilocs?.importedAt)}</Row>
<Row label="Source">
{clilocs?.source === 'bridge'
? 'The shard, over uo-link'
: clilocs?.configured
? clilocs.path
: 'None configured'}
</Row>
<Row label="Overlays">
{clilocs?.sources?.length ? clilocs.sources.join(', ') : 'None'}
</Row>
<Row label="Changed since import">
{clilocs?.drift == null ? '—' : clilocs.drift ? 'Yes — an import would pick it up' : 'No'}
</Row>
{clilocs?.problem && (
<Row label="Problem">
<span style={{ color: '#d98b84' }}>{clilocs.problem}</span>
</Row>
)}
{clilocs?.missingSources?.length > 0 && (
<Row label="Missing since last import">
<span style={{ color: '#d98b84' }}>{clilocs.missingSources.join(', ')}</span>
</Row>
)}
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', alignItems: 'center', marginTop: 14 }}>
<button
type="button"
className="btn btn-primary btn-sq"
disabled={busy}
onClick={() =>
run('clilocs', CLILOC_OUTCOME, (approve = false) =>
api.admin.clilocs.import({ approve }),
)
}
>
{busy ? 'Working…' : 'Update'}
</button>
<button
type="button"
className="btn btn-sq"
disabled={busy}
onClick={() =>
run('clilocs', CLILOC_OUTCOME, (approve = false) =>
api.admin.clilocs.import({ force: true, approve }),
)
}
>
Re-import everything
</button>
</div>
{review.clilocs && (
<div
style={{
marginTop: 14,
border: '1px solid #c58f4a',
borderRadius: 10,
padding: 14,
background: 'rgba(197,143,74,0.08)',
}}
>
<strong className="sans" style={{ color: 'var(--head)', fontSize: '0.9rem' }}>
An overlay file that was loaded last time is missing
</strong>
<p className="sans" style={{ margin: '6px 0 10px', fontSize: '0.85rem', color: 'var(--muted)', lineHeight: 1.6 }}>
{(review.clilocs.result.missingSources || []).join(', ') || 'One or more overlays'}
the table was left exactly as it is. If you deleted those files on purpose, import
anyway; if this is a mount that did not come back, fix it first and the next import
picks the names up again.
</p>
<div style={{ display: 'flex', gap: 10, flexWrap: 'wrap' }}>
<button
type="button"
className="btn btn-primary btn-sq"
disabled={busy}
onClick={() =>
run('clilocs', CLILOC_OUTCOME, () => review.clilocs.run(true))
}
>
Import without them
</button>
<button
type="button"
className="btn btn-sq"
disabled={busy}
onClick={() => setReview((r) => ({ ...r, clilocs: null }))}
>
Keep the names I have
</button>
</div>
</div>
)}
<div style={{ marginTop: 16 }}>
<p className="sans dim" style={{ margin: '0 0 8px', fontSize: '0.8rem', lineHeight: 1.6 }}>
{clilocs?.source === 'bridge'
? 'Where custom/ overlay files are read from. The base table comes from the shard' +
' either way; leave this blank if you have no overlays.'
: 'The directory holding the cliloc file. Blank turns cliloc resolution off — the' +
' table that is already loaded keeps serving.'}
</p>
<div style={{ display: 'flex', gap: 10, flexWrap: 'wrap', alignItems: 'center' }}>
<input
className="input"
value={clilocPath}
onChange={(e) => setClilocPath(e.target.value)}
placeholder="/srv/uo-client"
style={{ flex: '1 1 320px', minWidth: 0 }}
/>
<button type="button" className="btn btn-sq" disabled={busy} onClick={saveClilocPath}>
Save path
</button>
</div>
</div>
{msg.clilocs && (
<p className="sans" style={{ margin: '10px 0 0', fontSize: '0.85rem', color: '#7fd0a4' }}>{msg.clilocs}</p>
)}
</section>
{error && (
<span className="sans" style={{ color: '#d98b84', fontSize: '0.85rem' }}>{error}</span>
)}
</div>
)
}

View File

@@ -1,6 +1,7 @@
import { useCallback, useEffect, useState } from 'react'
import api from '../../api.js'
import { ErrorState, Loading } from '../../core.js'
import Row from '../../components/DetailRow.jsx'
// ── Admin · Spawn atlas ─────────────────────────────────────────────────────
//
@@ -36,26 +37,6 @@ const OUTCOME = {
const describe = (result) => (OUTCOME[result?.status] || (() => `Result: ${result?.status}`))(result)
function Row({ label, children }) {
return (
<div
className="sans"
style={{
display: 'flex',
alignItems: 'baseline',
justifyContent: 'space-between',
gap: 16,
padding: '7px 0',
borderBottom: '1px solid var(--line)',
fontSize: '0.86rem',
}}
>
<span className="dim">{label}</span>
<span style={{ color: 'var(--head)', textAlign: 'right', wordBreak: 'break-all' }}>{children}</span>
</div>
)
}
function PendingReview({ pending, busy, onApprove, onReject }) {
const declined = pending.status === 'rejected'
return (

View File

@@ -102,6 +102,42 @@ test('admin atlas actions use the right methods and bodies', async () => {
assert.deepEqual(calls[1].opts.body, { path: '/srv/servuo' })
})
// ── the Asset Bridge's two stages (docs/link/v8.md §6) ──────────────────────
// Update and Re-import are one route and differ only by `force`, and the
// difference is not cosmetic: one transfers nothing when the client files are
// unchanged, the other fetches the whole catalogue. A binding that sent `force`
// on both would make the cheap button the expensive one, and nothing visible
// would change — the pictures would be correct either way.
test('assets.update asks for the diff and assets.reimport asks for everything', async () => {
await admin.assets.update()
assert.equal(calls[0].url, '/api/v1/admin/shard/assets/import')
assert.equal(calls[0].opts.method, 'POST')
assert.deepEqual(calls[0].opts.body, { approve: false })
await admin.assets.reimport()
assert.deepEqual(calls[1].opts.body, { force: true, approve: false })
})
// Approving a vanished key re-runs the SAME operation the operator pressed, so
// `approve` has to ride on both. Sending the update's approval as a re-import
// would quietly turn "yes, accept those deletions" into a full re-download.
test('approve rides on whichever import the operator ran', async () => {
await admin.assets.update(true)
await admin.assets.reimport(true)
assert.deepEqual(calls[0].opts.body, { approve: true })
assert.deepEqual(calls[1].opts.body, { force: true, approve: true })
})
test('cliloc admin actions use the right methods and bodies', async () => {
await admin.clilocs.import({ force: true })
assert.equal(calls[0].url, '/api/v1/admin/shard/clilocs/import')
assert.deepEqual(calls[0].opts.body, { force: true, approve: false })
await admin.clilocs.setPath('/srv/uo-client')
assert.equal(calls[1].opts.method, 'PUT')
assert.deepEqual(calls[1].opts.body, { path: '/srv/uo-client' })
})
// ── path encoding ───────────────────────────────────────────────────────────
// A city name with an apostrophe and a space is the real case: "Serpent's Hold"
// is a governor city, and an unencoded one would break the route match rather

View File

@@ -120,7 +120,7 @@ const it = (name, fn) => test(name, { skip: skip && 'no dist/entry.js — run np
it('registers routes in all three areas, namespaced under the module id', () => {
const { routes } = registered
assert.equal(routes.public.length, 13)
assert.equal(routes.admin.length, 7)
assert.equal(routes.admin.length, 8)
assert.equal(routes.player.length, 2)
for (const area of ['public', 'admin', 'player']) {
for (const r of routes[area]) {

View File

@@ -305,16 +305,54 @@ function webUserId(webId) {
}
/** Resolve a `facet/name` landmark to the point the shard counts around. */
function landmarkValue(row) {
const group = row.group || ''
return group === '' ? `${row.facet}/${row.name}` : `${row.facet}/${group}/${row.name}`
}
/**
* A place string resolved to a point on a facet.
*
* **Two forms, and the older one is not deprecated — it is stored.** The current
* form is `facet/group/name`, which names exactly one landmark. The older
* `facet/name` is what every event published before this fix carries, and those
* rows are the authored record: a published version is immutable, so a parse that
* stopped understanding them would break runs rather than correct them. So the
* three-part form is tried first and the two-part read is the fallback.
*
* The fallback keeps the old first-match behaviour deliberately. It is wrong in
* the same way it always was — that is what the new form exists to fix — but it
* is what those runs did last time, and silently relocating a live event's
* spawn point is worse than repeating a known imprecision.
*
* A three-part value whose group no longer exists REFUSES rather than falling
* back to the name alone, and that is the point rather than a gap: it asked for
* one particular landmark, so the honest answer when that landmark is gone is to
* say so — the operator renamed something and an event needs re-pointing. Only a
* value that never named a group gets the imprecise read.
*/
async function landmarkPoint(value) {
const raw = String(value == null ? '' : value)
const cut = raw.indexOf('/')
if (cut < 1) {
const parts = raw.split('/')
if (parts.length < 2 || parts[0] === '' || parts[parts.length - 1] === '') {
return { ok: false, error: `"${raw}" is not a facet/name place` }
}
const facet = raw.slice(0, cut)
const name = raw.slice(cut + 1)
const facet = parts[0]
const rows = await shardAtlas.listLandmarks({ facet })
// `facet/group/name`. The name is the LAST segment and the group is everything
// between, so a group carrying a slash still resolves.
if (parts.length >= 3) {
const group = parts.slice(1, -1).join('/')
const name = parts[parts.length - 1]
const hit = rows.find((r) => r.name === name && (r.group || '') === group)
if (hit) return { ok: true, map: hit.facet, x: hit.x, y: hit.y }
// No fall-through error: a name containing a slash reads as three parts too,
// and the two-part read below is the one that resolves it.
}
const name = parts.slice(1).join('/')
const hit = rows.find((r) => r.facet === facet && r.name === name)
if (!hit) {
@@ -2125,7 +2163,14 @@ const OPTION_SOURCES = [
async resolve() {
const rows = await shardAtlas.listLandmarks()
return bounded(rows, 'uo.options.landmarks').map((r) => ({
value: `${r.facet}/${r.name}`,
// **`facet/group/name`, because `facet/name` does not name one place.**
// A stock 57.4 tree has 558 landmarks under 320 distinct `facet/name`
// pairs: `Trammel/Entrance` is 23 different dungeons, and `landmarkPoint`
// resolves with `.find()`, so 22 of them were unreachable — an author who
// picked "Entrance — Destard" got Blighted Grove, with a successful run
// and no warning. The group was already the disambiguator; it was shown
// to the eye and left out of the value. All 558 are distinct with it.
value: landmarkValue(r),
label: r.name,
// The atlas's own grouping where it has one, the facet otherwise — so a
// shard whose landmark file carries no groups still gets a usable

View File

@@ -957,3 +957,20 @@ UPDATE uo_link_config SET protocol = 8
WHERE id = 1 AND protocol < 8
AND NOT EXISTS (SELECT 1 FROM settings WHERE `key` = 'uo_link_protocol_8_migrated');
INSERT IGNORE INTO settings (`key`, value) VALUES ('uo_link_protocol_8_migrated', '1');
-- `shard_spawn_points.unique_id` for an install that already had the table
-- (Asset Bridge phase 9; the column itself is Events phase 12b).
--
-- The column was added to the CREATE TABLE above and nowhere else, so it reached
-- fresh installs and no existing one -- `CREATE TABLE IF NOT EXISTS` does not add
-- a column to a table that is already there, which is what every ALTER in this
-- file exists to do. `replaceAtlas` inserts `unique_id` unconditionally, so on an
-- upgraded install EVERY spawn-atlas import since v1.2.0 has failed outright with
-- `Unknown column 'unique_id' in 'INSERT INTO'` -- the bestiary, the spawn map and
-- the champion altars all frozen at whatever was last imported.
--
-- Found by the phase 9 acceptance walk, on a rig whose tables predate 12b: a fresh
-- install cannot reproduce it, and neither can a test whose schema is this file
-- applied to an empty database. That is the same blind spot the protocol-pin block
-- above records, two phases running.
ALTER TABLE shard_spawn_points ADD COLUMN IF NOT EXISTS unique_id VARCHAR(64) NULL;

View File

@@ -30,11 +30,26 @@ async function batched(conn, sql, rows) {
// ── the manifest side ──────────────────────────────────────────────────────
/** Every asset row we hold, as a Map of key → row. */
async function allAssets() {
/**
* The asset rows we hold in one family, as a Map of key → row.
*
* **The family is required, and the reason is a deletion.** The import diffs what
* this returns against a manifest, and a manifest is always of ONE family (§14 —
* the reply carries a single catalogue id, so it could not be otherwise). Phase 5
* put item and land art in this table beside the body catalogue; read whole, the
* body import then sees every item picture as a key the shard has stopped
* offering and stages all of them for deletion. On a real install that is a few
* hundred pictures the operator is asked to approve the loss of, with a sentence
* that is entirely wrong about what happened.
*
* `null` reads every family, which nothing in the import path should ever want.
*/
async function allAssets(family = null) {
const rows = await query(
'SELECT asset_key, family, sha256, bytes, width, height, body, action, direction, file, catalog ' +
'FROM shard_assets',
'FROM shard_assets' +
(family ? ' WHERE family = ?' : ''),
family ? [family] : [],
)
const map = new Map()
@@ -68,8 +83,16 @@ async function allAssets() {
* `ON DUPLICATE KEY UPDATE` rather than delete-and-insert, because an unchanged
* key must keep the file it already points at — re-writing the file for every
* asset on every Update is exactly the cost the manifest diff exists to avoid.
*
* `remove` is the keys an operator has APPROVED the loss of (§6). They are
* deleted here, inside the same transaction, because a half-applied removal is
* the worst of the three outcomes: until phase 8 the import unlinked the sprite
* and left the row, so the catalogue still counted a picture that was gone, the
* atlas could point a creature at a deleted file, and the very next forced
* import staged the same key for review again — telling the operator nothing had
* changed, about a file it had already deleted.
*/
async function saveAssets(rows, meta) {
async function saveAssets(rows, meta, remove = []) {
const conn = await core.pool.getConnection()
try {
@@ -101,6 +124,16 @@ async function saveAssets(rows, meta) {
values,
)
if (remove.length > 0) {
for (let i = 0; i < remove.length; i += BATCH) {
const slice = remove.slice(i, i + BATCH)
await conn.query(
`DELETE FROM shard_assets WHERE asset_key IN (${slice.map(() => '?').join(',')})`,
slice,
)
}
}
if (meta) {
await conn.query(
'INSERT INTO shard_asset_meta (id, payload) VALUES (1, ?) ' +
@@ -188,6 +221,31 @@ async function countByFamily() {
return out
}
/**
* Record what the import that just finished actually did (§6, phase 8).
*
* **A second write, deliberately.** The interesting half of that summary — how
* many atlas creatures resolved to a body id, how many portraits were applied —
* does not exist when `saveAssets` commits: producing it takes another round trip
* to the shard, and widening the rows-and-meta transaction to cover a network
* call is how an import ends up holding a write lock for the length of a timeout.
*
* `JSON_SET` rather than a read-modify-write for the same reason the rest of this
* file is one statement per operation: the payload is the gate an Update compares
* against, and re-serialising it from the outside is how a concurrent import
* loses a field nobody notices for a month.
*
* It is cosmetic by design — nothing reads `last` to make a decision, the panel
* only renders it — so a failure here is logged and swallowed by the caller
* rather than failing an import that has already applied.
*/
async function recordLastImport(last) {
await query('UPDATE shard_asset_meta SET payload = JSON_SET(payload, ?, JSON_COMPACT(?)) WHERE id = 1', [
'$.last',
JSON.stringify(last),
])
}
async function getMeta() {
const rows = await query('SELECT payload, imported_at FROM shard_asset_meta WHERE id = 1')
if (rows.length === 0) return null
@@ -195,9 +253,23 @@ async function getMeta() {
return { ...payload, importedAt: rows[0].imported_at }
}
async function countAssets() {
/**
* How many assets we hold, optionally in one family.
*
* **The family argument is not optional in spirit.** Phase 5 put item and land
* art in this table beside the body catalogue, and they are counted differently
* by nature: the catalogue is a SET with a known size, while item art is however
* much of an unbounded space the site has happened to ask for. A whole-table
* count answers neither question — it reported the creature catalogue as 1,408
* rows on an install holding 1,095 portraits and 313 item pictures, which is a
* confident wrong number in the one place an operator checks whether the import
* worked.
*/
async function countAssets(family = null) {
const rows = await query(
'SELECT COUNT(*) AS n, SUM(file IS NOT NULL) AS stored FROM shard_assets',
'SELECT COUNT(*) AS n, SUM(file IS NOT NULL) AS stored FROM shard_assets' +
(family ? ' WHERE family = ?' : ''),
family ? [family] : [],
)
return { total: Number(rows[0]?.n) || 0, stored: Number(rows[0]?.stored) || 0 }
}
@@ -295,6 +367,7 @@ async function artBySlug() {
module.exports = {
allAssets,
saveAssets,
recordLastImport,
getMeta,
countAssets,
replaceBodies,

View File

@@ -176,8 +176,12 @@ function removeSprite(name) {
* an operator recovers from a deleted uploads directory — the database still
* holds the hashes, but the files behind them are gone). `approve` accepts a
* catalogue that no longer offers keys we hold.
*
* `by` is who pressed the button, carried through only so the panel can say what
* the last import did and who ran it without reading the audit log (phase 8). It
* decides nothing.
*/
async function importAssets({ force = false, approve = false } = {}) {
async function importAssets({ force = false, approve = false, by = null } = {}) {
if (!(await shardLinked())) {
return {
status: 'skipped',
@@ -207,7 +211,7 @@ async function importAssets({ force = false, approve = false } = {}) {
const meta = await db.getMeta().catch(() => null)
if (!force && bridge.sameSources(sources, meta?.sources)) {
const counts = await db.countAssets()
const counts = await db.countAssets(bridge.FAMILY)
const bodies = await db.countBodies()
return {
@@ -228,7 +232,10 @@ async function importAssets({ force = false, approve = false } = {}) {
return failure(err, 'asset manifest')
}
const held = await db.allAssets()
// The body family only. This diff decides what gets DELETED, and the manifest
// it is diffed against is of one family by construction — so reading the whole
// table here stages every item picture phase 5 warmed as a vanished key.
const held = await db.allAssets(bridge.FAMILY)
const offered = new Set(manifest.rows.map((r) => r.key))
// A key we hold that the shard no longer offers. An unmounted client volume and
@@ -243,7 +250,11 @@ async function importAssets({ force = false, approve = false } = {}) {
reason:
`${vanished.length} asset(s) this site holds are no longer offered by the shard; ` +
'nothing was changed',
vanished: vanished.slice(0, 50),
// Each one carries the picture it currently has, because the decision the
// operator is being asked for is "is it right that these disappear?" and a
// list of keys cannot be looked at. `body/820/a23` names nothing a human
// recognises; the horse it is a picture of does.
vanished: vanished.slice(0, 50).map((key) => ({ key, file: held.get(key)?.file ?? null })),
vanishedCount: vanished.length,
}
}
@@ -318,14 +329,21 @@ async function importAssets({ force = false, approve = false } = {}) {
}
try {
await db.saveAssets(rows, {
catalog: manifest.catalog,
extractorVersion: manifest.extractorVersion,
family: bridge.FAMILY,
playerBodies: manifest.playerBodies,
sources: { files: sources.files, extractorVersion: sources.extractorVersion },
count: rows.length,
})
await db.saveAssets(
rows,
{
catalog: manifest.catalog,
extractorVersion: manifest.extractorVersion,
family: bridge.FAMILY,
playerBodies: manifest.playerBodies,
sources: { files: sources.files, extractorVersion: sources.extractorVersion },
count: rows.length,
},
// The approved removals go in with the write. The sprite is already
// unlinked above; leaving the row behind would keep counting a picture
// that is gone and re-offer the same key for review on every import.
removed,
)
} catch (err) {
return { status: 'failed', reason: err.message }
}
@@ -333,6 +351,36 @@ async function importAssets({ force = false, approve = false } = {}) {
const bodies = await resolveAtlasBodies()
const art = await applyArt()
// What this run did, kept beside the catalogue it produced (phase 8). The admin
// panel renders it as "the last import", which is the question an operator has
// straight after pressing a button that takes a minute and prints nothing:
// what changed, and did the body pass find drift. Core's activity log records
// the same action, but it is one unfiltered list of every admin action on the
// site, so an import from three client patches ago is not findable there.
//
// Best-effort on purpose: the import has already applied, and losing a cosmetic
// summary must not turn a successful import into a failure.
const last = {
at: new Date().toISOString(),
by,
force,
approve,
assets: rows.length,
fetched: fetched.assets.size,
written,
removed: removed.length,
absent: fetched.missing.absent,
unsupported: fetched.missing.unsupported,
bodies: bodies.tally ?? null,
art: art.applied ?? 0,
}
try {
await db.recordLastImport(last)
} catch (err) {
log.warn('could not record the import summary', { error: err.message })
}
log.info('asset import applied', {
assets: rows.length,
fetched: fetched.assets.size,
@@ -460,12 +508,21 @@ async function applyArt() {
* state with a reason an operator can act on.
*/
async function getStatus() {
const counts = await db.countAssets().catch(() => ({ total: 0, stored: 0 }))
// The BODY family, not the whole table: item and land art live here too and
// are reported separately below, because they are a working set rather than a
// catalogue with a size (§11).
const counts = await db.countAssets(bridge.FAMILY).catch(() => ({ total: 0, stored: 0 }))
const bodies = await db.countBodies().catch(() => ({ total: 0, resolved: 0 }))
const meta = await db.getMeta().catch(() => null)
const families = await db.countByFamily().catch(() => ({}))
const status = {
// Is there a shard to ask at all? Stated rather than left to be inferred:
// the panel disables its import buttons on it, and the alternative — reading
// it out of `reason`'s wording, or out of `shard` being null, which is also
// what a shard that is merely DOWN looks like — is a sentence that decides
// behaviour.
linked: await shardLinked(),
loaded: {
assets: counts.total,
stored: counts.stored,
@@ -480,12 +537,18 @@ async function getStatus() {
// for and holds, which is the only number that means anything here.
items: families.static?.stored ?? 0,
land: families.land?.stored ?? 0,
// What the last import did, and who ran it (phase 8). Null on an install
// that has never imported, and on one whose last import predates this
// field — both of which render as "no import recorded" rather than as
// zeroes, because an import that fetched nothing is a real and different
// answer from one that never happened.
last: meta?.last ?? null,
},
shard: null,
drift: null,
}
if (!(await shardLinked())) {
if (!status.linked) {
status.reason = 'uo-link is not configured'
return status
}

View File

@@ -19,8 +19,13 @@
// operator patches their client, which is an event they know about and the site
// does not. So this endpoint is what an operator presses afterwards.
//
// The full panel — per-key review, the activity view, approve/reject as buttons —
// is phase 8. This pair is what makes phase 3 reachable at all.
// Phase 8 built the panel these serve (`Admin → Client Files`) and added one
// thing to this pair: the import records a summary of what it did, and the
// vanished keys it refuses to apply come back with the pictures they currently
// have. Both exist because an operator pressing Update needs to see an answer,
// and the audit log — which still receives every action here — is one unfiltered
// list of every admin action on the site, so an import from three client patches
// ago cannot be found in it (org lead, 2026-09-14).
const assets = require('../../model/shardAssets/shardAssets.model')
const itemArt = require('../../model/shardAssets/shardItemArt.model')
@@ -56,7 +61,9 @@ async function importAssets(req, res) {
try {
const force = !!req.body?.force
const approve = !!req.body?.approve
const result = await assets.importAssets({ force, approve })
// From the session, never the body — the same rule the in-game ops routes
// apply, and for the same reason: this is recorded as who did it.
const result = await assets.importAssets({ force, approve, by: req.user?.username ?? null })
await activity.log({
req,

View File

@@ -626,6 +626,11 @@ module.exports = {
description:
'Admin view of the client-asset import (docs/link/v8.md §6, §8). What the site holds beside what the shards UO client currently is. Holding nothing at all is a supported state — creature pages simply render without pictures, which is what every install did before this pipeline existed.',
properties: {
linked: {
type: 'boolean',
description: 'Whether a shard is configured and enabled at all. Stated rather than inferred: `shard: null` is also what a linked shard that is merely DOWN looks like, and the two want opposite things from an admin surface — one disables its import buttons, the other keeps them available so the operator can retry.',
example: true,
},
loaded: {
type: 'object',
description: 'What this site currently holds.',
@@ -639,6 +644,35 @@ module.exports = {
importedAt: { type: 'string', format: 'date-time', nullable: true },
items: { type: 'integer', description: 'Item pictures held. Unlike the catalogue this has no total to compare against: item art is fetched because something on the site names it, so this is the working set rather than a fraction of one.', example: 1840 },
land: { type: 'integer', description: 'Land tile pictures held. Zero on every install until something asks for one.', example: 0 },
last: {
type: 'object',
nullable: true,
description: 'What the last import actually did. NULL on an install that has never imported, and on one whose last import predates this field — both of which mean "no import recorded", which is a different answer from an import that fetched nothing. The admin activity log records the same action, but it is one unfiltered list of every admin action on the site, so an import from three client patches ago is not findable there.',
properties: {
at: { type: 'string', format: 'date-time' },
by: { type: 'string', nullable: true, description: 'The admin who pressed it, from their session.' },
force: { type: 'boolean', description: 'True when it was a full re-import rather than an update.' },
approve: { type: 'boolean', description: 'True when it accepted assets the shard had stopped offering.' },
assets: { type: 'integer', example: 1095 },
fetched: { type: 'integer', example: 12 },
written: { type: 'integer', example: 12 },
removed: { type: 'integer', example: 0 },
absent: { type: 'integer', example: 0 },
unsupported: { type: 'integer', example: 0 },
bodies: {
type: 'object',
nullable: true,
description: 'The body pass, as a tally rather than one number: `unknown` is real drift — a spawn file naming a type this shards scripts do not define — and reads identically to a failure if both are summed into "not resolved".',
properties: {
ok: { type: 'integer', example: 780 },
unknown: { type: 'integer', example: 20 },
notCreature: { type: 'integer', example: 12 },
failed: { type: 'integer', example: 0 },
},
},
art: { type: 'integer', description: 'Creatures pointing at a picture afterwards.', example: 763 },
},
},
},
},
shard: {
@@ -723,7 +757,18 @@ module.exports = {
description: 'The body ids the shard reports as player-character bodies — every registered races male, female and ghost bodies, asked of the shard rather than hardcoded. These render head-on; everything else renders three-quarter.',
example: [400, 401, 402, 403, 605, 606, 607, 608, 666, 667, 694, 695],
},
vanished: { type: 'array', nullable: true, items: { type: 'string' }, description: 'On `needsReview`: up to fifty of the keys that disappeared.' },
vanished: {
type: 'array',
nullable: true,
description: 'On `needsReview`: up to fifty of the keys that disappeared, each with the picture this site currently serves for it. The filename is there because the decision being asked for is "is it right that these disappear?", and an asset key names nothing a human recognises — `body/820/a23` is a horse.',
items: {
type: 'object',
properties: {
key: { type: 'string', example: 'body/820/a23' },
file: { type: 'string', nullable: true, description: 'Filename under uploads/atlas/, or null if this site never stored a picture for it.', example: 'uo-body-820-a23-9f3c1a77.png' },
},
},
},
vanishedCount: { type: 'integer', nullable: true },
bodies: {
type: 'object',

View File

@@ -40,6 +40,7 @@ function stubEverything({ manifest, fetched, held = new Map(), meta = null, sour
saved.resolveBodies = bridge.resolveBodies
saved.allAssets = db.allAssets
saved.saveAssets = db.saveAssets
saved.recordLastImport = db.recordLastImport
saved.getMeta = db.getMeta
saved.countAssets = db.countAssets
saved.countBodies = db.countBodies
@@ -50,7 +51,7 @@ function stubEverything({ manifest, fetched, held = new Map(), meta = null, sour
saved.loadArtMap = atlasModel.loadArtMap
saved.getSafe = uoLinkConfig.getSafe
const seen = { saved: null, fetchedKeys: null, art: null }
const seen = { saved: null, fetchedKeys: null, art: null, last: null }
uoLinkConfig.getSafe = async () => ({ enabled: true, baseUrl: 'http://127.0.0.1:8080' })
@@ -78,6 +79,9 @@ function stubEverything({ manifest, fetched, held = new Map(), meta = null, sour
seen.saved = rows
return rows.length
}
db.recordLastImport = async (last) => {
seen.last = last
}
db.replaceBodies = async () => 0
db.artBySlug = async () => ({})
@@ -363,3 +367,193 @@ test('a sprite filename carries its hash so a changed picture is a changed URL',
assert.notEqual(before, after)
assert.match(before, /^uo-body-34-a0-[0-9a-f]{8}\.png$/)
})
// ── what the panel reads (phase 8) ────────────────────────────────────────
//
// The admin surface is the only thing that imports — boot never calls the shard
// — so everything an operator can learn about an import, they learn from what
// these two return. Each of these is a way the panel would render a confident
// sentence that is not true.
test('the vanished keys come back with the pictures they currently have', async (t) => {
useTempUploads(t)
const held = new Map([
['body/820/a23', { key: 'body/820/a23', sha256: 'a', file: 'uo-body-820-a23-aabbccdd.png' }],
])
stubEverything({ held, manifest: manifestOf([row(12, 'a')]) })
t.after(restore)
const result = await model.importAssets({ force: true })
// The decision being asked for is "is it right that these disappear?", and a
// key names nothing a human recognises. Without the filename the panel has
// nothing to show but `body/820/a23`, which is a horse.
assert.equal(result.status, 'needsReview')
assert.deepEqual(result.vanished, [
{ key: 'body/820/a23', file: 'uo-body-820-a23-aabbccdd.png' },
])
})
test('an import records what it did, including the body tally and who ran it', async (t) => {
useTempUploads(t)
const seen = stubEverything({
manifest: manifestOf([row(12, 'new')]),
fetched: {
assets: new Map([['body/12/a0', sprite('new')]]),
missing: { absent: 3, unsupported: 0 },
},
})
t.after(restore)
atlasDb.allCreatureTypes = async () => [{ slug: 'wolf', name: 'Wolf' }]
bridge.resolveBodies = async () => [
{ slug: 'wolf', typeName: 'Wolf', body: 34, status: 'ok' },
{ slug: 'ghost-of-something', typeName: 'GhostOfSomething', body: null, status: 'unknown' },
]
await model.importAssets({ force: true, by: 'colby' })
assert.equal(seen.last.by, 'colby')
assert.equal(seen.last.force, true)
assert.equal(seen.last.written, 1)
assert.equal(seen.last.absent, 3)
// The body pass is kept as a TALLY rather than a single "resolved" number:
// `unknown` means the spawn files name a type this shard's scripts do not
// define, which is real drift, and it reads identically to a failure if both
// are summed into "not resolved".
assert.deepEqual(seen.last.bodies, { ok: 1, unknown: 1, notCreature: 0, failed: 0 })
})
test('a summary that cannot be written does not fail an import that applied', async (t) => {
useTempUploads(t)
stubEverything({
manifest: manifestOf([row(12, 'new')]),
fetched: {
assets: new Map([['body/12/a0', sprite('new')]]),
missing: { absent: 0, unsupported: 0 },
},
})
t.after(restore)
db.recordLastImport = async () => {
throw new Error('the meta row is locked')
}
// The pictures are already on disk and the rows are already committed. Failing
// here would report a failure for an import that succeeded, and the operator's
// next move — press it again — would re-fetch the whole catalogue for nothing.
const result = await model.importAssets({ force: true })
assert.equal(result.status, 'imported')
assert.equal(result.written, 1)
})
test('status says whether a shard is linked rather than leaving it to be inferred', async (t) => {
stubEverything({ manifest: manifestOf([]) })
t.after(restore)
db.getMeta = async () => ({ catalog: 'cat1', last: { by: 'colby', written: 4 } })
const linked = await model.getStatus()
assert.equal(linked.linked, true)
assert.deepEqual(linked.loaded.last, { by: 'colby', written: 4 })
// A shard that is linked but DOWN also reports `shard: null`, which is why the
// panel cannot read this off that: one wants its buttons disabled and the
// other wants them available so the operator can retry.
uoLinkConfig.getSafe = async () => ({ enabled: false, baseUrl: '' })
const unlinked = await model.getStatus()
assert.equal(unlinked.linked, false)
assert.equal(unlinked.reason, 'uo-link is not configured')
})
test('the catalogue count is the body family, not every asset in the table', async (t) => {
stubEverything({ manifest: manifestOf([]) })
t.after(restore)
let askedFor = 'never called'
// Item and land art live in the same table as the body catalogue (phase 5) and
// are counted separately on purpose: one is a set with a size, the other is
// however much of an unbounded space the site has happened to ask for. A
// whole-table count reported 1,095 portraits plus 313 item pictures as a
// "1,408-row catalogue" on the one screen that answers "did the import work".
db.countAssets = async (family) => {
askedFor = family
return { total: 1095, stored: 1095 }
}
const status = await model.getStatus()
assert.equal(askedFor, 'body')
assert.equal(status.loaded.assets, 1095)
})
test('item pictures are not "vanished" just because the body manifest never listed them', async (t) => {
useTempUploads(t)
// The state every install reaches within a day of its first import: a body
// catalogue, plus whatever item art the warm pass has fetched because a
// marketplace page asked for it. Both live in `shard_assets`.
const held = new Map([
['body/12/a0', { key: 'body/12/a0', family: 'body', sha256: 'a', file: 'wolf.png' }],
['static/3934/h1801', { key: 'static/3934/h1801', family: 'static', sha256: 'b', file: 'robe.png' }],
])
const seen = stubEverything({ held, manifest: manifestOf([row(12, 'a')]) })
t.after(restore)
// The family filter is the fix, so the stub has to honour it or the test
// passes against a whole-table read.
db.allAssets = async (family) =>
new Map([...held].filter(([, r]) => !family || r.family === family))
const result = await model.importAssets({ force: true })
// Before the filter this was `needsReview` naming the item picture, and
// approving it would have deleted every picture the warm pass had fetched —
// with a sentence saying the shard had stopped offering them, which it had
// not: a body manifest never mentions item art at all.
assert.equal(result.status, 'imported')
assert.equal(result.removed, 0)
assert.ok(seen.saved)
})
test('an approved vanish deletes the row, not just the picture', async (t) => {
const dir = useTempUploads(t)
fs.mkdirSync(path.join(dir, model.ART_SUBDIR), { recursive: true })
fs.writeFileSync(path.join(dir, model.ART_SUBDIR, 'gone.png'), 'x')
const held = new Map([
['body/99/a0', { key: 'body/99/a0', family: 'body', sha256: 'a', file: 'gone.png' }],
])
let removedKeys = null
const seen = stubEverything({ held, manifest: manifestOf([row(12, 'a')]) })
t.after(restore)
db.saveAssets = async (rows, meta, remove) => {
seen.saved = rows
removedKeys = remove
return rows.length
}
const result = await model.importAssets({ force: true, approve: true })
assert.equal(result.removed, 1)
// The file was already unlinked before this fix; the ROW was not. A row whose
// picture is gone keeps being counted, keeps being offered for review on every
// forced import, and can still point a creature page at a file that is not
// there — with the import reporting "nothing was changed" about a deletion it
// had already performed.
assert.deepEqual(removedKeys, ['body/99/a0'])
assert.equal(fs.existsSync(path.join(dir, model.ART_SUBDIR, 'gone.png')), false)
})

View File

@@ -58,7 +58,8 @@ function writeTree(root, { facets = ['Sosaria'], includeChampions = true } = {})
fs.writeFileSync(
path.join(root, 'Spawns', `${facet}.xml`),
`<Spawns>
<Points><Name>${facet}A</Name><Map>${facet}</Map><X>1100</X><Y>1100</Y>
<Points><Name>${facet}A</Name><UniqueId>uid-${facet}-A</UniqueId>
<Map>${facet}</Map><X>1100</X><Y>1100</Y>
<MaxCount>3</MaxCount><IsRunning>True</IsRunning>
<Objects2>Lizardman:MX=3:SB=0:OBJ=Orc:MX=1:SB=0</Objects2></Points>
<Points><Name>${facet}B</Name><Map>${facet}</Map><X>9000</X><Y>9000</Y>
@@ -112,6 +113,29 @@ function tempTree(options) {
// ── buildAtlas against a custom-facet tree ─────────────────────────────────
test('buildAtlas: a point keeps the UniqueId a property lease targets', () => {
// The field is asserted on the AGGREGATOR's output, not the parser's, which is
// the whole point of this test. `parsePoints` produced it from Phase 12b
// onwards and `PARSER_VERSION`'s own note said a point kept it, while the
// mapping in `buildAtlas` rebuilt each point from an explicit field list that
// omitted it — so `shard_spawn_points.unique_id` was NULL on every row, and
// `listSpawners`, whose WHERE is `unique_id IS NOT NULL`, answered empty. That
// left `uo.options.spawners` an empty dropdown and every Phase 12b
// object-property lease unauthorable. Found by the Phase 16b released-artefact
// walk, against a real tree whose files carry ~6,400 of these.
//
// The fixture above had no <UniqueId> at all until this test, which is exactly
// why a green suite said nothing about it.
const root = tempTree({ facets: ['Sosaria'] })
const atlas = buildAtlas(root)
const named = atlas.points.find((p) => p.name === 'SosariaA')
assert.equal(named.uniqueId, 'uid-Sosaria-A')
// And a point whose file names none is absent rather than empty-string, so the
// DB layer's `unique_id IS NOT NULL AND <> ''` reads it the same way either way.
const unnamed = atlas.points.find((p) => p.name === 'SosariaB')
assert.ok(!unnamed.uniqueId)
})
test('buildAtlas: works entirely on facets that do not exist in stock UO', () => {
const root = tempTree({ facets: ['Sosaria', 'Underdark'] })
const atlas = buildAtlas(root)

View File

@@ -563,6 +563,78 @@ test('an atlas larger than the dropdown bound is truncated and said so', async (
assert.ok(warned, 'a truncated source must leave a log line naming itself')
})
// ── A landmark option value names ONE landmark (Phase 16b) ────────────────
test('two landmarks sharing a name are two different options, and both resolve', async () => {
// A stock 57.4 tree has 558 landmarks under 320 distinct `facet/name` pairs:
// `Trammel/Entrance` is 23 different dungeons. The source emitted `facet/name`
// and `landmarkPoint` resolved with `.find()`, so 22 of the 23 were unreachable
// — an author who picked "Entrance — Destard" got Blighted Grove, with a
// successful run and no warning. The group was already the disambiguator and it
// was shown to the eye while being left out of the value.
//
// Asserted as an INEQUALITY between two resolved points rather than against a
// literal value string, so it survives someone changing the value's format
// again as long as the two options still address two places.
shardAtlas.listLandmarks = async () => [
{ facet: 'Felucca', name: 'Entrance', group: 'Blighted Grove', x: 586, y: 1643, z: 0 },
{ facet: 'Felucca', name: 'Entrance', group: 'Destard', x: 1176, y: 2637, z: 0 },
]
const source = actions.OPTION_SOURCES.find((s) => s.id === 'uo.options.landmarks')
const options = await source.resolve({})
assert.equal(options.length, 2)
assert.equal(new Set(options.map((o) => o.value)).size, 2, 'both options must be addressable')
const points = []
for (const option of options) {
const result = await byId('uo.creature.spawn').perform({
runId: 41,
idempotencyKey: `L${option.value}`.padEnd(40, 'x'),
params: { place: option.value, creature: 'Orc', count: 1 },
verify: true,
})
assert.equal(result.ok, true, `${option.value} must resolve`)
points.push(option.value)
}
assert.notEqual(points[0], points[1])
})
test('a place published before the group was carried still resolves', async () => {
// Every event published before the fix stores `facet/name`, and a published
// version is immutable — so a parse that stopped understanding the two-part
// form would break those runs rather than correct them. It keeps the old
// first-match read, which is imprecise in exactly the way it always was.
shardAtlas.listLandmarks = async () => [
{ facet: 'Felucca', name: 'Entrance', group: 'Blighted Grove', x: 586, y: 1643, z: 0 },
{ facet: 'Felucca', name: 'Entrance', group: 'Destard', x: 1176, y: 2637, z: 0 },
// A name carrying a slash reads as three parts too; the two-part read is what
// resolves it, which is why the three-part attempt must not answer for it.
{ facet: 'Felucca', name: 'Odd/Name', group: null, x: 10, y: 20, z: 0 },
]
for (const place of ['Felucca/Entrance', 'Felucca/Odd/Name']) {
const result = await byId('uo.creature.spawn').perform({
runId: 42,
idempotencyKey: `P${place}`.padEnd(40, 'x'),
params: { place, creature: 'Orc', count: 1 },
verify: true,
})
assert.equal(result.ok, true, `${place} must still resolve`)
}
// And a three-part value whose group is gone REFUSES rather than silently
// landing somewhere else. That is the honest answer: it asked for one place.
const gone = await byId('uo.creature.spawn').perform({
runId: 42,
idempotencyKey: 'G'.repeat(40),
params: { place: 'Felucca/Renamed/Entrance', creature: 'Orc', count: 1 },
verify: true,
})
assert.equal(gone.ok, false)
assert.match(gone.error, /no landmark called/)
})
// ── The world verbs (Phase 12a) ───────────────────────────────
test('a spawn files one ledger row per serial, not one per call', async () => {

View File

@@ -206,14 +206,25 @@ function hashSources(root) {
* targets (Phase 12b). The bump is what re-reads a tree the boot path
* would otherwise skip on an unchanged hash — the source files have not
* changed, only what is kept from them.
* 5 — source files are parsed in one canonical label order (protocol 8 phase
* 5 — and it did NOT keep it: version 4 bumped the parser and the aggregator
* below still discarded the field, so the intent above shipped as a
* comment. This bump is what makes an already-imported tree re-read now
* that the mapping keeps it; without it `sameSources` sees an unchanged
* tree and every existing install stays empty. Released in v1.2.2.
* 6 — source files are parsed in one canonical label order (protocol 8 phase
* 7). The decoration index keeps the first item id it sees for a type, so
* the read order decided a preview graphic; it now cannot differ between a
* tree read off a disk and the same tree read over the bridge. Identical
* sources, and for a handful of types a different answer, which is exactly
* what this number exists to make reach an install.
*
* This was written as 5 on `edge` while 5 was being released from `main`
* meaning something else, so the cutover renumbered it: an install that
* imported under v1.2.2 already stores 5, and had the number not moved,
* `sameSources` would have called that tree current and this change would
* have reached nobody who was already running.
*/
const PARSER_VERSION = 5
const PARSER_VERSION = 6
/** True when two source fingerprints describe the same tree. */
function sameSources(a, b) {
@@ -373,6 +384,16 @@ function buildFromFiles(files, options = {}) {
const place = resolveRegion(point.x, point.y, point.facet, placement, resolveOpts)
return {
name: point.name,
// **The field this whole `PARSER_VERSION` note was about, and it was
// dropped right here.** The parser has produced it since Phase 12b and
// the column and the query have both been waiting for it, but this
// mapping rebuilds each point from an explicit field list and `uniqueId`
// was not on it — so every row landed with `unique_id` NULL, and
// `listSpawners`, whose WHERE is `unique_id IS NOT NULL`, could only ever
// answer empty. That made `uo.options.spawners` an empty dropdown and
// every Phase 12b object-property lease unauthorable, with nothing on the
// form to say why. Found by the Phase 16b walk against a released bundle.
uniqueId: point.uniqueId,
facet: point.facet,
x: point.x,
y: point.y,

View File

@@ -8482,6 +8482,23 @@
"properties": {
"type": "object",
"properties": {
"linked": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "boolean"
},
"description": {
"type": "string",
"example": "Whether a shard is configured and enabled at all. Stated rather than inferred: `shard: null` is also what a linked shard that is merely DOWN looks like, and the two want opposite things from an admin surface — one disables its import buttons, the other keeps them available so the operator can retry."
},
"example": {
"type": "boolean",
"example": true
}
}
},
"loaded": {
"type": "object",
"properties": {
@@ -8656,6 +8673,253 @@
"example": 0
}
}
},
"last": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "object"
},
"nullable": {
"type": "boolean",
"example": true
},
"description": {
"type": "string",
"example": "What the last import actually did. NULL on an install that has never imported, and on one whose last import predates this field — both of which mean \"no import recorded\", which is a different answer from an import that fetched nothing. The admin activity log records the same action, but it is one unfiltered list of every admin action on the site, so an import from three client patches ago is not findable there."
},
"properties": {
"type": "object",
"properties": {
"at": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "string"
},
"format": {
"type": "string",
"example": "date-time"
}
}
},
"by": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "string"
},
"nullable": {
"type": "boolean",
"example": true
},
"description": {
"type": "string",
"example": "The admin who pressed it, from their session."
}
}
},
"force": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "boolean"
},
"description": {
"type": "string",
"example": "True when it was a full re-import rather than an update."
}
}
},
"approve": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "boolean"
},
"description": {
"type": "string",
"example": "True when it accepted assets the shard had stopped offering."
}
}
},
"assets": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 1095
}
}
},
"fetched": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 12
}
}
},
"written": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 12
}
}
},
"removed": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 0
}
}
},
"absent": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 0
}
}
},
"unsupported": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 0
}
}
},
"bodies": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "object"
},
"nullable": {
"type": "boolean",
"example": true
},
"description": {
"type": "string",
"example": "The body pass, as a tally rather than one number: `unknown` is real drift — a spawn file naming a type this shards scripts do not define — and reads identically to a failure if both are summed into \"not resolved\"."
},
"properties": {
"type": "object",
"properties": {
"ok": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 780
}
}
},
"unknown": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 20
}
}
},
"notCreature": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 12
}
}
},
"failed": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"example": {
"type": "number",
"example": 0
}
}
}
}
}
}
},
"art": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "integer"
},
"description": {
"type": "string",
"example": "Creatures pointing at a picture afterwards."
},
"example": {
"type": "number",
"example": 763
}
}
}
}
}
}
}
}
}
@@ -9271,18 +9535,57 @@
"type": "boolean",
"example": true
},
"description": {
"type": "string",
"example": "On `needsReview`: up to fifty of the keys that disappeared, each with the picture this site currently serves for it. The filename is there because the decision being asked for is \"is it right that these disappear?\", and an asset key names nothing a human recognises — `body/820/a23` is a horse."
},
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "string"
"example": "object"
},
"properties": {
"type": "object",
"properties": {
"key": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "string"
},
"example": {
"type": "string",
"example": "body/820/a23"
}
}
},
"file": {
"type": "object",
"properties": {
"type": {
"type": "string",
"example": "string"
},
"nullable": {
"type": "boolean",
"example": true
},
"description": {
"type": "string",
"example": "Filename under uploads/atlas/, or null if this site never stored a picture for it."
},
"example": {
"type": "string",
"example": "uo-body-820-a23-9f3c1a77.png"
}
}
}
}
}
}
},
"description": {
"type": "string",
"example": "On `needsReview`: up to fifty of the keys that disappeared."
}
}
},