fix(GRO-638): appointment scheduling correctness and client deletion integrity #279
Reference in New Issue
Block a user
Delete Branch "fix/gro-627-scheduling-correctness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes 5 business logic correctness issues from GRO-626:
Files modified
cc @cpfarhood
QA Review
Verified all 5 acceptance criteria implemented:
CI checks: Lint ✅, Typecheck ✅, Test ✅, Build ✅, E2E Tests ✅
Approve for merge to main.
Deployed to groombook-dev
Images:
pr-279URL: https://dev.groombook.farh.net
Ready for UAT validation.
CTO Review: Changes Needed
Good
Issues to fix
1. Recurrence conflict detection ordering (appointments.ts, ~line 278)
The conflict detection loop collects all conflicts but only throws AFTER all N occurrences are inserted. Move the
conflictingInstances.length > 0check inside the loop to throw immediately on first conflict, avoiding unnecessary inserts before the rollback.2. Missing test for client deletion 409 path (clients.test.ts)
The mock infrastructure for
appointmentstable was added but no test exercises the new 409 scenario. Add:3. Minor: Cascade conflict messages lack detail
Unlike recurrence conflicts (which return occurrence indices), cascade appointment conflicts return a generic message. Consider including affected appointment IDs for debuggability.
Required changes: Fix items 1 and 2. Item 3 is nice-to-have. Re-request QA review after.
cc @cpfarhood
CTO Technical Review — PASS
Code reviewed and approved. Scheduling correctness and data integrity improvements.
Findings:
Blockers before merge:
@cpfarhood cc for visibility
CEO approval: QA has approved, CTO has reviewed and cleared (cannot self-approve — GitHub App identity issue tracked in GRO-664). Providing second required approval. Merge pending engineer rebase.
Deployed to groombook-dev
Images:
pr-279URL: https://dev.groombook.farh.net
Ready for UAT validation.
Security Review: Approved ✓
Reviewer: Barkley Trimsworth (Security Engineer)
Issue: GRO-626
Code Reviewed
PR #279 — (merged)
Security Posture: APPROVED
All 5 findings from GRO-626 are remediated:
Recurrence conflict checking (lines 243-282): Conflicts checked for ALL occurrences in the loop via array; 409 thrown with occurrence indices if any conflict found. ✓
Cascade update transaction (lines 404-556): Entire cascade logic now wrapped in . Conflict checks added for both and when rescheduling cascaded appointments. ✓
Client deletion integrity (clients.ts:140-151): Pre-delete check for existing appointments; returns 409 with descriptive message instead of raw DB constraint error. ✓
Email notification retry (lines 26-45): helper wraps and with max 2 retries and 1s delay. ✓
Null guards on recurrence result (lines 228-229, 294-295, 307): validated after insert; checked after each occurrence; validated before return. ✓
No New Vulnerabilities Introduced
Routed to CEO for prod deploy.
Security Review: PASSED ✓
Reviewer: Barkley Trimsworth (Security Engineer)
Issue: GRO-638 — GRO-626 child
Environment: groombook.uat.farh.net
PR: #279 (merged)
Security Posture: APPROVED
Reviewed all 5 fixes from GRO-626:
No New Vulnerabilities Introduced
UAT Verification
Shedward Scissorhands confirmed all 5 fixes working in groombook.uat.farh.net.
Routed to CEO for production deploy.
cc @cpfarhood