fix(demo): switch on the actions the seeded events use (DM28)
The step-5 walk found the demo's three seeded events (Server greeting,
Treasure drop, Payday) showing as ready but failing when run: a fresh
database has no switchboard rows, so every change and irreversible action
starts disabled ("not enabled on this deployment").
seed:demo now switches on, with the events, every action their steps use,
uncapped, as an admin flipping the switch without filling the cap boxes
would. Nothing else is switched on. The deny list (DM11) still keeps a
visitor's own command step harmless, and the wipe drops the rows with the
rest of the database.
Checked on a scratch database with the v0.6.1 module: the seed leaves
rust.command.run, rust.dt.start and rust.coins.pay enabled.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
This commit is contained in:
@@ -20,7 +20,7 @@ const db = require('../src/utils/db')
|
||||
const registries = require('../src/modules/registries')
|
||||
const settingsDb = require('../src/model/settings/settings.db')
|
||||
const settings = require('../src/model/settings/settings.model')
|
||||
const { resolveEnv, nextResetAt, checkFixture } = require('../db/seedDemo')
|
||||
const { resolveEnv, nextResetAt, checkFixture, eventActionIds } = require('../db/seedDemo')
|
||||
|
||||
after(() => db.close())
|
||||
afterEach(() => {
|
||||
@@ -212,6 +212,17 @@ test('checkFixture accepts the four accounts and refuses anything that would lea
|
||||
assert.match(checkFixture({ ...GOOD, modules: [] }).join('\n'), /modules must be an object/)
|
||||
})
|
||||
|
||||
test('eventActionIds lists each action the seeded events use, once, and the shipped fixture names all three', () => {
|
||||
const step = (actionId) => ({ actionId, params: {} })
|
||||
const ev = (...phases) => ({ spec: { phases: phases.map((steps) => ({ steps: steps.map(step) })) } })
|
||||
assert.deepEqual(eventActionIds([ev(['a.run', 'core.wait'], ['a.run']), ev(['b.pay']), {}, { spec: {} }]),
|
||||
['a.run', 'core.wait', 'b.pay'])
|
||||
assert.deepEqual(eventActionIds(), [])
|
||||
|
||||
const fixture = require('../../deploy/demo/seed.json') // eslint-disable-line global-require
|
||||
assert.deepEqual(eventActionIds(fixture.content.events), ['rust.command.run', 'rust.dt.start', 'rust.coins.pay'])
|
||||
})
|
||||
|
||||
test('seed:demo refuses to run off the demo', async () => {
|
||||
const { run } = require('../db/seedDemo') // eslint-disable-line global-require
|
||||
await assert.rejects(() => run('anything.json'), /only with DEMO_MODE=true/)
|
||||
|
||||
Reference in New Issue
Block a user