Skip to content

Give a sight: cd directory one spelling with or without a trailing separator - #446

Merged
jbearak merged 4 commits into
mainfrom
sight-cd-trailing-separator
Nov 20, 2026
Merged

jbearak merged 4 commits into
mainfrom
sight-cd-trailing-separator

Conversation

@jbearak

@jbearak jbearak commented Nov 20, 2026

Copy link
Copy Markdown
Owner

// sight: cd work/ and // sight: cd work name the same directory but resolved to different strings (.../work/ and .../work). Those strings are compared and used as keys, so the two spellings could be treated as different directories.

The directive parser now drops separators at the end of the resolved directory (without_trailing_separators in src/utils/fs-path.ts). A filesystem, drive or UNC root keeps its separator. On POSIX a trailing backslash is part of the name and is kept.

Which files a call resolves to does not change: joining a path to either spelling gave the same file before. Two existing tests pinned the trailing separator and are updated.

Proof: new unit tests for the helper under POSIX and Windows rules and for the parser; sight check over Stata's 3,780 base ados gives the same 30,118 diagnostics as main, byte for byte. All four gates pass locally.

Taken from #435.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: c212d78d-0e0d-4650-8d40-e5d9d6092dd9
Commits

Reviewing files that changed from the base of the PR and between 57855ef and 8dbe5d9.

Files selected for processing: 5

  • src/directive-parser/index.ts
  • src/utils/fs-path.ts
  • tests/integration/working-directory-propagation.test.ts
  • tests/property/working-directory-directive.prop.test.ts
  • tests/unit/utils/fs-path.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@jbearak

jbearak commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Note

🤖 Claude Fable 5.2 responding on behalf of jbearak

An independent cold review of 22af2704 found two things; state at 602d1e13:

  • A drive root lost its separator on POSIX (fixed). // sight: cd "C:/" gave C: on macOS and Linux, because the host's path rules do not treat C:/ as a root, and sight graph --json printed "working_directory":"C:". A drive root now keeps its separator on every platform; graph prints C:/ as on main. Tests added for the helper and the parser.
  • include "C:" under sight: cd "C:/other/lib/" (not changed). A call whose whole path is a bare drive letter leaves an empty file name once the drive prefix is dropped. main then probes lib\.do, misses, and falls back to a file beside the script; this branch probes lib.do. Shown at resolver level with injected Windows rules only. A call to a bare drive is not a file reference Stata accepts, so I left it.

Re-verified at 602d1e13: all four gates pass (10,517 tests pass, 0 fail). The reviewer also compared sight check output with main across 18 POSIX fixtures (workspace /, repeated separators, . and .., drive and UNC spellings, a directory ending in a backslash) and found no difference.

@jbearak
jbearak merged commit 862f577 into main Nov 20, 2026
17 checks passed
@jbearak
jbearak deleted the sight-cd-trailing-separator branch November 20, 2026 21:31
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