Skip to content

ltm: element-graph projection proptest never generates inlined reducers, so ThroughAgg routing is verified only vacuously #739

Closed

Description

@bpowers

Problem

The element-graph projection property test (src/simlin-engine/src/db/element_graph_proptest.rs) has a structural blind spot: project_spec_strategy() (line ~125) never generates a model containing an inlined (sub-expression) array reducer, e.g.

total = base + SUM(pop[*] * scale)

Because no generated model contains such a pattern, the aggregate-node hoisting machinery never fires under the proptest -- no synthetic $⁚ltm⁚agg⁚{n} node is ever minted. As a consequence:

are completely unexercised by the projection invariant element_edges_project_to_variable_edges (line ~238). The property "element edges project onto variable edges" holds only vacuously for the entire agg-routed edge class.

Why it matters

The projection invariant is the main structural guard on the element graph. The #533 fast-path bug (a scalar feeder of a hoisted reducer with a scalar target losing the agg hop) is exactly the kind of routing mistake this proptest exists to catch, yet the generator could never have found it -- and cannot detect a regression of the fix. Test coverage gap only; no production bug.

Components affected

  • src/simlin-engine/src/db/element_graph_proptest.rs (project_spec_strategy, project_to_variable_edges, element_edges_project_to_variable_edges)

Fix direction

  1. Extend project_spec_strategy with an inlined-reducer equation pattern (a reducer like SUM(arr[*]) or SUM(arr[*] * scalar) appearing as a sub-expression, not the whole RHS), covering both arrayed and scalar feeders/targets so both ThroughAgg arms are reachable.
  2. Teach the test's project_to_variable_edges to collapse synthetic $⁚ltm⁚agg⁚{n} nodes the same way real consumers trim them (splice from -> agg -> to into from -> to before comparing against the variable-level graph), so the invariant is stated over the trimmed graph.

Context

Surfaced during adversarial review of the #533 fix (branch ltm-bug-batch, commit 189e7d0). Related: #533, #520, #737, #738. Part of epic #488.

Activity

  1. added
    ltm
    on Jun 10, 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