Files
Imhotep/packages
John Dvorak 6a98d8ce9e refactor: compiler pipeline hardening — parser diagnostics + exhaustive switches + golden equivalence
grammar.ts:
  - Replace 2 parseAssertion console.warn + return-null patterns with
    this.errorWithCode() throws, producing structured ParseError
    diagnostics instead of silently skipping invalid clauses
  - Maintain parseBlock's return-null contract for unmatched tokens
    (caller loops over tokens expecting null for non-block starters)

compiler.ts:
  - buildOptionsFromAssertion: convert 3 standalone ifs to if/else if/else
    with never-exhausted throw on unknown assertion type
  - compileToFormula: replace silent return-null with throw on unknown
    assertion type

validator.ts:
  - validateAssertion: replace silent return {valid:true} for unknown
    assertion types with throw

fol-compiler.ts:
  - compileSingleAssertion: replace silent return-null with throw

Golden equivalence tests (fol-equivalence-golden.test.ts):
  7 new deterministic tests covering gaps identified in REFACTOR item 5:
    - Size assertions: atLeast, atMost, between (fluent vs dense)
    - Compound assertions: .and chain, .or chain
    - Options: gap, tolerance in jnd
  Documents known discrepancy: fluent size.* prefix vs dense canonical name
  (fol-compiler normalizes at FormulaNode level, canonical path does not)

Existing property-based equivalence tests cover spatial, quantifier,
and frame equivalence. Topology predicates have no fluent API surface
(dense-DSL-only), so equivalence must be verified at evaluation level
(already covered by hard E2E topology tests).

662 tests pass (315 DSL + 141 core + 149 solver + 57 E2E).
2026-05-22 15:23:29 -07:00
..