You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
P-022 step 4: port own-analysis (worklist solver + ownership/lifetime/effect/DI) with layered diagnostic parity #214
Agent brief — tier: strong. One PR (Closes #<this>); branch from main. House rules: AGENTS.md.
Goal
Step 4 of the P-022 strangler-fig migration, next after the merged own-cfg (#197/#203): the analysis heart. Port the generic worklist solver and the four analyses (ownership → then lifetime → effect → DI) to rust/crates/own-analysis, plus the minimal own-diagnosticstypes crate it constructs into. Python stays the reference; a divergence is a Rust bug until separately proven otherwise.
Sources of truth
docs/proposals/P-022-rust-core-migration.md — crate DAG (the load-bearing edges: own-analysis → own-diagnostics; own-diagnostics depends ONLY on the own-ir span leaf, never the parser or the solver), the idioms table (bitset lattice over {OWNED,MOVED,RELEASED,ESCAPED}, dense Vec by RID, RPO worklist scheduling, exhaustive match), and the migration order in §strategy step 4: diff diagnostics (line, code) first → then evidence → then SARIF, layer by layer.
ownlang/analysis.py, ownlang/ownership.py, ownlang/lifetimes.py, ownlang/effects.py, ownlang/di.py, ownlang/buffers.py — the reference implementations.
spec/Inference.md (MOS S/R/F/A/M-rules) and spec/OwnCore.md, spec/Diagnostics.md — normative behaviour.
The feat: P-022 step 3 — port own-cfg (AST → CFG lowering) with exact CFG-JSON parity #203 parity pattern: tests/test_cfg_fixtures.py + tests/fixtures/cfg_parity.json + own-cfg/tests/parity.rs — extend the same fixture-freezing approach to the diagnostics layer (Python emits the golden (path, line, code) sets over corpus/ + examples/ + tests/fixtures/ + curated cases; Rust replays and must match exactly, incl. intra-tie ordering).
Deliverable
rust/crates/own-diagnostics (Diagnostic/Evidence data types only — presentation/SARIF is step 5, out of scope).
rust/crates/own-analysis: Lattice/Analysis traits + one generic worklist solver + the four analyses as independent impls (the de-noodling of Python's interleaved _Analyzer).
No behaviour changes; exact parity on (line, code) per input — evidence-slice and SARIF parity are later steps, do not fake them now.
Cargo edge test (cargo metadata) asserting the allowed DAG edges from P-022 §fitness (diagnostics never depends on analysis; codegen untouched).
Workspace lints stand (unsafe_code = "forbid", the pre-resolved indexing_slicing allowance for arena/newtype access only).
Correctness first: no perf micro-опт before parity is green; the P-022 perf doctrine (bitset, RPO, FxHashMap) is the starting shape, not an optimization pass.
If a Python behaviour looks like a bug mid-port — do NOT fix it in Rust; note it in the PR and keep parity (a deliberate divergence is a separate, Python-first change).
Done when
Full-corpus diagnostics parity green in CI (rust job + the new fixture check in run_tests.py), cargo fmt/clippy/test clean, DAG edge test in place, Python side untouched except the parity-fixture generator.
Activity
feat(rust): own-analysis crate — generic monotone-lattice worklist so…
feat(rust): port ownership analysis with exact (line,code) parity (#214…
fix(rust): address checkpoint-2 review — lattice contract, schedules,…
fix(rust): represent lattice bottom explicitly, separate from a concr…
harden(rust): fail loud if a reachable block stays at lattice bottom (#…
feat(rust): checkpoint 3a — lifetime + buffer policy → full .own corp…
feat(rust): checkpoint 3b — port effect (EFF001) + DI (DI001-005) ana…
fix(rust): effect/DI verdict path+line anchors + Python-authored fact…
fix(own-analysis): match Python last-wins for duplicate DI site records
Merge pull request #298 from PhysShell/claude/own251-p022-reconcile
test(ownir): close the effects channel with a composition witness
feat(verdicts): compose the fact-driven channels, and stop at the wal…
test(analysis): freeze routing identity, the prerequisite cp4 turned …