Skip to content

ltm: duplicated-result-dim aggregate fans out phantom off-diagonal agg->target element edges (warned 0-stub loops) #778

Closed

Description

@bpowers

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 slot out[a] only reads the diagonal slot agg[a,a].
  • The score projection (result_dim_positions in src/simlin-engine/src/db/ltm/link_scores.rs) maps BOTH D1 occurrences 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_edges fans out the full [D1,D1] cross-product of agg slots
  • src/simlin-engine/src/db/ltm/link_scores.rs -- result_dim_positions maps 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:

  1. 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
  2. Patch the emitter: have emit_agg_routed_edges fan out only the diagonal slots when result_dims repeats a dimension, matching the existing result_dim_positions projection.

Related

Discovery context

Characterized by adversarial review during T4 of the LTM shape-expressiveness phase on branch ltm-shape-phase1, commit b7c559c1.

Activity

  1. added
    ltm
    on Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ltm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions