Skip to content

ltm: Piece 3 fragment-diagnostics positive tests are coupled to the lifetime of real fragment-compile bugs #547

Closed

Description

@bpowers

Summary

The positive tests for model_ltm_fragment_diagnostics added in commit dbc0844e ("engine: surface LTM synthetic-fragment compile failures", Piece 3 of the LTM-hardening effort) build their fixture in a way that relies on a real engine bug actually existing. When that bug is fixed, the fixture stops producing a fragment-compile failure and the tests break. The positive tests are coupled to the bug's lifetime.

Detail

model_ltm_fragment_diagnostics emits a Warning for every LTM synthetic variable whose fragment fails to compile. Testing it needs two kinds of fixture:

  • a negative fixture -- LTM fragments that all compile cleanly (no warning expected). This is fine: test_clean_ltm_model_emits_no_fragment_warning uses build_chain_scc_project, a plain scalar cycle, and is not coupled to any bug.
  • a positive fixture -- a fragment that genuinely fails to compile (warning expected). This is the coupled one.

In src/simlin-engine/src/db_ltm_unified_tests.rs, the positive fixture is build_smooth_loop_with_failing_fragment (used by test_ltm_fragment_compile_failure_surfaces_warning and test_model_ltm_fragment_diagnostics_emits_warning). It builds a goal-seeking model with a SMTH1 in the feedback path; the helper's own doc comment is explicit that it works because the link score into the SMOOTH's module-internal stock "does not compile as a scalar ceteris-paribus equation". In other words, the fixture produces a fragment-compile failure only because that compile-failure bug exists.

This is the same class of coupling regardless of which underlying bug the fixture happens to exploit. The SMOOTH-internal-stock compile failure and the empty-tables-map graphical-function compile failure (#546) are two instances of the same hazard: any time one of those real fragment-compile bugs is fixed, a positive test whose fixture depends on it will silently stop exercising a genuine failure (or break outright).

Why it matters

Component(s) affected

  • src/simlin-engine/src/db_ltm_unified_tests.rs -- build_smooth_loop_with_failing_fragment, test_ltm_fragment_compile_failure_surfaces_warning, test_model_ltm_fragment_diagnostics_emits_warning

Suggested fix direction

Add a test-only injection hook that can deterministically force a fragment-compile failure independent of any real engine bug -- e.g. a #[cfg(test)]-gated override that makes compile_ltm_synthetic_fragment (or model_ltm_fragment_diagnostics) treat a designated synthetic variable as a compile failure. The positive tests would then assert on the diagnostic pass's behavior without depending on the lifetime of #546 or the SMOOTH-internal-stock compile bug. The negative test (build_chain_scc_project) already stands alone and needs no change.

How it was discovered

Raised as a non-blocking nit during Piece 3's adversarial review and deferred with the reviewer's agreement, because the proper fix needs the non-trivial test-injection hook. Re-surfaced during the follow-up LTM deep review that also produced #546.

Linkage

Activity

  1. added
    ltm
    on May 14, 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