Skip to content

[C] #514 slice 13: General Inventory contract and the flock-eligibility read #855

Description

@mforce

Important

Track C is unscheduled. These slices move production code, and the 2026-08 design's own status
line still governs: "proposed architecture; no production refactor is authorized by this
document."
Filed so the analysis is tracked work rather than a comment, not as a commitment to
run it.

The 2026-09-14 re-plan
recommends gating Track C on evidence from Tracks A and B: if the #842 ratchet fires repeatedly in
real pull requests, these become worth their cost; if it stays quiet, they do not. Track C is
57–95 focused engineering days and produces no user-visible change.

Read the re-plan before picking any of these up. Several assumptions in the 2026-08 plan are
corrected there.

Inventory items, lots, movements, feed usage and water usage behind a contract.

Scope

  • IInventoryModule over purchase, adjust, consume, feed usage and water usage.
  • Calls Flock Management's eligibility read, not its entities or repositories. The risk this
    slice carries is importing Flock instead of asking a question about it.
  • Calls Farm for the currency snapshot.

The ordering detail that must not move

RecordFeedUsage locks the inventory item first, then — still inside that same transaction —
evaluates flock eligibility, then reads lots. The check must stay inside the transaction and after
the item lock.

Moving it to a precondition before the transaction opens would widen the race, not close it.
Today's shape deliberately shrinks a concurrent archive/deplete race to the commit itself, and leaves
the flock row unlocked on purpose: a same-day deplete racing a same-day feed is business-valid either
way, because the birds ate before they left.

Done when

Unedited and green: backdated FIFO consumption, insufficient-stock rollback, concurrent lot
consumption, flock eligibility behaviour, currency handling, tenant and Version tests, API and SPA
contracts. One inventory transaction retained. EF model digest identical.

Explicitly not in this slice

Flock internals. Egg stock — that is Egg Operations' ledger and a different FIFO.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiAPI/endpoint layerepic-514Modular monolith architecture (#514)priority:tier4Deferred or speculativesize:MA day or two; migration or a multi-state UIsliceThin vertical work itemtrack:C#514 Track C — moves production code; UNSCHEDULED, needs authorisation

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions