feat(seed): extend qa-seed with assets, KB, SLA, and appointments (PSA-55) #431

Merged
nrupard merged 4 commits from feat/PSA-55-qa-seed-demo-gaps into main 2026-07-06 18:30:48 +02:00
Owner

The Mokosh demo (PSA-49) needs the assets, knowledge-base, SLA, and dispatch/calendar surfaces populated. mokosh-server already has a complete operator seed - qa-seed (PMS-331) - covering companies/contacts/tickets/projects/time/contracts/invoices, so rather than build a second (file-driven) seed this extends the existing qa-seed, reusing its is_qa fail-closed guard, idempotency, and teardown.

Added to the QA walkthrough dataset

  • 1 asset type + 6 assets across the seeded companies (assets list + company-360 rollup).
  • 1 knowledge-base category with 3 published articles.
  • 1 SLA policy (populates the SLA-management view).
  • 5 calendar / dispatch appointments over the coming week.

All writes go through the tenant-scoped service layer (AssetsService, KbService, SlaService, CalendarService); every record carries the QA- name prefix / qa-seed tag; teardown removes the new entities before the companies/tickets/projects they reference; QaReport gained matching counters and its Display/doc were updated.

Scope calls

  • RMM device mappings not seeded - they need a real RMM connection + provider credentials a data-only seed can't supply. The seeded assets cover the demo's asset/CMDB surface; the RMM settings screens read fine empty.
  • AssetsService is built with a zero encryption key: the seed only creates plain assets/asset types, never the encrypted asset secrets (credentials / configuration items) that are the sole users of the key (PMS-188 removed the zero-key new).

Verification

cargo fmt --all --check + cargo clippy -p mokosh-server --all-targets -- -D warnings green in the pinned rust-builder-*:v1.0.1-rust1.94-trixie container (no local toolchain on this box). Runtime seeding is not exercised here (no Postgres): the create path is service-layer and compile-checked; the teardown SQL table/column names are grounded in each module's insert statements/models but not runtime-verified.

Operator note

qa-seed short-circuits when QA companies already exist, so an already-seeded QA tenant needs mokosh-bootstrap qa-teardown --tenant <id> then qa-seed to pick up the new entities. A fresh QA tenant gets everything in one run.

Fixes PSA-55.

The Mokosh demo (PSA-49) needs the assets, knowledge-base, SLA, and dispatch/calendar surfaces populated. mokosh-server already has a complete operator seed - `qa-seed` (PMS-331) - covering companies/contacts/tickets/projects/time/contracts/invoices, so rather than build a second (file-driven) seed this **extends the existing qa-seed**, reusing its `is_qa` fail-closed guard, idempotency, and teardown. ## Added to the QA walkthrough dataset - 1 asset type + 6 assets across the seeded companies (assets list + company-360 rollup). - 1 knowledge-base category with 3 published articles. - 1 SLA policy (populates the SLA-management view). - 5 calendar / dispatch appointments over the coming week. All writes go through the tenant-scoped service layer (`AssetsService`, `KbService`, `SlaService`, `CalendarService`); every record carries the `QA-` name prefix / `qa-seed` tag; teardown removes the new entities before the companies/tickets/projects they reference; `QaReport` gained matching counters and its `Display`/doc were updated. ## Scope calls - **RMM device mappings not seeded** - they need a real RMM connection + provider credentials a data-only seed can't supply. The seeded assets cover the demo's asset/CMDB surface; the RMM settings screens read fine empty. - `AssetsService` is built with a zero encryption key: the seed only creates plain assets/asset types, never the encrypted asset secrets (credentials / configuration items) that are the sole users of the key (PMS-188 removed the zero-key `new`). ## Verification `cargo fmt --all --check` + `cargo clippy -p mokosh-server --all-targets -- -D warnings` green in the pinned `rust-builder-*:v1.0.1-rust1.94-trixie` container (no local toolchain on this box). Runtime seeding is **not** exercised here (no Postgres): the create path is service-layer and compile-checked; the teardown SQL table/column names are grounded in each module's insert statements/models but not runtime-verified. ## Operator note `qa-seed` short-circuits when QA companies already exist, so an already-seeded QA tenant needs `mokosh-bootstrap qa-teardown --tenant <id>` then `qa-seed` to pick up the new entities. A fresh QA tenant gets everything in one run. Fixes PSA-55.
feat(seed): extend qa-seed with assets, KB, SLA, and appointments (PSA-55)
Some checks failed
Check / fmt + clippy + build + tests (pull_request) Successful in 1m39s
Integration / integration tests (pull_request) Successful in 5m40s
E2E / Playwright against staging (pull_request) Failing after 6m21s
1568eec7bb
The Mokosh demo (PSA-49) needs the assets, knowledge-base, SLA, and dispatch/calendar surfaces populated, which the existing qa-seed dataset (PMS-331) did not cover. Rather than build a second, file-driven seed, this extends the existing operator-triggered qa-seed, reusing its is_qa fail-closed guard, idempotency, and teardown.

Adds to the QA walkthrough dataset:
- 1 asset type + 6 assets spread across the seeded companies (assets list + company-360 rollup).
- 1 knowledge-base category with 3 published articles.
- 1 SLA policy (so the SLA-management view is populated).
- 5 calendar / dispatch appointments over the coming week.

All writes go through the tenant-scoped service layer (AssetsService, KbService, SlaService, CalendarService), everything carries the QA- name prefix / qa-seed tag, and teardown removes the new entities before the companies/tickets/projects they reference. QaReport gained matching counters.

RMM device mappings are intentionally not seeded: they require a real RMM connection + provider credentials, which a data-only seed cannot supply; the assets above cover the demo's asset/CMDB surface. AssetsService is constructed with a zero encryption key because the seed only creates plain assets and asset types, never the encrypted asset secrets (credentials / configuration items) that are the sole users of the key.

Verified: cargo fmt --all --check + cargo clippy -p mokosh-server --all-targets -D warnings green in the pinned rust-builder container (no local toolchain on this box). Runtime seeding is not exercised here (no Postgres); the create path is service-layer and compile-checked, and the teardown SQL table/column names are grounded in the modules' insert statements. Note: qa-seed short-circuits when QA companies already exist, so an already-seeded QA tenant needs qa-teardown then qa-seed to pick up the new entities.

#PSA-55
feat(seed): give the QA SLA policy a response/resolution target (PSA-55)
Some checks failed
Check / fmt + clippy + build + tests (pull_request) Successful in 1m23s
Integration / integration tests (pull_request) Successful in 5m13s
E2E / Playwright against staging (pull_request) Failing after 6m20s
4b8d73da9b
Review follow-up. The seeded SLA policy had no targets, so the SLA-management view showed a policy with no deadlines. Attach one target on the tenant's top ticket priority (1h first response, 8h resolution - first_response <= resolution per the cross-field validator) via SlaService::upsert_target. Teardown now removes the QA policy's targets before the policy itself (sla_targets is scoped through sla_policy_id, no tenant_id column of its own).

Verified: cargo fmt --check + clippy -p mokosh-server --all-targets -D warnings green in the pinned rust-builder container.

#PSA-55
fix(e2e): tolerate bunyip 2FA auto-submit in the login helper
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 36s
Check / fmt + clippy + build + tests (pull_request) Successful in 1m21s
Integration / integration tests (pull_request) Successful in 5m14s
9e27995379
The E2E login helper (fillTotpStep) filled the 6-digit TOTP and then clicked the submit button. But the bunyip hub that serves the 2FA step auto-submits the form the instant the code reaches six digits (BUNYIP-331 OTP autosubmit), and setInputValue dispatches an `input` event that triggers it. So the form was already navigating to the OIDC callback by the time the helper clicked, and the click waited out the full 60s timeout on a detached button, failing global.setup (bearer capture) and every test that logs in - even though auth actually succeeded (the trail reaches /dashboard).

Click only as a fallback now, and race it against the navigation off the /login/2fa step, so the happy autosubmit path resolves immediately instead of hanging on a vanished button. Unrelated to the seed change in this PR; folded in here to get the E2E gate green.

Verified: `tsc --noEmit` clean.

#PSA-55
Merge remote-tracking branch 'origin/main' into feat/PSA-55-qa-seed-demo-gaps
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 1m26s
Check / fmt + clippy + build + tests (pull_request) Successful in 4m59s
Create release / Gate (release-branch merges only) (pull_request) Successful in 0s
Create release / Create release from merged PR (pull_request) Has been skipped
Integration / integration tests (pull_request) Successful in 12m49s
10bb709d0f
# Conflicts:
#	e2e/lib/login.ts
nrupard scheduled this pull request to auto merge when all checks succeed 2026-07-06 18:28:32 +02:00
nrupard deleted branch feat/PSA-55-qa-seed-demo-gaps 2026-07-06 18:30:48 +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!431
No description provided.