Repository navigation
Description
Summary
A BARE arrayed argument to a whole-RHS reducer -- SUM(other) with other[D1] arrayed, inside an A2A equation over D1 -- is consumed PER-SLOT by execution but hoisted by LTM into a SCALAR synthetic aggregate whose value is the WHOLE-ARRAY sum. Every score touching the reducer is silently wrong (unwarned, sustained): phantom cross-element edges, a wrong changed-first freeze, and wildly inflated loop scores.
This is the bare-ARRAYED-arg sibling of #779 (bare SCALAR feeder of an un-hoisted reducer). Same root cause -- the read-slice vocabulary cannot express a bare iterated read -- but #779's loud-decline fix (commit ef91194d, branch ltm-phase1-residuals) covers only the changed-LAST live-feeder leg. The synthetic-agg halves and the changed-FIRST whole-reducer freeze still score silently wrong.
Fixture (reproduced at ef91194d with a TestProject fixture)
D1 = {a, b}
pop[D1] -- stock
other[D1] = pop * 0.01
frac[D1] = pop * 0.005
growth[D1] = SUM(other) * frac -- flow into pop
Execution resolves the bare other in the A2A-over-D1 context to the ACTIVE slot: SUM(other) = other[r] (a sum over one scalar), so growth[a] at t0 = 1.0 * 0.5 = 0.5 -- NOT the whole-array sum 2.0 * 0.5.
What LTM does instead (all unwarned)
enumerate_agg_nodeshoistsSUM(other)into a scalar synthetic agg$:ltm:agg:0 = SUM(other)whose VALUE is the whole-array sum (2.0): the hoisted fragment evaluates outside the A2A context, so the bare ref reads the full extent.- The element graph models cross-element edges
other[a/b] -> $:ltm:agg:0 -> growth[a/b]that do not exist in execution (execution has only the diagonalother[r] -> growth[r]). - The changed-first partial for the
frac -> growthedge freezesPREVIOUS(SUM(other))-- again the whole-array sum -- into the partial.
Measured result (ZERO warnings):
$:ltm:link_score:frac->growth= ~100.7 sustained$:ltm:link_score:$:ltm:agg:0->growth[a]= ~100.7- loop u1 = ~2512; loops u2/u3 = ~50
This violates epic #488's standing "no silent wrong numbers" invariant.
Components affected
src/simlin-engine/src/ltm_agg.rs--enumerate_agg_nodeshoists the bare-argSUM(other)as an all-Reduced slice; no vocabulary for a bare iterated read (the per-slot consumption execution actually performs)src/simlin-engine/src/ltm_augment.rs--wrap_non_matching_in_previouswhole-reducer changed-first freeze captures the whole-array sumsrc/simlin-engine/src/db/ltm/link_scores.rs-- the emitted agg-routed and feeder link scores
Possible approaches
- Teach the slice vocabulary a bare iterated read (the fix direction ltm: bare-spelled feeder of un-hoisted multi-source reducer gets silent wrong changed-last loop score (per-element partial vs broadcast execution) #779 also names): classify the bare arrayed arg the way execution treats it -- the active slot of the owner's A2A dimension -- so the "reducer" is recognized as a per-slot identity read (diagonal element edges, no whole-array agg, per-slot partials).
- Or, short-term, decline the bare-arrayed-arg reducer shape loudly (warning + dropped dependent loop scores per the ltm: declined element-mapped sliced reducer emits a non-compiling scalar link score on the conservative path (loop scores stub to 0) #758/ltm: PartialEquationError link-score skips don't drop dependent loop scores via unscoreable_edges #780 contract), restoring the no-silent-wrong-numbers invariant without the classification work.
Note the interaction with engine semantics: execution's per-slot resolution of a bare arrayed name inside a reducer is the XMILE A2A reading (a bare arrayed name in an A2A equation denotes the active element). Whatever the engine-side resolution of the related execution issue (see the co-filed engine issue on the bare-ref-with-sliced-co-source x|D1| bug), LTM must model what execution actually computes.
Discovery context
Empirically confirmed during the adversarial review of commit ef91194d ("engine: decline bare-spelled feeder of un-hoisted reducer loudly", the GH #779 fix, branch ltm-phase1-residuals), reproduced at that commit with TestProject fixtures. Pre-existing, not a regression from that commit; out of scope for #779's fix.
Tracking
Part of LTM tracking epic #488 (cluster A). Related: #779 (bare scalar feeder sibling; its fix covers only the changed-last live-feeder leg), #743/#767 (the subscripted-spelling lineage), #738 (closed scalar-target agg compile sibling).
Activity