Repository navigation
Save application state before macOS update installation - #1004
Conversation
Use ship-shape's installer-ready callback to force-close the main window through Paperback's normal persistence and cleanup handler, then leave the application event loop. This saves settings, document positions and window geometry, stops audio and timers, and bypasses macOS's hide-on-close veto so the update helper can replace and relaunch the app. Pass the resolved settings directory through Launch Services when the new app is launched, preserving custom and isolated configurations. Pin the companion ship-shape PR commit so this draft builds without a local checkout. Replace the temporary Git patch with the published crate version after trypsynth/ship-shape#6 is merged and released. Co-Authored-By: Codex <noreply@openai.com>
a78e768 to
0ceefdb
Compare
trypsynth
left a comment
There was a problem hiding this comment.
One thing here, alongside my review of ship-shape#6: this always passes PAPERBACK_CONFIG_DIR to the relaunch, set to whatever folder config_dir() resolved to, even when the reader never set the variable. It works out to the same folder today, but it means every relaunch after an update runs as if an override had been given. Please only pass it on when PAPERBACK_CONFIG_DIR was actually set in this process's environment.
It would also help VoiceOver users to hear something before Paperback quits, something like "Installing the update. Paperback will restart." Otherwise the app just disappears and comes back a few seconds later.
Forward PAPERBACK_CONFIG_DIR only when it is present in this process's environment. Preserve its native value so relaunch does not synthesize an override for the default settings directory or lose non-UTF-8 path bytes. Post a translated high-priority live-region announcement before updater shutdown. Disable the frame and keep the UI event loop running for a brief grace period so VoiceOver can receive the asynchronous notification, then run the existing forced-close persistence and cleanup path. Update the pinned ship-shape revision and lockfile to the reviewed signer, stale-stage cleanup and log-retention fixes. Keep the integration draft pending the upstream crate release. Co-Authored-By: Codex <noreply@openai.com>
|
Pushed 5b54c1c with both changes:
The dependency pin and lockfile now point to ship-shape's review-fix commit Validation against that public pin: The announcement is wrapped in |
Problem and behavior
The automatic macOS installer proposed in trypsynth/ship-shape#6 needs Paperback to exit after preparation. Its default immediate-exit callback would skip Paperback's normal close handler and the state it saves. This integration closes Paperback through that handler before the helper replaces and relaunches the app.
PAPERBACK_CONFIG_DIRonly when it was explicitly present in the current process's environment, preserving its native value. Default configuration resolution remains in effect when it is unset.Dependency and merge order
Draft: depends on ship-shape#6 being merged and released. The workspace currently patches ship-shape to the immutable reviewed commit
bbbdc5761a54a9b0b742b0f393e28ae0548e895bon my fork, with a matching lockfile. This allows reviewers and CI to build the integration without a local sibling checkout.Before merging:
Cargo.lock.Validation
On macOS, using the updated public pinned commit without a local override:
cargo check -p paperbackpasses.cargo test -p paperback --bin paperback --locked: 116 tests pass.cargo clippy -p paperback --all-targets --lockedpasses with existing repository warnings; formatting and whitespace checks pass.The companion updater passes 64 automated tests and an additional read-only signer test against a notarized release, plus standalone strict clippy using its own lint policy.
Before the signer policy was tightened, a disposable Paperback copy completed a real Minisign-verified GitHub dev update: it quit, was replaced at the same test path, and relaunched with its isolated settings and document at the same visible passage. The resulting release passed code-signature verification and Gatekeeper assessment as notarized. Exact saved character-offset equality was not established. The new VoiceOver announcement has not yet been verified by a listening check on a developer-signed automatic-update build.
Automatic installation now requires the running and replacement apps to have the same Apple developer team; ad-hoc/unsigned builds retain manual installation. The helper allows 60 seconds for shutdown. A successful launch request cannot establish subsequent application health. The ship-shape README documents signer checks, manual fallback and recovery limits.