Skip to content

fix(diagnostics): report errors in the included header - #98

Merged
mremond merged 1 commit into
mainfrom
infinitary-batch/b0500ed0
Nov 29, 2026
Merged

mremond merged 1 commit into
mainfrom
infinitary-batch/b0500ed0

Conversation

@mremond

@mremond mremond commented Nov 29, 2026

Copy link
Copy Markdown
Member

Why

A mistake in an included Erlang header could send you to an unrelated line in the module that included it.

What changed

  • Nera’s build and check commands identify the offending header, including through nested includes.
  • The language server updates header errors while you type, save, and close files.

Before and after

Before: The compiler and the language server could both point at the including module instead of the header.

After: Build and check report the nested header at 3:14, and the language server names the header even before you save the include.

Compiler output for a nested include

BeforeAfter

Both build and check show an illegal float at nested.erl line 3, column 11, with carets under the include path.

Both build and check show an illegal float in bad_float.hrl at line 3, column 14, with carets under 1.0e309.

Language server report for an unsaved include

BeforeAfter

The language server names service.erl and shows a range from line 2, column 20, to line 3, column 3.

The language server names include/limits.hrl and shows the illegal float on line 3 from column 14 to column 21.

Checked

Live validation: Demonstrated for this version. 3 of 3 scenarios driven live in the product.

Scenario Result Evidence
Find errors in direct and nested headers ✅ Passed live Build and check matched Erlang’s compiler at 3:14 in the headers, 1:14 at an unfinished header and 4:10 in the module itself.
Keep editor errors current while typing, saving, and closing ✅ Passed live Either save path cleared the obsolete report, and correcting the header cleared push and pull. Plain syntax feedback arrived before discovery resumed.
Preserve include priority and built-in macro values ✅ Passed live The preferred header replaced the fallback, the linked directory kept its physical target, and the original macro value comparisons still matched.
  • Misplaced header and macro errors: Kept header and argument ranges through preprocessing failures without changing macro values.
  • Stale or missing editor reports: Tracked which module and saved file produced a report so live updates preserve unrelated diagnostics.
  • Saves and overlapping checks: Tracked missing and preferred headers and rejected older reads to keep diagnostics current.
  • Slow or failed project discovery: Shared lookups and let plain parser checks run independently to preserve typing feedback.
  • Saves through linked paths: Matched editor paths, link locations and targets so either save path updates the report without changing include selection.
  • Regression coverage: Exercised production paths with real includes and showed the regression tests reject the old behavior.
How it was checked

Independent code and live-proof reviews passed.

The release build, lint, 2,298 workspace tests, and allocator and stacktrace checks passed.

The native suite passed 551 cases with two expected skips for external modules. Both save regressions passed ten consecutive runs.

Risk

Risk above low: Blast radius, medium — The change spans compiler source mapping and language-server diagnostic ownership.; Novelty, medium — Diagnostic ownership and disk-read matching extend the existing language server.

Full risk assessment
Dimension Level Why
Blast radius medium The change spans compiler source mapping and language-server diagnostic ownership.
Behavior low The fix corrects file locations and stale reports without changing include selection.
Undo low Reverting restores the previous diagnostics without migrating data or settings.
Evidence low The exact release passed CLI and language-server scenarios and independent review.
Sensitivity low The change handles diagnostics and does not touch credentials or settings.
Novelty medium Diagnostic ownership and disk-read matching extend the existing language server.
Dependencies low The change adds no dependencies.

Nera’s build and check commands identify the offending header, including through nested includes.

The language server updates header errors while you type, save, and close files.
@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 29, 2026
@mremond
mremond merged commit 40999f5 into main Nov 29, 2026
22 checks passed
@mremond
mremond deleted the infinitary-batch/b0500ed0 branch November 29, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant