Skip to content

Fix pySpecs path handling to avoid unnormalized paths#692

Merged
shigoel merged 1 commit intomainfrom
jhx/pyspec-path-fix
Mar 27, 2026
Merged

Fix pySpecs path handling to avoid unnormalized paths#692
shigoel merged 1 commit intomainfrom
jhx/pyspec-path-fix

Conversation

@joehendrix
Copy link
Copy Markdown
Contributor

@joehendrix joehendrix commented Mar 27, 2026

Summary

Fix a bug where paths were getting an extra slash (e.g., a//b) and this caused output paths to become absolute, failing with permission errors.

  • Rewrite path stripping to handle trailing-slash variations correctly
  • Promote internal path failures to hard errors instead of silently skipping modules

Verified on pyspec files.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

When sourceDir had a trailing slash, FilePath's `/` operator produced
double-slash paths (e.g. `src//boto3`). After stripping the prefix the
remainder started with `/`, creating absolute output paths that bypassed
the output directory entirely.

Rewrite pySpecOutputPath to use `dropPrefix?` and explicitly validate
the separator slash, so trailing-slash variation in sourceDir no longer
matters. Also promote path-derivation and metadata failures from
per-module soft errors to hard throws, since they indicate internal
bugs rather than user-recoverable problems.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@joehendrix joehendrix requested a review from a team March 27, 2026 16:56
@shigoel shigoel added this pull request to the merge queue Mar 27, 2026
Merged via the queue into main with commit fabb3ed Mar 27, 2026
15 checks passed
@shigoel shigoel deleted the jhx/pyspec-path-fix branch March 27, 2026 17:31
olivier-aws pushed a commit that referenced this pull request Mar 30, 2026
## Summary

Fix a bug where paths were getting an extra slash (e.g., `a//b`) and
this caused output paths to become absolute, failing with permission
errors.

- Rewrite path stripping to handle trailing-slash variations correctly
- Promote internal path failures to hard errors instead of silently
skipping modules

Verified on pyspec files.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

3 participants