【架构优化】从 RestoreMissingWorkspaceArtifacts 中拆出临时文件暂存逻辑 stageArchivedArtifact
维护者通常 1 天内回复
评估
调研方向
Start in internal/runtime/workspace_artifacts.go at RestoreMissingWorkspaceArtifacts, and find the inline block that retries O_EXCL temp-file names, writes, chmods and cleans up on failure. The issue asks for that block to become stageArchivedArtifact with the same error text and permissions, and a new artifact_stage_test.go should cover the 0644 mode and the 10-collision failure. Note that linked PR #472 is already open against this issue, so check it before starting.
由索引模型根据 Issue 内容生成。
描述
现状问题
internal/runtime/workspace_artifacts.go 中 RestoreMissingWorkspaceArtifacts 约 98 行,主循环里内嵌了一段约 30 行的「私有临时文件暂存」逻辑(最多 10 次 O_EXCL 抢名、写入、chmod 0644、Sync、Close、失败清理),和路径安全检查、Link 发布等逻辑混在一起,阅读和单测都不方便。
重构方案
- 把暂存部分抽成包内函数
stageArchivedArtifact(base *os.Root, parent, content string) (string, error):返回临时文件的 root 相对路径;10 次抢名都失败时返回原错误cannot stage archived artifact;写入失败会删掉残留的临时文件。 - 主循环改为调用这个函数后
Link发布,其余逻辑不动。
影响范围
只涉及 internal/runtime/workspace_artifacts.go(以及新增测试文件)。不改导出函数签名,行为、错误文字、文件权限都不变;调用方(runner/engine)不用改。
验证方式
gofmt、go vet ./internal/runtime/ ./internal/runner/- 现有
TestRestoreMissingArtifacts*用例 - 新增
artifact_stage_test.go:检查正常暂存(目录、内容、0644 权限)和连续 10 次重名后报错、之后能恢复
- 主要语言
- Go
- 星标
- 141
- 派生
- 28
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 113
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Tencent/LoopForge 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
[Bug]: 官方镜像未安装 wecom-cli,企业微信通知报「通知服务未安装 wecom-cli」可能已有人在做 @newexploreor 于 1 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 76/100
Tencent/LoopForge#156 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
【架构优化】合并 gitwork/workbranch.go 中 push/pull 重复的默认提交身份注入为 withFallbackIdentity可能已有人在做 @fx-kurumi 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 40/100
维护者通常 1 天内回复
-
【架构优化】从 runtime.installNPMCLI 中拆出 npm 参数拼装 npmCLIInstallArgs 与安装结果启用 activateNPMStage可能已有人在做 @fx-kurumi 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 30/100
维护者通常 1 天内回复
查看 Tencent/LoopForge 的全部 Issue
相似的 Issue
-
team:library-maintainers
难度 2/5 1-3 小时 新手友好度 82/100
padok-team/burrito#1208 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
bazel-contrib/rules_go#4784 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 62/100
POSIdev-community/aictl#40 ·
-
难度 1/5 1 小时以内 新手友好度 62/100
prime-radiant-inc/evener#6306 ·
维护者通常 1 天内回复