Skip to content

fix(platform): detect interrupted upgrades and prompt for replay #26

Description

@dipto0321

Problem

The plan and nodeup.md §10 say: "every step writes to disk BEFORE mutation so an interrupted run can be replayed via nodeup packages restore". Today, internal/cli/upgrade.go calls snapshot BEFORE install and restore AFTER install, but if the process is killed mid-install, the user must know how to invoke restore manually. A first-class replay command and a startup-time "looks like upgrade was interrupted" detection are missing.

Solution

  1. Add a sentinel file: <DataDir>/upgrade-in-progress.json written at the start of nodeup upgrade (after snapshot save, before first install), removed at the end.
  2. On every nodeup invocation, detect an orphaned sentinel and print:
    Detected an interrupted upgrade (snapshot: <mng>-<ver>.json, started: <RFC3339>).
    To resume: `nodeup packages restore --manager <mng> --version <ver>`
    
  3. Expose nodeup packages restore --from <snapshot-path> for explicit replay.

Tests

  • Write a sentinel in a tempdir, invoke the detector, verify the warning message contains the snapshot path.
  • Verify the sentinel is deleted on a successful (mocked) upgrade run.
  • CI: Test (ubuntu-latest) must pass.

Linked PRs

  • (this issue)

Refs #16 (Phase 6 meta-issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions