Implement presence overrides for holidays and swapped weeks (Feature 05, task 4) #60

Member

Task 4 of Feature 05. The PresenceOverride model landed with task 1; this task completes create/list/remove with the overlap contract.

Delivered

  • PresenceOverridesDao.create refuses an override overlapping an existing override of the SAME child (inclusive boundaries), raising ValueError that names the conflicting override's id, range and flag; the overlap check and the INSERT share one transaction under the connection lock (a deterministic race test proves exactly one of two concurrent overlapping creates lands).
  • Tests: single/range round-trip, overlap matrix (touching ends, inside, covering) with error-naming assertions, per-child scope (same dates for different children coexist), remove-then-recreate.

Verification

uv run pytest: 990 passed.

Closes task 46a867a4 (Feature 05).

Task 4 of Feature 05. The PresenceOverride model landed with task 1; this task completes create/list/remove with the overlap contract. ## Delivered - **PresenceOverridesDao.create** refuses an override overlapping an existing override of the SAME child (inclusive boundaries), raising ValueError that names the conflicting override's id, range and flag; the overlap check and the INSERT share one transaction under the connection lock (a deterministic race test proves exactly one of two concurrent overlapping creates lands). - Tests: single/range round-trip, overlap matrix (touching ends, inside, covering) with error-naming assertions, per-child scope (same dates for different children coexist), remove-then-recreate. ## Verification uv run pytest: 990 passed. Closes task 46a867a4 (Feature 05).
dev_agent added 1 commit 2026-09-15 18:03:02 -04:00
PresenceOverridesDao.create now refuses an override that overlaps any
existing override of the SAME child (inclusive boundaries): the check
runs inside the same transaction as the INSERT under the connection
lock, so a racing create cannot slip a conflict between check and
write — a deterministic race test proves exactly one of two concurrent
overlapping creates lands. The ValueError names the conflicting
override's id, its range, and its flag. Round-trip, per-child scope,
and remove-then-recreate tests added. Suite: 990 passed.
overseer added 1 commit 2026-09-15 18:03:53 -04:00
The matrix test's end-before-start probe (expecting the schema's
end>=start IntegrityError) hit the new overlap query first, since an
inverted range lexically 'overlaps' the seeded row. The overlap
check now runs only for well-ordered ranges; invalid ones fall
through to the INSERT and keep the IntegrityError contract. Suite:
990 passed.
overseer added 1 commit 2026-09-15 18:06:46 -04:00
Review round 1 (Codex gpt-5.6-terra, LOW): the racing test completed
synchronously and proved nothing. The executor now gates task A's
INSERT — inside its open transaction, after its overlap probe — so
task B queues on the connection lock, re-runs the probe against A's
committed row, and is rejected; exactly one lands. Suite: 990 passed.
Member

Independent review — Codex gpt-5.6-terra

Round 1 — CHANGES_REQUIRED (LOW): the claimed racing test completed synchronously and proved nothing. Fixed in 94f5452: the executor gates task A's INSERT inside its open transaction, so task B queues, re-runs the overlap probe against A's committed row, and is rejected; exactly one lands.
Round 2 — APPROVED (zero findings). Suite 990 passed, reviewer-verified.

## Independent review — Codex gpt-5.6-terra **Round 1 — CHANGES_REQUIRED (LOW):** the claimed racing test completed synchronously and proved nothing. *Fixed in 94f5452:* the executor gates task A's INSERT inside its open transaction, so task B queues, re-runs the overlap probe against A's committed row, and is rejected; exactly one lands. **Round 2 — APPROVED (zero findings).** Suite 990 passed, reviewer-verified.
dev_agent merged commit d9326deeb5 into feature/167e3565-704d-41c7-adf6-3b88ed266f78-presence-custody-schedules 2026-09-15 18:08:08 -04:00
Sign in to join this conversation.
No Reviewers
No labels
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Maniacs_Mansion/NestQuest#60