Skip to content

Preserve filesystem roots in path prompt answers - #525

Open
dailyun wants to merge 1 commit into
tmbo:masterfrom
dailyun:codex/preserve-path-roots
Open

dailyun wants to merge 1 commit into
tmbo:masterfrom
dailyun:codex/preserve-path-roots

Conversation

@dailyun

@dailyun dailyun commented Oct 20, 2026 •

Copy link
Copy Markdown

What is the problem that this PR addresses?

Accepting / in the path prompt returns an empty string. It happens both when typing the root and when accepting it as the default. The trailing-separator cleanup removes the root separator along with ordinary directory separators; on Windows the same cleanup can turn a drive root into a drive-relative path.

How did you solve it?

Keep a path unchanged when it equals its native Path.anchor. Continue removing one trailing separator from non-root paths.

The input-pipe tests cover typed/default filesystem roots, separator-only roots, Windows UNC roots, and the existing non-root cleanup. Four root cases fail against the original code on macOS.

Validation on macOS arm64 / Python 3.13.15:

  • Locked prompt_toolkit 3.0.48 / pytest 9.0.3 / pytest-cov 5.0.0: 175 passed, 1 skipped, 94% overall coverage.
  • prompt_toolkit 3.0.53 was also tested: 175 passed, 1 skipped.
  • prompt_toolkit 2.0.10: 167 passed, 9 skipped.
  • Configured Black, isort, Flake8 and autoflake checks pass on both changed files; git diff --check passes.
  • Mypy 2.1.0 with the locked prompt_toolkit 3.0.48: passes on all 19 source files. With the newer prompt_toolkit 3.0.53, four PromptSession argument-type errors occur identically on the branch and unmodified base 5a68c2d.

Native Windows Server 2025 / Python 3.13 verification also passes: 175 tests, no skips, including the UNC-root test, plus Mypy on all 19 source files. Fork CI run. The verification workflow is on a separate fork-only branch based on this exact PR commit; it is not part of this PR.

Developed and tested with OpenAI Codex assistance; no human review is claimed.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant