Skip to content

ltm-augment: parse fallback can silently break ceteris-paribus logic #311

Closed

Description

@bpowers

Summary

If partial-equation parsing fails during ceteris-paribus equation generation, the code silently falls back to lowercased original equation text without wrapping non-source dependencies in PREVIOUS().

Why this is a problem

Ceteris-paribus re-evaluation is central to LTM link score definition (Δ_x(z)). Silent fallback can produce equations that no longer compute partial change correctly, while still appearing to succeed. That creates hidden attribution errors.

Literature / algorithm alignment

Reference Section 3.1 requires re-evaluating with one source current and all other inputs previous. A fallback that omits dependency wrapping violates the core algorithm.

Current implementation behavior

build_partial_equation():

  • returns equation_text.to_lowercase() when parser returns Err or Ok(None).

Location:

  • src/simlin-engine/src/ltm_augment.rs (build_partial_equation)

Impact

  • Silent correctness degradation in edge-case expressions.
  • Difficult-to-debug mismatch between expected and actual link-score attribution.

Success criteria

  1. Eliminate silent fallback that changes semantics.
  2. On parse/transform failure, either:
    • return a structured error and fail augmentation, or
    • use a semantics-preserving fallback that still enforces ceteris-paribus wrapping.
  3. Add tests that force the failure path and assert deterministic, explicit behavior (error or guaranteed-correct fallback).
  4. Add diagnostic context in errors (variable name, original equation text).

Notes

This issue is distinct from the intentional flow-to-stock timing decision.

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