feat(seed): load first-visit demo data from a committed bundle, not hardcoded Rust (PMS-651) #448
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-651-data-driven-seed"
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
PMS-651 backend slice: make first-visit demo seeding data-driven. The demo content (company / contact / ticket names, titles, descriptions) moves out of hardcoded Rust literals in
src/modules/seed/data.rsinto a committed, compile-time-embeddedsrc/modules/seed/demo_seed.jsonbundle.data.rsmaps the bundle into the sameCreate*RequestDTOs and seeds through the real service methods.Design decision (the ticket-config wrinkle)
The Story asks to seed "via the restore path." That path (
data_transfer, PMS-648) is raw wipe-and-replace (jsonb_populate_recordset+ id-remap), andtickets.status_id/priority_id/queue_idare NOT NULL FKs into per-tenant config (migrations/005_tickets.sql:103-108) that onlycreate_ticketfills. To seed tickets through the raw import, the demo bundle would have to be a full tenant snapshot (all config + own_company + entities), regenerated on every config-default change and wiping the fresh tenant's just-created config on restore. That is fragile.Per the design call on PMS-651, this slice uses a data-driven, create-only service-layer load instead (PMS-621's original vision): correct per-tenant config FKs via
create_ticket, non-destructive, and the demo set is now editable without touching Rust. It intentionally does not reuse the wipe-replace restore path.AC status
ensure_demo_seeded/seed_rowsuntouched:demo_seededCAS, emptiness check, shared-landing-tenant exclusion,MOKOSH_DEMO_SEEDkill switch all intact.tests/seed_demo.rs(fresh-tenant counts, idempotency, PMS-239 exclusion, non-empty-tenant skip) still covers a clean seed on a fresh DB; a newdata.rsunit test guards that the embedded bundle parses to the expected shape.Frontend (AC1/AC6) is delivered by MAPPS-364; API (AC1/AC2) by PMS-647/648.
Testing
just pre-commitgreen (fmt / clippy -D / compile --all-targets / unit incl the new bundle-parse test / doc). Theseed_demointegration tests run in the Integration job.#PMS-651