Repository navigation
Description
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_warningusesbuild_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
- Test debt. A positive test should fail if and only if the behavior under test regresses. Here, fixing an unrelated correctness bug (e.g. ltm: synthetic-fragment compilation uses an empty tables map, so link scores into graphical-function targets stub to 0 #546, or the SMOOTH-internal-stock case) will break -- or silently hollow out -- a test that is supposed to be about the diagnostic pass, not about that bug.
- Wrong failure signal. When ltm: synthetic-fragment compilation uses an empty tables map, so link scores into graphical-function targets stub to 0 #546 (or the SMOOTH case) is fixed, whoever does that work will see
test_ltm_fragment_compile_failure_surfaces_warningfail and have to reverse-engineer that the failure is expected and the fixture needs replacing -- exactly the kind of non-actionable breakage the project guidelines warn about.
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
- Part of the LTM epic epic: Loops that Matter (LTM) -- open work #488.
- Test debt created by / coupled to ltm: synthetic-fragment compilation uses an empty tables map, so link scores into graphical-function targets stub to 0 #546 (LTM synthetic-fragment compilation uses an empty
tablesmap). The graphical-function compile failure in ltm: synthetic-fragment compilation uses an empty tables map, so link scores into graphical-function targets stub to 0 #546 and the SMOOTH-internal-stock compile failure the current fixture exploits are the same hazard; fixing either one is what would break these positive tests.
Activity