The org lead's rule, settled 2026-09-22: who is online is always the
narrowest audience - staff - unless an operator deliberately widens it,
and a count is fine where a list of names is not.
The public site broke that in three places since phase 4. The Online
tab named every player, the feed carried joins, respawns, deaths, chat
and tallies, and the leaderboard's lastSeen - refreshed every minute by
a gather tally - said who was on as plainly as either. All three now
sit behind one setting:
* PRESENCE_KINDS, a subset of the public allowlist, gated per request.
Below the audience the feed keeps the server's own story (wipe, start,
shutdown) and says presenceHidden rather than looking quiet.
* the Online route answers { players: [], hidden, count, audience } -
same shape, so an older client renders empty rather than breaking.
* rungs staff / signed_in / public, fleet-wide default in a new
rust_settings table with an optional per-server override on
rust_servers; an unknown stored word narrows to staff.
* the viewer's standing is RE-READ from the users row (ctx.users.getById),
not taken from the token, so a demotion or a ban applies on the next
request. Walked: a moderator demoted mid-session lost the roll call on
the same cookie.
* per-viewer answers are Cache-Control: private, no-store.
* GET/PUT /admin/rust/visibility (requireRole admin) and an admin page,
Rust visibility; every save is one activity-log row.
The browser walk also found every empty state in this module rendering
as a blank box. Core's EmptyState renders children only; this module
passed title/message (the shape the Integration Kit template teaches)
and React dropped both without a word. Fixed module-side with a small
Empty wrapper - nothing core or module-uo renders changes - and a client
test that refuses a titled EmptyState or a PageHeader subtitle.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
50 lines
2.2 KiB
JavaScript
50 lines
2.2 KiB
JavaScript
// ── The UI kit's props, as core actually reads them ───────────────────────
|
|
//
|
|
// React drops an unknown prop without a word, so a UI-kit component called with
|
|
// the wrong one renders — just not what was written. Two of these have shipped
|
|
// from this org already: `PageHeader subtitle` (Teams phase 11, the kit's
|
|
// template) and `EmptyState title/message` (this module, phases 4 to 8 — every
|
|
// empty panel was a blank box until the presence fix's browser walk).
|
|
//
|
|
// A DOM-less runner cannot see a blank box, so this reads the source instead:
|
|
// it names the props core's components do NOT take and fails on any use of them.
|
|
// It is a claim about core that must be re-read when core's kit changes —
|
|
// written down rather than imported, because no core is in this process.
|
|
|
|
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const SRC = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'src')
|
|
|
|
/** Every .jsx/.js under src/. */
|
|
function sources(dir = SRC) {
|
|
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
const full = path.join(dir, entry.name)
|
|
if (entry.isDirectory()) return sources(full)
|
|
return /\.(jsx?|mjs)$/.test(entry.name) ? [full] : []
|
|
})
|
|
}
|
|
|
|
// Core's `components/PageState.jsx` and `PageHeader.jsx`, read 2026-09-23 at the
|
|
// pinned core (ci/core-ref.json).
|
|
const REFUSED = {
|
|
// `EmptyState({ children })` — children only.
|
|
EmptyState: /<EmptyState\b[^>]*\b(title|message|description|text)\s*=/,
|
|
// `PageHeader({ eyebrow, title, lead, center })` — there is no `subtitle`.
|
|
PageHeader: /<PageHeader\b[^>]*\bsubtitle\s*=/,
|
|
}
|
|
|
|
test('no UI-kit component is handed a prop core does not read', () => {
|
|
const offences = []
|
|
for (const file of sources()) {
|
|
const text = fs.readFileSync(file, 'utf8')
|
|
for (const [component, pattern] of Object.entries(REFUSED)) {
|
|
if (pattern.test(text)) offences.push(`${path.relative(SRC, file)}: ${component}`)
|
|
}
|
|
}
|
|
assert.deepEqual(offences, [], 'use components/Empty.jsx for a titled empty state')
|
|
})
|