Tighten Section 0 projection wait proof

This commit is contained in:
virgil
2026-06-08 14:37:54 -07:00
parent edd60e905e
commit 39ef1f4eea
2 changed files with 14 additions and 8 deletions

View File

@@ -170,6 +170,9 @@ wait_for_projection() {
origin_commit="\$(printf "%s" "\$status_json" | json_get source.originCommit 2>/dev/null || true)"
projected_commit="\$(printf "%s" "\$status_json" | json_get projected.commit 2>/dev/null || true)"
completed_at="\$(printf "%s" "\$status_json" | json_get projected.completedAt 2>/dev/null || true)"
backend_ok="\$(printf "%s" "\$status_json" | json_get verification.backend.ok 2>/dev/null || true)"
native_ok="\$(printf "%s" "\$status_json" | json_get verification.nativeRead.ok 2>/dev/null || true)"
browser_status="\$(printf "%s" "\$status_json" | json_get verification.browserFreshness.status 2>/dev/null || true)"
readme_url="\$(printf "%s" "\$status_json" | python3 -c 'import json,sys
data=json.load(sys.stdin)
for doc in (data.get("projected") or {}).get("docs") or []:
@@ -177,12 +180,15 @@ for doc in (data.get("projected") or {}).get("docs") or []:
print(doc.get("url",""))
break' 2>/dev/null || true)"
printf " origin=%s projected=%s state=%s%s\n" "\${origin_commit:-unknown}" "\${projected_commit:-none}" "\${state:-unknown}" "\${completed_at:+ completed=\$completed_at}"
if [ "\$projected_commit" = "\$expected" ]; then
echo "Projected and verified in AFFiNE."
printf " verification: backend=%s native-read=%s browser=%s\n" "\${backend_ok:-unknown}" "\${native_ok:-unknown}" "\${browser_status:-not_verified}"
if [ "\$projected_commit" = "\$expected" ] && { [ "\$backend_ok" = "True" ] || [ "\$backend_ok" = "true" ]; } && { [ "\$native_ok" = "True" ] || [ "\$native_ok" = "true" ]; }; then
echo "Projected and verified through AFFiNE backend and native read."
[ -z "\$readme_url" ] || echo "Doc: \$readme_url"
echo "If a browser tab still shows old content, reload the AFFiNE tab or open the doc URL in a fresh tab."
json_log "wait.complete" "\$expected"
return 0
elif [ "\$projected_commit" = "\$expected" ]; then
echo " commit is projected, but verification is not complete yet"
fi
else
echo " projection status not reachable yet"