fix(schedule): cancel a pending change and write its audit row in one transaction #257

Open
opened 2026-10-03 10:45:37 +00:00 by gabogg · 0 comments
Owner

P3 follow-up from PR #177 review pass 5 (standards axis).

Finding

cancel_pending_change_async (app/services/occupancy_service.py ~665-678) supersedes the pending change and then inserts the CANCELLATION audit row, using two repository calls that each open their own connection. If the second call fails, the change is cancelled with no audit row. Pass 3 (P2-5) already moved a similar pair onto connection-taking repository methods.

Acceptance Criteria

  • The supersede and the audit insert commit in one transaction, through a connection-taking repository method.
  • A test with an injected audit failure leaves the pending change PENDING.
P3 follow-up from PR #177 review pass 5 (standards axis). ### Finding `cancel_pending_change_async` (`app/services/occupancy_service.py` ~665-678) supersedes the pending change and then inserts the `CANCELLATION` audit row, using two repository calls that each open their own connection. If the second call fails, the change is cancelled with no audit row. Pass 3 (P2-5) already moved a similar pair onto connection-taking repository methods. ### Acceptance Criteria - The supersede and the audit insert commit in one transaction, through a connection-taking repository method. - A test with an injected audit failure leaves the pending change PENDING.
Sign in to join this conversation.
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
gabogg/hikcentral#257
No description provided.