Repository navigation
Description
Summary
Discovery mode cannot score (or even discover) mapped-dimension loops: expand_a2a_link_offsets in src/simlin-engine/src/ltm_finding.rs (~line 676) -- the per-element expansion of a Bare A2A link score into discovery-graph edges -- subscripts both sides of the edge with the same element tuple drawn from the link score's dimensions:
for (idx, elems) in tuples.iter().enumerate() {
let subscript = subscript_from_elements(elems);
let from = Ident::new(&format!("{from_var}[{subscript}]"));
let to = Ident::new(&format!("{to_var}[{subscript}]"));
link_offsets.push(((from, to), base_offset + idx));
}This assumes the from-side variable's elements equal the link score's dimensions' elements. The link score's dimensions are the target's dimensions, so for a mapped edge -- source x over Region{r1,r2}, target over State{s1,s2} with a State→Region mapping, link score ApplyToAll over the target's dim (the shape the #527 fix on ltm-core-batch, commit a010931e, now emits for the element graph's mapped diagonal) -- it mints from-side node keys x[s1]/x[s2]: elements of the wrong dimension. Those keys match no real element node (x[r1]/x[r2]), so the discovery graph's mapped edges dangle and any loop through a mapped-dimension edge is undiscoverable and unscorable in discovery mode.
Exhaustive mode works correctly post-#527; the asymmetry is discovery-only.
Why it matters
Mapped-dimension loops are silently missing from discovery-mode analysis -- no warning, no diagnostic, the loops simply never appear. Discovery is the mode large models auto-flip into (MAX_LTM_SCC_NODES gate), so the models most likely to use dimension mappings are exactly the ones affected. Severity: low-medium (silent completeness gap, not wrong numbers).
Component
src/simlin-engine/src/ltm_finding.rs--expand_a2a_link_offsets(~line 676) and its callerparse_link_offsets(the Bare A2A arm, ~line 610)src/simlin-engine/src/dimensions.rs--DimensionsContext::mapped_element_correspondence(line 670; the fix's data source)
Fix direction
Translate the from-side element through the same DimensionsContext::mapped_element_correspondence helper the element graph now uses (added in src/simlin-engine/src/dimensions.rs by commit a010931e for the #527 expand_same_element diagonal): when the link score's dimension differs from the from-side variable's declared dimension but a mapping exists, emit x[<mapped source elem>] → to[<target elem>] instead of subscripting both sides with the target's element. This requires threading the from-side variable's declared dimensions (available via the ltm_var_map / model metadata) and a DimensionsContext into the expansion, keeping the discovery graph's node keys in lockstep with the element nodes model_element_causal_edges produces.
Discovery context
Pre-existing -- discovery's per-element expansion predates the branch. Surfaced during GH #527 work on branch ltm-core-batch (commit a010931e): the exhaustive-mode mapped scoring fix made the discovery asymmetry visible. Related: #527 (element-graph mapped diagonal, the exhaustive-side fix), #273 (LTM arrays umbrella), epic #488.
Activity
bpowers commentedon Jun 12, 2026
Second leg of the same defect: SCALAR-source Bare A2A link scores (the GH #790 feeder)
The phantom-from-key bug is not limited to mapped-dimension sources.
expand_a2a_link_offsetssubscripts BOTH endpoints with the link score's dimension elements unconditionally, so for a scalar source it invents afrom[elem]node key that never matches the scalar source's bare node. The edge dangles in the discovery search graph and every loop through it is undiscoverable in discovery mode -- the same silent completeness gap this issue documents for mapped dims, with the same severity class (low-medium; missing loops, not wrong numbers).Affected scores
Every scalar-feeder Bare A2A link score:
scale -> $:ltm:agg:Nfeeder score (emit_source_to_agg_link_scores,src/simlin-engine/src/db/ltm/link_scores.rs), andltm-phase1-residuals, commits0cae6443/d15e8e94) also the whole-RHS variable-backed feeder scorescale -> growthemitted bytry_scalar_to_arrayed_link_scores' new routing.Degradation-mode note specific to #790
Before the #790 fix, the broken per-target-element feeder scores at least produced LOUD fragment-failure Assembly warnings in discovery mode (constant-0 scores). After the fix the emission compiles cleanly, so discovery mode now has ZERO warnings while loops through the feeder are silently absent from discovery search results. (Exhaustive mode, the primary surface, is correctly fixed by #790.) The renamed test
scalar_feeder_of_whole_rhs_reduce_emits_cleanly_in_discovery_mode(src/simlin-engine/tests/integration/ltm_array_agg.rs) documents the gap in its scope note ("the discovery offsets fix is queued separately"); this issue is that durable tracking item, for both legs.Fix coverage
This issue's fix direction -- translate the from-side through the from-variable's DECLARED dims instead of the score's dims -- covers the scalar leg as the degenerate case: a dimensionless from-side should emit the bare
fromkey (one edge per target-element offset, all sharing the bare from node). Closing this issue should verify both legs: a mapped-dims fixture AND a scalar-feeder fixture (e.g. the #790growth[D1] = SUM(matrix[D1,*] * scale)shape, asserting thepop -> scale -> growth -> poploop is discoverable in discovery mode).Discovery context
Scalar leg found during the adversarial code review of commits
0cae6443+d15e8e94on branchltm-phase1-residuals(2026-06-12). Related: #790 (the feeder routing), epic #488.[-]ltm-finding: discovery mode mints phantom from-side element keys for mapped-dimension A2A edges (mapped loops undiscoverable)[/-][+]ltm-finding: discovery mode mints phantom from-side element keys for Bare A2A edges (mapped-dimension and scalar-source legs; loops undiscoverable)[/+]