Repository navigation
Description
Summary
recover_agg_hop_polarities (src/simlin-engine/src/db/ltm/loops.rs, ~lines 1633 and 1644 post-2f2dbbdc) never matches the agg endpoint of a SUBSCRIPTED arrayed-agg hop, so every scored/pinned loop through an arrayed synthetic agg classifies Undetermined (u{n}) even when the hop polarity is statically derivable.
The endpoint matches compare the bare canonical synthetic-agg name against the link's FULL ident:
// `source → agg`: the agg is this link's target.
if let Some((_, agg)) = synthetic.iter().find(|(name, _)| name == &link.to) {
...
// `agg → consumer`: the agg is this link's source.
if let Some((agg_ident, agg)) = synthetic.iter().find(|(name, _)| name == &link.from) {But an arrayed agg's element-graph hops carry a slot subscript -- the link ident is $⁚ltm⁚agg⁚0[a], not $⁚ltm⁚agg⁚0 -- so neither find ever matches, the hop links stay LinkPolarity::Unknown, and the loop-polarity reduction forces LoopPolarity::Undetermined.
The asymmetry is visible in the surrounding code: the non-agg side of the same comparisons already strips subscripts (strip_subscript(link.from.as_str()) / strip_subscript(link.to.as_str())); only the agg-endpoint side forgot to.
Reproduction
growth[r1] = 0.01*pool[r1] + SUM(matrix[r1,*]*scale)
scale = 0.001*SUM(pool[*]) + 0.01
The per-slot feeder loops through the arrayed agg score as u1/u2, although the SUM(matrix[r1,*]*scale) hops are genuinely derivable (Positive w.r.t. the matrix rows -- SUM is monotone in every element it reads).
Why it matters
- Silent polarity-label degradation: arrayed-agg loops report Undetermined instead of R/B. Loop SCORES are unaffected (this pass only patches polarity labels), so severity is low-medium.
- Cross-surface POLARITY disagreement: after the GH ltm: loop-score builder's PureScalar fast path never routes a loop through a scalar synthetic agg node (silent zero loop score) #737 fix, the detected surface's spliced agg hops from
expand_loops_through_routed_aggsuse BARE agg names, so they DO match and get patched -- detected says R/B while scored/pinned says U for the same arrayed-agg loop. (Cross-reference the parallel sibling finding on the arrayed-cycle agg id-namespace overlap between the two surfaces, being filed separately from the same review.)
Fix shape
Symmetric with the existing non-agg side: strip the subscript before the agg-name comparison on both endpoint matches, i.e. compare against strip_subscript(link.to.as_str()) / strip_subscript(link.from.as_str()) (as Ident::new(...) or a str compare). Add a fixture with an arrayed agg (iterated-dim reducer like SUM(matrix[r1,*]*scale)) asserting the recovered loops classify R/B, not U.
Component
src/simlin-engine/src/db/ltm/loops.rs (recover_agg_hop_polarities)
History / context
- ltm: cross-element loops through aggregate nodes always classify as Undetermined (agg-hop link polarity is always Unknown) #516 (closed) introduced this recovery machinery and fixed the scalar/subscript-free case; this is the arrayed-endpoint residual.
- ltm: loop-score builder's PureScalar fast path never routes a loop through a scalar synthetic agg node (silent zero loop score) #737's fix (
expand_loops_through_routed_aggs) made the detected surface immune (bare-name hops), turning this from a uniform U-labeling into a cross-surface disagreement. - Identified during adversarial review of branch
ltm-core-batch(HEAD ~db9136e5); verified pre-existing at the branch base and main-era commits -- NOT a regression of that branch.
Part of epic #488.
Activity
ltm: scoring-correctness and visibility batch from epic #488 (#775)