Repository navigation
fix(validate): 只差大小写的两条路径算撞名 - #186
Merged
MyPrototypeWhat merged 1 commit intoDec 1, 2026
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.
包里两条路径只差大小写的时候,仓库一直是放行的,宿主不放行。
宿主给每个路径的每一段前缀留一个名字,名字折成小写。两个前缀折到同一个名字上,包就被拒,报
CASE_COLLISION。实测:包里同时放
README.md和Readme.md,在当前的 main 上:npm run checkexit 0,全绿。宿主读同一个包,报的是同一对路径:CASE_COLLISION — Readme.md and README.md collide。Linux 上建得出这两个文件,Windows 和 macOS 建不出来 —— 所以这种问题在 CI 上看不出来,等到真装插件的时候才炸。
有一处要说清楚,不是所有安装路径都会拒。宿主那边有三条入口,行为不一样:
本地文件夹装进去(
readLocalMiniMaxPluginPackage)和摘要校验那一步会拒;从 git 仓库导入的那条路(readImportedPluginPackage)这一关放行,后面才撞上摘要校验。所以症状是「本地装不上、git 导入也装不上,但报错的时机不同」,不是每条路都在同一个地方拒。改的是
scripts/lib/rules/files.mjs走目录的那一段:每条路径的每个前缀按宿主那个办法折一次,折到同一个名字上就报PATH_CASE_COLLISION。折叠那几行跟宿主是同一套写法(normalize('NFC').toLocaleLowerCase('en-US')),放在scripts/lib/paths.mjs,规则那一层调它。测试加了两条:两条只差大小写的文件(一条在根目录,一条在子目录),以及一个目录和一条只差大小写的文件。这两条在未改的 main 上是红的。全量 98 条过。
零回归是量出来的。完整克隆上
node scripts/validate.mjs的输出与未改基线逐字节相同,md5 都是22e5461b67389f133403ca8c2b5490c0。也就是说仓库里现有的包一个都没撞名。docs/package-contract.md的 Portable paths 那节补了一条,写清这条规矩。没验证的部分说清楚。文档写的是「Verified against MiniMax Code 3.1.11」,本机只有 3.1.14,我只翻了 3.1.14 的源码,没翻旧版确认它当年也这样。
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.