爱美剧,爱生活 请登录 | 免费注册


Sketch.dev宕机直接原因初解析


小美发布 2025-08-02 11:28:27 阅读 35 字数 620
47



根据 Sketch.dev 工程团队的介绍,其日常会使用自家 AI 平台来开发 Sketch 这款产品,而此次问题的根源在于一段由 LLM 生成、随后经人工审核的大规模代码重构。


这段代码被从一个文件移动到另一个文件中,而 Bug 就悄然藏在这个过程中。


详细来看,重构前的代码如下:


for {
    repos, repoResp, err := ghClient.Apps.ListUserRepos(ctx, *installation.ID, repoOpt)
    if err != nil {
        // Log error but continue with other installations
        log.Printf("Error fetching repositories for installation %d: %v", *installation.ID, err)
        break
    }
    // ...
}


重构后的代码:


for {
    repos, repoResp, err := ghClient.ListUserRepos(ctx, *installation.ID, repoOpt)
    if err != nil {
        // Log error but continue with other installations
        log.Printf("Error fetching repositories for installation %d: %v", *installation.ID, err)
        continue
    }
    // ...
}


原本的 break 被改成了 continue,错误被“静默”处理,直接导致死循环。



评论