fix(scripts): 修复 UI 边界检查在 Windows 上的路径分隔符误报 - #455
Merged
su-fen merged 1 commit intoAug 13, 2026
Conversation
sharedFacades 的豁免声明使用正斜杠字面量,而 Windows 上 relative() 返回 反斜杠路径,Map.has() 的精确字符串比较必然失配,导致三条已声明的兼容入口 在 Windows 上全部被误报为「共享源码不能在应用目录保留同路径副本」, Windows 贡献者无法在本地跑通 pnpm check:ui-boundaries。 查表前统一转换为正斜杠;报错信息改为直接由 appFile 计算相对路径, 消除此前 crates\agent-gui\src/lib\... 这样的混合分隔符输出。 sep 在 POSIX 上即 "/",toPosixPath 为空操作,Linux 与 macOS 行为不变。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
StackCairn
marked this pull request as draft
August 13, 2026 11:07
Contributor
|
PR governance checks passed. Awaiting human review. |
Smithhss
marked this pull request as ready for review
August 13, 2026 11:08
StackCairn
marked this pull request as draft
August 13, 2026 11:08
Smithhss
marked this pull request as ready for review
August 13, 2026 11:13
Member
|
感谢排查到问题! |
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.
Closes #456
问题
在 Windows 上对干净的
main执行pnpm check:ui-boundaries会失败,报告三处并不存在的违规——而这三个文件正是sharedFacades已显式声明豁免的兼容入口。Windows 贡献者因此无法在本地跑通该门禁。根因
sharedFacades的 key 是正斜杠字面量:而
relative(repoRoot, appFile)在 Windows 上返回crates\agent-gui\src\lib\settings\index.ts。Map.has()做精确字符串比较,因此每条豁免声明在 Windows 上都失配,全部落入违规分支。CI 运行在 Linux 上,
relative()返回正斜杠、匹配成功,所以该问题不会在 CI 中暴露。同一 commit14844e1a上,上游 CI 为 success 而 Windows 本地该门禁失败。改动
toPosixPath()统一分隔符appFile计算相对路径,消除混合分隔符输出sep在 POSIX 上即/,toPosixPath为空操作,Linux 与 macOS 行为不变。已用path.posix逐组比对,报错信息新旧写法在 POSIX 上输出逐字符一致。验证(Windows 11 / Node 24.14.0 / pnpm 10.32.1)
修复前:
修复后:
负向验证——手动在应用目录造一份真实的同路径副本,确认门禁没有被改废,且路径输出已是干净的正斜杠:
git diff --check通过。未包含的改动
relative()(:111、:190、:283)在 Windows 上同样输出反斜杠,但仅影响显示、不影响判定,为保持改动聚焦未一并处理。如果希望统一,我可以补上。ui-boundary-declarations.mjs并在既有测试文件中补用例。🤖 Generated with Claude Code