fix(rust): every notice says which server, clan or player it is about
The live walk rendered a generic in-app notice as "A server came online.
A server's game started..." Core's structural projection falls back to
the trigger's label and description when the payload has no title, and
on a multi-server site that never says which server. Core's rule is that
the payload wins, so every trigger now declares `title` and `intro`, and
the emitter writes the sentence ("Oxide rig is online"). An operator's
own template can still ignore it and use the parts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -152,6 +152,23 @@ test('a clan path survives core\'s url check, colons and all', () => {
|
||||
assert.match(leaderboardPath('main'), RELATIVE_URL)
|
||||
})
|
||||
|
||||
test('every trigger names what happened and where, even with its optionals missing', () => {
|
||||
// The walk found a multi-server site's generic notice reading "A server came
|
||||
// online" — core's projection falls back to the LABEL when the payload carries
|
||||
// no `title`. Every trigger therefore declares its own, and the emitter writes
|
||||
// it; a headline that printed "undefined" would be worse than the label.
|
||||
const { TRIGGERS } = require('../engagement/triggers')
|
||||
const { headline } = require('../engagement/emit')
|
||||
for (const t of TRIGGERS) {
|
||||
const minimal = Object.fromEntries(t.variables.filter((v) => v.required).map((v) => [v.name, v.example]))
|
||||
const h = headline(t.id, minimal)
|
||||
assert.ok(h.title && h.intro, `${t.id} has a headline`)
|
||||
assert.ok(!/undefined|null/.test(h.title + h.intro), `${t.id}: ${h.title} / ${h.intro}`)
|
||||
}
|
||||
const online = headline('rust.server.online', { server: 'EU 2' })
|
||||
assert.match(online.title, /EU 2/, 'the notice says WHICH server')
|
||||
})
|
||||
|
||||
// ── The seeds ──────────────────────────────────────────────────────────────
|
||||
|
||||
test('every seeded rule is ours, off, and names bodies that exist', () => {
|
||||
|
||||
Reference in New Issue
Block a user