【架构优化】从 RestoreWorkspaceCheckpointFrom 中拆出单条目落盘逻辑 restoreCheckpointEntry
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 25/100
Línea de trabajo
The work is in RestoreWorkspaceCheckpointFrom in internal/runtime/workspace_checkpoint.go, where the tar loop mixes entry validation with per-type writes for directories, regular files and symlinks. Pull request #470 is already open against this issue, so check it and coordinate before starting any change. Done means the write logic sits in a helper with the signature the issue gives, the existing checkpoint tests still pass, and the new helper has unit tests for each case the issue lists.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
现状问题
internal/runtime/workspace_checkpoint.go 中 RestoreWorkspaceCheckpointFrom 约 90 行,在同一个 tar 读取循环里同时做:条目校验(路径、重复、数量、展开大小)和按类型落盘(目录 / 普通文件 / 软链接)。落盘部分用 var file *os.File + 嵌套 if err == nil 串联,阅读和单测都不方便。
重构方案
把循环内「创建父目录 + 按 header.Typeflag 写入目录/文件/软链接」这一段抽成包内函数
restoreCheckpointEntry(base *os.Root, path string, header *tar.Header, reader io.Reader) error,主循环只保留校验并调用它。
- 文件模式、
O_EXCL、io.CopyN、Sync、Close错误优先级、软链接注释、unsupported checkpoint entry报错全部原样保留。
影响范围
仅 internal/runtime/workspace_checkpoint.go 一个函数内部;对外 API、归档格式、报错文案均不变。与 #396/#397(排除路径判断)不重叠。
验证方式
- 新增
restoreCheckpointEntry单测(目录/文件/软链接落盘、不支持类型、重复文件不覆盖、文件体截断报错) - 现有 checkpoint 相关测试全部通过;
gofmt、go vet ./internal/runtime/
- Lenguaje dominante
- Go
- Estrellas
- 141
- Forks
- 28
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 113
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Tencent/LoopForge
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
[Bug]: 官方镜像未安装 wecom-cli,企业微信通知报「通知服务未安装 wecom-cli」Posiblemente ocupada @newexploreor la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Tencent/LoopForge#156 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
【架构优化】合并 gitwork/workbranch.go 中 push/pull 重复的默认提交身份注入为 withFallbackIdentityPosiblemente ocupada @fx-kurumi la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 40/100
Los mantenedores suelen responder en 1 día
-
【架构优化】从 runtime.installNPMCLI 中拆出 npm 参数拼装 npmCLIInstallArgs 与安装结果启用 activateNPMStagePosiblemente ocupada @fx-kurumi la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
Todos los issues de Tencent/LoopForge
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
bazel-contrib/rules_go#4784 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Уязвимые компоненты в GoAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
POSIdev-community/aictl#40 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
nebari-dev/nebari-infrastructure-core#774 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
oracle/terraform-provider-oci#2662 ·
-
[BUG]: A pre-hashed ACL password in uppercase hex fails ACL LOAD and crash-loops restarted podsAbiertobug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
valkey-io/valkey-operator#644 ·
Los mantenedores suelen responder en 3 días