Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,34 @@
- Deferred `uuid` dependency for ID generation to the task that first needs runtime IDs.
- Used a `newtype_id!` macro for the five ID types since they are structurally identical.
- Added `Eq` to all types whose fields support it, per CLAUDE.md §2 "derive eagerly."

## T0.3 — Gated trait + state transitions

**Status:** Complete

**What was done:**
- Created `crates/cockpit-core/src/gate.rs` with the `Gated` trait and all state transitions.
- Pure state transitions as default methods: `open`, `request_changes`, `approve`,
`mark_reworked`, `mark_agent_failed`.
- Effectful methods (`dispatch`, `reconcile`) are stubs returning `Error::NotImplemented`.
- `Gated` implemented for both `Review` and `ProjectPlan` — one loop, written once.
- Stale flag logic as inherent methods on `Review` (`mark_stale`, `clear_stale`).
- `gate::Error` with `thiserror`: `IllegalTransition`, `NoComments`, `NotImplemented`.

**Test results:**
- 34 new tests (41 total). All pass.
- Every legal transition tested (6 transitions from SPEC.md §7).
- Every illegal transition tested (19 invalid from/event pairs).
- Edge cases: no-comments rejected, comments cleared on reworked, comments preserved on
agent failure, full cycle, agent-failed-then-redispatch, stale flag orthogonal to loop.
- `ProjectPlan` full cycle verifies same trait, no forking.

**Decisions:**
- Separated pure state transitions (default trait methods) from effectful dispatch/reconcile.
This makes the state machine testable without real adapters.
- `mark_agent_failed` preserves comments — they are still pending feedback for re-dispatch.
- `mark_reworked` clears comments — enforces Invariant 4 (ephemeral).
- `gate_state_mut`/`comments_mut` are public trait methods (Rust traits can't have private
methods) but documented as implementation details.
- Stale logic is on `Review` directly, not on `Gated`, because it's Review-specific per
SPEC.md §7 ("stale gates the frontier, not the loop").
Loading
Loading