Skip to content

ltm: every-emitted-fragment-compiles harness over a generated corpus (prevention) #782

Description

@bpowers

Problem

LTM augmentation synthesizes link-score / loop-score / partial-equation fragments and compiles them alongside the user's model. Historically, a fragment that failed to compile was silently stubbed to a constant 0, producing quietly wrong loop scores. That defect class recurred repeatedly: #738, #741, #758, #759, and most recently #751 -- a live silent stub where 4 fragment-failure warnings hid all-zero scores behind a fixture that only asserted loop-ID prefixes. Each instance was found by review archaeology, not by CI.

The fixes so far make failures loud at runtime (model_ltm_fragment_diagnostics, the unscoreable_edges loud-skip/loop-drop invariant from PR #775) and add per-fixture zero-warning assertions. But nothing systematically generates novel shapes and checks that every emitted fragment compiles -- so the next shape-space corner (subscript form x reducer kind x module boundary x scoring surface is combinatorial) will again only be caught if a hand-written fixture happens to cover it.

Proposal

An invariant harness that, over a generated model corpus, compiles EVERY emitted LTM synthetic fragment and fails on any fragment-compile failure:

Why it matters

Epic #488's Strategy section names this the top prevention candidate: "Prevention beats archaeology. Extend the generated-corpus invariants (the element_graph_proptest pattern) so new defect classes fail in CI instead of being filed from review; an every-emitted-fragment-compiles harness is the top candidate." It would have caught the entire #738/#741/#758/#759 silent-stub family at birth, and the #751 live stub. It directly defends the epic's standing "no silent wrong numbers" invariant going forward.

Components

Context

Identified during the LTM burn-down strategy work (epic #488) and explicitly deferred by the shape-expressiveness design plan (docs/design-plans/2026-06-11-ltm-shape-expressiveness.md) with a mandate to file at landing time. Filed per that mandate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ciCI, build pipeline, test hygieneltmLoops that Matter (LTM) analysis subsystem

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions