@@ -124,8 +124,8 @@ This task list tracks implementation status for the integrity protocol.
124124### 8.1-8.2 At-Risk Styling
125125- [x] DataPanel has INTEGRITY, CLEANUP, ATRISK_WORKFLOW modes
126126- [x] Rendering methods for each new mode
127- - [ ] At-risk commitment shows warning color in lists (deferred )
128- - [ ] Notification task shows distinct icon (deferred )
127+ - [x ] At-risk commitment shows warning color in lists (CSS class ` .status-at_risk ` )
128+ - [x ] Notification task shows distinct icon (🔔 )
129129
130130## Phase 9: Integration Tests
131131- [x] Integration tests for integrity dashboard flows
@@ -134,19 +134,20 @@ This task list tracks implementation status for the integrity protocol.
134134- [x] Integration tests for ChatScreen integrity features
135135- [x] Integration tests for HomeScreen integrity features
136136
137- ## Phase 10: Snapshot Tests (Deferred)
138- - [ ] Snapshot: Integrity dashboard
139- - [ ] Snapshot: Commitment list with at_risk items
140- - [ ] Snapshot: CleanupPlan view
137+ ## Phase 10: Snapshot Tests
138+ - [x ] Snapshot: Integrity dashboard (A- and C- grade scenarios)
139+ - [x ] Snapshot: Commitment list with at_risk items
140+ - [x ] Snapshot: CleanupPlan view
141141
142142## Summary
143143
144144** Implemented** :
145- - Core models (CommitmentStatus.AT_RISK, CleanupPlan, IntegrityMetrics)
146- - IntegrityService (mark_at_risk, calculate_metrics, detect_risks)
147- - Commands (/atrisk, /cleanup, /integrity)
148- - TUI integration (HomeScreen grade, ChatScreen risk detection, DataPanel modes)
149- - Full test coverage
145+ - Core models (CommitmentStatus.AT_RISK, CleanupPlan, IntegrityMetrics with TrendDirection)
146+ - IntegrityService (mark_at_risk, calculate_metrics, detect_risks, recover_commitment, get_affecting_commitments, calculate_metrics_with_trends)
147+ - Commands (/atrisk, /cleanup, /integrity, /abandon, /recover)
148+ - TUI integration (HomeScreen grade, ChatScreen risk detection, DataPanel modes with trends and affecting commitments)
149+ - Full test coverage including snapshot tests
150+ - Visual indicators for at-risk status and notification tasks
150151
151152## Running Tests
152153
@@ -217,89 +218,75 @@ The following items are deferred to future iterations. Each is tracked here with
217218- [x] If mark at-risk, user can type 'atrisk' to redirect to /atrisk flow
218219- [x] Tests added to verify prompt behavior
219220
220- ### D5: Visual Indicators for At-Risk Status
221- ** Current** : No visual distinction in lists
222- ** Target** : Warning color for at-risk commitments, distinct icon for notification tasks
221+ ### D5: Visual Indicators for At-Risk Status ✅ COMPLETED
222+ ** Status** : Already implemented in DataPanel
223223
224224** Implementation** :
225- - [ ] Add CSS class ` .commitment-at-risk ` with warning color (yellow/orange)
226- - [ ] Update commitment list rendering to apply class based on status
227- - [ ] Add notification task icon (e.g., 📢 or ⚠️) in task list
228- - [ ] Sort commitment lists: overdue > at_risk > pending > in_progress
225+ - [x] CSS class ` .status-at_risk ` with warning color (yellow/bold) in ` DataPanel.DEFAULT_CSS `
226+ - [x] CSS class ` .notification-task ` with warning color for notification tasks
227+ - [x] Status icons including ⚠ for at-risk and 🔔 for notification tasks in ` _render_list_item() `
228+ - [x] ` _sort_items_by_priority() ` sorts: at_risk > in_progress > pending > completed > abandoned
229229
230- ** Effort** : Small (1-2 hours)
231- ** Priority** : Low - Polish/UX improvement
232-
233- ### D6: Metric Trends
234- ** Current** : Not implemented
235- ** Target** : Show improving/stable/declining indicators for each metric
230+ ### D6: Metric Trends ✅ COMPLETED
231+ ** Status** : Implemented in ` IntegrityService ` and ` DataPanel `
236232
237233** Implementation** :
238- - [ ] Store previous period metrics (could use session cache or simple comparison)
239- - [ ] Calculate delta for each metric vs previous period
240- - [ ] Add trend indicator to IntegrityMetrics dataclass
241- - [ ] Display ↑/→/↓ in integrity dashboard
242-
243- ** Effort ** : Medium (2-3 hours )
244- ** Priority ** : Low - Nice-to-have analytics
245-
246- ### D7: Commitments Affecting Score
247- ** Current ** : Not implemented
248- ** Target ** : List recent commitments that negatively impacted score
234+ - [x] Added ` TrendDirection ` enum (UP, DOWN, STABLE) to ` IntegrityMetrics `
235+ - [x] Added trend fields to ` IntegrityMetrics ` : on_time_trend, notification_trend, cleanup_trend, overall_trend
236+ - [x] Implemented ` calculate_integrity_metrics_with_trends() ` method
237+ - [x] Added ` _calculate_period_on_time_rate() ` , ` _calculate_period_cleanup_rate() ` , ` _calculate_period_notification_timeliness() ` for period-based calculations
238+ - [x] Added ` _determine_trend() ` helper with 5% threshold
239+ - [x] Updated ` DataPanel._render_integrity() ` to display trend indicators (↑/→/↓ )
240+ - [x] Added 8 unit tests in ` tests/unit/integrity/test_service.py `
241+ - [x] Added 7 unit tests in ` tests/unit/models/test_integrity_metrics.py `
242+
243+ ### D7: Commitments Affecting Score ✅ COMPLETED
244+ ** Status ** : Implemented in ` IntegrityService ` and ` DataPanel `
249245
250246** Implementation** :
251- - [ ] Query commitments where: completed_on_time=False OR status=abandoned
252- - [ ] Filter to recent (last 30 days)
253- - [ ] Include in integrity dashboard response
254- - [ ] Render as list in DataPanel integrity mode
255-
256- ** Effort** : Small (1-2 hours)
257- ** Priority** : Low - Helps user understand score
247+ - [x] Added ` AffectingCommitment ` dataclass with commitment and reason fields
248+ - [x] Implemented ` get_affecting_commitments() ` method in ` IntegrityService `
249+ - [x] Query late completions (completed_on_time=False) from last 30 days
250+ - [x] Query abandoned commitments from last 30 days
251+ - [x] Limit to 5 most recent affecting commitments
252+ - [x] Updated ` IntegrityHandler._show_dashboard() ` to include affecting commitments
253+ - [x] Added ` _render_affecting_commitments() ` method to DataPanel
254+ - [x] Added 6 unit tests in ` tests/unit/integrity/test_service.py `
258255
259- ### D8: Recovery Flow (at_risk → in_progress)
260- ** Current** : No handling when commitment recovers from at_risk
261- ** Target** : Cancel CleanupPlan and prompt about notification task when recovering
256+ ### D8: Recovery Flow (at_risk → in_progress) ✅ COMPLETED
257+ ** Status** : Implemented in ` IntegrityService ` and ` RecoverHandler `
262258
263259** Implementation** :
264- - [ ] Add /recover command or status change handler
265- - [ ] When commitment status changes at_risk → in_progress:
266- - Set CleanupPlan.status = CANCELLED
267- - Prompt user: "Do you still need to notify [ stakeholder] , or has the situation resolved?"
268- - If resolved: Mark notification task as skipped with reason "Situation resolved"
269- - If still need to notify: Keep task active
270- - [ ] Update IntegrityService with recover_commitment() method
271- - [ ] Add tests for recovery flow
272-
273- ** Effort** : Medium (2-3 hours)
274- ** Priority** : Medium - Completes the at-risk lifecycle
275-
276- ### D9: Snapshot Tests
277- ** Current** : No snapshot tests for integrity views
278- ** Target** : Visual regression tests for integrity UI
260+ - [x] Added ` /recover ` command to parser
261+ - [x] Created ` RecoverHandler ` class in handlers.py
262+ - [x] Implemented ` recover_commitment() ` method in ` IntegrityService `
263+ - [x] Sets CleanupPlan.status = CANCELLED on recovery
264+ - [x] Prompts about notification task if still pending
265+ - [x] ` /recover resolved ` skips notification task with reason "Situation resolved"
266+ - [x] Added 9 unit tests for recover_commitment() in ` tests/unit/integrity/test_service.py `
267+ - [x] Added 7 unit tests for RecoverHandler in ` tests/unit/commands/test_handlers.py `
268+
269+ ### D9: Snapshot Tests ✅ COMPLETED
270+ ** Status** : Snapshot tests exist in ` tests/tui/test_snapshots.py `
279271
280272** Implementation** :
281- - [ ] Create snapshot app for integrity dashboard (A+ grade scenario)
282- - [ ] Create snapshot app for integrity dashboard (C- grade scenario)
283- - [ ] Create snapshot for commitment list with at_risk items
284- - [ ] Create snapshot for CleanupPlan view
285- - [ ] Run ` uv run pytest --snapshot-update ` to generate baselines
286-
287- ** Effort** : Small (1-2 hours)
288- ** Priority** : Low - Testing infrastructure
273+ - [x] ` integrity_dashboard_app.py ` - A- grade scenario
274+ - [x] ` integrity_dashboard_low_app.py ` - C- grade scenario
275+ - [x] ` commitment_list_atrisk_app.py ` - Commitment list with at-risk items
276+ - [x] ` cleanup_plan_app.py ` - CleanupPlan view
277+ - [x] All 13 snapshot tests passing
289278
290279---
291280
292281### Deferred Work Priority Order
293282
294- ** Completed** :
283+ ** All Completed** :
2952841 . ✅ ** D1: Notification Timeliness** - Implemented
2962852 . ✅ ** D2: Reliability Streak** - Implemented
2972863 . ✅ ** D3: Soft Enforcement** - Implemented
2982874 . ✅ ** D4: Pre-Abandon Prompt** - Implemented
299-
300- ** Remaining** :
301- 1 . ** D8: Recovery Flow** - Medium, completes at-risk lifecycle
302- 2 . ** D5: Visual Indicators** - Low, polish
303- 3 . ** D6: Metric Trends** - Low, analytics
304- 4 . ** D7: Affecting Commitments** - Low, debugging aid
305- 5 . ** D9: Snapshot Tests** - Low, infrastructure
288+ 5 . ✅ ** D5: Visual Indicators** - Implemented (was already done)
289+ 6 . ✅ ** D6: Metric Trends** - Implemented
290+ 7 . ✅ ** D7: Affecting Commitments** - Implemented
291+ 8 . ✅ ** D8: Recovery Flow** - Implemented (was already done)
292+ 9 . ✅ ** D9: Snapshot Tests** - Implemented (were already done)
0 commit comments