Skip to content

[codex] make PathUri::from_abs_path infallible - #27976

Merged
anp-oai merged 3 commits into
mainfrom
codex/infallible-path-uri
Jun 12, 2026
Merged

[codex] make PathUri::from_abs_path infallible#27976
anp-oai merged 3 commits into
mainfrom
codex/infallible-path-uri

Conversation

@anp-oai

@anp-oai anp-oai commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Why

PathUri::from_abs_path can fail for absolute paths that do not have a normal file: URI representation, forcing filesystem call sites to handle a conversion error even though the original path can be preserved losslessly.

What

Make from_abs_path infallible and migrate its callers. Unrepresentable paths use file:///%00/bad/path/<base64>, encoding Unix bytes or Windows UTF-16LE; to_abs_path validates and decodes that fallback. The leading encoded null reserves a namespace that cannot collide with a real Unix or Windows path, and fallback URIs remain opaque to lexical path operations.

Validation

Added path-URI coverage for Unix null and non-UTF-8 paths, Windows device/verbatim and non-Unicode paths, serialization, malformed fallbacks, opaque lexical operations, invalid native payloads, and literal /bad/path collision resistance.

@anp-oai anp-oai changed the title [codex] Make PathUri::from_abs_path infallible [codex] make PathUri::from_abs_path infallible Jun 12, 2026
@anp-oai
anp-oai marked this pull request as ready for review June 12, 2026 23:09
@anp-oai
anp-oai requested a review from a team as a code owner June 12, 2026 23:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5beb1d3bf5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/utils/path-uri/src/lib.rs
Comment thread codex-rs/utils/path-uri/Cargo.toml
@anp-oai
anp-oai merged commit 968a3ac into main Jun 12, 2026
31 checks passed
@anp-oai
anp-oai deleted the codex/infallible-path-uri branch June 12, 2026 23:58
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants