Skip to main content

Module update

Module update 

Source
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 by install.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 upgrade and 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.
InstallMarker
<state>/install.json: what install.sh recorded.
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.
UpdateCache
<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, and Cargo.toml carries 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. Behind carries 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 for application/vnd.github.sha, and with a JSON object carrying sha otherwise; both are understood so [update] remote can point at either kind of server.
DEFAULT_RELEASES_URL
The newest release. A release install 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 that eclipse upgrade downloads 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] check period, 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: Some exactly 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 GET through http::get, inside CHECK_TIMEOUT.
fetch_release
Ask for the newest release, through the same GET. [update] releases is 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 shape install.sh writes with date -u, so the two cannot disagree about what a timestamp looks like.