Skip to content

Make URL persistence explicit with wrapper types - #2712

Closed
zaniebot wants to merge 1 commit into
mainfrom
zaniebot/url-persistence-comparison-20261014
Closed

zaniebot wants to merge 1 commit into
mainfrom
zaniebot/url-persistence-comparison-20261014

Conversation

@zaniebot

@zaniebot zaniebot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Combine astral-sh#22356, astral-sh#22357, and astral-sh#22358 for comparison with #2711. PersistSafeUrl serializes URLs without sensitive userinfo while retaining the complete query string; CredentialPersistingUrl serializes the complete parsed URL. Remove implicit serialization from DisplaySafeUrl and VerbatimUrl so ordinary Serde serialization requires an explicit persistence policy.

@codspeed

codspeed Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 15.51%

⚠️ 8 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚡ 1 improved benchmark
✅ 68 untouched benchmarks
⏩ 35 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ ⚠️ Simulation discover_workspace_from_all_members 153.6 ms 133 ms +15.51%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing zaniebot/url-persistence-comparison-20261014 (1af9c47) with main (a03d0cd)

Open in CodSpeed

Footnotes

  1. 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. ↩

@zaniebot
zaniebot deployed to automations October 14, 2026 17:02 — with GitHub Actions Active
zanieb pushed a commit to astral-sh/uv that referenced this pull request Oct 16, 2026
`SafeUrl` currently serializes the full URL, so fields can persist
credentials without an explicit choice. Add a type-level policy that
defaults to `Unserializable`; `Stripped` removes sensitive userinfo
while retaining the complete query, and `Raw` serializes the full parsed
URL. `Display` and `Debug` continue to redact passwords and recognized
sensitive query parameters. Index URLs in `pylock.toml` and publish URLs
in tool receipts use `Stripped`.

The inherent `serialize` and `serialize_internal` methods prevent those
method calls from falling through `Deref` to `Url`. Ordinary Serde
serialization of `SafeUrl` requires `Stripped` or `Raw`; the internal
serialization method requires `Raw`.

The serialization policies are an alternative to the wrapper types in
#22356, #22357, and #22358, combined in astral-sh#2712 for
comparison. `Stripped` and `Raw` follow the same serialization rules as
`PersistSafeUrl` and `CredentialPersistingUrl`. Using `SafeUrl<P>`
carries the policy through `VerbatimUrl`, stored fields, and
transformations such as `join`; shared implementations are generic over
the policy. The aforementioned stack also changes how `DirectUrl`
metadata is parsed and written; those changes are outside this PR's
scope. See also
#22600 (comment)

Stacked on #22599.

Co-authored-by: zaniebot <[email protected]>
@astral-automations-bot
astral-automations-bot Bot force-pushed the zaniebot/url-persistence-comparison-20261014 branch from 169acf7 to 1af9c47 Compare October 16, 2026 15:31
@zaniebot zaniebot closed this Oct 16, 2026

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants