Expand description
What an install knows about itself, and the notice that says a newer commit exists.
Two files live in the state directory, next to the sessions but not in them:
install.json, written byinstall.sh(never by this crate): which channel the install came from, where its binaries and its checkout are, and the commit it was built from.eclipse upgradeand the notice both read it; neither writes it.update.json, written here: when the public repository was last asked and what it said.
The notice is the only request this tool makes that is neither a model call nor something
the user asked for. It is bounded accordingly: at most one GET per [update] check period,
a 2 s timeout, no credentials, every failure silent, and check = "off" makes no request at
all. It also only runs for an install that has an install.json with a commit, because
without one there is nothing to compare the answer to.
The notice and the badge are two readings of one comparison. The notice happens once per
answer (notified); the badge is the comparison itself, behind, and lasts as long as the
install is behind — which is why a surface that repaints asks Watch again instead of
remembering what it was told.
Structs§
- Behind
- A newer version exists and the install has not taken it yet.
- Check
- What a front door (
run, the interactive interface) does about the notice: the line to say once, if any, the badge, and the refresh that may still be in flight. - Install
Marker <state>/install.json: whatinstall.shrecorded.- Release
- One release, as the API describes it: enough to fetch and verify the one asset this machine can use, and nothing else.
- Snapshot
- What the dashboard renders: the cache’s own numbers, with the comparison already made.
- Update
Cache <state>/update.json: the last time the repository was asked, and what it said.- Version
- A release version: three numbers, no pre-release. The workflow refuses a tag that disagrees
with
Cargo.toml, andCargo.tomlcarries no pre-release, so a fourth field would be a parser nobody can reach from a real release. - Watch
- Where a badge is read from, for a surface that asks more than once per process: the state
directory (the plain one, never a profile’s — an install belongs to the machine user) and the
[update]section that decides whether there is anything to say. Reading it is two small files, so a frame or a request may ask again rather than cache the answer in memory.
Enums§
- Channel
- Outcome
- What one refresh did, for a caller that logs or tests it.
Behindcarries the badge, so a caller that only renders does not have to ask the disk again.
Constants§
- CACHE_
FILE - CHECK_
TIMEOUT - The whole budget for one check: name resolution, connect, and reading the answer.
- DEFAULT_
LATEST_ URL - The public repository’s latest commit on
main, which is the branch releases are cut from. GitHub answers with the bare id when asked forapplication/vnd.github.sha, and with a JSON object carryingshaotherwise; both are understood so[update] remotecan point at either kind of server. - DEFAULT_
RELEASES_ URL - The newest release. A
releaseinstall compares a tag with a version, not a commit with a commit, so it asks a different question; the answer carries the tag and the asset URLs thateclipse upgradedownloads from, which is why a mirror can stand in for GitHub here too. - DEVELOP_
LATEST_ URL - The same question about
develop, for a source install that follows that track ([update] track = "develop"): the commits that are coming, not the ones that were released. - MARKER_
FILE - RELEASE_
TIMEOUT - Asking for a release is two round trips’ worth of latency on a bad day, not a 2 s notice.
- STALE_
AFTER_ SECS - How long an answer may stand before a surface that cannot refresh it stops repeating it. A
week is longer than either
[update] checkperiod, so only a machine that has stopped asking reaches this. - SUMS_
NAME - The asset that says which bytes the tarball should be.
- TARBALL_
SUFFIX - The one asset a Linux install can use. Named rather than guessed from
uname: a release with no matching asset is a refusal that lists what the release does carry.
Functions§
- behind
- The marker and the cache compared:
Someexactly while the installed thing is behind the cached answer. One rule, so the badge, the REPL, the dashboard and the gateway cannot disagree about what “behind” means. - fetch_
latest - Ask for the latest commit on the track’s branch. One
GETthroughhttp::get, insideCHECK_TIMEOUT. - fetch_
release - Ask for the newest release, through the same
GET.[update] releasesis the user’s URL, so it may be a host on their own network, exactly like[update] remote. - parse_
latest - A commit id out of an answer: the whole body, or a JSON object’s
sha. - parse_
release - Read a release answer. The assets are the API’s, not a URL built from a template: a tag can be republished, an asset name can change with the platform rule, and a mirror answers the same shape with its own URLs.
- refresh
- Ask the repository, if the cache says it is time, and leave the answer where every reader
looks. This is what a long-lived process runs on its schedule: the CLI’s per-run check and
the gateway’s tick write the same
update.json, so one of them answering spares the other the request. - rfc3339_
utc - The marker’s
installed_at: RFC 3339 in UTC, the same shapeinstall.shwrites withdate -u, so the two cannot disagree about what a timestamp looks like.