You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
diagram: unit inference errors underlined in the wrong place (UnitError kind collapsed to a boolean) #836
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.
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).
Activity
diagram: three-valued unit-error kind; plain-language inference text (#…