fix: refresh lighthouse mirror only on public architecture change

This commit is contained in:
冰朔 2026-09-08 14:19:55 +08:00
commit 8519b8c492
3 changed files with 6 additions and 1 deletions

View file

@ -126,9 +126,12 @@ def sync_architecture(repo: Path, state: Path, commit: str | None = None) -> dic
"contains_private_source_body": False,
"authority_granted": False,
}
snapshot["projection_fingerprint"] = sha(stable(projections))
snapshot["freshness_token"] = sha(stable(snapshot))
current = state / "architecture" / "CURRENT.json"
previous = json.loads(current.read_text()) if current.is_file() else None
if previous and previous.get("projection_fingerprint") == snapshot["projection_fingerprint"]:
return {"outcome":"PASS", "state":"MIRROR_PUBLIC_ARCHITECTURE_UNCHANGED", "observed_commit":commit, "current_source_commit":previous.get("source_commit"), "freshness_token":previous.get("freshness_token")}
if previous and previous.get("freshness_token") == snapshot["freshness_token"]:
return {"outcome":"PASS", "state":"MIRROR_IDEMPOTENT", "freshness_token":snapshot["freshness_token"]}
current_sha = atomic_json(current, snapshot)