Repository navigation
Conversation
Welcome To opensourceways CommunityHey @fly333sky , thanks for your contribution to the community. Bot Usage ManualI'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. Contact GuideIf you have any questions, please contact the SIG: infratructure , |
CLA Signature Passfly333sky, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
|||||||||||||||||||
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.
背景
[任务]: MindSpore 使用自建LFS 并支持github平台(BigFiles)· 开发流水线 · 开发预览阶段(代码已推 + 预览已部署 + UT 已补;门禁/对抗由 PR CI 异步跑)
改动内容
fix(BigFiles/lfs-website): 修复 GitHub 仓库外链错链 + 补齐 server 包新增函数单测覆盖
本轮针对上一轮预览核验的 4 条 FAIL 逐项修复,无设计变更、无环境改动。
一、修复 GitHub 仓库外链错链(lfs-website 前端,根因在后端缺稳定平台字段)
问题:
TheDetail.vue的repoPlatform从「当前页/筛选后的 filesList」推断平台(
filesList.value.find(f=>f.platform)?.platform),导致:lfs_obj无记录时filesList=[]→repoPlatform=''→ 外链错指atomgit.com/{owner}/{repo};filesList变化 → 外链域名跟着跳变。修法(与设计文档 2.3.2 一致,不新增接口、不改路由/表):
server.go的/object/list响应新增platform字段,值 =auth.ResolvePlatform(owner)(owner 解析,与文件筛选器无关,文件列表为空也正确)。repoPlatform由 computed(filesList) 改为 ref,取自响应res.platform;外链改用纯函数
buildRepoUrl(platform, ownerRepo)生成。https://github.com/{owner}/{repo},跨筛选器稳定。改动文件:
server/server.go:List传repoPlatform,buildListResponse增Platform字段。server/server_test.go:TestBuildListResponse适配新签名并断言 platform。src/utils/repo.ts(新):buildRepoUrl纯函数。src/views/detail/TheDetail.vue:repoPlatform→ref(API),repoUrl走buildRepoUrl,路由切换时重置。src/@types/type-repo.ts:补RepoFilesListResponseT(含 platform)。二、补齐 server 包新增/变更函数单测(覆盖率 ≥80%,全绿)
针对上一轮报红的 3 项覆盖率缺口:
tokenForPlatform(server.go:631)authorizedFn(server.go:244)getLfsFiles(server.go:519)countLfsFiles(server.go:539)新增 UT 文件(均在 BigFiles 子仓,照既有 testify + table-driven 风格):
server/platform_test.go:TestTokenForPlatform— github/gitcode/default 三分支(含未知平台兜底 gitee)。TestAuthorizedFn_FallbackNilMap—IsAuthorizedByPlatform=nil走isAuthorized兜底(原 50% 缺口)。TestAuthorizedFn_FallbackUnknownPlatform— map 已配但平台未命中走兜底。TestAuthorizedFn_PlatformHit— 命中平台用平台专属 authorizer。server/listfiles_test.go:TestGetLfsFiles_PlatformFilter/TestCountLfsFiles_PlatformFilter— 用 SQLite in-memory(单连接)插入 github/gitee/exist=0 行,钉死
platform===""不加过滤、platform==="github"加过滤两条分支(回归保护:防止再次破坏前端「全部」筛选)。
ON UPDATE子句),db.Db存/恢复。lfs-website UT(vitest,按约定不在 runner 上跑,预览 pod 内执行):
tests/repo.test.ts—buildRepoUrl:github→github.com;gitee/gitcode/''→atomgit.com;跨筛选器稳定回归用例。三、依赖
go.mod增gorm.io/driver/sqlite v1.6.0(CGO,仅server/listfiles_test.goimport,go build ./main.go不编译测试文件,生产镜像二进制不受影响;runner 有 gcc+cgo)。四、验证
相关 Issue
resolve https://github.com/opensourceways/backlog/issues/179
AI 使用声明
当前 PR 是否有 AI 参与:
/ai-develop-preview