fix(gitea-integration): 删除项目登记时一并解除 Gitea 绑定,轮询不再写入已删除或已解绑的项目(G8) #35

Merged
lanrtop merged 3 commits from fix/gitea-unbind-on-unregister into master 2026-10-03 09:59:08 +08:00

3 Commits

Author SHA1 Message Date
lanrtop
fccb76783d fix(gitea-integration): 处置 G8 独立审查——删除登记本体补外部清理测试,轮询写入前复核绑定,解绑读删同事务(G8)
All checks were successful
Push & PR Check / check (pull_request) Successful in 1m8s
- 抽出连接与凭证存储注入的删除登记本体 projects::delete_project_registration
  (delete_project_records + 提交后 Gitea 外部清理),delete_project 只做薄包装;
  补测试校验被删项目的 webhook 签名凭证被清理、他项目凭证保留,以及孤儿绑定可经删除登记清理
- 轮询 commit 与 PR 写入抽成 ingest_polled_commits / ingest_polled_prs,写入前用
  poll_target_still_bound 复核绑定仍在且项目仍登记,避免按本轮开头的旧快照写入已删除或已解绑的项目
- gitea_unlink_repo 的读与删放进同一事务,与删除登记路径同写法
- 孤儿绑定 warn 写明清理路径(对该 ID 调 unregister_project)
- 审查第 5 条(连接池外键只在迁移连接开启)经探针证伪:bundled SQLite 默认 foreign_keys=1,不改

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 10:49:26 +09:00
lanrtop
c1632a0549 fix(gitea-integration): 删除项目登记时同一事务解除 Gitea 绑定,轮询跳过已删除项目的遗留绑定(G8)
删除登记(UI 删除项目、MCP unregister_project)原来不清 gitea_repos,
后台轮询每 10 分钟仍把 commit 与 PR 事件写到已删除的项目 ID 下。

- gitea:解绑本体拆为 remove_repo_link_records(只动数据库,可进调用方事务)
  与 cleanup_removed_repo_link(提交后尽力删 Gitea 侧 webhook 与本机签名凭证),
  UI 解绑 gitea_unlink_repo 与删除登记共用
- projects:抽出 delete_project_records(连接注入),关联表、Gitea 绑定、
  workspace、孤儿 profile 同一事务删除;delete_project 提交后再做 Gitea 外部清理
- 轮询兜底:load_poll_targets 把所属项目已不存在的遗留绑定排除在 commit / PR
  轮询之外,每个绑定每次运行只记一次 warn
- 契约:unregister_project 描述与 project-context.yaml 同步

回归测试 deleting_project_registration_unbinds_its_gitea_repo 修复前失败、修复后通过;
变异验证通过;全量 cargo test 307 passed / 0 failed / 5 ignored。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 10:18:49 +09:00
lanrtop
5f74a5644e docs(blueprint/gitea-integration): 立 G8 卡并标 🔵——删除项目登记时一并解除 Gitea 绑定
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 10:02:44 +09:00