Repository navigation
Conversation
engine catalog [--refresh], catalog-plan <id>..., catalog-install <id>... [--any-car], updates [--refresh], update <id>... | --all | hmgapi, update-check (wifi.sh runs it each time home Wi-Fi comes up; the owner switches no_update_check and auto_stage_updates). - The catalogue: catalog/ on GitHub, from index.json (tools/catalog.py index) or GitHub's listing of the folder; cached in /data/hmgapi/catalog, updates also in public/updates.json. HMG-API's own release: its newest from the releases API (pre-releases only on one), the update zip's SHA-256 from SHA256SUMS. - Dependencies: requires met by what's installed, or by the catalogue's version installed first; a required mod that's off is turned on; the downloaded package's mod.json is read again for requires its entry doesn't name. Loops, conflicts, unmet ranges, a mod for a newer HMG-API (and, without --any-car, another car) are refused; everything is downloaded and checked before the first install. Removing a mod others require says which. - Trust: the entry's SHA-256, then Packages' signature check with the entry's author key (--uuid) on a first install; HMG-API's release key for HMG-API (UsbUpdates). Nothing applied. - tools/catalog.py: entries carry requires/conflicts (from mod.json, checked in bumps); catalog.py index. catalog-test.sh plays GitHub from files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80025ba to
64bfecc
Compare
…pply From the review of 2026-11-26: - Trust: the catalogue isn't signed, so a first install's author key must already be on the unit's maps/authors.json (only HMG-API's releases bring it), or the owner says yes for that mod (--any-author=<id>). Nothing here writes authors.json. - The plan is checked as a whole: every mod that will be on keeps what it requires, in range and on, and conflicts count from either side (an installed mod's list naming a planned one too). update --all leaves out each mod that can't go now, with why, and updates the rest. - unfit() honours the owner's any-car choice (overrides.ignore_system) and a hotspot mod's unpowered chip; --any-car=<id>,... per mod. - Every package is checked (Packages.check: signature, key, HMG-API, car) before the first install, and installed from the unzipped folder. - An unreadable range is a plan problem, not an exception. - Requires a package adds are kept (learned.json); if they change the plan, nothing is installed and the new plan comes back (exit 5) for a second OK. - update-check stages only pure updates signed with the installed key, into /data/hmgapi/pending/<id>, which nothing loads; engine apply puts them in place before it plans (previous version kept in previous/<id>), and puts them back if the apply is refused. engine plan lists them. - A plan or install refreshes a catalogue over 15 minutes old when online; one entry that doesn't come keeps the last check's; a bad index.json is an error, not a crash; per-run temporary names. - update-check at most every 6 hours. - A unit on a pre-release is offered only that version's next ones (rc.10: 1.1.0, not 1.2.0-alpha), unless the owner opts in. - update hmgapi refuses while a mod that's on wouldn't take the new version (--force: a warning instead). - Installs and removals outside the catalogue update the Updates count. - catalog.py: downloads only from GitHub's hosts, ranges checked, copies wifi.hotspot, writes index.json again on add when the repo keeps one and check refuses a stale one; bump allows an index written with the entry. catalog-test.sh 154 checks (was 71), tools/catalog-test.sh 113; test-all.sh --fast passes. Not on a car. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stagedIn puts them in mods/ right before an apply plans, and they went back only when the plan was refused. An apply that fails part-way (an exception, the files rolled back or left for recover) left them in mods/, where their code loads at the next boot, on /system files built for the versions before them. Found combining the open PRs: with #433's gear check and #434's in-run rollback there are more such paths; whichever lands after this puts them back there too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A mod the catalogue doesn't list (USB or adb, private, waiting for its PR) gets updates
from the repo its own mod.json names ("repo", inside the signed package, so the author's key
chose it). One API call per repo, at most 10 a refresh (longest unchecked first); the newest
release newer than what's installed, with its zip ("release_asset", else <id>-<version>.zip),
becomes an entry like the catalogue's ("source": "release"), so planning, staging and
installing are unchanged. Finals only, unless the installed version is a pre-release or the
owner opted in.
Trust is the installed key: a release is only ever an update by it (never a first install, a
key change or a downgrade), its package must be the tag's id and version, its SHA-256 is
checked when the release gives one (SHA256SUMS, or GitHub's digest), size capped. That is what
catalog-automerge already merges for a catalogue entry with no one looking.
- engine update-source <id> catalogue | releases | off | default: the owner's choice per mod
(a listed mod from a fork's releases, or no updates), in hmgapi.json catalog.update_source.
- catalog/withdrawn.json: versions maintainers stopped, for both sources; installed ones are
listed in updates. catalog.py checks it and never takes it for an entry.
- updates: each row's source, repo, release page and notes; every installed mod's source.
- GitHub's API limit: said, and the last answers kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub's API follows a transfer or rename, but the downloads it lists are the new repo's. The repo is taken from the release's page, and the zip (and SHA256SUMS) must be from that same repo; the package still has to be signed by the installed key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HMG-API checks a mod's own GitHub releases for updates when its mod.json names the repo (Open-HMG/HMG-API#423). Both builds carry it; each release's zips are named by id (egmp-aa-ev-<version>.zip, egmp-aa-ev-standalone-<version>.zip), which is what it looks for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eases HMG-API checks a mod's own GitHub releases for updates when its mod.json names the repo (Open-HMG/HMG-API#423); it looks for egmp-carplay-ev-routing-<version>.zip in a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HMG-API checks a mod's own GitHub releases for updates when its mod.json names the repo (Open-HMG/HMG-API#423), for owners who installed it from USB or follow its pre-releases. The release zips are already named wireless-carplay-aa-<version>.zip, with SHA256SUMS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
isaacwisdom
left a comment
There was a problem hiding this comment.
[P1] Staged updates escape trial and crash recovery — core/runtime/java/hmgapi/engine/Engine.java:451
Pending updates replace installed mod directories before the recovery journal is created. Recovery restores system files and settings but leaves the updated mod code installed. A reverted trial or interrupted apply can therefore leave incompatible code and system files. Persist the mod swaps in the transaction and restore them during recovery.
[P2] Withdrawn updates can still be applied — core/runtime/java/hmgapi/engine/Catalog.java:1623
A staged version remains eligible for promotion after a catalogue refresh withdraws it. Applying an unrelated settings change can install that withdrawn package. Recheck withdrawal status before promotion.
[P2] Automatic checks can run before Wi-Fi is marked connected — core/runtime/java/hmgapi/engine/HomeWifi.java:322
The update checker starts before "state":"up" is published. If it runs first, it rejects the connection as offline; the recorded lease prevents another attempt during that connection. Start the check after publishing connected state.
…ed; the check after Wi-Fi is up Review fixes (isaacwisdom): - Staged updates moved into mods/ are recorded (state/staged-swap.json) before the first move until the apply is final. engine recover puts them back with the /system files: a cut-off apply (with or without its journal yet, even between the two moves) and an undone trial. engine keep and a finished apply drop the record; an apply or install waits while it's there, and boot.sh runs recover for it as for a journal. - A staged version withdrawn since (catalog/withdrawn.json) is dropped at the apply, not put in. - wifi.sh starts the update check only after wifi.json says "up": the engine reads that to know it's online, and the check runs once per connection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, all three fixed in d4f5245:
Tests: 🤖 Addressed by Claude Code |
The messages, docs and comments this PR adds call the file a mod zip (or just the zip), so it isn't confused with a NEMESIS package. Lines from main are left as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VysseCodes
left a comment
There was a problem hiding this comment.
The trust chain holds: a first install needs a key on authors.json, the package must be signed by the entry's key, and Signing.verify checks the installed key.
One fix needed, a power-cut window: a non-trial apply() deletes the journal, and only afterwards does run() call Catalog.stagedDone() to remove staged-swap.json. A cut between the two makes the next boot run recover, and stagedRecover puts the old mod code back over the new /system files, so mod code and /system don't match.
Suggested fix: keep the staged ids in the journal itself, so deleting the journal makes the apply final in one step. staged-swap.json then only covers the moment before the journal is written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut window)
Review: a non-trial apply deleted its journal, and only afterwards did run() remove
staged-swap.json; a cut between the two made recover put the old mod code back over the new
/system files. Now apply() writes the staged ids into the journal ("staged") and deletes
staged-swap.json right after, so deleting the journal makes the staged updates final with the
files in one step, and recover puts them back from the journal. staged-swap.json only covers the
moments before the journal is written. Tests: a cut-off apply with the ids only on the journal,
and a finished apply (no journal, no record) that recover leaves alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fixed as suggested in 0b82eaa. New tests: a cut-off apply with the ids only on the journal (recover puts the update back), and a finished apply (no journal, no record) that recover leaves alone. The catalogue, engine, safety and Home Wi-Fi tests pass. |
The only conflict was tools/test-all.sh: this branch's catalog-test.sh and release/2.0's core/client/test.sh both go in ALL and FAST. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
release/2.0 carries version 1.1.0, so a fake 1.1.0 release was no longer newer and the update offer, its notes and the SHA256SUMS refusal weren't tested. 8.0.0 stays newer through 2.x; the 9.0.0 draft is still there to be skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stack: 4 of 5, on #422. The engine side of the catalogue; the app screens are #424.
Ops
engine catalog [--refresh]engine catalog-plan <id>... [--update]|--update --allengine catalog-install <id>...engine updates [--refresh]engine update <id>... | --all | hmgapi [--force]hmgapiruns HMG-API's own installerengine update-checkwifi.sh, when Home Wi-Fi comes up, at most every 6 hoursengine update-source <id> catalogue | releases | off | defaultThe owner's overrides are per mod:
--any-car=<id>,...(not listed for this head unit) and--any-author=<id>,...(a first install by an author key that isn't on the unit's trusted list).--any-caralone still means every mod in the batch, for adb.hmgapidpasses them to the app; the reads don't take the engine lock. Two new owner switches:no_update_checkandauto_stage_updates(off by default; see Staging). HMG-API itself is never updated automatically.No server of our own
The catalogue is
catalog/on GitHub:catalog/index.jsonif present (tools/catalog.py indexwrites it), else one call to GitHub's contents API for the listing, then each entry from raw. It's cached in/data/hmgapi/catalog/, and the update count is also inpublic/updates.jsonfor the app (rewritten after any install or removal, USB and adb too).index.jsonis an error, and the old cache stays.HMG-API's own updates come from the releases API: the newest non-draft release, its
-update.zip, and the SHA-256 from that release'sSHA256SUMS. A unit on a pre-release is offered only that version's next ones (on 1.1.0-rc.10: 1.1.0 or 1.1.0-rc.11, never 1.2.0-alpha), unless"catalog": {"prereleases": true}. The release notes are kept for the app. A fork or a test can pointhmgapi.json"catalog": {"base": ...}elsewhere.Trust
The fetch (#422) doesn't verify certificates, so whoever controls the network path could answer for GitHub. The catalogue isn't signed either, so this PR treats an entry as a hint and checks everything that matters on the unit:
maps/authors.json. Only HMG-API's signed releases bring that file, and nothing here writes it. Otherwise the plan says so and the owner says yes for that mod (--any-author=<id>). The package must then be signed by that key.UsbUpdates.updateHmgApi, so they need the release key.Packages.check(signature, key, HMG-API range, car).index.jsonwith the release key would close the rest. That's a separate change.Dependencies
requiresis met by what's installed (and turned on if it's off), or by the catalogue's version, installed first.optionalrequires (NEMESIS's) are skipped.conflictsnaming a planned one is refused too. Only what the plan changes is checked; something already broken doesn't block an unrelated install.update --all(andcatalog-plan --update --all) plans each mod on its own. A mod that can't go now is listed with why (for example, it would break another mod's range). The rest are updated.mod.jsonis read again, and what it adds is kept inlearned.jsonfor later plans. If that changes the plan, nothing is installed and the new plan comes back (exit 5) for the owner to confirm.overrides.ignore_system) and--any-car=<id>. A hotspot mod's unpowered chip counts for that mod.engine removenames the installed mods that require what's removed.update hmgapirefuses while a mod that's on wouldn't take the new version (applying would stop on it).--forcegives a warning instead.Staging
update-checkstages only pure updates: nothing else installed or turned on, signed with the installed key, checked as an install would be./data/hmgapi/pending/<id>. The hook loader, LiveState and apps never read that folder, so no staged code runs before an apply.engine planlists them.engine applychecks each one again and puts it in place right before it plans. The previous version is kept in/data/hmgapi/previous/<id>, and an apply that's refused puts everything back.Mods outside the catalogue: their own GitHub releases
An installed mod the catalogue doesn't list (from USB or adb, private, or waiting for its catalogue PR) is offered updates from the repo in its own
mod.json("repo": "https://github.com/<owner>/<repo>"). That file came inside the signed package, so the author's key chose the repo. Design notes:Releases.java's header.Source per mod (
Catalog.source), in this order:engine update-source, kept inhmgapi.jsoncatalog.update_source);This lets a tester follow a fork's releases for a listed mod, or turn a mod's updates off.
The check:
/releases?per_page=10); mods from the same repo share it. At most 10 repos per refresh, the ones checked longest ago first; the rest keep their last answer."release_asset"("my-mod-v{version}.zip"), otherwise it's the one<id>-....zip(or<id>-<version>.zipwhen the release has several).The result is an entry shaped like a catalogue entry (
"source": "release", kept incatalog/releases.json). Planning, staging intopending/,update --alland the install all run unchanged.Trust is the installed key. A release is only ever an update by that key: never a first install, a key change or a downgrade (
Packages.check).mod.jsonmust have the tag's id and version.SHA256SUMS, otherwise GitHub's assetdigest); otherwise the signature alone decides, as for a USB install.catalog-automerge.ymlalready merges for a catalogue bump with no one reviewing it.catalog/withdrawn.json:{"withdrawn": [{"id", "versions": range, "why"}]}.updates, with why.catalog.py checkvalidates it and never takes it for an entry.GitHub's API limit (60 an hour without an account): a 403 or 429 is reported, and the last answers are kept.
updatesgives each row's source, repo, release page, notes and pre-release flag, and every installed mod's source, for the app.catalog.py addcopiesrequires/conflictsandwifi.hotspotfrommod.json.addandcheckrefuse downloads that aren't on GitHub's hosts (the unit only fetches from there).checkvalidates ranges the way the engine reads them.bumpallows these fields to change only to what the package'smod.jsonsays.indexwritesindex.json. Once the repo keeps one,addwrites it again,checkrefuses a stale one, andbumpallows it alongside the entry.Tested
catalog-test.sh(201 checks; GitHub played by files). Covers:authors.jsonuntouchedupdate --all(run withoutHMGAPI_TEST_ANY_CAR); a hotspot mod on an unpowered chipSHA256SUMS, mods it would leave behind)update-check: the 6-hour gap; staging aside, listed byplan, put in at apply, kept staged when the apply is refused; not staging what needs a new mod or one turned onSHA256SUMS): matched, mismatched, or not givenwithdrawn.jsonfor both sourcesupdate-source: off, default, the releases of a listed mod; refusals when it can't applytools/catalog-test.sh(117):withdrawn.json's form; GitHub-only downloads, ranges,wifi,index.jsonkept current.test-all.sh --fast: 33 ok, 1 skipped (no ImageMagick).🤖 Generated with Claude Code