Repository navigation
Description
Summary
When a mapped-dimension sliced reducer is declined for aggregate-node hoisting -- specifically the element-mapped case behind the #756 positional-only gate -- the reference falls back to the conservative (un-hoisted) path, and the conservative link score it emits does not compile: the emitter mints $⁚ltm⁚link_score⁚matrix→growth with dims=[], a SCALAR equation whose body references the apply-to-all (arrayed) idents matrix and growth. Fragment compilation fails (22 Assembly warnings on the probe fixture), and every loop score through the edge is silently stubbed to constant 0.
This directly contradicts the documented contract. The rustdoc above link_score_var_name (src/simlin-engine/src/ltm_augment.rs, ~1570-1583 at 74f53661) says of the still-declined cases ("a mapped sliced reducer the correspondence declines (element-mapped -- GH #756 -- or reverse-declared -- GH #757)"): "a coarse conservative score is the right semantics for all of those." Empirically false: the declined cases get no score at all -- a warned zero-stub. The matching claim in the RefShape doc in src/simlin-engine/src/db/analysis.rs is likewise wrong for this case. (A doc fix citing this issue is queued on the ltm-core-batch branch.)
Fixture shape
State = {CA, NY} -- target dim
Region = {west, east} -- source dim, with an EXPLICIT element map State -> Region
(element-wise map declared on the dimension, not a
positional/name correspondence)
matrix[Region, D2]
growth[State] = 1 + SUM(matrix[State, *]) -- inline sliced reducer over the mapped pair
... a feedback loop closed through matrix and growth
Because the State/Region correspondence is an explicit element map, mapped_element_correspondence declines it (the #756 positional-only gate in src/simlin-engine/src/ltm_agg.rs), the reducer is not hoisted into a $⁚ltm⁚agg⁚{n} node, and the reference stays on the conservative path. The conservative per-shape link score is then emitted scalar (dims=[]) while its equation references the arrayed A2A variables -- fragment compile fails, and the loop-score equations that reference the never-compiled link score stub to 0.
Verified byte-identical at the parent of 74f53661: pre-existing, not a regression of the #534 work. In fact the #534 fix removed this fate for positional mappings by hoisting them; only the still-declined cases remain on the broken conservative path:
- element-mapped dimension pairs (declined by the engine: permuted element maps were read by position, giving wrong values #756 positional-only gate) -- this issue's fixture, and
- reverse-declared subscripted classification (ltm: subscripted reverse-declared mapped reference classifies DynamicIndex, keeping the cross-product despite the compiler's diagonal #757).
Why it matters
Medium severity. Silent zero loop scores plus a fragment-diagnostic warning flood for any model with an inline sliced reducer over an element-mapped dimension pair. The model class is currently rare because element maps barely work end-to-end (#756 executed-lowering bug, #753 different-cardinality compile failure), but the failure is the worst kind: the model compiles and simulates fine, LTM output looks plausible, and the affected loops just read 0.
It also invalidates the safety story used to justify the #756/#757 declines: "the conservative path is still correct, just imprecise" (see #534's "Why it matters", and the rustdoc cited above). The conservative path for these shapes is not coarse-but-correct -- it is non-compiling.
Components affected
src/simlin-engine/src/db/ltm/link_scores.rs--emit_per_shape_link_scoresand the dims computation for the conservativeBare/Wildcardlink-score variable (emitsdims=[]for an edge whose endpoints are arrayed)src/simlin-engine/src/ltm_augment.rs-- the per-shape partial-equation builder (the scalar equation body referencing A2A idents), and thelink_score_var_namerustdoc making the false "right semantics" claimsrc/simlin-engine/src/db/analysis.rs-- theRefShapedoc with the matching claim;emit_edges_for_reference's conservative cross-product arm (the edges whose loop scores reference the broken name)src/simlin-engine/src/ltm_agg.rs--mapped_element_correspondence/ the engine: permuted element maps were read by position, giving wrong values #756 positional-only gate (the decline that routes this shape onto the conservative path)
Possible approaches
- Make the conservative per-shape link score dimension-correct: emit it arrayed over the target's dims (or the appropriate from/to shape) so the partial equation's A2A references type-check, restoring the intended coarse-but-compiling score. This also serves ltm: un-hoisted multi-source iterated-dim-feeder reducer emits silent garbage arrayed loop score (combined_read_slice slice-disagreement carve-out) #743's "make the conservative path correct-or-visibly-degraded" half.
- Alternatively (or additionally), shrink the declined set: extend the ltm: mapped-dimension sliced reducers are not hoisted into aggregate nodes (compute_read_slice declines a remapped iterated axis) #534 hoisting machinery to honor explicit element maps once engine: permuted element maps were read by position, giving wrong values #756 fixes executed element-map lowering -- then the element-mapped case is hoisted like the positional case and never reaches the conservative path.
- At minimum, route the failure through a visible diagnostic rather than warnings + zero-stubs (the ltm: failed implicit-helper fragment compile emits no diagnostic (model_ltm_fragment_diagnostics skips model_ltm_implicit_var_info) #741/ltm: Piece 3 fragment-diagnostics positive tests are coupled to the lifetime of real fragment-compile bugs #547 fragment-diagnostic surface), and fix the two doc claims.
Discovery context
Unmasked during adversarial review of the GH #534 work on branch ltm-core-batch (commit 74f53661, "engine: hoist mapped-dimension sliced reducers into agg nodes"). The #534 fix hoists positionally-mapped sliced reducers, which made the remaining declined cases (element-mapped, reverse-declared) the only inhabitants of this conservative path -- probing them revealed the path was never compiling for arrayed endpoints.
Tracking
Part of LTM tracking epic #488. Related but distinct:
- ltm: mapped-dimension sliced reducers are not hoisted into aggregate nodes (compute_read_slice declines a remapped iterated axis) #534 -- mapped-dimension sliced reducer hoisting (the fix whose review unmasked this; its "conservative path is still correct" claim is what this issue falsifies for the declined residue)
- engine: permuted element maps were read by position, giving wrong values #756 -- engine executed A2A lowering ignores explicit element maps (the reason the positional-only decline gate exists)
- ltm: subscripted reverse-declared mapped reference classifies DynamicIndex, keeping the cross-product despite the compiler's diagonal #757 -- reverse-declared subscripted classification keeps the cross-product (the other still-declined shape that lands on this same broken path)
- ltm: un-hoisted multi-source iterated-dim-feeder reducer emits silent garbage arrayed loop score (combined_read_slice slice-disagreement carve-out) #743 -- un-hoisted multi-source slice-disagreement reducer (different decline reason, different symptom: silent garbage values; this issue is warned zero-stubs from a non-compiling scalar link score)
- ltm: loop scores through a variable-backed partial-reduce reducer reference never-emitted link-score names, stubbing to 0 #752 -- variable-backed partial-reduce loop scores reference never-emitted names (similar zero-stub symptom, different mechanism: missing names vs. ill-dimensioned emitted equation)
Activity
engine: gate mapped link-score dims on a bare-classified site