test(seed): assert demo seed is the clean baseline with no zQA/QA prefix (PMS-629) #447

Merged
nrupard merged 1 commit from fix/PMS-629-demo-seed-no-zqa into main 2026-07-13 21:13:45 +02:00
Owner

What

PMS-629: guarantee the first-visit demo seed is the clean, un-prefixed baseline, never the zQA/QA- E2E fixtures, with a regression test.

Finding: the separation already exists

Investigating the current code, the demo seed and the QA E2E fixtures are already distinct paths, and there is no zQA anywhere:

  • Demo seed (src/modules/seed/data.rs via ensure_demo_seeded): "Acme Corporation (Demo)", Alice/Bob contacts, three demo tickets, all tagged demo. No prefix.
  • QA fixtures (src/modules/seed/qa.rs): QA- prefix + qa-seed tag, fail-closed to settings->>'is_qa' = true tenants, run manually via mokosh-server qa-seed.
  • Migration 023 seeds pure config (statuses, priorities, queues, SLA, work types) - no entities.
  • Repo-wide search: zQA appears only in a tests/contacts.rs search fixture, never in a seed path. The prefix the issue describes was already replaced by QA- gated to is_qa tenants (PMS-157 demo seed + qa.rs gating).

So AC1/AC2 were already satisfied by prior work; AC3/AC4 were largely covered by the existing tests/seed_demo.rs. This PR makes the guarantee explicit and regression-proof.

Change

Adds demo_seed_is_the_clean_baseline_with_no_qa_prefix to tests/seed_demo.rs: a fresh tenant's first-visit seed must produce exactly the demo baseline company and contain zero QA-/zQA-prefixed companies, contacts, or tickets. Updates the module doc to state the demo-vs-QA separation invariant.

Acceptance criteria

  • Demo seed data contains no zQA-prefixed records - asserted by the new test.
  • zQA data confined to E2E test fixtures only - qa.rs QA- prefix, is_qa-gated; documented.
  • A fresh copy seeds to the expected demo baseline - new test asserts the exact baseline company; existing test asserts 1 company / 2 contacts / 3 tickets.
  • Tests cover a clean seed on a fresh database - tests/seed_demo.rs (existing + new), run by the Integration job.

Out of scope (noted): coordinating the DB-reset baseline is a docker/data-repo concern.

Testing

just pre-commit green (fmt / clippy -D / compile --all-targets / unit / doc). The new #[sqlx::test] runs against Postgres in the Integration job.

#PMS-629

## What PMS-629: guarantee the first-visit demo seed is the clean, un-prefixed baseline, never the `zQA`/`QA-` E2E fixtures, with a regression test. ## Finding: the separation already exists Investigating the current code, the demo seed and the QA E2E fixtures are already distinct paths, and there is no `zQA` anywhere: - **Demo seed** (`src/modules/seed/data.rs` via `ensure_demo_seeded`): "Acme Corporation (Demo)", Alice/Bob contacts, three demo tickets, all tagged `demo`. No prefix. - **QA fixtures** (`src/modules/seed/qa.rs`): `QA-` prefix + `qa-seed` tag, fail-closed to `settings->>'is_qa' = true` tenants, run manually via `mokosh-server qa-seed`. - **Migration 023** seeds pure config (statuses, priorities, queues, SLA, work types) - no entities. - Repo-wide search: `zQA` appears only in a `tests/contacts.rs` search fixture, never in a seed path. The prefix the issue describes was already replaced by `QA-` gated to `is_qa` tenants (PMS-157 demo seed + qa.rs gating). So AC1/AC2 were already satisfied by prior work; AC3/AC4 were largely covered by the existing `tests/seed_demo.rs`. This PR makes the guarantee explicit and regression-proof. ## Change Adds `demo_seed_is_the_clean_baseline_with_no_qa_prefix` to `tests/seed_demo.rs`: a fresh tenant's first-visit seed must produce exactly the demo baseline company and contain zero `QA-`/`zQA`-prefixed companies, contacts, or tickets. Updates the module doc to state the demo-vs-QA separation invariant. ## Acceptance criteria - [x] Demo seed data contains no zQA-prefixed records - asserted by the new test. - [x] zQA data confined to E2E test fixtures only - `qa.rs` `QA-` prefix, `is_qa`-gated; documented. - [x] A fresh copy seeds to the expected demo baseline - new test asserts the exact baseline company; existing test asserts 1 company / 2 contacts / 3 tickets. - [x] Tests cover a clean seed on a fresh database - `tests/seed_demo.rs` (existing + new), run by the Integration job. Out of scope (noted): coordinating the DB-reset baseline is a docker/data-repo concern. ## Testing `just pre-commit` green (fmt / clippy -D / compile --all-targets / unit / doc). The new `#[sqlx::test]` runs against Postgres in the Integration job. #PMS-629
test(seed): assert demo seed is the clean baseline with no zQA/QA prefix (PMS-629)
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 1m42s
Check / fmt + clippy + build + tests (pull_request) Successful in 5m12s
Integration / integration tests (pull_request) Successful in 14m21s
Create release / Gate (release-branch merges only) (pull_request) Successful in 1s
Create release / Create release from merged PR (pull_request) Has been skipped
2da0a7e015
The demo seed and the zQA/QA E2E fixtures are already separate code paths: first-visit demo data comes from src/modules/seed/data.rs (obviously-fake names like "Acme Corporation (Demo)", tagged demo) via ensure_demo_seeded, while the QA fixtures live only in src/modules/seed/qa.rs behind the QA- prefix and the fail-closed is_qa tenant marker. Migration 023 seeds pure config (statuses, priorities, queues, SLA, work types), no entities. A repo-wide search finds no zQA in any seed path; the prefix the issue describes was already dropped in favour of QA- gated to is_qa tenants.

This locks that separation in with a regression test: a fresh tenant's first-visit seed must produce exactly the demo baseline company ("Acme Corporation (Demo)") and contain zero QA-/zQA-prefixed companies, contacts, or tickets. Combined with the existing seed_demo tests (fresh-tenant counts, idempotency, the PMS-239 shared-tenant exclusion, and the emptiness guard), this covers the PMS-629 acceptance criteria: a fresh copy seeds to the expected clean baseline and no demo record is zQA-prefixed.

Note: coordinating the DB-reset baseline to use this seed data is a docker/data-repo concern, outside mokosh-server.

#PMS-629
nrupard deleted branch fix/PMS-629-demo-seed-no-zqa 2026-07-13 21:13:45 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!447
No description provided.