Repository navigation
Description
Summary
A reducer whose Iterated axes repeat a dimension -- out[D1] = SUM(sq[D1,D1,*]) over a square source sq[D1,D1,D3], or the inline form out[D1] = base[D1] + SUM(sq[D1,D1,*]) -- gets a synthetic agg node arrayed over result_dims = [D1,D1]. The agg->target element-edge emitter and the link-score projection disagree about which of those slots are real:
emit_agg_routed_edges(src/simlin-engine/src/db/analysis.rs) fans out ALL[D1,D1]slots, including off-diagonal ones:agg[a,b] -> out[a]. These edges are not causally real -- the target's slotout[a]only reads the diagonal slotagg[a,a].- The score projection (
result_dim_positionsinsrc/simlin-engine/src/db/ltm/link_scores.rs) maps BOTHD1occurrences to position 0, so per-slot link scores are emitted for the diagonal slots only.
Circuits through the off-diagonal edges therefore reference never-emitted link-score names, fail fragment compile, and produce loud, warned 0-stub loop scores. Measured at b7c559c1 (branch ltm-shape-phase1): the whole-RHS form yields 4 correctly-scored diagonal loops + 8 warned phantom 0-stub loops. The INLINE form behaves identically and predates the shape-expressiveness phase -- it is reachable on main today.
Provenance
Pre-existing inline-path defect. The shape-expressiveness phase (T4) widened its reachability to whole-RHS spellings -- a strict improvement over the parent whole-RHS state at T4's base (16 warned / 24 loops with zero correct scores), but the duplicated-axis disagreement itself is unchanged.
Why it matters
Severity: low. Square-matrix self-indexed reducers are rare; the degradation is loud (fragment-diagnostic warnings + 0-stubs), so no silent wrong numbers. But the phantom off-diagonal loops pollute the enumerated-loop surface and the warned count.
Components affected
src/simlin-engine/src/db/analysis.rs--emit_agg_routed_edgesfans out the full[D1,D1]cross-product of agg slotssrc/simlin-engine/src/db/ltm/link_scores.rs--result_dim_positionsmaps both duplicated-dim occurrences to one target position, pinning scores to the diagonal
Fix direction
A duplicated Iterated dim is semantically ONE axis read on the diagonal. Either:
- Canonicalize in the agg data model: dedupe/diagonalize duplicated result axes -- the read slice collapses to a single Iterated axis plus a diagonal constraint, so the agg is arrayed over
[D1]and both surfaces agree by construction (preferred; matches the epic's "two-surface decisions share one predicate" invariant), or - Patch the emitter: have
emit_agg_routed_edgesfan out only the diagonal slots whenresult_dimsrepeats a dimension, matching the existingresult_dim_positionsprojection.
Related
- epic: Loops that Matter (LTM) -- open work #488 -- LTM tracking epic (cluster A: read-slice / shape expressiveness)
- ltm: variable-backed partial reducers with broadcast or permuted axes keep the conservative cross-product (loop scores stub to 0) #764 -- broadcast/permuted-axis sibling shapes (distinct mechanism: duplicated axes, not reordered/extra ones); closing via the shape-expressiveness phase PR
docs/design-plans/2026-06-11-ltm-shape-expressiveness.md-- the phase design doc
Discovery context
Characterized by adversarial review during T4 of the LTM shape-expressiveness phase on branch ltm-shape-phase1, commit b7c559c1.
Activity
engine: defend ltm feeder slot pin and agg source slices (#787)