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

@ -2,7 +2,7 @@ schema: tcs.module-lock/v1
module_id: TCS-AGENT-SANITIZED-MIRROR-001
module_source_sha256: 1210b30c7dabc56b8b989763230a3cf56c0fe02a3b409be5f3833dee9853d771
module_gir_sha256: 0e7b1bbd5f3f8dbc83df6c72e4a1e0532b6f44beed21c8c8315f85cc76096712
runtime_sha256: b5c87c3a4d71e5c095e0b4f43c4c26f2b27afde19d972906f383587c7dcdefa4
runtime_sha256: 4b396550a144fa83614e340a34d087a96e2fb3e18045dabc801150f63b93c211
mirror_map_sha256: a03b5ba9e06f5fd3f626301305d75add0332ae06948a67c8bcd03c3cab248fe1
protocol_source_sha256: cf198e7939e4ab70828b74cef8a2b84c2dac2ff262582bb3d5663904d602d71b
protocol_gir_sha256: 69f1a2a5cfc5ee61bdc2bf2065751d9cc41b9f662b28c35e61b393fd2187e1dc

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)

View file

@ -33,6 +33,8 @@ class MirrorAgentTest(unittest.TestCase):
body = (Path(temp) / "architecture/CURRENT.json").read_text()
self.assertNotIn("/Volumes/", body)
self.assertNotIn("continuity-memory", body)
unchanged = M.sync_architecture(ROOT, Path(temp))
self.assertEqual(unchanged["state"], "MIRROR_PUBLIC_ARCHITECTURE_UNCHANGED")
def test_no_persona_decision_no_candidate(self):
with tempfile.TemporaryDirectory() as temp: