Skip to content

Daily entry: require grading to reconcile sellable eggs before submit #394

Closed

Description

@mforce

Problem

A Daily Entry can be submitted when its grade lines total less than its sellable eggs, including no grade lines at all. For example, a 200-egg entry with no losses and no grading can be submitted successfully.

Impact

Submission freezes the entry and creates egg lots only from grade lines. An ungraded 200-egg submission therefore creates zero stock, leaving recorded production that cannot be sold or reconciled through the intended Phase 1 grades-at-collection flow.

Agreed behaviour

  • Draft Daily Entries may be incomplete or ungraded.
  • Save & submit requires grades to equal sellable eggs: totalEggs - crackedEggs - dirtyEggs - discardedEggs.
  • Zero sellable eggs validly reconcile to zero grade lines.
  • Adjustments have no draft state, so saving an adjustment requires the same exact reconciliation.
  • UI and domain/API must enforce the invariant.

Adjust screen

Reshape the adjustment dialog to mirror Daily Entry: adjacent Egg counts and Grading panes, sellable calculation, remaining/day-adds-up status, and the same numeric controls. Retain the prior-adjustment context and required reason.

Acceptance criteria

  • The Daily Entry submit control is disabled until grading exactly reconciles.
  • Direct API callers cannot submit an ungraded or partially graded non-zero-sellable entry.
  • Adjustment save is disabled until grading exactly reconciles, and direct API callers cannot bypass it.
  • The adjustment dialog uses Daily Entry’s counts/grading visual hierarchy and feedback.
  • Regression tests cover no grades, partial grades, exact reconciliation, and a zero-sellable day.
  • Update the Help page and specs/product/GLOSSARY.md in the same change, per AGENTS.md docs-sync rule.

Activity

  1. mforce commented on Aug 2, 2026

    @mforce
    OwnerAuthor

    Design update: saleable quality eggs (#396)

    #396 changes the meaning of the #394 reconciliation rule without weakening it:

    • Drafts remain flexible.
    • On submit or adjustment, manual grades must exactly equal total - cracked - dirty - discarded.
    • Cracked and Dirty will have explicit, rename-safe quality-grade identities. When their snapshotted grade is saleable, the counter creates a separate quality lot; when it is not, it remains a loss. Discarded stays a loss.
    • The default Cracked and Dirty grades are saleable on fresh installs; existing farms and historic entries are not silently reclassified.
    • Products mapped to those grades carry independently configured default prices; no fixed discount is imposed.

    The implementation must also satisfy #395 by updating every non-CI writer and fixture that posts Daily Entries. The documentation PR contains the full design and execution plan.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions