fix(demo): seed NPC profiles, factions and chat styles (DM26) #65
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/demo-seed-npcs-chat"
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
The demo restores its rig from a baseline, then wipes the site; the fresh site imports what it finds on the rig (website
DEMO_MODE.md§7.1). The first three restored wipes (website runs 367-369) brought the default set's groups, permissions and members back. Two things didn't come back:data.managed ? []), and its first push sends an empty profile set. Afterwards the baseline's placementsbandit-1,bandit-2andguard-1sit at "profile 'bandit' is missing", with 0 NPCs alive.vipandmoderatorshowchat: null.The org lead chose (DM26) to seed them.
onDemoSeednow also takes:npcs.factionsnpcs.setFactionsnpcs.profiles[]npcs.create/npcs.updatechat[]{ serverId, group, style }permissions.db.setGroupChatchatStyle.defaults), validated wholeThe seed runs before the site's first permission read, so a chat style's group doesn't exist on the site yet. The seed creates it for that server. The first import then treats the rig's group of that name as a change, and adopts its title, rank and permissions into the existing group (
reconcile.js, the first-inventory branch). The style is stored separately, so the import leaves it alone.The new parts of the section are checked before anything is written. Off the demo nothing changes: core calls
onDemoSeedonly fromseed:demo, and only withDEMO_MODE=true.Release: once this reaches
main, thefixmakes it v0.6.1 (samecoreApi ^1.19.0, same protocol 14). The demo's wipe picks it up by itself. The fixture side is website#230.How it was tested
test/demo.test.jshas 2 new cases:markDirty.Full server suite: 730 tests, 0 failures.
check:importsandcheck:bundlepass.The demo fixture (
website/deploy/demo/seed.jsonon website#230) passescheckSection, apart from its two$env:placeholders, which the seed fills in before calling the hook. Both profile bodies passnpcProfile.checkBody.The same model calls (
setFactions, profile create, and the chat style through the group PATCH) were made live on the demo through the admin API on 2026-10-27, and the NPCs spawned.Not yet run: the whole flow on a fresh demo database. The first wipe after v0.6.1 is released and website#230 is merged is that test, and I'll check it.
AI-assisted: Claude Code (Claude Opus 5.5)
🤖 Generated with Claude Code
https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY