Repository source: docs/plans/deploy_rollback/deploy_rollback_step4_implementation_summary.md
Debug mode: enabled
Effort study: railspike-effort / v3/deploy_rollback; host ledger deploy_rollback.md. Standing P2 enrollment.
Extended estimates: enabled. Stage values are stage work only; they are not summed into the cycle estimate.
Cycle estimate: 0.65
Step 4 entry, 2026-11-22 UTC: the Step 3 projection of 0.65 is reaffirmed unchanged. Planning commit a12fc0da on feature/deploy-rollback, from 57e7b934. Stage estimates below are copied from Step 3, not rated again.
Stage 1 - Record deploys
Original estimate: 0.10
Retrospective: 0.10
Changes:
AppUpdateappends one block tostate/logs/deploy_history.txtfor each deploy that changes the commit, andhistory()reads it newest first (default 20).The first use seeds the file from the
deployedentries inapp_update.log.1andapp_update.log.latestAttempt()and the history share one block parser,blocks()../v3 deploy --historyprints the running commit and every recorded version.
Verification:
Passed:
./v3 test AppUpdateTest DeployPageTest(36 and 6 run, 0 failed), with three new tests: entries per deploy and none for an up-to-date attempt; seeding from an old log that has a refusal, an unreadable block and an entry withoutRead-Model; the CLI output.Not run in this stage: the smoke set (run at Stage 2).
Notes:
Reading the history creates the file when it is missing, so a page view writes one small file under
state/logs/.Tests run the real
scripts/deploy.phpagainst the fixture checkout through a newcli()helper.
Estimate details (extended mode only): original scope as in Step 3 Stage 1; uncertainty low; no revision.
— Claude · 2026-11-22 UTC · Model: claude-fable-5-2
Stage 2 - Roll back over SSH
Original estimate: 0.20
Retrospective: 0.20
Changes:
AppUpdate::rollback()resetsmainto an earlier deployed commit under the deploy lock, keeps local edits, runs the read-model check, and logs an attempt (rolled_back) and a history entry (Action: rollback). It never fetches.Refusals, each leaving the checkout as it was:
not_deployed_here,already_running,not_behind,wrong_branch,busy,local_changes_conflict.deploy()androllback()sharerecord()for the read-model check and logging, andmoveKeepingLocalChanges()for the set-aside and put-back of local edits. The deploy's messages and reasons are unchanged.deployedCommits()lists the allowed targets: every old or new commit in the history, so the version before the first recorded deploy is included../v3 deploy --rollback=COMMIT(7 to 64 hex digits).
Verification:
Passed:
./v3 test --smoke AppUpdateTest DeployPageTest, with five new tests: rollback then deploy forward; a kept local edit; a conflicting local edit leavesHEAD, the edit and the stash list unchanged; every refusal; the CLI.The first High risk from Step 3 (a local edit that does not apply on the older commit) is covered by the conflicting-edit test.
Notes:
Defect found and fixed from Stage 1: a first deploy on a checkout with no history file was recorded twice, because the seed read the attempt just logged.
record()now seeds before logging; the rollback tests cover it.
Estimate details (extended mode only): original scope as in Step 3 Stage 2; uncertainty medium; no revision.
— Claude · 2026-11-22 UTC · Model: claude-fable-5-2
Stage 3 - Preview and warnings
Original estimate: 0.10
Retrospective: 0.10
Changes:
AppUpdate::rollbackPreview()returns the commits a rollback undoes (same shape and cap as incoming commits) and up to three warnings: a read-model version change, changes undersrc/ForumRewrite/Canonical/, and changes underdocs/specs/. It changes nothing.incoming()and the preview sharecommitList();rollback()and the preview sharerollbackRefusal(), so both judge a target the same way../v3 deploy --rollback=COMMITprintsUndoes-Commit:andWarning:lines before the result.
Verification:
Passed:
./v3 test AppUpdateTest DeployPageTest(49 run, 0 failed), with two new tests: the commit list and refusals; each warning off and on, including aSCHEMA_VERSIONchange from 55 to 56, and a rollback that goes through despite three warnings.The second High risk from Step 3 (older code misreads newer records) has its early validation here; the mitigation is the warning plus Deploy now.
Notes:
Over SSH the warnings print and the rollback proceeds; the operator already chose the commit. The page (Stage 4) asks for a confirmation.
Estimate details (extended mode only): original scope as in Step 3 Stage 3; uncertainty low; no revision.
— Claude · 2026-11-22 UTC · Model: claude-fable-5-2
Stage 4 - Deploy page
Original estimate: 0.20
Retrospective: 0.20
Changes:
templates/pages/deploy.php: a History section below the actions lists each deploy and rollback, newest first, then the version that ran before the first recorded deploy. The running version is marked; each other version behind it has a Roll back button.Roll back posts
rollback_preview; the page then shows a confirmation above the facts with the commits undone, any warnings, a "Roll back to <commit>" button and Cancel. Confirm postsrollback, and the reply redirects to the page so a reload does not post again.DeployController::submit()handles both actions under the existing same-origin and root-operator checks.AppUpdate::versions()builds the rows.tool-details.css:.deploy-historyand.deploy-rollback.Every rollback control is a plain form, so it works with JavaScript off.
deploy_control.jsanddeploy_celebrate.jsare unchanged: the script never sees a rollback, so no banner plays.
Verification:
Passed:
./v3 test --smoke AppUpdateTest DeployPageTest(536 run, 0 failed). New page test: history and links; no button on the running version; the preview moves nothing; a refused preview; the rollback through the form; the page afterwards; the JSON replies; a reader sees the history without buttons. The gate test now also refusesrollbackandrollback_previewfor all six non-operator and cross-origin cases.Passed, in headless Chrome at 380px: Gloss, Gloss Dark, Word97 and Bubblegum, plus Gloss with JavaScript off. No element of the history or the confirmation extends past the viewport. Pages were rendered by the real controller and template over a fixture checkout, served with the real stylesheets.
Not verified in a browser: tapping through the flow on a live server. The form posts are covered by the page test.
Notes:
Differs from Step 3 in two places. The history is its own section below the actions, not a table row: in the facts table it sat in a narrow column and pushed Deploy now far down the page. And
deploy_control.jsneeded no change, because a deploy already reloads the page.Button labels stay as planned: "Roll back" and "Roll back to <commit>".
Estimate details (extended mode only): original scope as in Step 3 Stage 4; uncertainty medium; no revision.
— Claude · 2026-11-22 UTC · Model: claude-fable-5-2
Stage 5 - Docs and prod test
Original estimate: 0.05
Retrospective: 0.05
Changes:
docs/concepts/application_update.md: deploy history and rollback, and the new boundary.docs/runbooks/production_deploy.md: a "Deploy history and rollback" section.docs/reference/v3_cli.md:--historyand--rollback=COMMIT.
Verification:
Passed:
./v3 test --smoke AppUpdateTest DeployPageTest(536 run, 0 failed);git diff --check; local links in the three documents resolve.Pending: the maintainer's prod replay. On zenmemes.com from the iPhone: roll back one version, deploy forward, then
git statusover SSH still shows thepublic/.htaccessedit. Nothing in this cycle has run on production.Not run: the full suite.
Notes:
Final diff review: 17 files. No dependency added, no new navigation destination, no schema change.
deploy()androllback()share their lock, local-edit handling, read-model check and logging rather than duplicating them.
Estimate details (extended mode only): original scope as in Step 3 Stage 5; uncertainty low; no revision.
— Claude · 2026-11-22 UTC · Model: claude-fable-5-2
Closeout
Cycle retrospective: 0.70
All five stages are complete and committed, one commit each after the planning commit
a12fc0da.Completion Contract: entry, outcome, recovery, the no-JavaScript path and "no migration, no rebuild" are met in tests and a headless browser. The release condition (prod replay) is pending, so the cycle is technically complete with production acceptance pending.
Retrospective 0.70 against a projected 0.65: the stages matched their estimates; the extra is the Stage 1 double-entry defect found in Stage 2 and the history layout redone after the first screenshots.
Maintainer comfortable-fit judgment: pending.
Follow-ups, not done: none required. Possible later: show history times in the viewer's time zone (the page's other times are also UTC).
— Claude · 2026-11-22 UTC · Model: claude-fable-5-2