Objective
- Prevent a user from reopening a cancelled inspection by submitting a reschedule flow that was opened before the cancellation happened.
- Make the reschedule experience consistent with the workorder UI, which disables Reschedule once a job is cancelled.
Problem
Inspection NHI726 was cancelled and then reopened through reschedule a minute later:
- 5:51 PM — Sean Baltazar: status
confirmed→cancelled;canceledAtandcanceledByset. - 5:52 PM — Ricardo Chahin:
PATCH /:id/rescheduleclearedcanceledAtandcanceledBy, updated the inspection datetime and end time, and changed statuscancelled→unconfirmed. - 5:55 PM — Ricardo Chahin: status
unconfirmed→confirmed.
Backend review confirmed this is allowed by current code. PATCH /:id/reschedule intentionally reopens cancelled inspections by clearing cancellation fields and setting the inspection back to unconfirmed.
The bug is that this outcome appears possible even though the workorder UI greys out Reschedule when status === 'cancelled'. The most likely path is a stale or already-open reschedule modal:
- the reschedule modal was opened while the inspection was still active
- another user cancelled the inspection
- the open modal was still submittable
- submit sent
PATCH /:id/reschedule, which reopened the cancelled inspection
Expected behavior
Once an inspection is cancelled, an already-open reschedule flow should no longer be able to submit a reschedule that reopens the inspection accidentally.
Scope
- Confirm and fix the stale/open modal path in the frontend reschedule flow.
- Add a submit-time guard so reschedule cannot proceed when the latest inspection status is
cancelledunless the product explicitly intends a reopen flow. - Keep behavior aligned with the workorder UI rule that cancelled jobs should not be rescheduled from the normal reschedule action.
- Coordinate with the broader product decision in ATT-1267 about whether cancelled inspections should have an explicit reopen path.
Notes
- This issue is not asking to remove the backend capability in all cases unless that is the chosen product direction.
- This issue is focused on preventing accidental reopen via stale UI state or an already-open modal.
- If the product should support reopening cancelled inspections, that should happen through an explicit flow rather than an unintended reschedule submit.
References
- Backend:
attik-backend/src/routes/inspection.ts - Frontend disabled state:
attik-frontend/src/app/tools/inspections/[id]/components/WorkorderActionsDropdown.tsx - Frontend modal submit path:
attik-frontend/src/app/tools/inspections/[id]/components/RescheduleJobModal.tsx