Skip to content

fix(windows): preserve unsupported verbatim namespaces - #302

Merged
ualtinok merged 2 commits into
cortexkit:mainfrom
TreyThomasCodes:fix/windows-verbatim-path-validation
Sep 8, 2026
Merged

fix(windows): preserve unsupported verbatim namespaces#302
ualtinok merged 2 commits into
cortexkit:mainfrom
TreyThomasCodes:fix/windows-verbatim-path-validation

Conversation

@TreyThomasCodes

@TreyThomasCodes TreyThomasCodes commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • centralize strict Windows verbatim-path conversion for only valid DOS and UNC namespaces
  • update inspect normalization, LSP URI rendering, batch-shim execution, and bridge root identity to preserve unsupported namespaces such as \\?\Volume{GUID}\
  • add regression coverage for malformed and unsupported namespace spellings

Validation

  • cargo fmt --all -- --check
  • cargo test -p agent-file-tools --lib windows_path
  • cargo test -p agent-file-tools --lib windows_extended_
  • bun x @biomejs/biome check packages/aft-bridge/src/project-identity.ts

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes Windows extended-length path normalization so only valid DOS and UNC namespaces lose their \\?\ prefix; unsupported namespaces like \\?\Volume{GUID}\ are now preserved instead of being corrupted.

  • Centralizes strict verbatim-prefix conversion in windows_path for inspect normalization, LSP URI rendering, batch-shim execution, and bridge root identity.
  • Rejects malformed spellings (dot components, incomplete UNC) and unsupported namespaces rather than stripping their prefix; LSP URI conversion now errors on preserved verbatim paths instead of emitting a bogus UNC URI.
  • Adds regression coverage in Rust and bridge TypeScript tests.

Written for commit a7049db. Summary will update on new commits.

Review in cubic

Closes #303

Greptile Summary

This PR centralizes strict Windows verbatim-path normalization and prevents unsupported or malformed namespaces from being corrupted by indiscriminate prefix removal.

  • Converts only valid extended-length DOS-drive and UNC paths.
  • Preserves unsupported namespaces such as volume GUID paths.
  • Reuses the normalization behavior across inspection, LSP URI handling, batch command execution, and bridge project identity.
  • Adds Rust and TypeScript regression coverage for supported and preserved path forms.

Confidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness or repository-rule violations.

The previously reported LSP concern was manually resolved after the author documented that URL parsing rejects the malformed representation, and the bridge coverage concern is fully addressed by the new injectable-platform regression tests. No new actionable failure remains.

Important Files Changed

Filename Overview
crates/aft/src/windows_path.rs Introduces the shared strict converter for valid DOS and UNC verbatim paths while preserving unsupported or malformed namespaces.
crates/aft/src/lsp/position.rs Routes URI path normalization through the shared converter and covers unsupported volume namespaces.
crates/aft/src/windows_command.rs Uses the shared conversion before invoking batch shims and preserves paths that cannot be converted safely.
packages/aft-bridge/src/project-identity.ts Mirrors strict Windows project-root normalization and exposes an injectable platform for portable testing.
packages/aft-bridge/src/tests/project-identity.test.ts Adds direct win32 coverage for valid DOS and UNC paths plus unsupported and malformed namespace spellings.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Input[Windows path] --> Validate{Valid verbatim DOS or UNC?}
  Validate -->|Yes| Convert[Remove verbatim namespace safely]
  Validate -->|No| Preserve[Preserve original namespace]
  Convert --> Consumers[Inspect, LSP, commands, bridge identity]
  Preserve --> Consumers
Loading

Reviews (2): Last reviewed commit: "fix(windows): reject malformed verbatim ..." | Re-trigger Greptile

Comment thread crates/aft/src/lsp/position.rs
Comment thread packages/aft-bridge/src/project-identity.ts

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 7 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread crates/aft/src/lsp/position.rs
Comment thread packages/aft-bridge/src/project-identity.ts Outdated
Comment thread crates/aft/src/windows_path.rs
Comment thread packages/aft-bridge/src/project-identity.ts
@aft-alfonso

aft-alfonso Bot commented Sep 8, 2026

Copy link
Copy Markdown

Reviewed against the CI verdict. Greptile's P1 (\\?\Volume{GUID}\ becoming a bogus file://?/... URI) is contradicted by the matrix: the new windows_extended_volume_path_is_not_misrepresented_as_a_file_uri test ran in the Windows libtest lane and passed, so the preserved verbatim spelling does error out of path_to_uri rather than parsing as UNC - you can resolve that thread with that pointer. The P2 (no win32 coverage for project-identity.ts) is fair: one small test with a DOS, a UNC, a preserved Volume{} and a malformed spelling, asserting the pool key matches the Rust policy, would let the bridge side drift-guard the same rule. The four cubic threads are the same two findings restated. Once the threads are resolved (and that test is in, if you agree), this merges - the matrix is green and #303 is approved.

@ualtinok
ualtinok merged commit c08a816 into cortexkit:main Sep 8, 2026
36 checks passed
@TreyThomasCodes
TreyThomasCodes deleted the fix/windows-verbatim-path-validation branch September 8, 2026 13:29
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.

design-gate: retain unsupported Windows verbatim namespaces

2 participants