Application update

Purpose: Let an operator move the running application to the latest origin/main without SSH, and never leave the checkout half-updated. Scenario: The maintainer, on a phone, opens Tools → Deploy. The page shows the current commit and, from the last fetch, that it is two commits behind, listing those two commits and the size of the change. They tap Deploy now; the server fetches, sees a clean main that origin/main fast-forwards, moves HEAD, logs the attempt and shows the new commit. An operator's own edit to public/.htaccess survives: the deploy stashes it, fast-forwards and reapplies it. Had the update changed the same lines, the deploy would have gone back to the previous commit with the edit intact and named the file to merge over SSH. High-traffic mode no longer makes such an edit; its rules ship in the tracked file. Queue deploy does the same through the task queue (the page shows how long it has waited for the worker), and ./v3 deploy does it over SSH; all three share one lock and one attempt log. Sources: routine (source unavailable), page and actions (source unavailable), template (source unavailable), page script (source unavailable), CLI (source unavailable), operator guide, tests (source unavailable), page tests (source unavailable).

After a successful update, a short process of the new code (./v3 task-queue check-read-model) compares the read model's schema and queues a rebuild when it changed; the attempt log records Read-Model: and the page's Site data row follows the rebuild to completion, naming ./v3 rebuild when no worker runs it.

Deploy history and rollback: every deploy that changes the commit, and every rollback, appends a block to state/logs/deploy_history.txt (never rotated; first filled from the attempt log). The page's History section and ./v3 deploy --history list those versions. Roll back, after a confirmation that lists the commits undone and warns on format changes, resets main to a commit from the history that is behind HEAD, under the same lock and with the same handling of local edits; ./v3 deploy --rollback=COMMIT does the same. It never fetches, and the next deploy fast-forwards again. Only the application checkout moves, never content.

With the Deploy prompt site flag on (FORUM_DEPLOY_HEADER_PROMPT_ENABLED), a browser that has deployed from the page remembers it. Later pages check a few seconds after load, accepting a fetch up to three minutes old (check with max_age, judged by FETCH_HEAD), and reveal Deploy now by the site name when the checkout is behind (header script (source unavailable), browser check (source unavailable)). The button runs the same now action; a refusal makes that browser stop checking.

Boundaries: pull only (no docs publish or static build); a rollback only to a previously deployed commit; only session-authenticated root-approved operators and same-origin requests; opening the page reads local Git state and never fetches; the header prompt fetches at most once per three minutes.

Browser update notices: /api/version, forum app-version metadata and agent discovery/check-in versions use the application checkout's Git HEAD. Posts and background content commits do not change that value. With navbar copies enabled, page-version combines code and content revisions so refreshed content still raises the existing notice. Pending page refreshes use separate session storage from app and Docs updates. Reload uses the existing cache bypass and clears satisfied pending state. Linked worktrees resolve through their .git file; source-only distributions return no-git. Sources: version source (source unavailable), revision lookup (source unavailable), browser notice (source unavailable), cached navigation (source unavailable), worker (source unavailable), regressions (source unavailable).