fix(catalog): align directory and permission tests with Windows semantics / 修复 catalog 测试的 Windows 平台兼容性 - #8408
Merged
SivanCola merged 1 commit intoAug 11, 2026
Conversation
Problem: main-v2 push CI fails on the Windows leg in projectiondb.TestOpenAppliesLedgerAndPrivatePermissions and sessioncatalog.TestRebuildFailureKeepsExistingCatalog, introduced by the sqlite catalogs integration and never executed on Windows because the PR smoke suite omits these packages. Root cause: os.ReadDir of a plain file returns ENOTDIR on POSIX but yields the file itself on Windows (FindFirstFile semantics), so Rebuild silently treated a file path as an empty directory. The projectiondb permission assertion assumes POSIX 0600, which os.Chmod cannot express on Windows (read-only bit only). Fix: directorySignature stats the path first and rejects non-directories on every platform; the permission assertion skips on Windows while keeping the ledger assertions. Verification: gofmt, go vet (darwin + GOOS=windows), go test -race on both packages, repolint clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the two Windows-only CI failures blocking the v1.24.0 release candidate.
Problem
main-v2 push CI fails on the Windows leg in
projectiondb.TestOpenAppliesLedgerAndPrivatePermissionsandsessioncatalog.TestRebuildFailureKeepsExistingCatalog, introduced by the sqlite catalogs integration (#8257). Neither test ever ran on Windows before merge: the PR smoke suite (ci.ymltest (Windows smoke)) omits these packages, while the full./...sweep runs only on main-v2 pushes.Root cause
os.ReadDirof a plain file returnsENOTDIRon POSIX but yields the file itself on Windows (FindFirstFilesemantics), soRebuildsilently treated a file path as an empty directory and succeeded.0600, whichos.Chmodcannot express on Windows (read-only bit only).Fix
directorySignaturestats the path first and rejects non-directories on every platform, makingRebuildbehavior consistent across POSIX and Windows.Verification
go test -race ./internal/projectiondb/ ./internal/sessioncatalog/green on macOSgofmt,go vet(darwin +GOOS=windows),go build ./...,go run ./tools/repolintall cleanCache-impact: none - no prompt/tool/provider files changed
Cache-guard: existing stable-prefix guard rationale; provider-visible prefix untouched