fix(2w): W2 --quick live-proof fixes (time import + stale-TYPE reset)

3 bugs found by the live PASS+FAIL proof on the custom-html canonical:
- import time (run_quick._wait_undeployed used it → the FAIL rollback crashed
  with NameError before restore ran).
- canonical.deploy_canonical now resets .env TYPE=<recipe>:<version> before
  redeploy, so a stale TYPE left by a prior --quick upgrade (pointing at a
  since-removed broken PR commit) can't FATAL abra 'unable to resolve <commit>'.
- run_quick FAIL rollback resets TYPE to known-good after restore (idle .env
  agrees with the registry).

LIVE PROOF (custom-html canonical), ALL PASS: (A) PASS quick run → undeploy
keep-volume, known-good UNCHANGED, marker intact; (B) FAIL quick run (broken
image) → 'rolling back' → 'restored known-good data; canonical idle' → exit 1,
known-good UNCHANGED, DATA RESTORED. Canonical left clean (idle, 1.11.0+1.29.0).
61 unit pass; cold path untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 03:05:39 +01:00
parent f68e9d463f
commit 191ebde466
2 changed files with 16 additions and 1 deletions

View File

@ -100,7 +100,11 @@ def deploy_canonical(recipe: str, timeout: int = 900) -> None:
if not rec:
raise RuntimeError(f"no canonical registry for {recipe} — seed one first (cold run)")
domain, version = rec["domain"], rec["version"]
# The .env + retained volume already exist; redeploy the recorded version (idempotent with -f).
# The .env + retained volume already exist; redeploy the recorded known-good version. Reset the
# recorded TYPE=<recipe>:<version> FIRST so abra can resolve the "current deployment" even if a
# prior --quick upgrade left TYPE pointing at a since-removed/broken PR commit (otherwise abra
# FATALs "unable to resolve <commit>"). Then checkout the tag + idempotent (-f) redeploy.
abra.env_set(domain, "TYPE", f"{recipe}:{version}")
abra.recipe_checkout(recipe, version)
r = subprocess.run(
["abra", "app", "deploy", domain, version, "-o", "-n", "-f"],