Skip to content

Remove legacy cutover rollback support - #420

Merged
corrin merged 2 commits into
mainfrom
chore/kan-275-remove-legacy-cutover-support
Jun 28, 2026
Merged

Remove legacy cutover rollback support#420
corrin merged 2 commits into
mainfrom
chore/kan-275-remove-legacy-cutover-support

Conversation

@corrin

@corrin corrin commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • delete the one-time legacy cutover and rollback scripts
  • remove legacy checkout branches from deploy, release utility, and predeploy backup handling
  • update runbooks and template tests to document shared-release rollback only

Validation

  • pytest apps/workflow/tests/test_xero_instance_templates.py
  • bash scripts/test_release_utils.sh
  • shellcheck scripts/server/deploy.sh scripts/predeploy_backup.sh scripts/predeploy_rollback.sh scripts/server/release-utils.sh scripts/server/instance.sh scripts/test_release_utils.sh
  • rg -n "cutover_legacy_instance|legacy_rollback|legacy-rollbacks|is_legacy_checkout|compact_legacy_instance_checkout|allow-dirty|dirty legacy working tree" scripts docs apps/workflow/tests -g '!docs/plans/**'
  • pre-push hook: backend type-check baseline sync, frontend unit tests, lint, type-check, typed-router build check, workflow formatting

KAN-275

Summary by CodeRabbit

  • Bug Fixes

    • Simplified deploy and instance setup flows to use only the shared-release rollback path.
    • Backup creation now always writes to the standard instance backup location.
    • Improved validation for incomplete instance setup so errors are shown earlier and more clearly.
  • Documentation

    • Updated deploy and rollback guidance to reflect the shared-release workflow only.
    • Removed outdated legacy rollback instructions from operator docs.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d5bc4858-ea4a-4094-9495-2915e80a7f53

📥 Commits

Reviewing files that changed from the base of the PR and between a865a77 and 9d9ad86.

📒 Files selected for processing (4)
  • apps/workflow/tests/test_xero_instance_templates.py
  • docs/updating.md
  • scripts/server/README.md
  • scripts/server/instance.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/updating.md
  • apps/workflow/tests/test_xero_instance_templates.py

📝 Walkthrough

Walkthrough

Removes legacy per-instance checkout scripts (legacy_rollback.sh, cutover_legacy_instance.sh) and all supporting helpers (is_legacy_checkout, compact_legacy_instance_checkout, git-fallback SHA resolution, --allow-dirty). Updates deploy.sh, instance.sh, release-utils.sh, and predeploy_backup.sh to use only the shared-release rollback path. Tests and docs are updated to match.

Changes

Legacy cutover/rollback removal

Layer / File(s) Summary
deploy.sh, instance.sh, release-utils.sh: remove legacy helpers
scripts/server/deploy.sh, scripts/server/instance.sh, scripts/server/release-utils.sh
deploy.sh drops --allow-dirty, is_legacy_checkout(), compact_legacy_instance_checkout call, and .git-based instance validation; instance.sh removes .git-based existence detection and SHA selection, adds guard for .env-without-symlink partial state; release-utils.sh removes git-fallback SHA resolution and compact_legacy_instance_checkout().
predeploy_backup.sh: always write to instance backup dir
scripts/predeploy_backup.sh
Removes legacy rollback directory selection logic; OUT is now always derived from BACKUP_DIR and written atomically via tmp rename.
Tests and docs: shared-release rollback only
apps/workflow/tests/test_xero_instance_templates.py, docs/updating.md, scripts/server/README.md
Removes legacy script constants and four legacy-focused test methods; adds tests for shared-release rollback path, instance-only backup dir, README single-path documentation, and the new .env-without-symlink error path in instance.sh; updates docs/updating.md and scripts/server/README.md to remove legacy rollback guidance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • corrin/docketworks#407: Updates the same test file to replace legacy cutover/rollback expectations with shared-release rollback assertions.
  • corrin/docketworks#409: Modifies the same test file around legacy cutover/rollback behavior — the inverse of this PR's changes.
  • corrin/docketworks#418: Modifies the same backup-timer ownership and instance-backup directory assertions in the same test file.

Poem

🐇 Snip, snip, the old scripts are gone,
No legacy tarballs to carry on!
One rollback path, clean and neat,
predeploy_rollback.sh — can't be beat.
The warren is tidy, the burrow is clear,
Shared releases only, from here to here! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing legacy cutover/rollback support.
Description check ✅ Passed It includes a clear summary, Jira key, and validation steps, covering the main required details despite no checklist section.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/kan-275-remove-legacy-cutover-support

Comment @coderabbitai help to get the list of available commands.

@corrin
corrin marked this pull request as ready for review June 28, 2026 05:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/server/deploy.sh`:
- Line 340: The deploy status message in the rollback guidance should not
advertise `predeploy_rollback.sh` when the deploy is running with `--no-backup`.
Update the logging around the `log` call in `scripts/server/deploy.sh` to gate
the rollback command on `DO_BACKUP`, or replace it with a clear warning that
rollback data is unavailable when no paired dump exists. Make sure any related
docs and tests that assume a rollback pair is always present are updated to
match the `predeploy_rollback.sh` / `DO_BACKUP` behavior.

In `@scripts/server/instance.sh`:
- Around line 324-325: The instance detection in instance.sh is too permissive:
if .env exists but app/current is missing, the script can mark the instance as
existing and later reconfigure it without taking the bootstrap/migration path.
Update the IS_EXISTING logic and the reconfigure flow to explicitly reject or
reroute instances that lack a release symlink, using the existing
INSTANCE_DIR/app, INSTANCE_DIR/current, and NEEDS_APP_BOOTSTRAP checks to force
the full deploy path when app/current is absent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 68d3b410-8663-4007-b9ed-1137b52b11fb

📥 Commits

Reviewing files that changed from the base of the PR and between 65831b5 and a865a77.

📒 Files selected for processing (9)
  • apps/workflow/tests/test_xero_instance_templates.py
  • docs/updating.md
  • scripts/legacy_rollback.sh
  • scripts/predeploy_backup.sh
  • scripts/server/README.md
  • scripts/server/cutover_legacy_instance.sh
  • scripts/server/deploy.sh
  • scripts/server/instance.sh
  • scripts/server/release-utils.sh
💤 Files with no reviewable changes (3)
  • scripts/legacy_rollback.sh
  • scripts/server/cutover_legacy_instance.sh
  • scripts/server/release-utils.sh

Comment thread scripts/server/deploy.sh
else
log " sudo $SCRIPT_DIR/../predeploy_rollback.sh $instance $(short_release_sha "$previous_sha")"
fi
log " sudo $SCRIPT_DIR/../predeploy_rollback.sh $instance $(short_release_sha "$previous_sha")"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Don't advertise predeploy_rollback.sh after a --no-backup deploy.

predeploy_rollback.sh restores the newest predeploy_*_<hash>.sql.gz for the requested short SHA. If this deploy ran with --no-backup, there is no fresh paired dump, so the printed command will either fail or roll the instance back to an older snapshot for the same release hash. Please gate this message on DO_BACKUP (or emit an explicit warning that rollback data is unavailable) and update the docs/tests that now assume the rollback pair always exists.

Suggested guard
-                log "    sudo $SCRIPT_DIR/../predeploy_rollback.sh $instance $(short_release_sha "$previous_sha")"
+                if [[ $DO_BACKUP -eq 1 ]]; then
+                    log "    sudo $SCRIPT_DIR/../predeploy_rollback.sh $instance $(short_release_sha "$previous_sha")"
+                else
+                    log "    --no-backup was used, so no fresh pre-deploy dump exists for rollback."
+                fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
log " sudo $SCRIPT_DIR/../predeploy_rollback.sh $instance $(short_release_sha "$previous_sha")"
if [[ $DO_BACKUP -eq 1 ]]; then
log " sudo $SCRIPT_DIR/../predeploy_rollback.sh $instance $(short_release_sha "$previous_sha")"
else
log " --no-backup was used, so no fresh pre-deploy dump exists for rollback."
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/server/deploy.sh` at line 340, The deploy status message in the
rollback guidance should not advertise `predeploy_rollback.sh` when the deploy
is running with `--no-backup`. Update the logging around the `log` call in
`scripts/server/deploy.sh` to gate the rollback command on `DO_BACKUP`, or
replace it with a clear warning that rollback data is unavailable when no paired
dump exists. Make sure any related docs and tests that assume a rollback pair is
always present are updated to match the `predeploy_rollback.sh` / `DO_BACKUP`
behavior.

Comment thread scripts/server/instance.sh
@corrin
corrin merged commit 81a6ca6 into main Jun 28, 2026
8 of 9 checks passed
@corrin
corrin deleted the chore/kan-275-remove-legacy-cutover-support branch June 28, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant