Skip to content

Add per-error informational diagnostics - #21604

Draft
zanieb wants to merge 4 commits into
mainfrom
zb/diagnostic-info-20260910
Draft

zanieb wants to merge 4 commits into
mainfrom
zb/diagnostic-info-20260910

Conversation

@zanieb

@zanieb zanieb commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

TOML failures currently place the parser's complete multiline display inside a cause, including a redundant heading and its own source gutter. Add typed presentation data for individual errors so the shared renderer can show the specific parser message, a source location, and a numbered excerpt when a valid span is available. Settings, workspace, and package-metadata errors retain the original parser error and the exact input used to produce it; recoverable warnings use the same presentation as fatal errors.

The presentation API also supports inline info: statements and guttered detail blocks. Detail blocks retain paragraphs and visibly escape terminal control characters. Errors without presentation data still use Display, and the underlying source chains, hints, and exit-status classification are unchanged.

Prior work:

@zanieb
zanieb added this pull request to stack #21588 September 10, 2026 23:27
@zanieb
zanieb force-pushed the zb/diagnostic-info-20260910 branch from a9e11d0 to 5c74074 Compare September 10, 2026 23:33
@zanieb
zanieb force-pushed the zb/diagnostic-info-20260910 branch from 5c74074 to 4109787 Compare September 11, 2026 00:16
@zanieb
zanieb force-pushed the zb/diagnostic-info-20260910 branch from 4109787 to 04dcf90 Compare September 11, 2026 01:00
@zanieb
zanieb force-pushed the zb/diagnostic-info-20260910 branch from 04dcf90 to 926360d Compare September 11, 2026 18:12
Base automatically changed from zb/labelled-error-causes-20260910 to main September 11, 2026 18:37
@zanieb
zanieb force-pushed the zb/diagnostic-info-20260910 branch from 926360d to b1405b1 Compare September 11, 2026 18:37
@astral-sh-bot

astral-sh-bot Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

uv test inventory changes

This PR changes the tests when compared with the main base revision.

  • Added tests: 15
  • Removed tests: 0
  • Changed suites: 4
uv: +2 / -0

Added:

  • uv::commands::diagnostics::tests::pyproject_diagnostics_retain_parser_sources
  • uv::commands::diagnostics::tests::settings_parse_error_retains_source

Removed: none

uv-errors: +10 / -0

Added:

  • uv-errors::source::tests::invalid_source_spans
  • uv-errors::source::tests::multiline_and_eof_spans
  • uv-errors::source::tests::single_source_line
  • uv-errors::source::tests::source_names_and_debug_output_are_safe
  • uv-errors::source::tests::untrusted_source_text
  • uv-errors::tests::format_info_between_causes
  • uv-errors::tests::format_info_on_root
  • uv-errors::tests::format_info_wrapping
  • uv-errors::tests::format_untrusted_info_details
  • uv-errors::tests::source_presentation_keeps_the_real_chain_and_trailing_hints

Removed: none

uv-pypi-types: +1 / -0

Added:

  • uv-pypi-types::metadata::pyproject_toml::tests::spanless_schema_error_retains_the_key_path

Removed: none

uv-toml: +2 / -0

Added:

  • uv-toml::diagnostic::tests::retains_the_original_parser_error
  • uv-toml::diagnostic::tests::spanless_deserialization_retains_the_key_path

Removed: none

This branch was previously deployed

1 inactive deployment
automations — 55c430e0 Deployed Sep 11, 2026 by zanieb via review / security review #46477
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