test(tickets): pin priority round-trip on ticket create (PMS-358) #270

Merged
nrupard merged 1 commit from feat/pms-358-priority-roundtrip-integration-test into main 2026-06-16 21:55:59 +02:00
Owner

External review reported "select Priority = High on New Ticket, ticket saves as Medium" everywhere downstream (detail, list, dashboard, widget). Medium is the seeded default priority (023_seed_data.sql), and the create path falls back to that default only when priority_id is absent from the request. The server create path itself binds request.priority_id straight into the INSERT (src/modules/tickets/service.rs), so a present, valid priority_id already persists unchanged.

This adds a server-side integration test that enumerates every tenant priority via GET /api/v1/tickets/priorities, creates a ticket with each explicit priority_id, and asserts both the create response and a fresh GET carry that exact id+name (never the default), while company/status/joined fields still resolve. The test passes against all four seeded priorities (Critical, High, Medium, Low), proving the backend round-trips priority correctly and is not the source of the regression.

Remediation note: because the server stores whatever priority_id the form sends and only defaults to Medium when the field is omitted, the "High -> Medium" symptom maps to the SPA New Ticket form dropping priority_id before POST (suspects a/b in the issue: onchange writing a different signal, or submit ignoring the selection). The fix belongs in the mokosh-apps SPA, not this repo. Existing data: any tickets created through the broken form carry the default Medium rather than the intended value; this is staging-only at present and the call on backfill is left to operators - this change does not retroactively repair rows.

#PMS-358

External review reported "select Priority = High on New Ticket, ticket saves as Medium" everywhere downstream (detail, list, dashboard, widget). Medium is the seeded default priority (023_seed_data.sql), and the create path falls back to that default only when `priority_id` is absent from the request. The server create path itself binds `request.priority_id` straight into the INSERT (src/modules/tickets/service.rs), so a present, valid `priority_id` already persists unchanged. This adds a server-side integration test that enumerates every tenant priority via GET /api/v1/tickets/priorities, creates a ticket with each explicit `priority_id`, and asserts both the create response and a fresh GET carry that exact id+name (never the default), while company/status/joined fields still resolve. The test passes against all four seeded priorities (Critical, High, Medium, Low), proving the backend round-trips priority correctly and is not the source of the regression. Remediation note: because the server stores whatever `priority_id` the form sends and only defaults to Medium when the field is omitted, the "High -> Medium" symptom maps to the SPA New Ticket form dropping `priority_id` before POST (suspects a/b in the issue: onchange writing a different signal, or submit ignoring the selection). The fix belongs in the mokosh-apps SPA, not this repo. Existing data: any tickets created through the broken form carry the default Medium rather than the intended value; this is staging-only at present and the call on backfill is left to operators - this change does not retroactively repair rows. #PMS-358
test(tickets): pin priority round-trip on ticket create (PMS-358)
All checks were successful
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 56s
E2E / Playwright against staging (pull_request) Successful in 1m48s
Integration / integration tests (pull_request) Successful in 5m41s
Create release / Create release from merged PR (pull_request) Has been skipped
075555d198
External review reported "select Priority = High on New Ticket, ticket saves as Medium" everywhere downstream (detail, list, dashboard, widget). Medium is the seeded default priority (023_seed_data.sql), and the create path falls back to that default only when `priority_id` is absent from the request. The server create path itself binds `request.priority_id` straight into the INSERT (src/modules/tickets/service.rs), so a present, valid `priority_id` already persists unchanged.

This adds a server-side integration test that enumerates every tenant priority via GET /api/v1/tickets/priorities, creates a ticket with each explicit `priority_id`, and asserts both the create response and a fresh GET carry that exact id+name (never the default), while company/status/joined fields still resolve. The test passes against all four seeded priorities (Critical, High, Medium, Low), proving the backend round-trips priority correctly and is not the source of the regression.

Remediation note: because the server stores whatever `priority_id` the form sends and only defaults to Medium when the field is omitted, the "High -> Medium" symptom maps to the SPA New Ticket form dropping `priority_id` before POST (suspects a/b in the issue: onchange writing a different signal, or submit ignoring the selection). The fix belongs in the mokosh-apps SPA, not this repo. Existing data: any tickets created through the broken form carry the default Medium rather than the intended value; this is staging-only at present and the call on backfill is left to operators - this change does not retroactively repair rows.

#PMS-358
nrupard deleted branch feat/pms-358-priority-roundtrip-integration-test 2026-06-16 21:56:00 +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!270
No description provided.