Skip to content

fix(compiler): use slash-separated fs.FS paths for composable schema imports - #3529

Open
zaidrain06 wants to merge 1 commit into
authzed:mainfrom
zaidrain06:fix/windows-composable-schema-imports-3525
Open

zaidrain06 wants to merge 1 commit into
authzed:mainfrom
zaidrain06:fix/windows-composable-schema-imports-3525

Conversation

@zaidrain06

Copy link
Copy Markdown

Description

Fixes #3525.

Composable schema compilation reads imported .zed files from an fs.FS (os.DirFS via SourceFolder or an explicit SourceFS), which requires forward-slash-separated relative paths on all operating systems. importResolutionContext.translateImports previously built filePath and newSourcePrefix using filepath.Join and filepath.Dir, turning subdirectory imports such as ./sub/b.zed into sub\b.zed on Windows and causing fs.ReadFile (os.DirFS) to fail with readfile ...: invalid argument (fs.ErrInvalid).

  • Switch translateImports in pkg/schemadsl/compiler/translator.go from filepath.Join / filepath.Dir to path.Join / path.Dir so fs.FS paths always use /.
  • Reject backslash separators and validate cleaned fs.ValidPath paths in validateFilepath (pkg/schemadsl/compiler/importer.go) so invalid separator usage fails deterministically across platforms.
  • Switch the fs.Sub test helper in pkg/schemadsl/compiler/importer_test.go to path.Join and add platform-independent fs.ValidPath-enforcing regression tests (TestNestedSubdirectoryImportsUseSlashSeparatedFSPaths and TestBackslashImportPathCausesError).
  • Add an entry under Unreleased -> Fixed in CHANGELOG.md (formatted with [email protected]).

@zaidrain06
zaidrain06 requested a review from a team as a code owner November 25, 2026 10:26
@github-actions github-actions Bot added area/schema Affects the Schema Language area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@zaidrain06

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

authzedbot added a commit to authzed/cla that referenced this pull request Nov 25, 2026

This branch has not been deployed

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

Labels

area/schema Affects the Schema Language area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composable schema imports from subdirectories fail on Windows

1 participant