fix(registry): clean content_repo failure in hygiene; retire META_REPO from .env.example; clarity + idempotency test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ben Stull
2026-06-03 23:28:08 -07:00
parent cecc6c0b41
commit 48fd6f9675
4 changed files with 38 additions and 21 deletions
+8 -1
View File
@@ -299,7 +299,14 @@ async def _delete_branch_via_bot(
log.warning("hygiene: cannot delete %s/%s — slug missing from cache", slug, branch)
return False
if not rfc["repo"]:
owner, repo = config.gitea_org, (projects_mod.default_content_repo(config) or "")
repo = projects_mod.default_content_repo(config)
if not repo:
log.warning(
"hygiene: default project has no content_repo; skipping branch delete for %s/%s",
slug, branch,
)
return False
owner = config.gitea_org
elif "/" in rfc["repo"]:
owner, repo = rfc["repo"].split("/", 1)
else:
+8 -3
View File
@@ -80,16 +80,21 @@ def make_router(config: Config, gitea: Gitea) -> APIRouter:
payload = {}
repo_full = (payload.get("repository") or {}).get("full_name") or ""
registry_full = f"{config.gitea_org}/{config.registry_repo}"
meta_repo = projects_mod.default_content_repo(config)
meta_full = f"{config.gitea_org}/{meta_repo}" if meta_repo else None
content_repo = projects_mod.default_content_repo(config)
if not content_repo:
log.warning("webhook: default project content_repo is unknown; corpus refresh skipped")
content_full = f"{config.gitea_org}/{content_repo}" if content_repo else None
try:
if repo_full == registry_full:
# §22.2: a registry-repo push re-mirrors the projects table.
# Tolerate a malformed projects.yaml (keep last-good rows); let a
# transport error bubble to the outer 500 so an unreachable Gitea
# on a registry push is loud rather than silently dropped.
try:
await registry_mod.refresh_registry(config, gitea)
except registry_mod.RegistryError:
log.exception("registry webhook: invalid projects.yaml; keeping last-good")
elif meta_full and (repo_full == meta_full or not repo_full):
elif content_full and (repo_full == content_full or not repo_full):
await cache.refresh_meta_repo(config, gitea)
await cache.refresh_meta_branches(config, gitea)
await cache.refresh_meta_pulls(config, gitea)