|
74 | 74 | - ✅ Milestone 4 Step 5: documentation pass to close out the milestone and queue the next phase. |
75 | 75 | - Summarised the refactor scope (status tracker + ADR 0011 update) and recorded the retrospective in `design-docs/codetracer-architecture-refactor-milestone-4-retrospective.md`. |
76 | 76 | - Repository remains test-clean; next work items roll into Milestone 5 prep. |
| 77 | +- 🔄 Milestone 5 Kickoff: audited `runtime/mod.rs` to outline collaborator boundaries before extracting modules. |
| 78 | + - **Lifecycle management:** `RuntimeTracer::new`, `finish`, `finalise_writer`, `cleanup_partial_outputs`, `notify_failure`, `require_trace_or_fail`, activation teardown, and metadata writers. |
| 79 | + - **Event handling:** `Tracer` impl (`interest`, `on_py_start`, `on_line`, `on_py_return`) plus helpers (`ensure_function_id`, `mark_event`, `mark_failure`). |
| 80 | + - **Filter cache:** `scope_resolution`, `should_trace_code`, `FilterStats`, ignore tracking, and filter summary appenders. |
| 81 | + - **IO coordination:** `install_io_capture`, `flush_*`, `drain_io_chunks`, `record_io_chunk`, `build_io_metadata`, `teardown_io_capture`, and `io_flag_labels`. |
77 | 82 |
|
78 | 83 |
|
79 | 84 | ### Planned Extraction Order (Milestone 4) |
|
82 | 87 | 3. **Install plumbing:** Shift `install_tracer`, `flush_installed_tracer`, and `uninstall_tracer` into `monitoring::install`, ensuring tool acquisition, event mask negotiation, and disable-sentinel handling route through the new callback table. |
83 | 88 | 4. **Tests and verification:** Update unit tests (including panic-to-pyerr coverage) to point at the new modules, add table-driven tests for registration completeness, and run `just test` to confirm the refactor preserves behaviour. |
84 | 89 |
|
| 90 | +### Planned Extraction Order (Milestone 5) |
| 91 | +1. **Scaffold collaborators:** Introduce `runtime::tracer` with submodules for lifecycle, events, filtering, and IO; move `RuntimeTracer` into the new tree while keeping the public facade (`crate::runtime::RuntimeTracer`) stable. |
| 92 | +2. **IO coordinator migration:** Extract IO capture installation/flush/record logic into `runtime::tracer::io::IoCoordinator`, delegating from `RuntimeTracer` and covering payload metadata helpers. |
| 93 | +3. **Filter cache module:** Move scope resolution, ignore tracking, statistics, and metadata serialisation into `runtime::tracer::filtering`, exposing a collaborator that caches resolutions and records drops. |
| 94 | +4. **Lifecycle controller:** Relocate writer setup/teardown, policy checks, failure handling, activation gating, and metadata finalisation into `runtime::tracer::lifecycle`. |
| 95 | +5. **Event processor:** Shift `Tracer` trait implementation and per-event pipelines into `runtime::tracer::events`, wiring through the collaborators and updating unit/integration tests; run `just test` after the split. |
| 96 | + |
85 | 97 | ### Planned Extraction Order (Milestone 2) |
86 | 98 | 1. **Policy model split:** Move data structures (`OnRecorderError`, `IoCapturePolicy`, `RecorderPolicy`, `PolicyUpdate`, `PolicyPath`) and policy cell helpers (`policy_cell`, `policy_snapshot`, `apply_policy_update`) into `policy::model`. Expose minimal APIs for environment/FFI modules. |
87 | 99 | 2. **Policy environment parsing:** Relocate `configure_policy_from_env`, env variable constants, and helper parsers (`parse_bool`, `parse_capture_io`) into `policy::env`, depending on `policy::model` for mutations. |
|
97 | 109 | 5. **Tests:** After each move, update unit tests in `trace_filter` modules and dependent integration tests (`session/bootstrap.rs` tests, `runtime` tests). Targeted command: `just test` (covers Rust + Python suites). |
98 | 110 |
|
99 | 111 | ## Next Actions |
100 | | -1. Draft the Milestone 4 retrospective/ADR update and circulate for feedback. |
101 | | -2. Revisit the Milestone 5 runtime tracer plan with the monitoring split in mind; flag any prep tasks. |
| 112 | +1. Create the `runtime::tracer` scaffolding and re-export `RuntimeTracer` through the existing facade. |
| 113 | +2. Extract IO coordination into `runtime::tracer::io` and refresh tests to cover the delegate. |
102 | 114 | 3. Track stakeholder feedback and spin out follow-up issues if new risks surface. |
0 commit comments