Skip to content

test(storage): build invalid UTF-8 path with Git plumbing - #2097

Merged
M4n5ter merged 1 commit into
mainfrom
agent/issue-2095-non-utf8-git-path
Aug 4, 2026
Merged

test(storage): build invalid UTF-8 path with Git plumbing#2097
M4n5ter merged 1 commit into
mainfrom
agent/issue-2095-non-utf8-git-path

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Aug 4, 2026

Copy link
Copy Markdown
Member
English

Summary

  • construct the invalid UTF-8 Git path fixture with Git plumbing instead of the host filesystem
  • preserve the original 0xff path byte through the repository tree
  • keep the public managed-workspace validation path unchanged

Why

The previous fixture asked macOS to create a filename containing an invalid UTF-8 byte. APFS rejects that setup with EILSEQ before 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-worktree so Git does not materialize it. The product code still reads the raw ls-tree -z bytes and rejects the non-UTF-8 source tree.

Closes #2095.

Validation

  • focused regression test
  • full @maka/storage test suite: 634 passed, 12 skipped, 0 failed
  • npm run typecheck -w @maka/storage
  • npm run build -w @maka/storage
  • npm run lint
  • Biome format check
  • git diff --check
中文

概要

  • 使用 Git plumbing 构造非法 UTF-8 路径测试夹具,不再依赖宿主文件系统创建该路径
  • 在 Git tree 中原样保留 0xff 路径字节
  • 保持公开的 managed-workspace 校验路径不变

原因

旧测试要求 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 failed
  • npm run typecheck -w @maka/storage
  • npm run build -w @maka/storage
  • npm run lint
  • Biome format check
  • git diff --check

@M4n5ter
M4n5ter marked this pull request as ready for review August 4, 2026 06:47
@M4n5ter
M4n5ter merged commit 188ad66 into main Aug 4, 2026
11 checks passed
@M4n5ter
M4n5ter deleted the agent/issue-2095-non-utf8-git-path branch August 4, 2026 06:47
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.

test(storage): make the non-UTF-8 Git-path fixture reliable on macOS

1 participant