feat(events): the step editor reworked, and event templates (MODULE_API 1.13.0) #212
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/event-step-editor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
This is the core half of Rust
PLAN_REDESIGNS.md§2 (U-3–U-6, F11; D192, D334). The first Rust player walk found the event step editor honest but hard to use. This PR reworks it, staying game-agnostic. Module-uo's steps get the new controls and nothing else.Contract: MODULE_API 1.12.0 → 1.13.0. Four optional additions, so a minor bump:
api.registerEventTemplates([{ id, label, description, inputs, build }])inputsare params (at most 8). Core checks them, callsbuild()(with a 10 s limit), validates the result as a spec, and answers an unsaved draft.POST /admin/events/catalog/templates/:templateId(admin, editor).duration: 'minutes'(int or float only).core.lease'sminutesdeclares it.examplefor its value.note(at most 300 characters), shown under the field while that option is chosen.Editor
· typetags and no bare*. A required field says so in words, but only once a save has been tried with it empty. The save then stops before the round trip.values, or a small source) is a row of buttons.core.leaseis drawn as the chosen lease:valuesand example;target.source(F11);after: <longest hold>. Under any phase whose run can end before its longest hold, a sentence says when the hold is given back. Teardown happens at run end, so later phases count toward the time.draftAheadfield on GET, PUT and publish, which compares the working spec with the published one as data.Regenerated:
swagger-output.json(+ the new path only),routes.manifest.jsonandroutes.guards.json(+ the new route only), andengagement-triggers.json(themoduleApiVersionline).The spec is in docs PR (
docs/event-step-editor):MODULE_API.md,EVENTS.mdandPLAN_REDESIGNS.md§2.8. Decisions are in docs#334 (merged).How it was tested
test/eventStepEditor.test.jshas 10 tests:build();build();draftAhead.MODULES_DIRempty (7/7, which is how CI runs). With this machine's git-ignoredmodules/uoandmodules/rustinstalled they fail, because module routes get mounted. I proved that by running both ways.test/eventStepEditor.test.js(12 tests: the phase guard, the shortfall sentence, missing params, segmenting and notes).npm run buildis clean.routes.manifest.json is current — 76 routes, all documented, anduoregisters its 12 actions.npm test): 723/723.Checklist
AI-assisted contributions (required)
Claude Code (Claude Opus 5.5). I have reviewed and understandevery change, and take responsibility for it. AI-authored commits are
marked with a
Co-Authored-By/Assisted-Bytrailer.License
(GNU GPL v3.0 or later), and I have the right to contribute it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY
Rust PLAN_REDESIGNS §2 (U-3-U-6, F11; D192, D334), core half. Game-agnostic: Module-uo's steps get the new controls and nothing else. Contract (MODULE_API 1.12.0 -> 1.13.0, four optional additions): - api.registerEventTemplates([{ id, label, description, inputs, build }]): inputs are params (<= 8); core checks them, calls build() (10 s), validates the result as a spec and answers an unsaved draft. POST /admin/events/catalog/templates/:templateId (admin, editor). - a param's duration: 'minutes' (int/float only); core.lease's minutes has it. - a lease's example for its value. - an option row's note (<= 300 chars), shown under the chosen field. Editor: - no type tags or bare asterisks; a required field says so in words once a save has been tried with it empty (and the save stops before the round trip). - boolean: toggle when required, [Not set] [Yes] [No] when optional (D334). - a choice of two or three is a row of buttons (lease values, small sources). - core.lease drawn as the chosen lease: picked by label; value by the lease's type, range, values and example; target picker over target.source (F11); minutes with the lease's longest hold. - a timed step keeps its run open: a phase with no advance rule gets after: <longest hold> when a timed step is added; a sentence under any phase whose run can end sooner (U-6). - Start asks "Publish and start" or "Start version N" when the working copy is ahead of the published version (draftAhead on GET/PUT/publish; U-5). - New event can start from a module's template. - core's own examples name no game (§0.9). Swagger, routes.manifest/guards and engagement-triggers.json regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeYOne follow-up commit,
e58857c: a searchable source's chosen note is found when the page lacks it.A searchable source answers the editor a bounded first page. The value an author picked, or one a template filled in, may not be on that page, and its note goes missing with it.
useChosenNoteasks the source for that value as a search term, once per value, and shows the exact match's note.I found this while building the Rust kit warning (PLAN_REDESIGNS §2.6), because its source,
rust.options.grouppermissions, is searchable. The client build is clean and 413/413 tests pass.Module-Rust's
ci/core-ref.jsonis pinned to this head while the PR is open, the same as during website#209. It moves to the merge sha after the merge.