fix(planner): wipe-and-replan preserves today's planned items #468

Merged
admin-mrrm merged 2 commits from fix/planner-replan-preserves-planned into main 2026-06-13 01:55:22 +02:00
Collaborator

Fixes #461

Summary

  • planToday() läuft in einer DB-Transaktion. Vor dem Slotter werden heutige planned-Items zurück auf pending demotet (plannedSlot = NULL). Damit ist der Pool für den Slotter vollständig und die Response-DTO enthält alle für heute geplanten Items.
  • Slotter-Tiebreaker erweitert: (priority, earliestAt, createdAt, id) — gleicher Pool produziert deterministisch identische Slot-Zuordnung.
  • Gestrige planned-Items und alle done-Items bleiben unangetastet.

Tests

  • demotes today's already-planned candidates back to pending before slotting
  • runs inside a db.transaction so demote+replan are atomic
  • orders deterministically by id when priority, earliestAt and createdAt all tie
  • Bestehende Tests bleiben grün; obsolete-marker und planned-Update-Reihenfolge im Mock-Index nachgezogen.
  • Full API suite: 452/452.

Arch-Decision

Option (a) Wipe-and-replan aus #461 arch-bot Kommentar. Frontend (setQueryData) bleibt — Response ist jetzt fachlich vollständig.

Fixes #461 ## Summary - `planToday()` läuft in einer DB-Transaktion. Vor dem Slotter werden heutige `planned`-Items zurück auf `pending` demotet (`plannedSlot = NULL`). Damit ist der Pool für den Slotter vollständig und die Response-DTO enthält alle für heute geplanten Items. - Slotter-Tiebreaker erweitert: `(priority, earliestAt, createdAt, id)` — gleicher Pool produziert deterministisch identische Slot-Zuordnung. - Gestrige `planned`-Items und alle `done`-Items bleiben unangetastet. ## Tests - `demotes today's already-planned candidates back to pending before slotting` - `runs inside a db.transaction so demote+replan are atomic` - `orders deterministically by id when priority, earliestAt and createdAt all tie` - Bestehende Tests bleiben grün; obsolete-marker und planned-Update-Reihenfolge im Mock-Index nachgezogen. - Full API suite: 452/452. ## Arch-Decision Option (a) Wipe-and-replan aus #461 arch-bot Kommentar. Frontend (`setQueryData`) bleibt — Response ist jetzt fachlich vollständig.
fix(planner): wipe-and-replan preserves today's planned items
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
d9fffdecd4
Fixes #461

planToday() now demotes today's already-planned candidates back to
pending in the same transaction before fetching the slot-plan pool.
The slotter operates on the full set; the response DTO contains every
item that ends up planned for today. done-candidates and yesterday's
planned-candidates are untouched.

Slotter ordering gets an `id` tiebreaker so identical-priority,
identical-createdAt candidates land in deterministic slots across
repeated runs.

Per arch-decision on #461 (Option a, Wipe-and-replan with stability
refinement). Frontend setQueryData stays — backend response is now
the full truth.
test(planner): update idempotency-test for wipe-and-replan semantics
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
74bedb0265
Second /planner/run now re-includes today's already-planned items
in the response (deliberate behavior change from #461). Idempotency
asserts identical candidateId + identical plannedSlot across runs,
and no DB-side duplicate.
admin-mrrm deleted branch fix/planner-replan-preserves-planned 2026-06-13 01:55:22 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
admin-mrrm/mrrmlabapp!468
No description provided.