feat(cli): add self-update mechanism (omnigraph update) [MR-612]#79
Open
devin-ai-integration[bot] wants to merge 5 commits into
Open
feat(cli): add self-update mechanism (omnigraph update) [MR-612]#79devin-ai-integration[bot] wants to merge 5 commits into
devin-ai-integration[bot] wants to merge 5 commits into
Conversation
- New `omnigraph update` subcommand: GitHub Releases API → archive download → SHA256 verification → atomic POSIX rename of both binaries. - Detects Homebrew installs and short-circuits with a hint to run `brew upgrade ModernRelay/tap/omnigraph`. - Channels: `--channel stable` (default) or `edge`. `--check` for check-only, `--yes` to skip the confirmation prompt. - Best-effort startup version check (24h cached at `~/.cache/omnigraph/update-check.json`) with one-line stderr notice. Cache is refreshed via a detached `__refresh-update-cache` subprocess so the foreground command never blocks on the network. Suppression: CI, `OMNIGRAPH_NO_UPDATE_CHECK=1`, non-TTY stdout, and `version`/`update` subcommands. - Integration tests use an in-process raw-TCP HTTP fixture (no extra dev-deps) and override `OMNIGRAPH_UPDATE_API_BASE` / `OMNIGRAPH_UPDATE_DOWNLOAD_BASE` to keep the suite hermetic. - Docs: `install.md`, `cli.md`, `cli-reference.md` updated. Co-Authored-By: Ragnor Comerford <ragnor.comerford@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
- Refuse non-interactive update without --yes (Devin Review P1): bail with a clear error instead of silently replacing binaries when stdin is not a TTY. Matches gh / rustup / apt-get posture. - Persist 24h cooldown on refresh failures (cubic P2): the hidden `__refresh-update-cache` subprocess now writes a fresh `checked_at_unix` even when the GitHub API call fails (keeping the previously-known tag), so a transient outage doesn't spam refreshes. - Make the checksum-mismatch test platform-correct (cubic P2): compare byte-for-byte against the snapshotted original binary instead of ELF/shebang magic, which excluded macOS arm64 (Mach-O). - Bump cli-reference top-level family count 17 -> 18 (cubic P3). - Add a new integration test asserting non-interactive bail-out. Co-Authored-By: Ragnor Comerford <ragnor.comerford@gmail.com>
…R-612) cubic P2 follow-up. `touch_cooldown` previously carried forward `latest_version` from any prior cache entry, even one written by a binary pointed at a different fork. After this change we only reuse the cached version when its `repo_slug` matches the repo this binary was built for; otherwise we fall back to the current binary's own version, which never fires a spurious "newer available" notice. Adds two unit tests covering both cases. Co-Authored-By: Ragnor Comerford <ragnor.comerford@gmail.com>
Previous run failed only on `concurrent_branch_ops_morphological_matrix` in omnigraph-server, a new concurrency stress test introduced by #75. This PR touches only omnigraph-cli; the same test passed on the main branch run immediately before this PR's CI executed. Empty commit to re-trigger CI and confirm flake. Co-Authored-By: Ragnor Comerford <ragnor.comerford@gmail.com>
`concurrent_branch_ops_morphological_matrix` (added by #75) fails ~20% locally on plain main; tracked separately. No code change in this commit. Co-Authored-By: Ragnor Comerford <ragnor.comerford@gmail.com>
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.
Summary
Implements MR-612. Adds a CLI self-update flow with three pieces:
Phase 1 —
omnigraph updatesubcommand (crates/omnigraph-cli/src/update.rs)CARGO_PKG_VERSION, and short-circuits withomnigraph is up to date (vX.Y.Z)if nothing newer is available.omnigraph-<platform>.tar.gzand.sha256, verifies the digest before touching anything, extracts into a temp dir on the same filesystem as the install dir, and replaces bothomnigraphandomnigraph-server(when present) via POSIXrename(2)so the running binary is never partially overwritten./opt/homebrew/,/usr/local/Cellar/,/usr/local/opt/,/home/linuxbrew/.linuxbrew/, plus a fallback tobrew --prefix) and prints a one-liner directing the user tobrew upgrade ModernRelay/tap/omnigraph.--channel <stable|edge>(defaultstable),--check,-y/--yes.--channel edgealways reinstalls because theedgetag moves with every push tomain.Phase 2 — startup notification (
crates/omnigraph-cli/src/version_check.rs)$XDG_CACHE_HOME/omnigraph/update-check.json(default~/.cache/omnigraph/update-check.json). Override for tests viaOMNIGRAPH_UPDATE_CACHE_DIR.__refresh-update-cachesubcommand,setsidon Unix) so the foreground command never blocks on the network — same pattern asnpm/update-notifierandgh.OMNIGRAPH_NO_UPDATE_CHECK=1,CItruthy, stdout not a TTY, and theversion/update/__refresh-update-cachesubcommands.Phase 3 — Homebrew tap auto-update — already implemented in
.github/workflows/release.yml(theupdate_homebrew_tapjob runsscripts/update-homebrew-formula.sh, gated on theHOMEBREW_TAP_TOKENsecret). No code changes needed; verified the workflow matches the ticket's verification criteria.Best-practice deltas from the literal ticket text
Per request, applied best-practice defaults rather than the literal spec:
~/.cache/omnigraph/(XDG cache, where volatile data belongs), not~/.config/omnigraph/.--checkexits 0 in both up-to-date and "upgrade available" cases (matchesapt list --upgradable); errors still exit non-zero. Easy to add a terraform-style--exit-codeopt-in later if scripting demands it.--channel edgealways reinstalls — no fragile sha-compare against a tag that moves withmain.Tests
crates/omnigraph-cli/tests/update.rsuse a hermetic in-process raw-TCP HTTP fixture (no extra dev-deps) and overrideOMNIGRAPH_UPDATE_API_BASE/OMNIGRAPH_UPDATE_DOWNLOAD_BASE. Coverage: up-to-date, newer-available, full download+verify+rename flow (asserts both binaries replaced byte-for-byte), checksum mismatch leaves the original binary in place, missing release metadata, and the case whereomnigraph-serverisn't present (must not be created).Docs
docs/install.md— new "Updating" section.docs/cli.md— new "Updating" section.docs/cli-reference.md—updaterow added to the top-level command table.Review & Testing Checklist for Human
omnigraph update --checkandomnigraph update --yesagainst an actual GitHub release and confirm both binaries get replaced and run the new version. The integration tests cover the logic but not the live-network path.omnigraph updateprints thebrew upgradehint without making network calls or modifying anything.HOMEBREW_TAP_TOKENis configured at the repo level and that the next stable tag actually triggersupdate_homebrew_tapto push a formula update toModernRelay/homebrew-tap.Notes
CIand the non-TTY check, so it should never appear in release pipelines.OMNIGRAPH_UPDATE_API_BASE/OMNIGRAPH_UPDATE_DOWNLOAD_BASEare documented only in the source — they're test-only knobs and intentionally not surfaced in user docs.Link to Devin session: https://app.devin.ai/sessions/a22fd3c129a747679d520560ee683fc6
Requested by: @ragnorc