100%

Walking skeleton — minimal ORI_TRACE_IDX DAG

Goal

A single ORI_TRACE_IDX=<n> knob emits a minimal provenance DAG (structure edges only) for one type-pool Idx, wired end-to-end through oric, verified on the BUG-04-234 Wrap<Wrap<int>> fixture. This is the walking skeleton — prove the pipe before layering mono/resolution/consumer edges.

Implementation Sketch

The type-pool Idx is stable + session-singleton + threaded by &Pool through typeck->canon->arc->repr->llvm (types.md PC-4), so tracing needs NO new recording. Reuse Pool::format_type_with_idx (compiler/ori_types/src/pool/format/mod.rs). The DAG walk is read-only: depth-bounded, cycle-guarded, never mutates the pool or compilation.

Spec / Rule References

.claude/rules/types.md TY-1/TY-6/PC-4 (stable Idx); .claude/rules/tooling-first.md §4 (permanent diagnostic surface); compiler/oric/src/debug_flags.rs (flag SSOT); 500-line file limit (compiler crates).

Test Strategy

Walking-skeleton pin asserts a non-empty structure DAG rooted at the outer Wrap<Wrap<int>> Idx. Ground truth from the already-shipped ORI_DUMP_TYPE_IDX: #230{inner: Wrap#217{inner: T#141}}.

Work Items

  • Add the ORI_TRACE_IDX flag (value = target Idx raw u32) to the flag SSOT compiler/oric/src/debug_flags.rs via the flags! macro, with a doc comment; parse the value where the tracer dispatches.
  • Add a read-only ProvenanceDag skeleton in ori_types that walks the session Pool from a root Idx collecting STRUCTURE edges only (struct_fields/enum_variants/resolve_fully), reusing the existing Pool::format_type_with_idx renderer; depth-bounded + cycle-guarded.
  • Wire compiler/oric/src/commands/mod.rs to emit the DAG to stderr when ORI_TRACE_IDX is set, after typeck, using the session Pool (read-only; never mutates compilation).
  • Walking-skeleton regression pin: on the Wrap<Wrap<int>> fixture, assert the tracer emits a non-empty structure DAG rooted at the outer body Idx (verified via ORI_DUMP_TYPE_IDX ground truth: #230{inner: Wrap#217{inner: T#141}}).

Fresh intel (regenerated)

{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “idx-provenance-diagnostic/s-e4d6264c” }, “generated_at”: “2026-06-28T02:10:11.990506+00:00”, “graph_state”: { “head_sha”: “8340d7a0”, “last_code_import_at”: “2026-06-28T02:06:41.01Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:idx-provenance-diagnostic/s-e4d6264c] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “constrained_symbols”: [ “resolve_fully”, “resolve_fully_guarded”, “resolve” ], “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/idx-provenance-diagnostic” } } }

(full dossier: walking-skeleton—s-e4d6264c.intel.json)