swactor/CLAUDE/notes/progress.md
Developer 473999d1df feat: actor watching — local death notifications
Add watch/unwatch API to the actor system so actors can monitor each
other's liveness. When a watched actor dies (panic or stop), watchers
receive an ActorExited notification via on_actor_exit().

- ExitReason enum (Stopped, Panicked, NodeDown) and ActorExited struct
- ContextInner::watch()/unwatch() + Ctx typed wrappers
- ActorInterface::on_actor_exit() default method (system message fallback)
- WatchRegistry in worker with bidirectional tracking
- Death notification dispatch as phase 5b in tick_once
- Runtime-level watch for external callers
- 10 behavioral tests in tests/watch_api.rs
- Design documents for OS features in docs/os-design/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 07:25:27 +00:00

36 lines
1.9 KiB
Markdown

# Progress
## Completed
### Feature 1: Actor Watching (local only) — `docs/os-design/01-actor-watching.md`
- Added `ExitReason` enum (Stopped, Panicked, NodeDown) and `ActorExited` struct to `src/actor.rs`
- Extended `ContextInner` trait with `watch()`/`unwatch()` methods
- Added `Ctx::watch(target)` and `Ctx::unwatch(target)` typed API
- Added `on_actor_exit()` default method to `ActorInterface` trait
- Updated `AnyActor::handle_any` with system message fallback (tries `ActorExited` after `Incoming`)
- Implemented `WatchRegistry` in `src/worker.rs` (bidirectional HashMap tracking)
- Integrated death notification dispatch as phase 5b in `tick_once`
- Implemented `watch`/`unwatch` on `Runtime`'s `ContextInner` impl
- Added `watch_registry` field to `TickContext` in `src/delivery.rs`
- 10 behavioral tests in `tests/watch_api.rs` — all passing
- All 53 tests pass (42 existing + 10 new + 1 doctest)
- All 134 distribution crate tests pass
## Next Steps
1. **Command Interface** — `docs/os-design/04-command-interface.md`
- Create `crates/command/` crate with `CommandHandler` trait, `CommandRouter`, `CommandRequest`/`CommandResponse` types
- Extract existing `cmd_*` functions from `crates/runtime-dashboard/src/investigate.rs` into CommandHandler impls
- Add built-in read commands (help, overview, nodes, workers, actors)
- Add built-in write commands (spawn, stop, send, drain, shutdown)
- Write behavioral tests
2. **Cluster Registry** — `docs/os-design/02-cluster-registry.md`
3. **Node Capabilities** — `docs/os-design/03-node-capabilities.md`
4. **Remote Watching** — extends 01-actor-watching with wire protocol
5. **Supervision** — `docs/os-design/05-supervision.md`
## Open Questions
- Command Interface: Should custom actor commands (via `Ctx::register_command()`) be deferred to a later PR?
- Should the dashboard migration happen in the same PR as the command crate creation?
## Blockers
- None