Repository navigation
tracking: ADR-022 Polonius origin/region variables — implementation M1–M4 (lib/borrow_polonius/) #553
Description
Why this issue exists
ADR-022 (docs/decisions/0022-polonius-origin-variables.adoc, merged via PR #407, 2026-05-27) is the declared residual behind the CORE-01 closure (#177 / PR #473) — yet as of 2026-06-11 it had no open tracking issue, lib/borrow_polonius/ does not exist on main, and the M1 sketch existed only as a local unpushed branch. This issue is the tracking record.
Current state
- Ratification vs doc status: PR docs(adr): ADR-022 — origin variables + Polonius-style loan solver (Refs #177) — surgical refile of #398 #407's thread records owner ratification of the architectural bundle (2026-05-27: custom OCaml datalog solver in
lib/borrow_polonius/, surface syntax elided for v1, M1–M4 gates) — but the ADR'sStatus::field still readsProposed(0022:9; also META.a2ml). Flip the field or note the ratification inline. - Implementation: 0%. No origin/region-variable machinery anywhere in
lib/(ast.ml:60-62TyRef/TyMutare bare constructors). - M1 sketch: now preserved at branch
core-01/polonius-m1-sketch(b28757c, "M1 of ADR-022 — origin_var option on TyRef/TyMut + b_origin") — pushed 2026-06-11 from the previously-local-only branch noted in SESSION-HANDOFF-2026-05-27.adoc:24-26.
Scope (from ADR-022)
- M1 —
origin_var optiononTyRef/TyMut, behaviour-neutral. - M2 — fresh origins at borrow sites.
- M3 — subset constraints + datalog-style loan-live-at-point solver, parallel-run diff against the lexical checker (lexical checker is the merge oracle through M3).
- M4 — cutover; deletes ~30–40% of
lib/borrow.mlincludingstate.moved/ref_bindings/callee_owned_params/merge_arm_results.
Why this is soundness, not precision
ADR-022's own context section concedes the lexical checker cannot reason about cross-function borrows (callee_owned_params is a name-set heuristic, "not a constraint discharge") and loop soundness is a 2-iteration heuristic. A probe-verified false negative now demonstrates the gap is live — see the companion soundness issue (filed same day). The ADR's "residual = precision" framing should be corrected to "residual = soundness".
Related
- Proof: borrow-graph soundness (no use-after-move + no conflict + BorrowOutlivesOwner) #515 (borrow-graph soundness proof) explicitly defers Polonius — that proof formalises the lexical checker, not this.
lib/borrow.ml:1756-1768"Still deferred" trailer (includes the quantity-checker integration note for captured linears).
Filed from the 2026-06-11 whole-picture survey.
Activity
security: standardize secret scanning on TruffleHog (+ ADR-023 draft …
docs: truth-refresh after CORE-01 closure + 2026-06-11 survey — matri…
docs: truth-refresh after CORE-01 closure + 2026-06-11 survey — matri…
docs: truth-refresh after CORE-01 closure + 2026-06-11 survey (matrix…
fix(borrow): close #554 residuals (a) interprocedural + (c) reassign-…
fix(borrow): close #554 use-after-move through a callee-returned borrow
fix(borrow): close #554 residuals (a) interprocedural + (c) reassign-…
fix(borrow): round-3 hardening — ref-count Slice-B reassign + union r…
fix(borrow): close #554 use-after-move through a callee-returned borrow
fix(borrow): close #554 residuals (a) interprocedural + (c) reassign-…
fix(borrow): round-3 hardening — ref-count Slice-B reassign + union r…
fix(borrow): close #554 use-after-move through a callee-returned borr…
docs: make soundness status a single, test-anchored source of truth (#…
feat(formal): mechanize the four Wave-0 siblings (P-2, P-3, F-3, F-4) (…
feat(formal): grow P-3 to a real borrow graph (loan edges + move-loca…
Harden the soundness-ledger gate: content-binding, stamp-enforcement,…