feat: socket-patch --update self-update + passive update notifier#128
Open
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Open
feat: socket-patch --update self-update + passive update notifier#128Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Mikola Lysenko (mikolalysenko) wants to merge 4 commits into
Conversation
…re engine, CLI wiring, crux e2e) - core update engine: release resolution (redirect probe + API fallback), SHA256SUMS verify-before-extract, single-entry archive extraction with caps, dest-dir staging + sanity exec, mode-preserving atomic swap (self-replace on Windows), flock single-flight, channel detection - CLI: root --update flag via argv rewrite to hidden self-update subcommand; SOCKET_PATCH_VERSION pin; --force; envelope command=update - passive notifier: guarded once-daily background check, 500ms grace, stderr-only notice, SOCKET_NO_UPDATE_CHECK opt-out - hermeticity: notifier kill-switch in .cargo [env] + test harnesses - shellcheck install.sh in CI (and fix its SC2144 musl-loader probe) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… suites 25 + 18 + 30 tests, all hermetic (wiremock fake release / closed ports): - failures: checksum/sums/404/timeout/truncation/downgrade/pin/sanity/ EACCES/offline-beats-force/lock-held/json-envelope rows, each ending binary-intact + no-droppings - channels: npm/pip/cargo/launcher-cache refusals with per-manager hints, zero-network-before-refusal, --force override, symlink canonicalization - notifier: cadence via state-file timestamps, cache-notice zero-network, guard matrix (fetch suppressed, not just print), grace budget bound, corrupt/future/unwritable state tolerance, PTY true-TTY proof Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- HTTPS-only redirect hops now enforced for SHA256SUMS and API-fallback fetches too, not just the archive download (the SUMS leg is the integrity root; shared follow_redirect_policy) - --update --dry-run on an up-to-date install now reports the documented verified/update_check probe shape (updateAvailable: false) instead of falling into the skipped/already_latest path - stage sweep is age-gated (1h) so a concurrent updater with a divergent state dir can no longer have its live stage deleted mid-pipeline; contract wording now states the lock's per-environment scope honestly - Linux file capabilities (setcap xattr) on the target now refuse the swap, same rationale as setuid: an unprivileged rename cannot restore them - fixture: corrupt_sums_entry_for matches the full ' <name>' suffix so it cannot corrupt a different asset's line - e2e: cli_global_args matrix covers self-update; new up-to-date dry-run probe regression test Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
`socket-patch --update` — the CLI updates itself from GitHub Releases, closing the loop with the curl|sh install flow:
Passive update notice — interactive runs mention a newer release at most once/day, stderr-only, after command output; suppressed under `--json`/`--silent`/offline/CI/non-TTY/`SOCKET_NO_UPDATE_CHECK=1` (suppressed ⇒ zero network I/O); can never change an exit code, touch stdout, or add >~500 ms; state corruption degrades to "never checked".
Also: `shellcheck scripts/install.sh` in the lint job (and a fix for the SC2144 musl-probe bug it found).
Reliability & testing
All hermetic (wiremock fake-release fixture; hostile-seeded env scrub keeps every pre-existing suite off the network — belt-and-braces kill-switch in `.cargo/config.toml` `[env]` + both test harnesses):
Live smoke against real GitHub is `#[ignore]`-gated: `cargo test -p socket-patch-cli --test self_update_e2e -- --ignored` (documented in ci.yml next to the other live-API suites; most useful right after a release).
Notes for review
🤖 Generated with Claude Code