Skip to content

F11: Reactivate flock — undo deplete/archive (#57) - #62

Merged
mforce merged 2 commits into
mainfrom
feat/f11-reactivate-flock
Jul 18, 2026
Merged

mforce merged 2 commits into
mainfrom
feat/f11-reactivate-flock

Conversation

@mforce

@mforce mforce commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Closes #57. The undo for the mis-deplete incident: Depleted/Archived flocks return to Active.

What

  • Flock.Reactivate() — clears DepletedOn/ArchivedOn (the backfill window disappears with them; full capture restored), bumps Version, 409 when already Active.
  • POST /flocks/{id}/reactivate.
  • Flocks screen: "reactivate" on any non-Active row, including archived rows behind the toggle. Deliberately no confirm dialog — this action is the undo.

Tests (+3 → 123)

Domain transitions/stamps/Version; integration: deplete → reactivate → entry recordable for today again, archive → reactivate, 409 on Active, parallel-reactivate race (Version == successes).

Verification (chromium, real stack)

Depleted flock → reactivate → Active and back in the daily-entry flock picker (prefill banner even confirmed its submitted entry still resolves). Archived flock → revealed via toggle → reactivate → Active. One false alarm during the drive was a script nav-race, confirmed against a fresh page load.

mforce added 2 commits July 16, 2026 17:11
Deplete/archive were one-way; a mis-click was unrecoverable from the
UI (the incident that motivated this: a DB wipe as the only undo).

- Flock.Reactivate(): Depleted/Archived -> Active, clears the
  DepletedOn/ArchivedOn stamps (so the CanRecordProductionOn backfill
  window disappears and full capture is restored), bumps Version.
  Reactivating an Active flock -> 409.
- POST /flocks/{id}/reactivate.
- Flocks screen: "reactivate" action on any non-Active row, including
  archived rows behind the toggle. No confirm — it IS the undo.

Tests (+3 -> 123): domain transition/stamp/Version assertions;
integration deplete->reactivate->record-today (full capture restored),
archive->reactivate, 409 on active; parallel-reactivate race pinning
Version to successful mutations.

Verified in chromium: Depleted flock reactivated to Active and back in
the daily-entry picker; archived flock reactivated from behind the
"show archived" toggle.

Closes #57
- Race test asserts the Version DELTA around the parallel reactivates
  instead of an absolute value, so future fixture mutations can't make
  it silently mis-assert. (pi Low)
- Glossary documents Reactivate and the dual-stamp state (deplete then
  archive), which the transition leans on. (pi Info)

Deferred with reasons on the PR: lifecycle-transition audit trail
(belongs to the Phase 1.1 audit-log slice — retrofit deplete/archive/
reactivate together), no confirm on reactivate (it IS the undo; a
mistaken one is re-depletable, losing only stamp dates — covered by
the audit decision).
@mforce

mforce commented Jul 17, 2026

Copy link
Copy Markdown
Owner Author

Review round: codex + pi

codex: clean pass — "consistently implemented across domain, application, API, and UI layers; preserves optimistic concurrency, tenant filtering, idempotency."

# Source Severity Finding Action
1 pi Medium Reactivate nulls DepletedOn/ArchivedOn with no audit trail — the fact and date of the lifecycle change are irretrievably lost Deferred by design — the Phase 1.1 audit-log slice is the right home; retrofitting event capture onto deplete/archive/reactivate together is cheaper than special-casing reactivate now. Noted on the audit item.
2 pi Low No confirm dialog, unlike deplete/archive Deliberate — reactivate is the undo; a mistaken one is re-depletable, losing only stamp dates (see #1)
3 pi Low Race test asserted an absolute Version — brittle to future fixture changes Fixed — asserts the delta around the race (4c7f592)
4 pi Info Dual-stamp state (deplete→archive) is an implicit invariant Fixed — Reactivate + dual-stamp behavior documented in the glossary (4c7f592)
5 pi Info Reactivated flock regains future capture with a potential data gap in the depleted window Accepted — intended "full capture restored" semantics; the gap is backfillable by normal entry

123 tests green.

@mforce
mforce merged commit bfa9ac3 into main Jul 18, 2026
3 checks passed
@mforce
mforce deleted the feat/f11-reactivate-flock branch July 18, 2026 00:21
@mforce mforce mentioned this pull request Jul 18, 2026
90 tasks done
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.

F11: Reactivate flock — undo deplete/archive

1 participant