Skip to content

Rename DisplaySafeUrl to SafeUrl - #22599

Merged
zanieb merged 1 commit into
mainfrom
zaniebot/safe-url-rename-20261014
Oct 16, 2026
Merged

zanieb merged 1 commit into
mainfrom
zaniebot/safe-url-rename-20261014

Conversation

@astral-automations-bot

@astral-automations-bot astral-automations-bot Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

DisplaySafeUrl is used for URL handling and serialization as well as display formatting. Rename it to SafeUrl and rename DisplaySafeUrlError to SafeUrlError, updating callers.

Precursor for #22600 which expands the role of this type.

@zanieb
zanieb merged commit d14332d into main Oct 16, 2026
124 of 126 checks passed
@zanieb
zanieb deleted the zaniebot/safe-url-rename-20261014 branch October 16, 2026 15:16
zanieb pushed a commit 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]>

This branch was previously deployed

1 inactive deployment
automations — 7ae8d810 Deployed Oct 16, 2026 by astral-automations-bot[bot] via review / security review #51314
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants