|
| 1 | +# Todo Compliance Model |
| 2 | + |
| 3 | +Epic 15 Task 15.1 defines the compliance contract that keeps execution aligned with approved plans. |
| 4 | + |
| 5 | +## Goals |
| 6 | + |
| 7 | +- enforce explicit, auditable todo state progression during plan execution |
| 8 | +- prevent silent task skipping by allowing only explicit, reasoned bypass paths |
| 9 | +- keep compliance checks deterministic and machine-readable for automation |
| 10 | + |
| 11 | +## Required todo state model |
| 12 | + |
| 13 | +Every tracked todo item must be in exactly one state: |
| 14 | + |
| 15 | +- `pending`: planned but not started |
| 16 | +- `in_progress`: actively being executed |
| 17 | +- `done`: completed and verified |
| 18 | +- `skipped`: intentionally not executed with explicit rationale |
| 19 | + |
| 20 | +Unknown states must fail compliance checks. |
| 21 | + |
| 22 | +## Core enforcement rules |
| 23 | + |
| 24 | +1. Exactly one item may be `in_progress` at a time. |
| 25 | +2. Transition order must follow: |
| 26 | + - `pending -> in_progress` |
| 27 | + - `in_progress -> done` |
| 28 | + - `in_progress -> skipped` |
| 29 | +3. Direct transitions like `pending -> done` are invalid unless a bypass annotation exists. |
| 30 | +4. Plan completion is valid only when all items are `done` or `skipped`. |
| 31 | + |
| 32 | +## Bypass annotations |
| 33 | + |
| 34 | +Bypass is allowed only through explicit metadata attached to the affected item: |
| 35 | + |
| 36 | +- `bypass_reason`: concise justification |
| 37 | +- `bypass_actor`: who authorized it |
| 38 | +- `bypass_at`: RFC3339 timestamp |
| 39 | +- `bypass_type`: one of `risk_acceptance`, `scope_change`, `emergency_hotfix` |
| 40 | + |
| 41 | +Missing any required bypass field must invalidate the bypass. |
| 42 | + |
| 43 | +## Audit event format |
| 44 | + |
| 45 | +Compliance-relevant state transitions should emit append-only events: |
| 46 | + |
| 47 | +```json |
| 48 | +{ |
| 49 | + "event": "todo_transition", |
| 50 | + "todo_id": "todo-3", |
| 51 | + "from": "pending", |
| 52 | + "to": "in_progress", |
| 53 | + "at": "2026-02-13T12:00:00Z", |
| 54 | + "actor": "diego", |
| 55 | + "compliance": "enforced" |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +Bypass usage should emit: |
| 60 | + |
| 61 | +```json |
| 62 | +{ |
| 63 | + "event": "todo_bypass", |
| 64 | + "todo_id": "todo-5", |
| 65 | + "from": "pending", |
| 66 | + "to": "done", |
| 67 | + "at": "2026-02-13T12:05:00Z", |
| 68 | + "actor": "diego", |
| 69 | + "bypass": { |
| 70 | + "type": "scope_change", |
| 71 | + "reason": "task absorbed into prior step", |
| 72 | + "authorized_by": "owner" |
| 73 | + } |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +## Validation outcomes |
| 78 | + |
| 79 | +Compliance checks should return deterministic results: |
| 80 | + |
| 81 | +- `PASS`: all todo states and transitions satisfy rules |
| 82 | +- `FAIL`: violations detected; include violation code(s), affected todo id(s), and remediation hints |
| 83 | + |
| 84 | +Reference violation codes: |
| 85 | + |
| 86 | +- `unknown_todo_state` |
| 87 | +- `multiple_in_progress_items` |
| 88 | +- `invalid_transition` |
| 89 | +- `missing_bypass_metadata` |
| 90 | +- `incomplete_todo_set` |
| 91 | + |
| 92 | +## Integration targets |
| 93 | + |
| 94 | +- Task 15.2 should implement enforcement engine checks for this model |
| 95 | +- Task 15.3 should expose `/todo status` and `/todo enforce` diagnostics with machine-readable outputs |
| 96 | +- Task 15.4 should validate normal, bypass, and failure paths with docs/examples |
0 commit comments