Skip to content

feat: render comline-core's diagnostics properly in the CLI (Phase 3) - #46

Merged
Kinflou merged 2 commits into
mainfrom
feat/diagnostics-phase3
Oct 5, 2026
Merged

Kinflou merged 2 commits into
mainfrom
feat/diagnostics-phase3

Conversation

@Kinflou

@Kinflou Kinflou commented Oct 5, 2026

Copy link
Copy Markdown
Member

Summary

Phase 3 of the error-reporting plan — the CLI bridge. Bumps comline-core/comline-codegen pins to core#69, which brings Phase 1+2's work: parse errors now render as real ariadne source snippets (line:column, caret) instead of a Debug-dumped Vec<ParseError>, routed through one shared Diagnostic type.

  • core_err now branches on whether the wrapped error's detail is multi-line — a rendered snippet gets its own paragraph instead of being glued onto the "<context>: " prefix on one line.
  • The per-language-generator error bridge (generate.rs:194) is left alone, with a comment explaining why: those errors are about schema/package structure, not source text — no span to render a snippet against.
  • No miette::Diagnostic/SourceCode/#[label] wrapping needed, and no miette::set_hook installation — the string arriving from comline-core is already fully rendered, terminal-ready text.

Test plan

  • cargo build (single comline-core/comline-codegen resolved)
  • cargo test (65 passing, no regressions)
  • cargo clippy --all-targets (no new warnings)
  • New integration tests reproducing the exact reported bug end-to-end through the real CLI binary (broken schema + broken config.idp), asserting stderr never contains "ParseError {"/"FailedNode(" and does contain the filename plus a line:column-shaped location
  • Manual check: piped/non-TTY output has zero stray ANSI escape codes

Kinflou added 2 commits October 5, 2026 19:02
Bumps the comline-core/comline-codegen pins to core#69 (Phase 1+2 of the
error-reporting work: parse errors now render as real ariadne source
snippets instead of Debug-dumped Vec<ParseError>s, routed through one
shared Diagnostic type).

core_err now branches on whether the wrapped error's detail is multi-line
- a rendered snippet gets its own paragraph instead of being glued onto
the "<context>: " prefix on one line. The per-language-generator error
bridge in generate.rs is left alone (documented why: those errors are
about schema/package structure, not source text, so they carry no span to
render a snippet against).

New integration tests reproduce the exact reported bug end-to-end through
the real CLI binary, for both a broken schema and a broken config.idp,
asserting stderr never contains "ParseError {"/"FailedNode(" and does
contain the filename plus a line:column-shaped location.
@Kinflou
Kinflou merged commit 6023f8b into main Oct 5, 2026
2 checks passed
@Kinflou
Kinflou deleted the feat/diagnostics-phase3 branch October 10, 2026 21:05
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