test(storage): build invalid UTF-8 path with Git plumbing - #2097
Merged
Conversation
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.
English
Summary
0xffpath byte through the repository treeWhy
The previous fixture asked macOS to create a filename containing an invalid UTF-8 byte. APFS rejects that setup with
EILSEQbefore the managed-workspace code runs, making the test platform-dependent and preventing it from exercising the intended boundary.The new fixture writes the blob, tree, and commit directly through Git plumbing, then marks the path
skip-worktreeso Git does not materialize it. The product code still reads the rawls-tree -zbytes and rejects the non-UTF-8 source tree.Closes #2095.
Validation
@maka/storagetest suite: 634 passed, 12 skipped, 0 failednpm run typecheck -w @maka/storagenpm run build -w @maka/storagenpm run lintgit diff --check中文
概要
0xff路径字节原因
旧测试要求 macOS 文件系统创建包含非法 UTF-8 字节的文件名。APFS 会在 managed-workspace 代码运行前以
EILSEQ拒绝该操作,导致测试依赖平台,也无法覆盖原本要验证的产品边界。新测试通过 Git plumbing 直接写入 blob、tree 和 commit,再将该路径标记为
skip-worktree,避免 Git 将其物化到文件系统。产品代码仍通过ls-tree -z读取原始路径字节,并拒绝非 UTF-8 source tree。Closes #2095.
验证
@maka/storage测试:634 passed,12 skipped,0 failednpm run typecheck -w @maka/storagenpm run build -w @maka/storagenpm run lintgit diff --check