Skip to content

Commit 788d55c

Browse files
committed
Stage 4
1 parent e73e4ac commit 788d55c

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

codetracer-python-recorder/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
99
- Balanced call-stack handling for generators, coroutines, and unwinding frames by subscribing to `PY_YIELD`, `PY_UNWIND`, `PY_RESUME`, and `PY_THROW`, mapping resume/throw events to `TraceWriter::register_call`, yield/unwind to `register_return`, and capturing `PY_THROW` arguments as `exception` using the existing value encoder. Added Python + Rust integration tests that drive `.send()`/`.throw()` on coroutines and generators to guarantee the trace stays balanced and that exception payloads are recorded.
1010

1111
### Changed
12-
- Module-level call events now use the actual dotted module name (e.g., `<my_pkg.mod>` or `<boto3.session>`) instead of the generic `<module>` label. `RuntimeTracer` derives the name via the shared module-identity helper, caches the result per code object, and falls back to `<module>` only for synthetic or nameless frames. Added Rust + Python tests plus README documentation covering the new semantics.
12+
- Module-level call events now prefer the frame's `__name__`, fall back to filter hints, `sys.path`, and package markers, and no longer depend on the legacy resolver/cache. This keeps `<__main__>` for direct scripts while package imports continue to emit `<pkg.mod>`. Updated Rust + Python tests and documentation to describe the new semantics and opt-in flag.
1313

1414
## [0.2.0] - 2025-10-17
1515
### Added

codetracer-python-recorder/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ action = "drop"
8484

8585
## Trace naming semantics
8686

87-
- Module-level activations no longer appear as the ambiguous `<module>` label. When the recorder sees `co_qualname == "<module>"`, it derives the actual dotted package name (e.g., `<my_pkg.mod>` or `<boto3.session>`) using project roots, `sys.modules`, and frame metadata.
87+
- Module-level activations no longer appear as the ambiguous `<module>` label. When the recorder sees `co_qualname == "<module>"`, it first reuses the frame's `__name__`, then falls back to trace-filter hints, `sys.path` roots, and package markers so scripts report `<__main__>` while real modules keep their dotted names (e.g., `<my_pkg.mod>` or `<boto3.session>`).
8888
- The angle-bracket convention remains for module entries so downstream tooling can distinguish top-level activations at a glance.
8989
- Traces will still emit `<module>` for synthetic filenames (`<stdin>`, `<string>`), frozen/importlib bootstrap frames, or exotic loaders that omit filenames entirely. This preserves previous behaviour when no reliable name exists.
9090

design-docs/adr/0016-module-name-resolution-via-globals-name.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ADR 0016 – Module Name Resolution via `__name__`
22

3-
- **Status:** Proposed
3+
- **Status:** Accepted
44
- **Date:** 2025-03-18
55
- **Stakeholders:** Runtime team, Trace Filter maintainers
66
- **Related Decisions:** ADR 0013 (Reliable Module Name Derivation), ADR 0014 (Module Call Event Naming)
@@ -46,4 +46,3 @@ Key points:
4646

4747
- Update existing ADR 0013/0014 statuses once this ADR is accepted and the code lands.
4848
- Communicate the behavioural change to downstream teams who consume `<module>` events or rely on path-derived module names.
49-

design-docs/module-name-resolution-globals-implementation-plan.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ This plan delivers ADR 0016 by retooling module-name derivation around `frame.f_
3737
- Remove the `ModuleNameHints` plumbing and any resolver invocations.
3838
- Update the Python integration test `test_module_imports_record_package_names` to expect `<my_pkg.mod>` coming directly from `__name__`.
3939

40-
### Stage 4 – Remove Legacy Resolver Module
41-
- Delete `src/module_identity.rs` and tidy references (Cargo module list, tests, exports).
42-
- Drop resolver-specific tests and replace them with focused coverage around globals-based extraction.
43-
- Update documentation and changelog to describe the new semantics. Reference ADR 0016 and mark ADR 0013 as superseded where appropriate.
40+
### Stage 4 – Documentation and Changelog
41+
- Update design docs, ADR status, and changelog entries to describe the new globals-based module naming.
42+
- Ensure the developer guide explains how `__name__` hints interplay with filter selectors and `<__main__>` behaviour.
43+
- Document the phase-out of the resolver to guide downstream integrators.
4444

4545
### Stage 5 – Flip the Feature Flag
4646
- After validating in CI and canary environments, change the default for `module_name_from_globals` to `true`.
@@ -61,4 +61,3 @@ This plan delivers ADR 0016 by retooling module-name derivation around `frame.f_
6161
- ADR 0016 updated to “Accepted” once the feature flag defaults to on.
6262
- Release notes highlight the new module-naming semantics and the opt-out flag during transition.
6363
- Telemetry or logging confirms we do not hit the fallback path excessively in real workloads.
64-

design-docs/module-name-resolution-globals-implementation-plan.status.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@
3131
### Stage 3 – Runtime Naming Downstream
3232
- **Status:** Completed
3333
`RuntimeTracer` no longer depends on `ModuleIdentityCache`; it prefers globals hints, otherwise reuses filter resolutions, `sys.path` roots, or package markers before falling back to `<module>`. The shared helpers in `module_identity.rs` were slimmed down accordingly, and updated unit/integration tests confirm the new flow.
34+
35+
### Stage 4 – Documentation and Changelog
36+
- **Status:** Completed
37+
Updated `codetracer-python-recorder/CHANGELOG.md` and README to describe globals-first module naming, refreshed ADR 0016 to Accepted, and revised the implementation plan to cover the documentation rollout so downstream teams understand the new semantics and feature flag.

0 commit comments

Comments
 (0)