Skip to content

Add source annotations to diagnostic messages - #1365

Draft
zanieb wants to merge 1 commit into
zb/rich-diagnostics-notes-20260910from
zb/rich-diagnostic-sources-20260910
Draft

zanieb wants to merge 1 commit into
zb/rich-diagnostics-notes-20260910from
zb/rich-diagnostic-sources-20260910

Conversation

@zanieb

@zanieb zanieb commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

The source renderer supports a single parser location but cannot express related locations or annotations on informational context. Extend retained source files into a shared byte-range annotation model for Diagnostic and Info, rendered through annotate-snippets. The renderer validates UTF-8 boundaries, shows annotated lines by default, and falls back to a file location when a range is unavailable or invalid. Existing TOML diagnostics retain their first-line excerpt limit, and formatting never rereads the input.

Builds on astral-sh#21604 and the design in #1362.

@zanieb
zanieb added this pull request to stack #1364 September 10, 2026 23:53
@astral-automations-bot astral-automations-bot Bot added area:error-messages Messaging when something goes wrong internal A refactor or improvement that is not user-facing labels Sep 10, 2026
@zanieb
zanieb removed this pull request from stack #1364 September 11, 2026 02:14
@zanieb
zanieb force-pushed the zb/rich-diagnostic-sources-20260910 branch from 9c4f1c2 to 030879f Compare September 11, 2026 02:15
@zanieb
zanieb added this pull request to stack #1382 September 11, 2026 02:17
@zaniebot zaniebot added risk:1 Negligible risk of localized mistakes that are obvious and easy to correct. priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. size:3 Substantial: interacting behaviors, difficult compatibility questions, or a careful migration. labels Sep 11, 2026
@zaniebot zaniebot added priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. priority:1 High: material security boundary, data loss, silent incorrect results, or major regression. and removed priority:3 Normal: useful features, documentation, usability, or routine efficiency improvements. priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. labels Sep 11, 2026
@zanieb
zanieb force-pushed the zb/rich-diagnostic-sources-20260910 branch from 030879f to 376e171 Compare September 22, 2026 20:01
@zanieb
zanieb removed this pull request from stack #1382 September 22, 2026 20:03
@zanieb
zanieb changed the base branch from zb/rich-diagnostic-source-overrides-20260910 to zb/rich-diagnostics-notes-20260910 September 22, 2026 20:11
@zanieb
zanieb force-pushed the zb/rich-diagnostic-sources-20260910 branch from 376e171 to 7648e8a Compare September 22, 2026 20:26
@zanieb
zanieb force-pushed the zb/rich-diagnostic-sources-20260910 branch from 7648e8a to 19211f8 Compare September 22, 2026 21:12
@zanieb
zanieb added this pull request to stack #2044 September 22, 2026 21:13
@codspeed

codspeed Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 41 untouched benchmarks


Comparing zb/rich-diagnostic-sources-20260910 (19211f8) with main (01cb90c)1

Open in CodSpeed

Footnotes

  1. No successful run was found on zb/rich-diagnostics-notes-20260910 (bd98ca5) during the generation of this report, so main (01cb90c) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@zaniebot zaniebot added risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. and removed risk:1 Negligible risk of localized mistakes that are obvious and easy to correct. priority:1 High: material security boundary, data loss, silent incorrect results, or major regression. labels Sep 23, 2026
@zaniebot zaniebot added the build:skip-release Disable building release binaries for a pull request label Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:error-messages Messaging when something goes wrong build:skip-release Disable building release binaries for a pull request internal A refactor or improvement that is not user-facing priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. size:3 Substantial: interacting behaviors, difficult compatibility questions, or a careful migration.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants