57%

Section 03: Traceable trait-method AOT emitters (ROOT A)

Goal

Close the explicitly-documented ‘no LLVM coverage yet’ surface: Traceable has_trace (140) / trace_entries (92) / trace (26). The registry marks these backend_required:false with stub arms (builtins/mod.rs:296,301). Add real AOT emitters matching interpreter trace semantics.

Implementation Sketch

Add the trait-method AOT emitters in arc_emitter/builtins/ (a traceable family module if warranted by size). The trace machinery (TraceEntry, has_trace/trace_entries/trace) interop with ori_rt; ensure the runtime entry points exist (3-sync-point pattern if a new ori_rt fn is needed). Dual-exec parity vs the interpreter trace output is the gate. Stay out of arc.md §STOP.

Spec References

ori_registry/src/defs/error/ (Traceable, backend_required:false doc); arc_emitter/builtins/mod.rs:296,301 (current stubs); runtime.md (ori_rt entry points); layer-coverage.md §3.1.

Work Items

  • TDD-first: author failing AOT spec tests for has_trace/trace_entries/trace on the production path; confirm each emits ‘missing mono instance?’ pre-fix.
  • Implement the AOT emitters for has_trace/trace_entries/trace (+ any ori_rt entry points via the 3-sync-point pattern); interp==LLVM trace-output parity; zero leaks; flip backend_required:true.
  • Layer-matrix closure (L1-L12); the three Traceable signatures absent from the test-all mono grep; debug+release; dual-exec; leak.

Items

  • TDD-first: run the mono-grep with ORI_LOG=ori_llvm::mono=debug on tests/spec/traits/traceable/{error_trace,result_delegation,no_trace}.ori to confirm WHICH receiver shape is actually unresolved. Author the failing AOT spec/parity pins separating the two pre-fix failure shapes: (a) a PARITY MISMATCH on the Error-struct path (mod.rs:296-302 stub returns false/empty vs eval’s real trace), and (b) a MONO-MISS on the Result/Option Traceable-delegation path (eval methods/variants.rs dispatch_result_method forwards has_trace/trace_entries/trace to the inner Error; AOT has no arm). Pin each against the eval-side semantics (dispatch_error_method + dispatch_result_method) so the gate is interp==LLVM parity, not stub-shape.
  • After the trace-data-parity decision is recorded, implement the AOT arm for the receiver shape the decision scopes in: minimally the Result/Option Traceable-delegation path (the genuine mono-miss; mirror eval methods/variants.rs forwarding to the inner Error) plus, per the decision, either a parity-correct Error-struct emitter (requires AOT ?-hop trace storage + TraceEntryData<->TraceEntry marshalling matching ori_patterns ErrorValue + eval trace_entry_to_struct) OR a documented traceless-AOT scoping. Add any ori_rt entry points via the 3-sync-point pattern (mirror the landed §02 emit_char_is_alpha exemplar). Gate on interp==LLVM trace-output parity (dual-exec-verify.sh tests/spec/traits/traceable/); if trace_entries allocates a [TraceEntry] list, clear the leak gate (L10) under the burden-sole stream ONLY (ORI_DISABLE_PREDICATE_STACK_RC=1 per arc.md §STOP — a default-path RC count is FALSE-GREEN). Flip the now-covered registry methods (ori_registry defs/error/mod.rs ERROR_METHODS) to backend_required:true, scoped to exactly what the emitter covers — do NOT blanket-flip methods left N/A by the decision.
  • Layer-matrix closure (layer-coverage.md §1): for each method/receiver shape the emitter covers, record L1-L12 as COVERED or explicit N/A: per the trace-data-parity decision. Backend dimension MANDATORY for this compiler-scope work: L9 dual-exec parity AND L10 leak-freedom over tests/spec/traits/traceable/ (debug+release; L10 burden-sole only per arc.md §STOP). §03’s verified deliverable is the FOCUSED dual-exec spec-test parity, NOT a per-section ./test-all.sh run — the whole-corpus mono-grep (mono signatures == 0) is the plan-wide gate measured at §07 (s-50bfe700). Do NOT re-run test-all to close §03; cite §07 for the corpus-wide mono-zero. Pull the criteria-amendment concern (focused per-method parity vs whole test-all) into scope per the §02 precedent if it blocks close.
  • BEFORE any emitter is written: resolve and RECORD the trace-data-parity architectural decision in a decisions/ artifact (per routing.md §6 + STRUCT-04 decision-in-implementation). The decision: does AOT (a) build ?-hop trace injection + Error trace storage to MATCH eval (faithful parity), or (b) declare the trace-DATA surface AOT-N/A and split the spec corpus into traceless-AOT-covered (no_trace.ori, result_delegation traceless) vs trace-data tests gated on eval only, with error_trace.ori’s has_trace()==true / trace_entries().len()==1 post-? assertions explicitly scoped? Ground the decision in: AOT has no inject_trace_entry/push_trace twin (verified: grep ori_llvm/src returns only panic_trampoline.rs); the stub at mod.rs:296-302 returns parity-honest-but-eval-divergent defaults. This decision scopes both w-8b95c967 (what to emit) and w-096df283 (what is L-covered vs N/A) and is a prerequisite for both.

Fresh intel (regenerated)

{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “aot-mono-stdlib-completeness/s-03ba3e73” }, “generated_at”: “2026-06-24T17:41:33.107417+00:00”, “graph_state”: { “head_sha”: “f9d92587”, “last_code_import_at”: “2026-06-24T17:38:07.097Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:aot-mono-stdlib-completeness/s-03ba3e73] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/aot-mono-stdlib-completeness” } } }

(full dossier: traceable-trait-aot-emitters—s-03ba3e73.intel.json)