Repository navigation
Conversation
de73bc8 to
3d1befa
Compare
Merging this PR will improve performance by 11.6%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ |
Simulation | discover_workspace_from_all_members |
151.5 ms | 135.8 ms | +11.6% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing zb/rich-diagnostic-info-20260922 (33b8574) with main (64e2ac8)
Footnotes
-
35 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
52e2404 to
6009f11
Compare
6009f11 to
bc37bfc
Compare
| /// Attach additional context to this error. | ||
| #[cfg(test)] | ||
| #[must_use] | ||
| pub(super) fn with_info(mut self, info: Info<'a>) -> Self { | ||
| self.info.push(info); | ||
| self |
There was a problem hiding this comment.
[P3] Defer informational rendering until it has a production consumer
with_info and the Info constructors are private and test-only, so production diagnostics always have an empty info vector. Nevertheless, the shared renderer carries the field and implements wrapping, detail blocks, and rendering calls for it. Defer this unused machinery and its synthetic tests until a concrete error needs informational context; the TOML snippet implementation can remain independently reviewable.
| fn diagnostic_for_error<'a>(error: &'a (dyn StdError + 'static)) -> Option<Diagnostic<'a>> { | ||
| uv_settings::diagnostic_for_error(error) | ||
| .or_else(|| uv_workspace::pyproject::diagnostic_for_error(error)) | ||
| .or_else(|| uv_pypi_types::diagnostic_for_error(error)) | ||
| } |
There was a problem hiding this comment.
[P3] Share the standard TOML diagnostic dispatcher
This dispatcher duplicates the same three providers, in the same order, in uv-lock-operations/src/lock.rs and uv/src/commands/diagnostics.rs. Maintaining supported TOML diagnostics now requires coordinated edits across fatal-error rendering and two recoverable-warning paths. Extract these identical dispatchers into one shared command-level helper, leaving the warning-specific message adapters local, so presentation changes apply consistently.
bc37bfc to
e41456b
Compare
e41456b to
bb1dbd1
Compare
| textwrap = { workspace = true } | ||
| serde-untagged = { workspace = true } |
There was a problem hiding this comment.
[P3] Remove the unused settings dependencies
serde-untagged has no consumer in uv-settings, and the warning refactor removes the crate’s last textwrap use. Both declarations are now unused dependencies, which the repository checks with cargo-shear --deny-warnings. Remove both manifest entries and their corresponding uv-settings lockfile dependency entries.
6bbba3f to
1e90e84
Compare
1e90e84 to
0da23fd
Compare
0da23fd to
e96f632
Compare
| pub struct ParseError<E> { | ||
| error: E, | ||
| document: Option<SourceFile>, |
There was a problem hiding this comment.
[P3] Require the source snapshot in ParseError
Every production construction in PyProjectToml::from_string and PyProjectToml::from_toml supplies a SourceFile. The source-less conversion only supports an otherwise unused From<toml::de::Error> implementation and a synthetic test. Making the document optional adds fallback branches to both diagnostic providers and lets future ? conversions silently omit source excerpts. Store SourceFile directly and remove the unused conversions; missing or invalid parser spans can still retain their existing display fallback independently.
e96f632 to
f4c4680
Compare
| let document = | ||
| SourceFile::new(path.as_ref().user_display().to_string(), raw.clone()); |
There was a problem hiding this comment.
[P3] Borrow the TOML text when constructing the source snapshot
On a workspace TOML parse failure, raw.clone() copies the entire document before SourceFile::new copies that temporary into an Arc<str>. The fallback parse only borrows raw, and the other parser adapters already pass borrowed text to this constructor. Pass raw.as_str() here to retain the same owned snapshot without the redundant full-document allocation.
f4c4680 to
33b8574
Compare
33b8574 to
7597f6b
Compare
7597f6b to
c56214a
Compare
TOML failures place the parser's complete multiline display inside a cause, including a redundant heading and source gutter. Add typed presentation data so the shared renderer can show the specific parser message, a source location, and a numbered excerpt when a valid span is available. Retain the original parser errors and inputs, and use the same presentation for recoverable warnings. The API also supports inline
info:statements and guttered detail blocks without changing source chains, hints, or exit statuses.Corresponds to astral-sh#21604.