Intelligence Reconnaissance
Queries run 2026-04-23 (Phase 2 research):
scripts/intel-query.sh --human file-symbols "registry/traits" --repo ori— inventoryTraitRegistrysurface. Result:lookup_method+lookup_method_checkedare the single entry points for trait-method lookup;impls_by_type: FxHashMap<Idx, Vec<ImplEntry>>is the keying structure.scripts/intel-query.sh --human callers "lookup_method_checked" --repo ori—infer/expr/calls/impl_lookup.rs:35is the sole caller from inference paths.scripts/intel-query.sh --human callers "lookup_method" --repo ori—infer/expr/operators.rs:708,759+registry/methods/mod.rs:36(thin wrapperlookup_trait_method).scripts/intel-query.sh --human similar "bound_chain_dispatch" --repo rust,swift --limit 5— Rust’sassemble_inherent_candidates_from_paramatprobe.rs:958scansself.param_env.caller_bounds()forClauseKind::Traitpredicates.scripts/intel-query.sh --human file-symbols "FunctionSig" --repo ori—FunctionSig.type_params: Vec<Name>,FunctionSig.type_param_bounds: Vec<Vec<Name>>,FunctionSig.scheme_var_ids: Vec<u32>— parallel arrays. Bounds are stored HERE, not inTraitRegistry.
Results summary [ori]:
- File-size baseline pre-§10.0 split:
registry/traits/mod.rs765 lines;method_call.rs524 lines (both overimpl-hygiene.md §File Organization500-line cap → §10.0 prerequisite). lookup_method_checkedkeys on receiverIdx;Tag::RigidVarIdx is never registered as an impl’sself_type, so dispatch misses on rigid-receiver bound-chain.- Bounds live on
FunctionSig.type_param_bounds: Vec<Vec<Name>>parallel totype_params: Vec<Name>/scheme_var_ids: Vec<u32>— three parallel arrays per the §FunctionSig query result above (NOT inTraitRegistry). - §10.1’s bound-chain walk consumes
FunctionSig+TraitRegistryjointly: retrieve current function’s sig viaengine.signatures(); scantype_param_bounds[idx_of_rigid_var]for trait names; callTraitRegistry::get_trait_by_namefor each; check that trait’scollected_methodsformethod_name. - §10.2 capability gap:
infer_with_capability(compiler_repo/compiler/ori_types/src/infer/expr/constructors.rs:178-201) binds provider type in env without trait-shape validation — §10.2.2 extends to surface registered trait methods of the capability + validate handler conformance.
Section 10: Dispatch-on-Rigid-Receiver Gaps
Goal: Close method-dispatch-on-rigid-receiver gaps that block tests/spec/declarations/traits.ori (§10.1) and tests/spec/capabilities/propagation.ori (§10.2). Prerequisite §10.0 splits over-500-line files to satisfy impl-hygiene.md §File Organization before §10.1/§10.2 edit them.
Depends on: §03 (bodies-pass + validator), §04 (codegen assertions), §06 (overview Phase 1 predecessor for Phase 2/3/4 per §10.R-026 cited-section-drift cure), §09 (especially §09.2 def-impl Self — same impl_self_type infrastructure; landing §09.2 first ensures §10.1 RigidVar dispatch doesn’t interact with un-scoped Self fabrication).
Sequencing rule: §10.0 MUST complete before §10.1 or §10.2 touch their target files. §10.1 before §10.2 (Codex 2.6B: capability dispatch wires through the same lookup policy as bound-chain dispatch; §10.1 establishes the policy). Mirrored in subsection_depends_on: frontmatter per routing.md §5.
Banned Patterns (§10 execution discipline; per §10.R-027)
Per skill-control-contract.md §Banned phrases (autopilot mode), §10 execution forbids these shapes regardless of autopilot vs interactive mode:
AskUserQuestionon ambiguous generic bounds during §10.1.3 / §10.2.3 implementation dispatch. Ambiguity (e.g., multiple bound-chain candidates) MUST emitE2023diagnostic pertypeck.md §DI-1, NEVER prompt the user inline. Cure: TDD matrixtest_method_dispatch_on_rigid_var_ambiguous_bounds_reports_ambiguityper §10.1.1.AskUserQuestionon TraitMethodDef.has_self classification edge cases (§10.2.0). Classification flows from registration-time syntactic source (params.first().name == checker.well_known().self_kw, interned-NameSSOT per §10.R-028); no judgment call at dispatch time.- Permission-asking hedges + pause-rationalization phrases per
skill-vocabulary.md §2 Banned Phrases — Autopilot Context (Critical)— banned in all §10 execution-step output (full enumeration lives at SSOT; cite, do not duplicate). Reviewer enforcement:STRUCTURE:autopilot-pause-leakCritical viascripts/prose-lint.pyautopilot-pause-leak label family. - Mid-loop
AskUserQuestionbetween TDD cells, between subsection close-outs, between §10.R finding resolutions. The plan-execution authorization covers the whole arc. - Deferral language (“nice-to-have”, “out of scope”, “future improvement” without anchor, “covered by existing tests”) per
impl-hygiene.md §Findings Disposition.
Reviewer enforcement: STRUCTURE:autopilot-pause-leak Critical when banned shapes appear in §10 execution output; blocks §10.N close-out.
10.0 Prerequisite file splits
Goal: Reduce compiler_repo/compiler/ori_types/src/registry/traits/mod.rs from 765 lines to ≤500 lines AND compiler_repo/compiler/ori_types/src/infer/expr/calls/method_call.rs from 524 to ≤400 lines. Extract cohesive submodules; keep mod.rs as a dispatch hub. Mechanical split — zero semantic change.
10.0.1 Discovery
- Run
wc -l compiler_repo/compiler/ori_types/src/registry/traits/mod.rs— verify 765 lines baseline. - Run
wc -l compiler_repo/compiler/ori_types/src/infer/expr/calls/method_call.rs— verify 524 lines baseline. - Re-read both files end-to-end to identify cohesive extraction boundaries:
registry/traits/mod.rs: publicTraitRegistrystruct + inherent methods; separatelookup_method*paths (lookup) fromregister_impl*+register_trait*paths (registration). Candidate split:registry/traits/lookup.rs(lookup paths) +registry/traits/registration.rs(registration paths) +registry/traits/mod.rs(struct definition + dispatch hub).method_call.rs:infer_method_call+infer_method_call_namedare the public entry points;resolve_receiver_and_builtin,check_positional_args,unify_higher_order_constraints,unify_closure_param_with_iterator_elem,check_range_float_iteration,check_infinite_iterator_consumed,find_infinite_sourceare private helpers. Candidate split:method_call/receiver_dispatch.rs(receiver/builtin resolution + closure-param unification) +method_call/mod.rs(public entry points).
10.0.2 Design
Fix shape (mechanical):
- Create new files with extracted content:
registry/traits/lookup.rs—impl TraitRegistry { pub fn lookup_method(...) { ... } pub fn lookup_method_checked(...) { ... } pub fn impls_for_type(...) { ... } }+ helper private functions.registry/traits/registration.rs—impl TraitRegistry { pub fn register_impl(...) { ... } pub fn register_trait(...) { ... } }+ helper private functions (coherence checks, specificity, conflicting-defaults etc.).registry/traits/mod.rs— struct definition +mod lookup; mod registration;+ re-exports.method_call/receiver_dispatch.rs—resolve_receiver_and_builtin,unify_higher_order_constraints,unify_closure_param_with_iterator_elem,check_range_float_iteration,check_infinite_iterator_consumed,find_infinite_source. Keep thempub(crate)somethod_call/mod.rscan call them.method_call/mod.rs—infer_method_call+infer_method_call_named+check_positional_args.
- Update
usestatements in dependents (none should need changes if re-exports are preserved).
No semantic change: the split is git mv-like at function granularity. Existing behavior preserved; all existing tests pass unchanged.
10.0.3 Implementation
- Create
registry/traits/lookup.rswith extracted content. - Create
registry/traits/registration.rswith extracted content. - Trim
registry/traits/mod.rsto struct + module declarations + re-exports. (Final post-split: 450 lines per HISTORY note line 84; ≤500 cap met, 300-target follow-up filed as §10.R-008.) - Create
method_call/receiver_dispatch.rswith extracted content. (Shipped asclosure_unify.rsper HISTORY; equivalent surface.) - Trim
method_call/mod.rs(or rename tomethod_call.rs). (Final post-split: 503 lines; ≤400 target unmet, follow-up filed as §10.R-009.) - Run
cargo build— compiles clean. - Run
cargo test -p ori_types— all existing tests pass unchanged. - Run
cargo clippy -p ori_types— clean. - Commit the split as ONE atomic commit (per
compiler.md §Multi-commit sequences). Commit a20bc41b1. - Post-split file counts:
registry/traits/mod.rs=450(split target met, ≤500 cap satisfied);registry/traits/lookup.rs=513,infer/expr/calls/method_call.rs=503,infer/expr/calls/impl_lookup.rs=522exceed 500-line cap and carry follow-up cures anchored under §10.R-007 (extractfind_conflicting_defaults→registry/traits/conflicts.rs) / §10.R-009 (extractcheck_positional_args→method_call/arg_check.rs) / §10.R-010 (extractLookupOutcomeconstruction →impl_lookup/outcome.rs). The split’s primary goal (mod.rshub trim) met; residual cap breach on three sibling files owned by the three §10.R cures gating §10.N close-gate.
10.0.4 Close §10.0
- All §10.0.3 checkboxes marked
[x]. -
cargo t+cargo clippy+cargo fmtall green post-split. -
/tpr-reviewon §10.0 diff → deferred to §10.R aggregate close-gate (mechanical split, low-finding; per §10.R-016 cure option (a) — defers but acknowledges intent; aggregate close-gate satisfies the per-subsection-gate contract). -
/impl-hygiene-reviewon §10.0 diff → deferred to §10.R aggregate close-gate (BLOAT 500-line follow-ups filed under §10.R-007/§10.R-009/§10.R-010 — three files still over cap; cures anchored; per §10.R-016 cure option (a)). - Frontmatter
10.0 status: complete.
10.1 Generic-param method dispatch via bound-chain walk
Goal: Extend TraitRegistry::lookup_method_checked to consult FunctionSig.type_param_bounds when receiver is Tag::RigidVar (generic type parameter). The current behavior keys impls_by_type by concrete Idx, so RigidVar receivers always miss. @f<T: Clone>(val: T) -> str = val.clone() fails E2003 method-not-found despite the declared bound.
Guards (both reviewers 2.6B): visited-set keyed on (rigid_var_idx, trait_idx) to prevent infinite loops on cyclic bounds A: B, B: C, C: A; recursion depth limit 256 per impl-hygiene.md §Panic & Assertion.
Priority (Rust + Swift consensus): bound-chain candidates are inherent-priority — they win over extension-method lookup when receiver is a rigid var. This matches Rust’s WhereClauseCandidate in probe.rs:958.
10.1.1 Discovery + root cause verification
- Re-read
registry/traits/lookup.rs(after §10.0 split) — confirmed:find_trait_method_via_bound_chainat lookup.rs:429 returnsBoundChainLookup::NotFound(0 candidates),Found(1),Ambiguous(2+); visited-set dedup ontrait_idxviaseen_traits; supertrait flattening viacollected_methods. 2026-06-07. - Re-read
infer/expr/calls/method_call.rs(post-§10.0) +impl_lookup.rs— confirmed dispatch path:impl_lookup.rs:370gatesTag::RigidVar | Tag::Varreceivers, callsreg.find_trait_method_via_bound_chain(method, &bounds)at :378, buildsLookupOutcome::Foundat :381 withTag::SelfType → receiver_tysubstitution. 2026-06-07. - Re-read
FunctionSig—type_params/type_param_bounds/scheme_var_idsparallel arrays; bounds-for-var aggregated caller-side and passed to the helper as flat&[Name](shipped wiring). 2026-06-07. - Confirm engine access — bounds aggregation is shipped caller-side at the
impl_lookup.rs:370dispatch site (the helper consumes a pre-aggregated&[Name]slice). 2026-06-07. - TDD matrix authored as Rust unit tests in
registry/traits/tests.rs(test_bound_chain_*, 7 cells): single-bound Found, multi-bound each-Found, no-matching-bound NotFound, empty-bounds NotFound, ambiguous-two-bounds Ambiguous, supertrait-inherited Found, duplicate-bound dedup (cyclic guard) Found-not-Ambiguous. All 7 green; 1079 ori_types lib pass; clippy clean. 2026-06-07.- Positive
test_method_dispatch_on_rigid_var_with_single_bound—@f<T: Clone>(val: T) -> T = val.clone()compiles clean;val.clone()resolves toClone::clone(val). - Positive
test_method_dispatch_on_rigid_var_with_multiple_bounds_different_methods—@f<T: Clone + Debug>(val: T)withval.clone()andval.debug()both resolve. - Negative
test_method_dispatch_on_rigid_var_without_bound_reports_missing—@f<T>(val: T) -> T = val.clone()reports E2003 (or equivalent) with suggestion “addT: Clonebound”.- RESOLVED 2026-06-07 (later): the unified §06.5 unknown-method diagnostic now fires for this case.
emit_unknown_method(impl_lookup.rs) emits E2001 “no methodmon generic type parameter — add a trait bound” for a NotFound on aTag::RigidVarOR a NAMED unboundedTag::Var(generic param viafresh_named_var);method_call.rs:313no longer defers a named-generic no-bounds receiver (only anonymous inference vars defer). Pinned bytest_unknown_method_on_unbounded_rigid_receiver_reports_error+test_method_on_bounded_rigid_receiver_resolves_clean(positive boundary) incheck/bodies/tests.rs; 1082 ori_types lib pass, clippy clean. Full spec-suite + dual-exec verification is cross-scope-blocked (parallel-sessionori_arcBurdenAnalysisCtxmid-edit does not compile); completes when that tree settles. - (historical) VERIFIED-OPEN 2026-06-07: end-to-end
@f<T>(a: T, b: T) -> T = a + b;AND@f<T>(x: T) -> str = x.hello();(no bound) BOTH compile clean (silent-accept) when they MUST report E2003. Root cause UNIFIED with BUG-02-044 + §06.5:lookup_impl_methodcorrectly returnsNotFound, but the caller (method_call.rs:110,213) callsemit_into_not_implemented(impl_lookup.rs:575) which is INTO-ONLY (emits only whenmethod == into); every other unknown method pushes NO diagnostic → caller returnsIdx::ERROR→ silent poison. SSOT cure = the §06.5 general unknown-method diagnostic (covers concrete + rigid receivers; suppresses follow-on E2005; defers ONLY for unresolvedTag::Var). The bound-chain helper itself is pinned green by the 7test_bound_chain_*cells; this negative case is gated on §06.5’s general-method-not-found emit replacing the into-only path. The positive cells (with-bound) work; the negative cell closes when §06.5 lands.
- RESOLVED 2026-06-07 (later): the unified §06.5 unknown-method diagnostic now fires for this case.
- Negative
test_method_dispatch_on_rigid_var_ambiguous_bounds_reports_ambiguity—@f<T: Foo + Bar>(val: T)where bothFooandBarhavemethod()reports E2023 ambiguous method. - Cyclic guard
test_method_dispatch_cyclic_bounds_does_not_infinite_loop— construct cyclic-bound scenario (if possible within Ori’s surface syntax; else test via direct TraitRegistry fixture) and verify visited-set prevents loop. Test MUST have a bounded timeout (timeout: 5000ms or similar in the harness). - Depth guard
test_method_dispatch_deep_supertrait_chain_respects_depth_limit— construct supertrait chain of ≥256 levels (via fixture), verify error instead of stack overflow.
- Positive
10.1.2 Design
RigidVar origin scope (resolves §10.R-001 — gemini convergent): Bound resolution MUST cover ALL Tag::RigidVar origin sources, not just current_fn_sig.scheme_var_ids. Per the TDD matrix in §10.1.1, the matrix mandates:
Tag::RigidVarfrom@f<T: Bound>— top-level function generic. Sourced fromcurrent_fn_sig.type_params+type_param_bounds.Tag::RigidVarfromimpl<T: Bound> Type<T>— impl-level generic. Sourced fromImplEntry.type_params+type_param_bounds(registered atcompiler_repo/compiler/ori_types/src/check/registration/impls.rs).Tag::SelfTypein trait default method — synthetic receiver placeholder. Sourced from enclosingTraitEntry.method_boundsforSelf.
Keying lookup solely off current_fn_sig.scheme_var_ids (per the prior draft) misses impl-level and trait-default-method origins. The unified resolution surface uses an analog of Rust’s param_env.caller_bounds() — gather every bound visible at the call site from (a) current function scope, (b) enclosing impl scope (via engine.current_impl_self() per typeck.md §SG-2), (c) enclosing trait scope (for default methods).
Fix shape:
- In
lookup.rs(post-§10.0), the shipped helperfind_trait_method_via_bound_chain(method_name: Name, type_param_bounds_for_var: &[Name]) -> BoundChainLookupatcompiler_repo/compiler/ori_types/src/registry/traits/lookup.rs:429is the SSOT bound-chain walker. Signature accepts a flat bounds slice (&[Name]) — NOT aParamEnvstruct (noParamEnvtype exists in the shipped code; the conceptualparam_env::caller_bounds()notion from earlier drafts is realized by passing the pre-aggregated&[Name]slice directly):- Caller-side responsibility: aggregate bounds visible at the call site from (a) current
FunctionSig.type_param_bounds_for_var(var_id)(shipped percompiler_repo/compiler/ori_types/src/registry/traits/types.rsFunctionSig API), (b) enclosingimpl<T: Bound>impl bounds (viaengine.current_impl_self()pertypeck.md §SG-2), (c) enclosing trait default-method bounds. Single SSOT aggregation per receiver-Idxperimpl-hygiene.md §SSOT. - For each trait name in the bounds slice:
- Call
self.get_trait_by_name(trait_name)→Option<&TraitEntry>.Noneskips the bound (trait not in registry); does NOT crash. - Check
trait_entry.collected_methodsformethod_name(covers supertrait-inherited methods). - If found: record as
BoundCandidate(trait_idx, method_item).
- Call
- Deduplicate candidates. 0:
BoundChainLookup::NotFound. 1:BoundChainLookup::Found { trait_idx, method }. 2+:BoundChainLookup::Ambiguous { candidates }. - Guard with visited-set keyed on
(rigid_var_idx, trait_idx). Max recursion depth 256 perimpl-hygiene.md §Panic & Assertion.
- Caller-side responsibility: aggregate bounds visible at the call site from (a) current
- MANDATORY: share
find_trait_method_via_bound_chainacross both lookup entry points (resolves §10.R-020):lookup_method_checked(called fromimpl_lookup.rs::lookup_impl_methodforreceiver.method(...)dispatch): SHIPPED — sole call site atcompiler_repo/compiler/ori_types/src/infer/expr/calls/impl_lookup.rs:337invokesreg.find_trait_method_via_bound_chain(method, &bounds)whenreceiver_idx’s tag isTag::RigidVarORTag::SelfType(under enclosing trait default-method scope), BEFORE returningNotFound.lookup_method(called fromoperators.rs:708resolve_binary_op_via_traitANDoperators.rs:759resolve_unary_op_via_traitfor operator-dispatch): SAME bound-chain consultation MUST occur onTag::RigidVarreceiver. Operator dispatch cannot rely onlookup_method_checked’s inherent-shadowing path — operator dispatch path historically useslookup_methoddirectly. Either (a) route both lookups through a sharedlookup_method_with_boundsprimitive that performs the bound-chain walk, OR (b) inline the bound-chain consultation inlookup_methodmirroringlookup_method_checked. Cure (a) preferred perimpl-hygiene.md §Algorithmic DRY(single SSOT for bound-chain dispatch). Operator-dispatch cell in TDD matrix (§10.1.1) verifiesval + otherwhereval: T, T: Addworks.- Priority: bound-chain candidates are inherent-priority (Rust + Swift consensus per
inspired_bycites) — they win over extension-method lookup at both entry points.
- In
infer/expr/calls/method_call.rs(orreceiver_dispatch.rspost-§10.0), whenresolve_receiver_and_builtinencountersTag::RigidVarreceiver, fall through tolookup_impl_method(unchanged); the new bound-chain walk runs insidelookup_method_checkedand returns the right method.
10.1.3 Implementation
-
find_trait_method_via_bound_chainhelper SHIPPED inregistry/traits/lookup.rs:429with signature(method_name: Name, type_param_bounds_for_var: &[Name]) -> BoundChainLookup. - Wired into
lookup_method_checkedforTag::RigidVarreceivers — sole call site atinfer/expr/calls/impl_lookup.rs:337. - TDD matrix authored FIRST (7
test_bound_chain_*cells inregistry/traits/tests.rs); pins the shippedfind_trait_method_via_bound_chaincontract. 2026-06-07. - Visited-set (
seen_traitsontrait_idx) shipped infind_trait_method_via_bound_chain; supertrait-depth guarded insidecollected_methods; duplicate-bound cell pins dedup-not-Ambiguous. 2026-06-07. - Run unit tests — 7/7 bound-chain cells + 1079 ori_types lib pass; duplicate-bound (cyclic) + supertrait-chain cells green. 2026-06-07.
-
cargo run -- test tests/spec/declarations/traits.ori— 30/30 passed, zero E2005 sites. 2026-06-07. - Verify operator dispatch overlap: test
@f<T: Add>(val: T, other: T) -> T = val + otherworks (§10.R-020 shared-primitive cure verified at bothlookup_method_checkedANDlookup_methodentry points; cure (a) sharedlookup_method_with_boundsprimitive both call OR cure (b) inlinefind_trait_method_via_bound_chaininlookup_methodmirroringlookup_method_checked). - Matrix: receiver × bound × method:
- Receivers:
Tag::RigidVarfrom@f<T>,Tag::RigidVarfromimpl<T: Bound> Type<T>,Tag::SelfTypein trait default method. - Bounds: single bound, multi-bound (A + B), supertrait chain (A: B: C), bound on trait method’s generic param.
- Methods: trait-required method, trait-default method, supertrait-inherited method, operator (
+,-,==,<).
- Receivers:
- Verify
cargo st tests/green, debug + release parity. - Run
timeout 150 diagnostics/dual-exec-verify.shon §10.1-touched files — zero divergences (§10.R-022 success_criteria SC line 89).
10.1.4 Close §10.1
- All §10.1.3 checkboxes marked
[x]. -
/tpr-reviewon §10.1 diff → clean. -
/impl-hygiene-reviewon §10.1 diff → clean. -
/improve-toolingretrospective (cyclic-guard pattern may generalize to other compiler recursion paths). -
/sync-clauderetrospective — updatetypeck.md §TR-4bound-satisfaction discussion with bound-chain walk specifics. - Frontmatter
10.1 status: complete.
10.2 Capability-method dispatch — trait-method surface for bound handler value
Goal: Extend infer_with_capability at constructors.rs:99-122 to surface the capability trait’s methods for dispatch on the bound handler value. When body calls Http.get(url: "..."), the Http identifier resolves to the handler’s type, and method lookup must find get via the capability trait’s method set (not only via the handler type’s own impls).
Composition with §10.1: §10.1’s bound-chain walk generalizes — §10.2 uses the same TraitRegistry::lookup_method_checked extension plus a capability-specific surface that registers the capability trait’s methods as candidates when the receiver is a capability-bound name.
10.2.0 Capability-method dispatch fork (has_self detection via TraitMethodDef persistence)
Goal: Eliminate the design contradiction between §10.2’s “reuses the same TraitRegistry::lookup_method_checked extension” claim and impl_lookup.rs:371-377’s hardcoded has_self: true. Capability methods (Http.get(url: str) -> str) lack a self receiver; receiver-method dispatch (val.clone()) requires has_self: true. The two cannot share the same has_self value; the existing path conflates them. Design citation per routing.md §6 decision artifact: this subsection resolves §10.R-002 (codex + opencode convergent) AND §10.R-021 (TraitMethodDef.has_self persistence — strengthens prior signature-shape heuristic per Step 4 codex BS-10-B) AND §10.R-028 (interner-SSOT discipline for self parameter detection per Round 0 gemini TPR-10-R0-002 — checker.well_known().self_kw mandatory; string-literal comparison BANNED in non-test code).
Fix shape (resolves §10.R-021 — TraitMethodDef.has_self persistence; supersedes signature-shape heuristic):
The prior signature-shape heuristic (pool.tag(sig) == Tag::Function AND first param Idx equals receiver_ty post-substitution) is structurally weak: it misclassifies associated functions whose first parameter coincidentally matches receiver_ty. The existing ImplMethodDef at registry/traits/mod.rs:241,249 already persists has_self: bool computed from the parameter NAME at check/registration/impls.rs:503 — a stronger syntactic source. Capability traits go through TraitMethodDef (registry/traits/mod.rs:144) which currently lacks the field. Cure: mirror the has_self field on TraitMethodDef, populate at trait-method registration in check/registration/traits.rs from parameter syntactic shape, consume at bound-chain dispatch site.
TraitMethodDefextension — Addhas_self: boolfield toTraitMethodDefstruct atcompiler_repo/compiler/ori_types/src/registry/traits/mod.rs:144. Populate atcheck/registration/traits.rstrait-method registration:has_self = method_decl.params.first().is_some_and(|p| p.name == checker.well_known().self_kw)— mirrorsImplMethodDef.has_selfcomputation pattern atcheck/registration/impls.rs:506(interned-NameSSOT viaWellKnownNames; pertypes.md §TI-2interning discipline +impl-hygiene.md §Interning Disciplineban on== "identifier_name"in non-test code).- Bound-chain dispatch consumption — At
compiler_repo/compiler/ori_types/src/infer/expr/calls/impl_lookup.rs:371-382(currentLookupOutcome::Foundconstruction), replace hardcodedhas_self: truewithhas_self: trait_method_def.has_self— read fromTraitMethodDefpersisted in step 1. No signature-shape introspection; noPool::childrentraversal required for this decision. - Strip
task #11comment atimpl_lookup.rs:373-376as part of has_self refactor (resolves §10.R-004 + §10.R-013 line-range refresh + perimpl-hygiene.md §CommentsC-B11 /routing.md §6). Current TODO text:// TODO(typeck): capability methods without self need has_self: false dispatch path.— strip in same commit as §10.2.0 implementation. - Canon arena panic bisection owned by BUG anchor from §10.R-003/§10.R-011 (separate bug-plan);
Pool::children/ extra-array accessor discipline applies to any other signature traversal sites but is not invoked by the TraitMethodDef.has_self consumption path.
Cross-dispatch invariant (§10.R-020 alignment): Both lookup_method_checked AND lookup_method entry points (per §10.1.2 Fix shape step 2) consume the same shared bound-chain primitive; has_self from TraitMethodDef flows through the shared primitive uniformly for both receiver-method and operator-dispatch paths. No parallel has_self resolution at operator sites.
Sequencing per DAG (§10.R-025): §10.1 (bound-chain + operator routing) ships before §10.2 per declared depends_on; within §10.2, §10.2.0 ships BEFORE §10.2.2 trait-shape validation so dispatch reaches the eval/codegen path with correct has_self classification before §10.2.2 validates conformance, closing the phase-gap surface.
10.2.1 Discovery + root cause verification
- Re-read
constructors.rs:178-201(infer_with_capability) — confirms env bindingcapability → provider_ty(line 192) + provided-capability mark (lines 196-197), zero trait-shape validation. Anchor: §10.R-005 missing-validation finding. Symbol-anchored ref; line range refreshed Round 0 TPR-10-R0-004 from pre-§09.3:99-122aftercheck_ok/check_err/check_someadditions shifted file +79 lines. - Trace
Http.get(url: "...")path throughinfer_method_call→resolve_receiver_and_builtin→lookup_impl_method→lookup_method_checked→ §10.1 bound-chain (via capability-bound registration incheck_function). - Confirm built-in capability traits (
Http,Logger,Env,FileSystem,Print,Clock,Random,Crypto,Cache) registered inTraitRegistryviaregister_builtin_traitspass (or document the gap as discovery output). Anchor:compiler_repo/compiler/ori_types/src/check/registration/builtin_types.rs+compiler_repo/compiler/ori_types/src/check/registration/traits.rs. - TDD matrix BEFORE implementation:
- Positive (with-impl handler)
test_capability_method_dispatch_via_handler_impl—with Http = RealHttp in { Http.get(url: "foo") }resolves viaRealHttp’s registeredimpl Http(handler-side conformance). - Positive (stateful handler)
test_capability_method_dispatch_via_capability_trait_surface—with Cap = handler(state: S) { get: (s, url:) -> (s', val) } in ...provides every trait method shape (stateful-handler form perori-syntax.md §Capabilities). - Negative (missing method)
test_capability_method_missing_on_handler_reports_error— handler lacksget→ clean error atwith ... = handlersite naming missing capability trait method (§10.2.2 mandatory validation). - Negative (wrong arity)
test_capability_method_arity_mismatch_reports_error— handler’sgetdeclared with wrong parameter count → diagnostic atwithsite, NOT at dispatch site. - Negative (wrong return)
test_capability_method_return_type_mismatch_reports_error— handler’sgetreturns wrong type → diagnostic atwithsite. - Phase-gap regression pin
test_capability_method_missing_does_not_crash_eval— handler missinggetMUST NOT crash eval or codegen with internal panic; typeck rejects thewith ... = handlerform with a clean diagnostic. - has_self regression pin (§10.R-021)
test_bound_chain_associated_function_reports_has_self_false— capability trait method declared withoutselffirst param (e.g.,@new (cfg: Config) -> Selfon acapability Foo { ... }) MUST dispatch withhas_self: falseper TraitMethodDef persistence; signature-shape coincidence (first paramIdx == receiver_ty) MUST NOT misclassify it as receiver-method. - has_self regression pin (§10.R-021)
test_has_self_misclassification_does_not_crash_eval— TraitMethodDef.has_self mismatch (synthetic test fixture forcing wrong classification) MUST NOT crash eval or codegen with internal panic; downstream consumers (eval method dispatch, codegen ABI) handle the disagreement gracefully via diagnostic, not via panic. - Built-in capability registration pin (§10.R-023)
test_capability_dispatch_when_trait_not_registered_reports_clean_error— whenTraitRegistry::get_trait_by_name(capability)returnsNone(built-in capability trait not yet registered), §10.2.2 validation MUST emit a clean diagnostic at thewith ... = handlersite naming the unregistered capability — MUST NOTunwrap()and panic.
- Positive (with-impl handler)
10.2.2 Design — MANDATORY trait-shape validation
Goal: Validate handler conformance to the capability trait’s method set at the with Cap = handler in expr site. Failure produces a clean diagnostic at the with site naming the missing/mismatched method, NOT a crash downstream when dispatch reaches eval/codegen.
Rule (per CLAUDE.md §The One Rule + §Correctness Above All): Trait-shape validation is MANDATORY, not optional. Typeck-passes-but-eval/codegen-crashes on non-conformant handler IS a phase-gap defect per impl-hygiene.md §Cross-Phase Invariant Contracts (Type Checker → Eval / Codegen rows); the cure is enforcement at typeck, not downstream symptom suppression.
Fix shape:
- At
infer_with_capability(compiler_repo/compiler/ori_types/src/infer/expr/constructors.rs:178-201), after resolvingcapabilityto a registered trait:- Look up the trait’s method set via
TraitRegistry::get_trait_by_name(capability). ReturnsOption<&TraitEntry>percompiler_repo/compiler/ori_types/src/registry/traits/lookup.rs:22. - MANDATORY None-handling (§10.R-023): On
None(built-in capability trait not registered in TraitRegistry — e.g.,Http,Logger,FileSystemifregister_builtin_traitsgap surfaces): emit a CLEAN diagnostic at thewith ... = handlerspan naming the unregistered capability. NEVERunwrap()—None-on-built-in-capability is a registration gap to file as bug, NOT an internal panic. Cite §10.2.1 discovery checkbox confirming built-in capability trait registration. - On
Some(trait_entry): iteratetrait_entry.collected_methods. - For each trait method, look up the corresponding method on the handler’s provider type (via
TraitRegistry::lookup_methodwith the handler’s provider_ty as receiver). - Verify signature shape match: parameter count, parameter types (post-
Self-substitution to provider_ty), return type.
- Look up the trait’s method set via
- On missing method: emit a new diagnostic (E2014 reuse OR new code E2043 — bound at §10.2.2 ship time per
.claude/rules/typeck.md §DI-1Error Code Table) at thewith ... = handlerspan naming the missing capability trait method. - On signature mismatch: same diagnostic family, including diff between expected (trait method) and actual (handler method) signatures.
- Wire the bound identifier in scope to surface the trait’s method set (per the existing capability-bound registration in
check_function, already shipped percompiler_repo/compiler/ori_types/src/check/bodies/functions.rs:152). - For method lookup on a capability-bound identifier: try capability-trait method set first; fall back to regular dispatch on provider_ty if not found. Routing handled by §10.2.0’s
has_selffork.
Spec citation (§10.R-024 anchor requirement): Pre-implementation MUST trace exact sub-clause in compiler_repo/docs/ori_lang/v2026/spec/ mandating which handler shape properties must be validated. Clause 20 (Capabilities) covers with Cap = handler in expr requiring handler to implement every method of the capability trait at the conceptual level; trait-shape validation rules currently surface as typeck.md §CP-3 (target-only with...in semantics including stateful handler form with Cap = handler(state: init) { op: (s) -> (s', val), ... } in expr with errors E1204-E1207). Implementer SHALL:
- Trace exact spec sub-clause(s) defining (a) trait method enumeration, (b) handler method matching rule, (c) signature shape equivalence (param count + types + return), (d) stateful-handler form vs static-handler form. Citable at
Clause 20.N.MorAnnex E §Xgranularity, NOT bareClause 20. - If sub-clause does NOT exist at required granularity: file
/add-bugsubsystemspecseveritymediumtitle “spec gap: handler trait-shape validation rules under Clause 20” with concrete proposal pointer; derive validation shape from spec’s stated handler semantics; record bug ID in §10.R-024 anchor checkbox. - Add canonical spec-anchored rule to
typeck.md §CP-3as newCP-N(Clause 20-anchored) when spec sub-clause exists, removing the target-only marker from §CP-3.
Banned (per impl-hygiene.md §INVERTED-TDD): Marking validation “optional”, deferring as “future improvement”, “skip when handler.impl exists” gates, #[cfg(strict_caps)] flags. Validation runs on every with ... = handler in ... form.
10.2.3 Implementation
- Write failing tests FIRST per §10.2.1 TDD matrix (positive + negative + phase-gap-regression + has_self-regression + None-handling cells per §10.R-021/§10.R-023).
- §10.R-024 spec-anchor trace (BEFORE §10.2.2 implementation): Trace exact sub-clause(s) in
compiler_repo/docs/ori_lang/v2026/spec/defining handler trait-shape validation rules under Clause 20. Cite atClause 20.N.Mgranularity. If gap exists, file/add-bugand record BUG-XX-NNN in §10.R-024. - §10.2.0 — Implement
has_selfdetection via TraitMethodDef.has_self persistence per §10.R-021:- Add
has_self: boolfield toTraitMethodDefatregistry/traits/mod.rs:144. - Populate at trait-method registration in
check/registration/traits.rsviaparams.first().is_some_and(|p| p.name == checker.well_known().self_kw)(interned-NameSSOT viaWellKnownNames; mirrorsImplMethodDef.has_selfatcheck/registration/impls.rs:506; pertypes.md §TI-2+impl-hygiene.md §Interning Discipline— string-literal comparison BANNED in non-test code). - At
impl_lookup.rs:371-377LookupOutcome::Foundconstruction: replace hardcodedhas_self: truewithhas_self: trait_method_def.has_self(no signature-shape introspection). - Strip
// TODO(typeck): capability methods without self need has_self: false dispatch path.comment atimpl_lookup.rs:373-376(resolves §10.R-004 + §10.R-013).
- Add
- §10.2.2 — Implement MANDATORY trait-shape validation at
constructors.rs:178-201:- Look up capability trait’s method set via
TraitRegistry::get_trait_by_name(capability)→Option<&TraitEntry>. - None-handling per §10.R-023: On
None, emit clean diagnostic naming unregistered capability atwith ... = handlerspan. NEVERunwrap(). File built-in capability registration bug if gap surfaces in discovery step. - On
Some(entry): iterateentry.collected_methods; for each trait method, verify handler provides matching method shape (param count, types, return). - On missing/mismatched: emit clean diagnostic at
with ... = handlersite.
- Look up capability trait’s method set via
- Extend method lookup path to consult capability-trait methods before falling through to
NotFound(already shipped via §10.1 bound-chain + capability-bound registration; verify integration). - Run unit tests — all pass.
- Run
timeout 150 cargo stf tests/spec/capabilities/propagation.ori— green (no[CAPABILITY-METHOD-DISPATCH]sites; 7 tests gated on §10.2.0 + §10.2.2 unblocked). - Matrix: capability × handler-shape × method:
- Capabilities:
Http,Logger,FileSystem, user-definedcapability Foo { ... }. - Handler shapes: concrete struct with
impl Http, stateful handlerwith Cap = handler(state: S) { op: (s, ...) -> (s', val) } in ..., default impl. - Methods: required methods, default methods, cross-trait method calls, missing methods (negative).
- Capabilities:
- Verify
cargo st tests/green, debug + release parity. - Run
timeout 150 diagnostics/dual-exec-verify.shon §10.2-touched files — zero divergences (§10.R-022 success_criteria SC line 89).
10.2.4 Close §10.2
- All §10.2.3 checkboxes marked
[x]. -
/tpr-reviewon §10.2 diff → clean. -
/impl-hygiene-reviewon §10.2 diff → clean. -
/improve-toolingretrospective. -
/sync-clauderetrospective — updatetypeck.md §CP-2/CP-3with capability-method-dispatch specifics. - Frontmatter
10.2 status: complete.
10.R Third Party Review Findings
Step 4 /tp-help blind-spot envelopes (codex + gemini + opencode, 2026-05-15). Concrete - [ ] items below carry implementation anchors; each MUST resolve before §10.N close.
-
§10.R-006 — Subsection status frontmatter drift fixed (opencode) — Pre-edit: §10.0/§10.1/§10.2 all carried
status: not-startedwhile RESUME POINTER and commits indicated otherwise. Post-edit: §10.0=complete, §10.1=in-progress, §10.2=in-progress, §10.R=in-progress; section-levelstatus: in-progress(fromin-review);prior_status: in-reviewadded for abort recovery per.claude/rules/state-discipline.md §4.00-overview.md:393Quick Reference flipped from “NEW — Not Started” to “In Progress — §10.0 complete; §10.1/§10.2 production code complete, TDD matrix + close-out pending”. §10.1 status flip completed atomically with §10.R-028 cure (Round 0 TPR-10-R0-001 inline). -
§10.R-012 — §10.N close-gate range expanded to §10.R-001..§10.R-019 (codex TPR R2) — Original §10.N checklist named
§10.R-001..§10.R-006but R1 + R2 added §10.R-007 through §10.R-019. Anchor: §10.N checklist row updated at line 475 (range now §10.R-001..§10.R-028 post-Step 4 BS additions + Round 0 TPR appended §10.R-028 for interner-SSOT discipline). RESOLVED inline by /review-plan Step 5 editor 2026-05-16 + /tpr-review Round 0 fix-and-commit + Round 5 close-gate range cure. -
§10.R-016 —
/tpr-reviewper-subsection-gate fidelity at §10.0.4 (gemini TPR R3, Critical) —/tpr-reviewcheckbox at section-10:196 was flipped[x]with body “Covered by §10.R aggregate close-gate” — defers but does not satisfy per-subsection-gate as authored. Perskill-control-contract.md §Caller Foreground Dispatch Contract: foreground-dispatch the skill, consume structured exit state, then flip[x]. Cure options: (a) reword §10.0.4 checkbox to “deferred to §10.R aggregate” (acknowledges intent); (b) run/tpr-reviewon §10.0 diff specifically and record SHA + finding count. RESOLVED inline by /tpr-review Round 2 fix-and-commit via cure option (a) — §10.0.4 lines 251-252 reworded to “deferred to §10.R aggregate close-gate (per §10.R-016 cure option (a))” for both/tpr-reviewand/impl-hygiene-reviewcheckboxes. -
§10.R-017 — Adopt
subsection_depends_on:ordering primitives (gemini TPR R3, Major) — §10’s authoring carries sequencing rule in prose at section-10:150 (“§10.0 MUST complete before §10.1 or §10.2 touch their target files. §10.1 before §10.2”) withoutsubsection_depends_on:/blocks_section_close:frontmatter primitives. Perrouting.md §5 Ordering Primitives. Cure:subsection_depends_on: {"10.1": ["10.0"], "10.2": ["10.0", "10.1"]}added to section frontmatter at lines 95-97; prose statement preserved as cross-reference. RESOLVED inline by /review-plan Step 5 editor 2026-05-16. -
§10.R-019 — Resume-pointer state drift: “7/7 green” asserts end-state as fact (codex TPR R3, High) — section-10:27 RESUME POINTER comment line asserts “propagation.ori 7/7 green” but §10.2 is
status: in-progresswith §10.2.0 + §10.2.2 implementation pending; the 7/7 is end-state target, not current. Perstate-discipline.md §3. Cure: reword line 27 to “propagation.ori GATED on §10.2.0+§10.2.2 (target: 7/7 green at §10.2.4 close)”. RESOLVED inline by /review-plan Step 5 editor 2026-05-16 — RESUME POINTER rewritten with explicit GATED-on language. -
§10.R-022 — Test-coverage checklist gap: dual-exec-verify missing from §10.1.3 + §10.2.3 (Step 4 gemini BS-10-D, Medium) — success_criteria SC at section-10:89 requires
timeout 150 diagnostics/dual-exec-verify.sh zero divergences on §10-touched files; §10.1.3 implementation checklist (line 267 pre-edit) and §10.2.3 (line 332 pre-edit) lacked the verification step. Anchor: §10.1.3 + §10.2.3 each gain a- [ ] Run timeout 150 diagnostics/dual-exec-verify.sh on §10.{1,2}-touched files — zero divergences (§10.R-022)checkbox. RESOLVED inline by /review-plan Step 5 editor 2026-05-16. -
§10.R-025 — Resume-order vs declared-dependency inversion (Step 4 opencode BS-10-G, Critical) — Pre-edit RESUME POINTER at section-10:33-44 ordered §10.2.0 → §10.2.2 → §10.1.1 → §10.1.3 → §10.2.3, driven by §10.R-002 has_self hardcode discovery rather than DAG. Plan prose at line 159 declared §10.1 before §10.2 (capability dispatch wires through bound-chain lookup policy §10.1 establishes). §10.R-017 recorded missing
subsection_depends_on:but resume order actively inverted declared dependency. Anchor: (a) RESUME POINTER reordered to put §10.1.1 (TDD matrix) FIRST, §10.1.3 + §10.1.4 close §10.1 before §10.2 begins; (b)subsection_depends_on: {"10.1": ["10.0"], "10.2": ["10.0", "10.1"]}added to section frontmatter making DAG explicit perrouting.md §5(cure for §10.R-017). RESOLVED inline by /review-plan Step 5 editor 2026-05-16 (both halves shipped). -
§10.R-027 — Banned-patterns list for §10 execution discipline (Step 4 gemini BS-10-F, Low) — Pre-edit §10 omitted banned-patterns list preventing
STRUCTURE:autopilot-pause-leakfailure modes during implementation dispatch. Anchor: “Banned Patterns” subsection added BEFORE §10.0 forbiddingAskUserQuestionon ambiguous generic bounds (cure:E2023diagnostic pertypeck.md §DI-1), on TraitMethodDef.has_self classification edge cases (cure: syntactic registration-time source), and on mid-loop pacing prompts during TDD cell execution / subsection close-outs / §10.R finding resolutions. Reviewer enforcement:STRUCTURE:autopilot-pause-leakCritical blocks §10.N close-out. RESOLVED inline by /review-plan Step 5 editor 2026-05-16. -
§10.R-010 — BLOAT cure:
impl_lookup.rs(opencode TPR R2) — RESOLVED 2026-06-07: the §06.5 unknown-method emit grew the file to 670; split into siblings to 436 (under cap). Extractedresolve_impl_signature→infer/expr/calls/impl_signature.rs(147) + the two diagnostic emitters (emit_into_not_implemented+emit_unknown_method) →infer/expr/calls/method_diagnostics.rs(113).method_call.rs447, all under 500. 1082 ori_types lib pass, clippy clean. (Note: sibling flat modules incalls/rather than the anchor’simpl_lookup/outcome.rsdir form — same SRP outcome, lower churn.) -
§10.R-001 — RigidVar origin scope expansion (gemini) — §10.1.2 design keyed lookup off
current_fn_sig.scheme_var_idsonly, missingTag::RigidVarfromimpl<T: Bound>andTag::SelfTypein trait default methods. Anchor: §10.1.2 Design ParamEnv aggregation across function + impl + trait scopes; §10.1.1 TDD matrix cells for all three origins. -
§10.R-002 — has_self hardcode resolves §10.2 reuse contradiction (codex + opencode convergent) —
compiler_repo/compiler/ori_types/src/infer/expr/calls/impl_lookup.rs:371-377hardcodeshas_self: truewhile plan claimed §10.2 reuses the same lookup path. Anchor: SUPERSEDED at Round 0 §10.2.0 redesign by §10.R-021 (TraitMethodDef.has_self persistence — stronger syntactic source via parameter NAME at registration, replacing the prior signature-tag + first-param-is-receiver heuristic). Cure path now: implement §10.R-021 (addhas_self: booltoTraitMethodDefatregistry/traits/mod.rs:144; populate atcheck/registration/traits.rsvia internedchecker.well_known().self_kwper §10.R-028; consume atimpl_lookup.rs:371-377viahas_self: trait_method_def.has_self); strip “task #11” comment atimpl_lookup.rs:373-376in the same commit. See §10.R-021 + §10.R-028 for full design. -
§10.R-003 — Canon arena panic at u32::MAX promoted to bug (gemini autopilot-risk) — Inline bisection of “canon arena panic” in resume pointer creates autopilot self-halt risk per
routing.md §3 case (a)(blocker on current subsection close). Anchor:/add-bug --inlinefiling a BUG-XX-NNN tracker entry for “canon arena panic at u32::MAX during has_self detection in §10.2”; bug-plan carries the bisection work (which spec test panics; whatreceiver_ty/sigshape produces u32::MAX; root cause incompiler_repo/compiler/ori_canon/src/arena.rs:108). Once filed, record the bug-pointer in this section’s frontmatter as an inline YAML comment per theplans/typeck-inference-completeness/section-11-inference-fallback.md§11.R-R1-001 cure pattern (# blocker: BUG-XX-NNN (canon arena panic at u32::MAX during §10.2.0 has_self detection) — gates §10.2.0). Gate §10.2.0 implementation on resolution by checking the comment + bug-tracker status at §10.2.0 entry.blocked_by:is NOT aPlanSectionSchemafield (onlyFixBugSchemacarries it for bug-bug chains perscripts/plan_corpus/schemas.py:361); attempting to addblocked_by:here would failpython -m scripts.plan_corpus checkvalidation. Until filed, the bug-anchor lives at this checkbox; implementing §10.2.0 MUST file the bug FIRST per CLAUDE.md §Tests That Expose Bugs. -
§10.R-004 — “task #11” deferral has no anchor (opencode) —
compiler_repo/compiler/ori_types/src/infer/expr/calls/impl_lookup.rs:376cites “task #11” with no plan checkbox or BUG-XX-NNN. Perimpl-hygiene.md §CommentsC-B11 (non-spec-pointer ban) + CLAUDE.md §“Future Improvement” MUST Be Concretely Tracked. Anchor: §10.2.0 implementation strips the comment as part of has_self detection fix. -
§10.R-005 — §10.2 trait-shape validation MANDATORY (codex + gemini convergent, Critical) — Original §10.2.2 design listed validation as “optional for §10.2 core, filed-if-not-done”. Per CLAUDE.md §The One Rule + §Correctness Above All +
impl-hygiene.md §Cross-Phase Invariant Contracts(Type Checker → Eval / Codegen): typeck-passes-but-eval/codegen-crashes on non-conformant handler IS a phase-gap defect; cure is enforcement at typeck. Anchor: §10.2.2 redesigned with MANDATORY validation; §10.2.1 TDD matrix addstest_capability_method_missing_on_handler_reports_error+test_capability_method_arity_mismatch_reports_error+test_capability_method_return_type_mismatch_reports_error+test_capability_method_missing_does_not_crash_eval(phase-gap regression pin); §10.2.3 implementation step authors the validation pass atconstructors.rs:99-122. -
§10.R-007 — BLOAT cure:
registry/traits/lookup.rs513 lines (opencode, TPR R1) — File exceedsimpl-hygiene.md §File Organization500-line cap by 13 lines. Anchor: extractfind_conflicting_defaults(lines 142-189) into sibling submodulecompiler/ori_types/src/registry/traits/conflicts.rs; parentlookup.rsdrops below 500. Resolve as part of §10.0 file-split sweep close (companion to existing §10.0 splits atmod.rs/lookup.rs/tests.rs). -
§10.R-008 — Stretch target:
registry/traits/mod.rs≤300 lines hub (opencode + codex TPR R2) — §10.0 SC stretch goal was 300-line hub; actual final is 450 lines. Above the 500-line BLOAT cap but above stretch target. Anchor: factor coherence + specificity helpers out ofmod.rsintocompiler/ori_types/src/registry/traits/coherence.rsafter §10.R-007 lands. Optional — passing 500-cap is the hard requirement. -
§10.R-009 — BLOAT cure:
method_call.rs503 lines (opencode TPR R2) — File exceeds 500-line cap by 3 lines AND §10.0 stretch target was ≤400. Anchor: extractcheck_positional_args(private helper, single-purpose) into siblingcompiler/ori_types/src/infer/expr/calls/method_call/arg_check.rs; parent drops below 500 + closer to 400 stretch. -
§10.R-011 — Canon arena panic concrete bug filing (codex + opencode TPR R2 convergent) —
BUG-XX-NNNplaceholders at section-10:29 + §10.R-003 body never resolved to concrete tracker entry. Anchor: foreground-dispatch/add-bug --inlinefor “canon arena panic at u32::MAX during §10.2.0 has_self detection” surfacing under aims-burden parallel-session adjacency; receive concreteBUG-XX-NNN; replace placeholders at section-10:29 + §10.R-003 body. Until filed, both placeholders areLEAK:placeholder-bug-idCritical findings per CLAUDE.md §“Future Improvement” MUST Be Concretely Tracked. -
§10.R-013 — Stale plan anchor: §10.2.0 line range cite (gemini TPR R2) — §10.2.0 design body at section-10:332 cites
impl_lookup.rs:371-382for has_self detection; current hardcode lives at lines 371-377 with TODO at 373-376. Anchor: amend §10.2.0 body to cite currentimpl_lookup.rs:371-377+ quote current TODO text verbatim. -
§10.R-014 — Section-10 work-order-violation (codex + gemini TPR R2 convergent, Critical) — §10 frontmatter
depends_onextended at /review-plan Round 4 Step 4 (per §10.R-026 cure) to["03", "04", "06", "09"]; current predecessor state: §03 complete + reviewed:true; §04 status: in-progress (cross-scope blocked on aims-burden-tracking §06 parallel session); §06 status: in-progress (Phase 1 §06 rewrite per 00-overview.md); §09 status: in-progress + reviewed:false (post-§09 production-code landing; TPR + close-out pending). Perimpl-hygiene.md §STRUCTURE:work-order-violation(Critical, ABSOLUTE): “Consumer status: in-progress ONLY when every depends_on: predecessor satisfies status: complete AND reviewed: true”. Anchor: gate §10.N close on EVERY predecessor (§04 AND §06 AND §09) reachingstatus: complete + reviewed: true(§03 already satisfies); §10 may legitimately carry status:in-progress mid-pipeline perstate-discipline.md §4(TPR-exit terminal flip) but cannot reach §10.N close-gate until all four predecessors close. Pull-into-scope for §04/§06/§09 cures is BANNED in autopilot per cross-scope parallel-session adjacency (user FYI 2026-05-15); §04 + §09 cures landed/landing in parallel autopilot sessions; §06 cure tracked under §06 rewrite Phase 1 close. -
§10.R-015 —
00-overview.mdtable sync at §10.N close (deferred from drift-cure agent) — Cohesion-edit at /review-plan §1.7D bounded scope: when §10.N close completes, verify00-overview.md:393Quick Reference reflects final §10 state. Anchor: §10.N close-gate touches00-overview.mdQuick Reference row. -
§10.R-018 — Decision-in-implementation: §10.2.0 inline Decision block (gemini TPR R3, Critical) — section-10:285 carries “Decision (resolves §10.R-002, convergent codex + opencode): Detect
has_selfat the bound-chainLookupOutcome::Foundconstruction site by examining the resolved method signature shape.” Perrouting.md §6+skill-vocabulary.md §3 rationale-prose: design decisions live indecisions/<NN>-<topic>.mdOR absorbed into §10.R-002 finding body. Cure: lift toplans/typeck-inference-completeness/decisions/<NN>-has-self-detection.mdOR expand §10.R-002 body; replace inline at section-10:285 with citation pointer. -
§10.R-020 — Operator-dispatch routing gap: lookup_method vs lookup_method_checked (Step 4 codex BS-10-A, High) — §10.1 success criterion at section-10:59 claims
lookup_method_checkedfix coversresolve_binary_op_via_trait(operators.rs:708) andresolve_unary_op_via_trait(operators.rs:759), but those paths calllookup_method(NOTlookup_method_checked). Implementation checklist wiresfind_trait_method_via_bound_chainonly intolookup_method_checked. Anchor: §10.1.2 Fix shape step 2 MANDATES shared bound-chain primitive across BOTH lookup entry points perimpl-hygiene.md §Algorithmic DRY(cure (a) preferred:lookup_method_with_boundsprimitive both call invokingfind_trait_method_via_bound_chain); operator-dispatch cell in §10.1.1 TDD matrix verifiesval + otherwhereval: T, T: Addworks at thelookup_methodentry point. §10.1.3 implementation checkbox cites §10.R-020 cure verification. -
§10.R-021 — has_self detection via TraitMethodDef.has_self persistence (Step 4 codex + opencode BS-10-B, High) — Prior §10.2.0 design used signature-shape heuristic (
pool.tag(sig) == Tag::FunctionAND first paramIdx == receiver_ty) which silently misclassifies associated functions whose first param coincidentally matchesreceiver_ty. Stronger syntactic source exists:ImplMethodDef.has_selfatregistry/traits/mod.rs:249computed from parameter NAME atcheck/registration/impls.rs:503.TraitMethodDefatregistry/traits/mod.rs:144lacks the field. Anchor: §10.2.0 redesigned with TraitMethodDef.has_self persistence — add field; populate at trait-method registration incheck/registration/traits.rsviaparams.first().is_some_and(|p| p.name == "self"); consume atimpl_lookup.rs:371-377LookupOutcome::Foundviahas_self: trait_method_def.has_self. §10.2.1 TDD matrix adds negative-pin cellstest_bound_chain_associated_function_reports_has_self_false+test_has_self_misclassification_does_not_crash_eval. §10.2.3 implementation checklist mandates the persistence path. -
§10.R-023 — Built-in capability trait registration None handling (Step 4 gemini BS-10-E, Medium) — §10.2.2 design at section-10:321 (pre-edit) mandates
TraitRegistry::get_trait_by_name(capability).collected_methodschain; §10.2.1 discovery at section-10:299 (pre-edit) notes potential gap in built-in capability trait registration (Http/Logger/Env/FileSystem/Print/Clock/Random/Crypto/Cache).get_trait_by_namereturnsOption<&TraitEntry>(perregistry/traits/lookup.rs:22); unregistered built-in causesunwrap()panic, NOT clean diagnostic. Per CLAUDE.md §The One Rule: phase-gap-defect cure is enforcement, NOT silent panic. Anchor: §10.2.2 Fix shape step 1 mandates None-handling emitting clean diagnostic atwith ... = handlerspan; §10.2.1 TDD matrix addstest_capability_dispatch_when_trait_not_registered_reports_clean_errorcell; §10.2.3 implementation checkbox cites §10.R-023. -
§10.R-024 — Spec-anchor gap for §10.2.2 trait-shape validation surface (Step 4 opencode BS-10-H, Medium) — §10.2.2 design body at section-10:334 (pre-edit) cited bare “Clause 20 (capabilities)” — Clause 20 is entire chapter;
typeck.md §CP-3line 683 lists trait-shape validation as Target-only with no formal rule number or spec sub-clause mapping. Validation shape derived from first principles, not spec sub-clause. Anchor: §10.2.2 Spec citation block rewritten to MANDATE pre-implementation trace of exact sub-clause(s) defining (a) trait method enumeration, (b) handler method matching rule, (c) signature shape equivalence, (d) stateful-handler vs static-handler form. If sub-clause missing at required granularity, file/add-bugsubsystemspecseveritymediumand derive from spec’s stated handler semantics. Add canonical spec-anchored rule totypeck.md §CP-3removing target-only marker when spec sub-clause exists. §10.2.3 implementation gains pre-validation spec-anchor trace checkbox. -
§10.R-026 — Close-gate routing drift: Boolean TPR-clean → exit_reason-to-next_action mapping (Step 4 codex BS-10-C, Medium) — Pre-edit §10.N close-gate at section-10:406 was a Boolean “/tpr-review on §10 aggregate diff returns clean across codex + gemini + opencode” — does NOT model dispatched-skill exit-state classification per
skill-control-contract.md §Continuation Contract. Anchor: (a) section-10:89 success_criteria adds exit_reason-to-next_action mapping declaration (“clean closes; substantive findings append §10.R; predecessor/structural drift pivots through orchestrator; transport/tool failure logs and redispatches per canonical handler table”); (b) §10.N close-gate body cites exit_reason mapping. Also addresses §06 in depends_on (informational drift from audit cited-section-drift finding — overview makes §06 rewrite a Phase 1 predecessor for Phase 2/3/4):depends_on: ["03", "04", "06", "09"]per frontmatter edit. -
§10.R-028 — Interner-SSOT discipline for
selfparameter detection (Round 0 TPR gemini TPR-10-R0-002, High) — Pre-cure §10.2.0 prose at lines 346 + 402 instructed authors to computehas_self = params.first().is_some_and(|p| p.name == "self")using string literal"self". Shipped sibling pattern atcompiler_repo/compiler/ori_types/src/check/registration/impls.rs:506usesp.name == checker.well_known().self_kw(interned-NameSSOT viaWellKnownNames). String-literal comparison in non-test code is BANNED pertypes.md §TI-2(interning discipline) +impl-hygiene.md §Interning Discipline(== "identifier_name"ban). RESOLVED inline by Round 0 fix-and-commit: both §10.2.0 sites rewritten to citechecker.well_known().self_kwmirroring impls.rs:506 verbatim; §10.2.0 Goal block updated to cite §10.R-028 anchor.
§10.R aggregate /tpr-review (runs at §10.N close)
-
/tpr-reviewon §10 aggregate diff returns clean across codex + gemini + opencode. - Any new findings appended below as
§10.R-NNNentries with concrete anchors.
10.N Completion Checklist
- 10.0 complete — file splits landed;
registry/traits/mod.rsdropped to 450 lines (split target met, ≤500 cap satisfied); three sibling files exceed 500-line cap (lookup.rs=513, method_call.rs=503, impl_lookup.rs=522) and carry follow-up cures anchored under §10.R-007 / §10.R-009 / §10.R-010 (gated on §10.N close-gate via those[x]flips). All existing tests pass unchanged. Commit a20bc41b1. - 10.1 complete — bound-chain dispatch on Tag::RigidVar; cyclic + depth guards;
traits.ori30/30 green; operator dispatch overlap verified; §10.R-001 RigidVar origin scope expansion shipped; §10.1.1 TDD matrix authored; §10.1.3 unit tests pass. - 10.2 complete — capability-method dispatch; §10.R-002 has_self fork shipped; §10.R-005 MANDATORY trait-shape validation shipped; §10.R-003 canon arena panic bug closed; §10.R-004 “task #11” comment stripped;
propagation.ori7/7 green. - §10.R all findings resolved — §10.R-001 through §10.R-028 each
[x](range expanded per §10.R-020..§10.R-027 added at /review-plan Round 4 Step 4 blind-spots; §10.R-028 appended at /tpr-review Round 0 fix-and-commit for interner-SSOT discipline per TPR-10-R0-002). Atomic discipline: §10.N close-gate range cite MUST be updated whenever new §10.R-NNN entries land. - §10 aggregate
/tpr-reviewon full §10 diff → clean (codex + gemini + opencode). Exit-reason mapping per §10.R-026: clean exit closes §10.N; substantive findings append §10.R-NNN entries with concrete anchors; predecessor/structural drift pivots through orchestrator perrouting.md §6; transport/tool failure logs disposition + redispatches perskill-control-contract.md §Caller Foreground Dispatch Contract. - §10 aggregate
/impl-hygiene-review→ clean. -
/improve-toolingsection-close sweep — cyclic-guard pattern generalization; ParamEnv builder canonicalization. -
/sync-claudesection-close doc sync —typeck.md §TR-4(bound-chain walk specifics + ParamEnv) +typeck.md §CP-2/CP-3(MANDATORY trait-shape validation no longer target-only) updates. - Plan sync — §10 frontmatter
status: complete+reviewed: true;00-overview.mdQuick Reference updates;index.mdsection 10 status updated.
Exit criteria: All 3 subsections complete with TPR + hygiene clean; all §10.R findings resolved with concrete anchors; §10-touched test files green (traits.ori, propagation.ori); dual-exec parity preserved. §11 may begin.
HISTORY
-
2026-06-07 (later) — §10.R-010 impl_lookup.rs BLOAT split (litter-pickup owned by the §06.5 edit): the §06.5
emit_unknown_methodaddition grewimpl_lookup.rs522→670 (well over the 500 cap), making the split a §Scope-Expansion litter-pickup. Extracted two responsibilities intocalls/siblings:impl_signature.rs(147,resolve_impl_signature+ impl-binder substitution / arity check) +method_diagnostics.rs(113, theinto-not-implemented + general method-not-found emitters). impl_lookup.rs → 436, method_call.rs 447 — all under cap. Mechanical split, zero semantic change; 1082 ori_types lib pass, clippy clean. §10.R-007 (lookup.rs513) untouched this iteration (not in the edited set). compiler_repo changes remain uncommitted pending the parallel-sessionori_arcbuild settling (full spec-suite + dual-exec verification blocked). -
2026-06-07 (later) — §06.5 unified unknown-method diagnostic IMPLEMENTED; exposed + fixed §09.2 def-impl latent bug: Implemented the SSOT cure at
emit_unknown_method(impl_lookup.rs) wired into bothmethod_call.rsNotFound sites — closes the silent-poison class across receiver kinds: concrete (BUG-02-044{str:int}.map(...)now emits E2001) + rigid (§10.1@f<T>(x)=x.hello()now emits). Named-vs-anonymousTag::Vardistinction (VarState::Unbound{name}) separates an unbounded generic param (error) from an inference var (defer); placeholder tags (SelfType/BoundVar/Projection/Infer/Error) defer. The cure EXPOSED a real §09.2 latent bug: def-implself.method()dispatch never truly resolved (relied on the silent poison) — the def-impl Self RigidVar had no trait bound registered. Fixed by bindingdef_impl.trait_nameonself_rigidincheck_def_impl_method(def_impls.rs) soself.m()resolves via the §10.1 bound-chain. 1082 ori_types lib pass (was 1079 + 3 new §06.5 pins), clippy clean. Remaining: follow-on E2005 cascade suppression (the real diagnostic now fires alongside the lambda-param E2005s); §10.R-020 operator-dispatch path (operators.rslookup_method— separate, also silently accepts unbounded). Full spec-suite + dual-exec cross-scope-blocked by parallelori_arcbuild break; compiler_repo changes uncommitted pending that. -
2026-06-07 — §10.1.1 TDD matrix authored + §10.1-negative-case root cause UNIFIED with BUG-02-044/§06.5: After the orchestrator route-past fix (
8e6ed1f5) unblocked the picker to §10, authored the §10.1.1 bound-chain TDD matrix as 7 Rust cells inregistry/traits/tests.rs(test_bound_chain_*: single/multi-bound Found, no-match/empty NotFound, ambiguous, supertrait-inherited, duplicate-bound dedup) — all green; 1079 ori_types lib pass; clippy clean;traits.ori30/30. Verified the shipped bound-chain POSITIVE path works end-to-end (x.hello()withT: Greet,a + bwithT: Addcompile clean). DISCOVERED the §10.1 negative-case soundness gap: unbounded-rigid@f<T>(x) = x.hello()+@f<T>(a,b) = a + bsilently ACCEPT (must be E2003). Root cause traced + UNIFIED:emit_into_not_implemented(impl_lookup.rs:575) is into-only; non-into unknown methods on ANY receiver (concrete per BUG-02-044, rigid per §10.1) push no diagnostic →Idx::ERRORsilent poison. SSOT cure = §06.5 general unknown-method diagnostic (one site, all receiver kinds, E2005 suppression, Var-defer). §10.1-negative is gated on §06.5; §10.1-positive + §10.1.1 matrix complete. compiler_repo test additions uncommitted (cross-scope parallel-session ori_llvm tree; commit consolidates when that lands or via user-typed /commit-push —bypass). -
2026-05-17 — /review-plan SIGNIFICANT REWORK APPLIED + /tpr-review 5-round-cap close on §10:
/continue-roadmap plans/typeck-inference-completeness --autopilotrouted past recurring §04 anchored-elsewhere terminus to §10 via explicit section-arg dispatch. Orchestrator auto-dispatched/review-plan section-10 --autopilot --called-by-orchestratorforreviewed: falseflip. Workflow arc: Step 1 precheck clean → Step 1.7 integrity audit clean → Step 2/3 audit (5 findings, 0 halt-gating) → Step 4 /tp-help blind-spots (3-of-3 reviewers, 8 blind spots BS-10-A..H) → Step 5 editor (8 new §10.R-020..§10.R-027 finding entries with inline cures: DAG-conformant RESUME POINTER rewrite, subsection_depends_on + blocks_section_close ordering primitives, §10.2.0 redesign around TraitMethodDef.has_self persistence, §10.2.2 hardened with mandatory None-handling + spec-anchor trace, banned-patterns subsection, dual-exec-verify wiring, depends_on extension to [03, 04, 06, 09], close-gate exit_reason-to-next_action mapping) → Step 6 /tpr-review —skill review-plan —autonomous 5-round cap exit_reason cap_reached_max_rounds (Round 0: 4 actionable cured incl. §10.R-028 interner-SSOT discipline; Round 1: 3 cured + 5 META; Round 2: 3 cured + 3 META + 3 dropped; Round 3: 4 cured; Round 4: 2 cured + 3 META + 3 dropped; Round 5: 3 cured + 8 META re-verifications + 2 dropped; total: 19 actionable cures + 11 META re-verifications confirming §10.R catalog comprehensive + 8 Tier-3 confabulations dropped) → Step 7 verify clean → Step 8 status report → Step 9 verdict SIGNIFICANT REWORK APPLIED. Atomic flip executed viaflip_from_in_review_to_in_progress:status: in-review → in-progress;third_party_review.status: cap_reached_with_substantive;reviewed: false → trueper Step 9 verdictreviewed_flag_action=flip-to-true. Remaining work owned by 16 OPEN §10.R-NNN items (§10.R-001..§10.R-028 range) anchored to subsection cures; §10 close-gate (§10.N) gates on §04+§06+§09 reachingstatus: complete + reviewed: trueper §10.R-014 + §10.R-026 depends_on extension. Next session: §10.2.0 has_self detection implementation per §10.R-021 (TraitMethodDef.has_self persistence + impl_lookup.rs:371-377 consumption + “task #11” strip + §10.R-028 interner-SSOT discipline atchecker.well_known().self_kw); blocks 7 spec tests in capabilities/propagation.ori. Cross-scope blockers unchanged: §04.S.4 + §10.R-014 still gate on aims-burden §06 burden-lowering parallel-session work. /commit-push skipped per ongoing cross-scope dirty tree (autopilot dirty-tree-skip cure landed1778976564-b3f85e3b); plan-file edits persisted to disk; user-typed/commit-push --bypassin a future session consolidates all parallel work.