# Task Todo - [x] Review the current project instructions and check for task-relevant lessons. - [x] Check repository status before writing the implementation plan. - [x] Inspect existing engine, CLI, docs, and frontend event handling for disposal-tracking impact. - [x] Write the design spec for webhook case management in an isolated worktree. - [x] Confirm the design with the user before implementation. ## Design Review - Spec path: `docs/superpowers/specs/2026-06-09-webhook-case-management-design.md` - Scope fixed to local case management plus outbound and inbound webhook integration. - Confirmed behaviors: - manual handling and external callback handling are both supported - cases are created from `time_alarm`, `batch_pending_disposal`, and `warning_escalated` - both batch-event webhooks and case-state webhooks are required - callback `status` is exactly `handled` - callback-applied case handling must emit a `case_event` webhook ## 2026-06-09 Implementation Plan - [x] Create isolated worktree for implementation on branch `feat/webhook-case-management`. - [x] Re-check runtime baseline in the worktree and note the local Python environment requirement. - [x] Write the detailed implementation plan to `docs/superpowers/plans/2026-06-09-webhook-case-management-implementation.md`. - [x] Execute backend case-state TDD cycle. - [x] Execute webhook integration TDD cycle. - [x] Execute management API TDD cycle. - [x] Execute frontend case-management TDD cycle. - [x] Run full verification and record outcomes. ## 2026-06-09 Implementation Review - Worktree path: `/Users/glo/.config/superpowers/worktrees/cold_display_guard/webhook-case-management` - Baseline note: the default `python3` in this shell resolves to macOS system Python 3.9 and cannot import the repo's `dataclass(..., slots=True)` code. Python verification in this worktree must run through `eval "$(/opt/homebrew/bin/pyenv init -)" && python ...`, which resolves to Python 3.12.11. - Frontend baseline check in the worktree passed with `node --test web/test/zone-state.test.js`. - Implemented: - `src/cold_display_guard/cases.py` for case lifecycle and JSONL persistence - `src/cold_display_guard/webhooks.py` for outbound event/case webhook delivery and audit logging - runtime integration in `src/cold_display_guard/main.py` - case listing/summary/manual-handle/callback routes in `src/cold_display_guard/manage_api.py` - frontend case summary and manual-handle flow in `web/src/main.js` and `web/src/zone-state.js` - Targeted verification passed during implementation: - `eval "$(/opt/homebrew/bin/pyenv init -)" && PYTHONPATH=src python -m unittest tests/test_cases.py -v` - `eval "$(/opt/homebrew/bin/pyenv init -)" && PYTHONPATH=src python -m unittest tests/test_webhooks.py -v` - `eval "$(/opt/homebrew/bin/pyenv init -)" && PYTHONPATH=src python -m unittest tests/test_main.py -v` - `eval "$(/opt/homebrew/bin/pyenv init -)" && PYTHONPATH=src python -m unittest tests/test_manage_api.py -v` - `node --test web/test/zone-state.test.js` - Final verification passed: - `eval "$(/opt/homebrew/bin/pyenv init -)" && PYTHONPATH=src python -m unittest discover -s tests -v` - `cd web && pnpm build` - Frontend build note: the isolated worktree needed `cd web && pnpm install --frozen-lockfile` before `pnpm build` because `node_modules` are not shared into new worktrees.