You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of Phase 1.1 (epic #14). Spec §8.1 (entry states + who can edit), §9.5 (voided entry → reversing movement). The domain half already exists: DailyEntry carries the full state enum, Lock(), and ManagerAdjust(totals, reason, grades) with grade validation and a Version bump — nothing above it is wired, so today no one can correct a submitted entry.
Scope
Auto-lock (spec §8.1 default):
Background/durable job locks Submitted entries older than 7 farm-local days (Lock(), stamps locked_at/locked_by=system). Farm-local: reuse IClock.TodayInZone + farm timezone default (single-farm MVP: account default; Use farm-local dates for withdrawal restriction and allocation boundaries #35 timezones refines later).
Adjust submitted/locked entries:
POST /daily-entries/{id}/adjust — body: totals (total/cracked/dirty/discarded/mortality), optional grade lines, required reason (≤500, whitespace-guarded). Admin-only until RBAC lands (single login today — enforce role check when EPIC: Phase 1.1 — Operational fill #14 RBAC ships; leave TODO seam).
Spec allows managers to edit submitted pre-lock; MVP simplification: one adjust path for both Submitted and Locked → both land in ManagerAdjusted (domain currently requires Locked — relax to Submitted|Locked, keep the reason mandatory).
Mortality: if MortalityCount changes, append a compensating Mortality bird-movement delta tied to the entry (ledger stays append-only — no edits of the original row).
All of it in one transaction with the entry's Version race-tested per AGENTS.md.
Adjust reason + previous values surfaced in the entry response (audit trail until the audit-log slice lands).
Void entry (spec §8.1/§9.5):
POST /daily-entries/{id}/void — reverses ALL the entry's egg lots (blocked the same way if stock already sold) and appends a compensating mortality movement; entry preserved as Voided. Reuses the F14: Void confirmed sales order — return allocated stock #60 provenance discipline.
SPA:
History page: adjust/void actions on Submitted/Locked entries behind F13-style confirm + required reason; Locked/ManagerAdjusted/Voided badges; adjusted entries show reason.
Entry submitted 8+ farm-local days ago is Locked automatically; adjust on it lands as ManagerAdjusted with reason; totals/lots/stock all consistent afterwards.
Shrinking a grade below its already-sold quantity → 422, nothing changes.
Adjust mortality 2→5 → bird ledger shows the original 2 plus a +3 compensating movement; CurrentBirds correct.
Void entry with unsold lots → stock drops by those lots, entry Voided, lots emptied; void with sold stock → 422.
Parallel adjusts: exactly one wins (Version delta 1).
Part of Phase 1.1 (epic #14). Spec §8.1 (entry states + who can edit), §9.5 (voided entry → reversing movement). The domain half already exists:
DailyEntrycarries the full state enum,Lock(), andManagerAdjust(totals, reason, grades)with grade validation and a Version bump — nothing above it is wired, so today no one can correct a submitted entry.Scope
Auto-lock (spec §8.1 default):
Lock(), stamps locked_at/locked_by=system). Farm-local: reuseIClock.TodayInZone+ farm timezone default (single-farm MVP: account default; Use farm-local dates for withdrawal restriction and allocation boundaries #35 timezones refines later).Adjust submitted/locked entries:
POST /daily-entries/{id}/adjust— body: totals (total/cracked/dirty/discarded/mortality), optional grade lines, required reason (≤500, whitespace-guarded). Admin-only until RBAC lands (single login today — enforce role check when EPIC: Phase 1.1 — Operational fill #14 RBAC ships; leave TODO seam).ManagerAdjusted(domain currently requires Locked — relax to Submitted|Locked, keep the reason mandatory).QuantityProduced − QuantityAvailable(already sold/allocated) → 422 with a message naming the blocking allocation. Same pessimistic FOR UPDATE + canonical lock ordering as confirm/void (F14: Void confirmed sales order — return allocated stock #60/PR F14: Void confirmed sales order — return allocated stock (#60) #64).Void entry (spec §8.1/§9.5):
POST /daily-entries/{id}/void— reverses ALL the entry's egg lots (blocked the same way if stock already sold) and appends a compensating mortality movement; entry preserved as Voided. Reuses the F14: Void confirmed sales order — return allocated stock #60 provenance discipline.SPA:
Out of scope
manager_adjustedinventory interplay for feed/water (arrives with F15: Feed inventory + feed usage #66/F16: Water usage tracking #67 usage records).Acceptance