Pause AFFiNE projection in contributor docs

This commit is contained in:
virgil
2026-06-08 23:16:27 -07:00
parent 401768a552
commit b39c4b85d1
2 changed files with 23 additions and 12 deletions

View File

@@ -2,16 +2,18 @@
These documents are available in two ways: These documents are available in two ways:
1. Read them in AFFiNE. 1. Read the current source in Git.
AFFiNE is the shared reading and whiteboard space. The Markdown docs from This repo is the source of truth for the shared Markdown docs.
this repo appear there as read-only copies.
2. Edit them in Git. 2. Edit them in Git.
The editable files live in this plain Markdown repo. Use your normal editor, The editable files live in this plain Markdown repo. Use your normal editor,
then commit and push changes. then commit and push changes.
If you want to change one of these docs, edit the Markdown file. Do not edit If you want to change one of these docs, edit the Markdown file.
the AFFiNE copy; it will be refreshed from Git.
AFFiNE projection is paused while the native writer is rebuilt. Earlier AFFiNE
copies may exist, but they should be treated as stale research artifacts rather
than the current reading surface.
## What To Edit ## What To Edit
@@ -63,12 +65,12 @@ section0-docs pull
section0-docs status section0-docs status
MESSAGE="Describe the doc change" section0-docs commit MESSAGE="Describe the doc change" section0-docs commit
section0-docs push section0-docs push
section0-docs wait
``` ```
By default, `section0-docs push` waits for the projected commit to pass backend `section0-docs push` updates Git. `section0-docs wait` reports projection state;
verification and AFFiNE native read verification. If an already-open AFFiNE tab for now it should say the AFFiNE writer is frozen. That is expected until the
still shows old content, reload the tab or open the printed doc URL in a fresh native AFFiNE writer replaces the old direct database experiment.
tab.
## Contributor Setup ## Contributor Setup

View File

@@ -60,7 +60,7 @@ Commands:
status show Git status status show Git status
commit commit all current changes with MESSAGE commit commit all current changes with MESSAGE
push push current branch push push current branch
wait wait for a pushed commit to reach AFFiNE wait show AFFiNE projection state for a pushed commit
push-test prove write access with a temporary remote branch push-test prove write access with a temporary remote branch
trace show local/origin state and recent helper events trace show local/origin state and recent helper events
help show this help help show this help
@@ -79,8 +79,8 @@ Examples:
section0-docs push section0-docs push
section0-docs wait section0-docs wait
AFFiNE is read-only for these docs. Make lasting changes in Markdown; the AFFiNE is read-only for these docs. Make lasting changes in Markdown.
AFFiNE copies are refreshed from Git. AFFiNE projection is currently paused until the native writer is ready.
USAGE USAGE
} }
@@ -173,6 +173,8 @@ wait_for_projection() {
backend_ok="\$(printf "%s" "\$status_json" | json_get verification.backend.ok 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)" 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)" browser_status="\$(printf "%s" "\$status_json" | json_get verification.browserFreshness.status 2>/dev/null || true)"
writer_status="\$(printf "%s" "\$status_json" | json_get writer.status 2>/dev/null || true)"
writer_note="\$(printf "%s" "\$status_json" | json_get writer.note 2>/dev/null || true)"
readme_url="\$(printf "%s" "\$status_json" | python3 -c 'import json,sys readme_url="\$(printf "%s" "\$status_json" | python3 -c 'import json,sys
data=json.load(sys.stdin) data=json.load(sys.stdin)
for doc in (data.get("projected") or {}).get("docs") or []: for doc in (data.get("projected") or {}).get("docs") or []:
@@ -180,7 +182,14 @@ for doc in (data.get("projected") or {}).get("docs") or []:
print(doc.get("url","")) print(doc.get("url",""))
break' 2>/dev/null || true)" 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}" printf " origin=%s projected=%s state=%s%s\n" "\${origin_commit:-unknown}" "\${projected_commit:-none}" "\${state:-unknown}" "\${completed_at:+ completed=\$completed_at}"
printf " writer: %s\n" "\${writer_status:-unknown}"
printf " verification: backend=%s native-read=%s browser=%s\n" "\${backend_ok:-unknown}" "\${native_ok:-unknown}" "\${browser_status:-not_verified}" printf " verification: backend=%s native-read=%s browser=%s\n" "\${backend_ok:-unknown}" "\${native_ok:-unknown}" "\${browser_status:-not_verified}"
if [ "\$state" = "writer-frozen" ] || [ "\$writer_status" = "frozen" ]; then
echo "AFFiNE projection is paused. Your Git push is still the source of truth."
[ -z "\$writer_note" ] || echo "Reason: \$writer_note"
json_log "wait.writer_frozen" "\$expected"
return 2
fi
if [ "\$projected_commit" = "\$expected" ] && { [ "\$backend_ok" = "True" ] || [ "\$backend_ok" = "true" ]; } && { [ "\$native_ok" = "True" ] || [ "\$native_ok" = "true" ]; }; then 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." echo "Projected and verified through AFFiNE backend and native read."
[ -z "\$readme_url" ] || echo "Doc: \$readme_url" [ -z "\$readme_url" ] || echo "Doc: \$readme_url"