Skip to content

ltm-finding: multiply_score_series/max_abs_score_series silently truncate to the shorter operand #678

Closed

Description

@bpowers

Summary

Two link-score series combinators in src/simlin-engine/src/ltm_finding.rs silently truncate to the shorter of their two operands:

  • multiply_score_series (~line 888): let n = a.len().min(b.len());
  • max_abs_score_series (~line 906): let n = a.len().min(b.len());

Both helpers compose two per-timestep link-score series (e.g. when collapsing a synthetic chain into a composite). If the two series ever differ in length, len().min(...) silently shortens the composite to the shorter operand with no diagnostic, which would corrupt downstream timestep alignment (the composite would no longer span step_count, and any consumer indexing by timestep would read misaligned or missing values).

Why it matters

This is a latent robustness gap. Today both inputs always span step_count, so the mismatch path is unreachable and the truncation is a no-op. But the silent min means that if a future change ever produces mismatched-length series (a real possibility as the synthetic-chain / aggregate machinery evolves), the failure would be a quiet numeric corruption of composite link scores rather than a loud crash -- exactly the kind of bug LTM correctness work has repeatedly had to hunt down after the fact.

Component(s) affected

  • src/simlin-engine/src/ltm_finding.rs (multiply_score_series, max_abs_score_series)

Possible approaches

  • Add a debug_assert_eq!(a.len(), b.len()) in both helpers so a length mismatch fails loudly in debug/test builds while production keeps the defensive min.
  • Or return None / propagate an explicit error on mismatch rather than silently truncating.

Severity

Minor -- currently unreachable; latent robustness / fail-loud gap.

Context

Identified during a 2026-06-02 LTM design review. Tracking epic: #488.

Activity

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