Skip to content

fix(update): verify and atomically stage SSH-pushed standalone updates - #256

Merged
abruption merged 6 commits into
mainfrom
abruption/v103-issue-229
Oct 5, 2026
Merged

abruption merged 6 commits into
mainfrom
abruption/v103-issue-229

Conversation

@abruption

Copy link
Copy Markdown
Owner

Summary

Verify bounded SSH-pushed source bytes, stage on the target filesystem, require exact staged/installed version checks, and atomically publish with rollback for handled in-process failures. Preserve owned launchers and independently probe before reporting updated: true.

Closes #229

Type

  • fix

Checklist

  • Generated standalone and scoped tests checked.
  • Interrupted/corrupt transfers and user-owned sentinels exercised in isolated fixtures.
  • Real-host SSH verification (not performed).

Verified against

Python 3.13.7, macOS arm64. Independently reran 64 original focused tests, then the combined SSH/updater/output/release contract set (81 passed). Worker follow-up passed 18 updater and 27 CLI runtime tests. Independent read-only review findings addressed: benign first-connect stderr no longer hides an exact absence sentinel; started transfer failures are explicitly unknown and disallow retry.

Notes

These are actual generated remote-script executions on synthetic homes, NOT a live SSH connection. Truncation, digest/base64/artifact/version/publication failures preserve the old copy when rollback executes. SIGTERM after publication may leave the new file installed: signal/transport loss or rollback failure is an unknown commit, not a preservation guarantee. Confirmed commit plus failed later probe retains commit evidence without updated: true. Symlinked installation directories/custom launchers are refused; hard-link support is required for rollback. Coordinate with #228/#230/#239; draft only, no merge/release/deployment.

@abruption abruption added this to the v1.0.3 milestone Oct 3, 2026
@abruption

Copy link
Copy Markdown
Owner Author

Review follow-up implemented in e98e501.

Remote publication now holds a persistent POSIX flock across snapshot, installed verification and conditional rollback. A rollback requires the published device/inode and digest to match. Deterministic interleaving verifies a failed updater cannot overwrite a different cooperating updater's successful version. Contention is bounded at 30 seconds; the lock inode is intentionally retained, never deleted/truncated as stale state. Unmanaged writers and signal-driven termination are not made atomic by this advisory lock.

The exact complete LF/CRLF installed receipt is parsed on both normal exit and timeout output, including bytes; exit 255 no longer hides that evidence. updated: true still requires the separate fresh installed-version probe. Partial/wrong/invalid receipts remain unknown/no retry.

Verified: 26 updater plus 27 CLI-runtime tests on actual Python 3.9.6 and 3.13.7. No real SSH/deployment; draft retained. Reconcile generated standalone with #249/#254/#255 on later integration.

@abruption

Copy link
Copy Markdown
Owner Author

Additional review addressed: push and installed-version probe capture raw bytes. Exact complete receipts survive non-UTF8 diagnostic stderr, while protocol stdout decodes strictly. Real local fake subprocess regressions cover exit 0/255 and invalid/partial/mismatched output; successful updates still require the independent fresh probe.

The publisher rereads the installed release while holding flock before snapshot/publication. A same/newer/unusable release returns a strict rejection without replacing the target or reporting update success. A deterministic newer-first fixture has both clients observe 1.0.2, lets 1.0.4 finish while 1.0.3 waits, then requires the stale client to reject and preserve 1.0.4. Stable/prerelease comparison parity, no retry, retained lock inode and rollback ownership checks remain covered.

Rejection decoding rejects duplicate fields/NaN/Infinity and unsafe conversion errors; malformed data does not establish prepublication certainty. commitStatus: not_started refers to publication, not the already-run SSH transfer. Advisory locks protect cooperating updaters; unmanaged writers/signals keep their documented limitations. Local synthetic fixtures only, no real SSH/deployment/merge/release.

@abruption
abruption merged commit ebf4943 into main Oct 5, 2026
28 checks passed
@abruption
abruption deleted the abruption/v103-issue-229 branch October 5, 2026 00:17
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.

fix(update): stage and verify the pushed standalone in update --host

1 participant