Skip to content

Commit e919e15

Browse files
committed
Milestone 5 - Step 0
codetracer-python-recorder/src/runtime/mod.rs: codetracer-python-recorder/src/runtime/tracer/events.rs: codetracer-python-recorder/src/runtime/tracer/filtering.rs: codetracer-python-recorder/src/runtime/tracer/io.rs: codetracer-python-recorder/src/runtime/tracer/lifecycle.rs: codetracer-python-recorder/src/runtime/tracer/mod.rs: design-docs/codetracer-architecture-refactor-implementation-plan.status.md: Signed-off-by: Tzanko Matev <[email protected]>
1 parent 156156a commit e919e15

File tree

7 files changed

+33
-2
lines changed

7 files changed

+33
-2
lines changed

codetracer-python-recorder/src/runtime/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub mod io_capture;
66
mod line_snapshots;
77
mod logging;
88
mod output_paths;
9+
pub mod tracer;
910
mod value_capture;
1011
mod value_encoder;
1112

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! Event handling pipeline for `RuntimeTracer`.
2+
3+
// Placeholder module; implementations will arrive during Milestone 5.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! Trace filter cache management for `RuntimeTracer`.
2+
3+
// Placeholder module; implementations will arrive during Milestone 5.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! IO capture coordination for `RuntimeTracer`.
2+
3+
// Placeholder module; implementations will arrive during Milestone 5.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! Lifecycle orchestration for `RuntimeTracer`.
2+
3+
// Placeholder module; implementations will arrive during Milestone 5.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Collaborators for the runtime tracer lifecycle, IO coordination, filtering, and event handling.
2+
3+
pub mod events;
4+
pub mod filtering;
5+
pub mod io;
6+
pub mod lifecycle;

design-docs/codetracer-architecture-refactor-implementation-plan.status.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@
7474
- ✅ Milestone 4 Step 5: documentation pass to close out the milestone and queue the next phase.
7575
- Summarised the refactor scope (status tracker + ADR 0011 update) and recorded the retrospective in `design-docs/codetracer-architecture-refactor-milestone-4-retrospective.md`.
7676
- 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`.
7782

7883

7984
### Planned Extraction Order (Milestone 4)
@@ -82,6 +87,13 @@
8287
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.
8388
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.
8489

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+
8597
### Planned Extraction Order (Milestone 2)
8698
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.
8799
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,6 +109,6 @@
97109
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).
98110

99111
## 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.
102114
3. Track stakeholder feedback and spin out follow-up issues if new risks surface.

0 commit comments

Comments
 (0)