Problem
The diagram's per-field unit-error underline misattributes unit inference errors to the units field.
UnitError in src/core/datamodel.ts carries only a boolean isConsistencyError, collapsing the engine's three-valued unit-error kind (Definition | Consistency | Inference -- see SimlinUnitErrorKind in src/engine/src/internal/types.ts). convertErrorDetails in src/diagram/project-controller.ts sets isConsistencyError = (unitErrorKind === Consistency), so an Inference error is treated exactly like a Definition error downstream.
But an inference error's start/end offsets point into the equation, not the units string (see format_unit_error's InferenceError arm in src/simlin-engine/src/errors.rs). highlightRangeForField in src/diagram/equation-highlight.ts applies those equation-relative offsets to the units string, producing a red underline over the wrong span of the units box.
Why it matters
User-facing diagnostic correctness: the red underline points at an arbitrary, wrong span of the units declaration, misleading users about where the problem is. Low severity (display-only), but it undermines trust in the per-field error affordance.
Components affected
src/core/datamodel.ts (UnitError.isConsistencyError)
src/diagram/project-controller.ts (convertErrorDetails)
src/diagram/equation-highlight.ts (highlightRangeForField)
Possible approach
Replace the boolean with kind: 'definition' | 'consistency' | 'inference' on core's UnitError, and give inference errors their own placement rule -- probably a warning underline in the equation field (like consistency errors), or highlighting the whole units declaration.
Context
Pre-existing bug discovered in July 2026 while fixing unit-error display; the consistency and definition paths are now placed correctly -- only inference is mislocated. Related but distinct from #835 (ErrorCode enum numbering skew in the same conversion path).
Problem
The diagram's per-field unit-error underline misattributes unit inference errors to the units field.
UnitErrorinsrc/core/datamodel.tscarries only a booleanisConsistencyError, collapsing the engine's three-valued unit-error kind (Definition | Consistency | Inference -- seeSimlinUnitErrorKindinsrc/engine/src/internal/types.ts).convertErrorDetailsinsrc/diagram/project-controller.tssetsisConsistencyError = (unitErrorKind === Consistency), so an Inference error is treated exactly like a Definition error downstream.But an inference error's
start/endoffsets point into the equation, not the units string (seeformat_unit_error'sInferenceErrorarm insrc/simlin-engine/src/errors.rs).highlightRangeForFieldinsrc/diagram/equation-highlight.tsapplies those equation-relative offsets to the units string, producing a red underline over the wrong span of the units box.Why it matters
User-facing diagnostic correctness: the red underline points at an arbitrary, wrong span of the units declaration, misleading users about where the problem is. Low severity (display-only), but it undermines trust in the per-field error affordance.
Components affected
src/core/datamodel.ts(UnitError.isConsistencyError)src/diagram/project-controller.ts(convertErrorDetails)src/diagram/equation-highlight.ts(highlightRangeForField)Possible approach
Replace the boolean with
kind: 'definition' | 'consistency' | 'inference'on core'sUnitError, and give inference errors their own placement rule -- probably a warning underline in the equation field (like consistency errors), or highlighting the whole units declaration.Context
Pre-existing bug discovered in July 2026 while fixing unit-error display; the consistency and definition paths are now placed correctly -- only inference is mislocated. Related but distinct from #835 (ErrorCode enum numbering skew in the same conversion path).