Skip to content

Fixes from the PR #74 accuracy reviews: depleted backfill, draft-grade preservation, help/glossary corrections, a11y - #75

Merged
mforce merged 2 commits into
mainfrom
fix/daily-entry-depleted-backfill
Jul 18, 2026
Merged

mforce merged 2 commits into
mainfrom
fix/daily-entry-depleted-backfill

Conversation

@mforce

@mforce mforce commented Jul 18, 2026 •

Copy link
Copy Markdown
Owner

Consolidated fixes from PR #74's post-merge accuracy reviews (codex + stand-in + local llamacpp-pi). Full finding tables: stand-in, codex.

App fixes

  • Depleted flocks reachable for daily-entry backfill (stand-in P2 + codex P2): picker now includes depleted flocks labeled "— depleted, backfill only" (archived hidden), default selection prefers Active; matches the domain, the Flocks-dialog copy, and the F15 (2/2): Feed usage + stock corrections (#66) #70 feed-usage pattern.
  • Draft-grade preservation (codex P2, real data-loss bug): a draft referencing a since-deactivated grade rendered without that line and the next save silently dropped it. Grades now load includeInactive; deactivated grades render (labeled) while a prefilled quantity exists and are included in the save payload.

Documentation corrections (help + GLOSSARY)

  • codex P1: removed the implication that medication-withdrawal protection is operational — nothing sets RestrictedUntil yet; the docs now say so explicitly (food-safety).
  • Deactivated-grade semantics (existing order lines confirm; new lines rejected), purchase-correction scope (quantities only), usage corrections fix stock not history, draft-editability scope, legacy-order void caveat, inventory category nuances.

UI/a11y

  • Help tables wrap on phones (no more nowrap scrollers); glossary terms are th scope="row"; --muted darkened to 4.6:1 (WCAG AA), app-wide.

Browser-verified: help sections/anchors/375 px clean, backfill flow works end-to-end (depleted flock selectable, API date-gate message surfaces), rowheader semantics present.

Found by the PR #74 accuracy review (post-merge): the Help page, the Flocks
screen's own deplete dialog ("backfill for past dates still works"), the
glossary, and the domain (Flock.CanRecordProductionOn) all promise backfilled
entries for depleted flocks up to their depletion date — but the Daily entry
picker filtered to Active-only, so the capability was unreachable in the UI.

Picker now includes depleted flocks (archived stay hidden), labeled
"— depleted, backfill only", mirroring the feed-usage picker shipped in #70.
Default selection still prefers an Active flock; the API continues to gate
the exact dates.

Browser-verified: depleted flock listed + labeled, default selection Active,
and a post-depletion date surfaces the API's lifecycle rejection in the UI.
codex P1: the help implied medication-withdrawal protection is operational,
but no production path sets EggLot.RestrictedUntil — a food-safety
overclaim. Stock section, in-app glossary, and GLOSSARY.md now state plainly
that nothing marks eggs restricted yet and withholding periods must be
managed outside Cluckwork until medication tracking (spec §13) lands.

App bug (codex P2): a draft referencing a since-deactivated grade rendered
without that line (SPA loaded active grades only) and the next save silently
dropped it via ReplaceGrades. Daily entry now loads grades includeInactive;
deactivated grades render (labeled) only while a prefilled quantity exists,
and the save payload includes them.

Doc corrections (codex P2s): deactivated-grade stock does NOT keep selling —
existing order lines confirm but new lines are rejected (help + GLOSSARY);
"typo in a feed purchase" scoped to quantities only (cost/date/lot number
not correctable); usage corrections fix stock, not the create-only usage
record or its cost estimate; "drafts freely editable" scoped (flock/date and
customer/date are fixed); legacy pre-allocation orders can't self-serve
void. GLOSSARY inventory-item entry: all categories support purchases/
corrections, only flock feeding is Feed/Supplement/Additive; deactivation
blocks new purchases, not using up stock.

UI (codex P2/P3): help tables wrap on phones instead of inheriting the
mobile nowrap scroller; glossary terms are th scope=row for screen-reader
term-definition association; --muted darkened to clear WCAG AA (4.6:1).

Browser-verified: help page sections/anchors/375px clean, depleted-backfill
flow intact, rowheader semantics in place.
@mforce mforce changed the title Fix: depleted flocks reachable for daily-entry backfill Fixes from the PR #74 accuracy reviews: depleted backfill, draft-grade preservation, help/glossary corrections, a11y Jul 18, 2026
@mforce
mforce merged commit ce38f00 into main Jul 18, 2026
3 checks passed
@mforce
mforce deleted the fix/daily-entry-depleted-backfill branch July 18, 2026 18:44
mforce pushed a commit that referenced this pull request Jul 18, 2026
mforce pushed a commit that referenced this pull request Jul 18, 2026
Docs-sync rule: Help page gains a Water section (direct vs meter-derived
amounts, in-place correction, lifecycle rule), a "Wrong water record" row in
the corrections map, and a glossary entry; GLOSSARY.md gains the Water usage
entry noting it is the one editable record type (no inventory behind it).
Written against #75's corrected text — held until that merged.

local-pi review (scoped 96k run, 0 P1 / 2 P2 / 2 P3, all applied):
- Equal meter readings now refuse with a meter-specific message instead of
  surfacing as a confusing "quantity must be positive" (domain + validators;
  equal-readings domain test added).
- Source validator gains NotEmpty for a clear missing-field message.
- Meter-pair rule's When guard rewritten to state its intent.
- SPA maps 409 to a human concurrent-edit message.
mforce added a commit that referenced this pull request Jul 18, 2026
* F16: Water usage tracking (#67)

Spec §12.5. Unlike feed there is no inventory behind water, so records are
EDITABLE (Version token) instead of corrected via compensating rows — the
design decision #67 left open, resolved and documented in the domain comment;
corrections become admin-gated with #73.

- WaterUsage: flock + date (fixed after creation — identity-like), quantity
  in L/gal, source (Well/Municipal/Tank/Other), optional meter start/end.
  Quantity may be omitted when meters are given (derived as the delta);
  when both are present they must agree. CreatedAtUtc for same-day ordering;
  DailyEntryId reserved with a real FK.
- Record/Update handlers: same flock lifecycle gate as production and feed
  (CanRecordProductionOn — depleted backfill allowed, archived never),
  future dates refused. Update keeps flock/date fixed; parallel corrections
  race on the Version token (loser 409).
- API: POST/PUT/GET /api/v1/water-usage (flock/date filters, paged).
- SPA: Water page — capture form with a meters toggle, depleted flocks
  labeled backfill-only, record list with filters and inline "correct".

Tests: 8 new (domain meter rules/unit guard/update semantics; integration
direct + meter-derived recording, guard matrix incl. qty-vs-delta mismatch,
archived/future 422s, update keeps flock/date, parallel-update Version race
with no blended payload). 186 green.

Runtime-verified: API scenario (derive 85.25 from meters, correction round
trip) + Playwright UI flow (direct + metered records, inline correction).

Help/GLOSSARY sections follow in this PR once #75 (which edits the same
files) merges — docs-sync rule.

Closes #67

* Water docs (post-#75 merge) + local-pi review fixes

Docs-sync rule: Help page gains a Water section (direct vs meter-derived
amounts, in-place correction, lifecycle rule), a "Wrong water record" row in
the corrections map, and a glossary entry; GLOSSARY.md gains the Water usage
entry noting it is the one editable record type (no inventory behind it).
Written against #75's corrected text — held until that merged.

local-pi review (scoped 96k run, 0 P1 / 2 P2 / 2 P3, all applied):
- Equal meter readings now refuse with a meter-specific message instead of
  surfacing as a confusing "quantity must be positive" (domain + validators;
  equal-readings domain test added).
- Source validator gains NotEmpty for a clear missing-field message.
- Meter-pair rule's When guard rewritten to state its intent.
- SPA maps 409 to a human concurrent-edit message.

---------

Co-authored-by: mforce <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant