Commit Graph

879 Commits

Author SHA1 Message Date
Bear Huddleston
33522e6dee Merge pull request #159835 from NousResearch/fix/mac-dmg-sign-notarize
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
Docs Search Monitor / probe (push) Has been cancelled
fix(desktop): sign, notarize, staple, and verify outer macOS DMG
2026-11-25 12:55:52 -06:00
BearHuddleston
0919743d07 fix(desktop): refuse a macOS record whose outer DMG is missing
_verify_macos_dmg returned early when the root held neither a DMG nor a
*-mac.yml, so a tagged, channel or signedDmg commit-claim record whose
root carried only the update ZIP passed with no outer DMG check at all.
The workflow's own guards (the feed rename's test -s, the commit-claim
DMG count) keep that shape out of CI today, but the recorder is the gate
publish trusts, so it now fails closed on its own inputs: whenever the
outer check applies, exactly one *-mac-<arch>.dmg must be present.

The feed stays required only for tagged releases. Channel builds write
latest-mac.yml, but their staging step never stages or publishes a feed,
so requiring one would gate on a file nothing downstream reads; a feed
that is present is still checked.

The existing ZIP-only fixtures gain the DMG, blockmap and (tagged) feed a
real build produces. _write_mac_feed now streams its hashes, since the
Squirrel-limit fixture is a sparse 1 GiB ZIP.
2026-11-25 04:05:36 +00:00
BearHuddleston
bcf917ab2d fix(desktop): harden macOS DMG signing, notary budget, and release/smoke gates
Address CI failure and validated review findings on outer macOS DMG
signing, notarization, recording, and smoke verification:

- Update tests/ci/test_protected_canary_publication.py's darwin transport
  fixture to write a real gzipped .dmg.blockmap and parse_mac_feed-valid
  canary-mac.yml matching the recorded ZIP and DMG bytes.
- Reuse the exact certificate identity and keychain selected for the .app
  by recording them in apps/desktop/scripts/mac-sign.mjs (getAppSigningResult)
  instead of re-querying security find-identity in notarize-dmg.mjs.
- Share one combined 300-minute notarization budget across afterSign and
  notarize-dmg.mjs (with a 15-minute reserve for verification/metadata) so
  DMG waiting cannot outlast the 330-minute CI step.
- Require .dmg.blockmap presence and validate tagged *-mac.yml feeds via
  parse_mac_feed (exact ZIP + single DMG entries) in
  scripts/bundles/release_artifacts.py, keeping the no-feed path explicit
  for commit and channel builds.
- Align commit-claim outer DMG verification across release_artifacts.py
  and tests/install/macos-bundle-smoke.sh via a sealed signedDmg: true
  field in darwin bundled install-stamp.json: releases, canaries,
  channels, and signedDmg commit claims enforce outer DMG verification,
  while older pre-PR and legacy commit claims still verify the inner .app.
2026-11-25 00:42:59 +00:00
Bear Huddleston
949afabbe7 Merge pull request #159469 from NousResearch/feat/stable-mac-dmg-url
feat(release): publish stable macOS DMG alias and downloads page on promotion
2026-11-24 18:14:31 -06:00
xxxigm
08b61240ec test(bundles): sealed payload must keep the WhatsApp bridge
The desktop and Store snapshot drops scripts/, so bridge.js never ships and WhatsApp parks as fatal.
2026-11-24 09:23:50 -05:00
BearHuddleston
12849ad777 fix(release): don't read back a stable page the promotion left alone
When the stable page already described a newer release, b1469d1641 left
it in place but still read it back through the public origin. If the
public copy was still catching up, the read-back failed after the feeds
and DMG alias had moved and before the head advanced, over a page this
promotion never wrote.

_check_stable_page_state now returns None for the page bytes in that
case. publish_page then neither writes nor reads back. A page this
promotion writes, or finds already in place, is still verified. In
test_stable_promotion_rejects_stale_order_for_dmg_and_page the
page-ahead case now serves a stale public page; it failed on 86ba6e6244
with "Channel read-back differs" and passes now.
2026-11-24 09:51:26 +00:00
BearHuddleston
537e99ed6e fix(release): refuse the stable role in the channel_releases CLI
`python -m scripts.releases.channel_releases stable` called
publish_release("stable-release") directly. That skipped advance_stable's
check of the candidate digest against the final release receipt and ran
outside the stable-release concurrency group. It reached the same stable
feeds, and with this PR the DMG alias and downloads page, that
ff616309d5 closed off in the release_artifacts CLI. No workflow, test or
doc uses that role; stable-release.yml calls only `channel_releases
canary`.

The CLI now refuses `stable` with the reason (exit 2) and publishes
canary as before. test_channel_releases_cli_publishes_canary_and_refuses_stable
did not raise on f4785e7bee and does now.
2026-11-24 09:41:20 +00:00
BearHuddleston
f4785e7bee fix(release): keep only a newer stable page, not a canary page at the stable key
b1469d1641 left the stable downloads page alone whenever supersedes()
said the promoted tag could not replace it. supersedes() also says no
when the page at the stable key records a canary build, so that wrong
page was kept, with only a warning, while the stable head advanced.

The skip now applies only to a newer stable release, the renderer's
page-ahead case. A canary marker at the stable key fails closed before
any write. test_stable_promotion_refuses_a_canary_page_at_the_stable_key
did not raise on a906c2b033 and does now.
2026-11-24 09:39:56 +00:00
BearHuddleston
a906c2b033 fix(release): refuse a stable DMG copy source without an ETag
copy_source kept whatever ETag the source HEAD returned, and copy_object
sent x-amz-copy-source-if-match only when there was one. A HEAD without
an ETag therefore made the copy unconditional, and a same-size
replacement of the source would pass the destination's size check.

copy_source now refuses a source with no ETag. CopySource.etag is always
set, and copy_object always sends the condition. The no-ETag case in
test_copy_object_sends_signed_server_side_copy_and_verifies_destination
did not raise on b1469d1641 and does now.
2026-11-24 09:35:13 +00:00
BearHuddleston
b1469d1641 fix(release): let an older pending advance pass a stable page already ahead
The stable downloads page has a second writer on main: render-builds-table
in stable-release.yml's `complete` step renders a full-desktop release's
page before the ordered publication pass runs. If an older published
release's advance was still pending, that step put the page ahead of it.
The sequencer advances oldest first, so StableDownloads.prepare for the
older release then refused with "Refusing to move the stable downloads
page backward", on every rerun. Since the standalone CLI no longer
promotes stable, nothing could clear it.

Feed order is checked before promotion, so a page describing a newer
release can only be that renderer's. _check_stable_page_state now leaves
it as it is with a warning, as the renderer's own write_channel_page does,
and returns the bytes that should be live plus the write conditions (None:
no write). The older advance moves the feeds and the DMG alias, and the
public read-back checks the page that is actually live. The page is still
never moved backward.

In test_stable_promotion_rejects_stale_order_for_dmg_and_page, the
page-only-ahead case raised on 274bc33a78 and now promotes the older
release while leaving the newer page alone. stable-releases.md no longer
says the page changes only with promotion.
2026-11-24 09:33:59 +00:00
BearHuddleston
e68a1d67e2 fix(desktop): sign, notarize, staple, and verify outer macOS DMG
Sign, notarize, staple, and Gatekeeper-verify the outer macOS .dmg
container in an electron-builder artifactBuildCompleted hook while
keeping inner .app notarization (afterSign) intact for Squirrel.Mac .zip
updates.

- Reuse notarize.mjs auth resolution and 4h LOST_CONTACT / CloudKit
  retry logic in apps/desktop/scripts/notarize-dmg.mjs, signing the
  outer .dmg with Developer ID Application + --timestamp (which
  dmg-builder's built-in dmg.sign omits) using the packager's active
  codeSigningInfo keychain.
- Verify codesign, stapler validate (with LOST_CONTACT retries), and
  spctl -a -vv -t open --context context:primary-signature, then rebuild
  .dmg.blockmap and update event.updateInfo before artifactCreated fires
  so PublishManager writes post-staple sha512/size to *-mac.yml.
- Enforce outer DMG codesign, team match, .dmg.blockmap size, and
  *-mac.yml consistency in scripts/bundles/release_artifacts.py, and
  verify outer DMG signature, stapler ticket, Gatekeeper policy, and
  team match before mounting in tests/install/macos-bundle-smoke.sh.
2026-11-24 09:29:12 +00:00
BearHuddleston
274bc33a78 fix(release): check the stable DMG copy source before any feed moves
StableDownloads.prepare HEADed the source DMG and compared its size, but
the 5 GiB single-copy limit was applied only inside copy_object, which
ran after finalize had moved the macOS feed. A DMG over the limit would
stop promotion with the feed already pointing at the new release.
copy_object also HEADed the source again and copied against that fresh
ETag rather than the object prepare had checked.

r2.copy_source now runs every source check once: the path, the
single-copy limit, existence and receipt size. It returns a CopySource
holding the key, size and ETag. prepare calls it before any write, and
copy_object takes the CopySource and copies on its ETag, so a source
that changed after the check fails with 412 instead of being copied.

With the limit below the staged DMG's size, the new stable promotion
test fails on c1494b2ff2 (feed PUTs were sent before the error) and
passes now.
2026-11-24 09:27:57 +00:00
BearHuddleston
af0fbc9060 test(release): run bad candidates through the controller's admission
When ff616309d5 moved the renderer harness off the refused CLI, the
admission test's fault loop kept only the renderer step. Its helper hashed
the bytes it had just read and called promote_stable_feeds directly, so no
test sent a legacy, smoke-less, failed, wrong-identity or tampered manifest
through the controller's own check.

The helper now promotes the way publish_release does: accepted_stable
against a digest pinned separately from the stored bytes, then
promote_stable_feeds. The fault loop sends every bad manifest through it,
checking the controller's message and that nothing was written, before
running the renderer step. With accepted_stable reduced to an unpinned,
unvalidated read, the ff616309d5 test passes and this one fails.
2026-11-24 09:13:38 +00:00
BearHuddleston
ff616309d5 fix(release): refuse stable candidates in the standalone promote CLI
python -m scripts.bundles.release_artifacts promote checked the pinned
candidate digest but neither required the published release nor ran
inside the stable-release concurrency group. A manual replay could
therefore pass the stable DMG alias's order check and then overwrite a
newer alias that a concurrent controller promotion had just copied. R2's
CopyObject takes no destination If-Match, so the copy itself cannot be a
compare-and-swap. Promoting a staged draft needed no race at all.

The CLI now refuses a stable candidate, payload tag or attempt ref,
before it reads anything. Stable promotion runs only through the Stable
Release Publication sequencer (channel_releases.advance_stable ->
publish_release -> promote_stable_feeds), which already requires the
published release and serializes every stable writer. Canary candidates
still promote through the CLI. The renderer harness test now promotes
through promote_stable_feeds, as the sequencer does, instead of the CLI.
stable-releases.md says only the controller promotes stable, and that a
partial publication is repaired by running Stable Release Publication
again.
2026-11-24 09:03:09 +00:00
BearHuddleston
43639eec9c refactor(release): stop re-exporting moved page helpers from the renderer
render-builds-table.py imported recorded_build only so three tests could
reach it through the script after it moved to downloads_page.py, and it
still imported smoke_rows, which nothing in the script uses. Both imports
are gone; test_render_builds_binding, test_render_builds_publication and
test_canary_page_history import recorded_build from downloads_page.
2026-11-24 04:48:01 +00:00
BearHuddleston
0240d00e30 test(release): cover the public read-back of the stable DMG alias
The read-back test failed at copy_object's signed R2 HEAD, so deleting
StableDownloads.publish_dmg's public-origin HEAD left every test green.
The new test lets R2 take the copy while the public origin serves another
size for the alias, and checks promotion stops before the App Installer
pointer and the page move. It fails with that HEAD removed.
2026-11-24 04:45:15 +00:00
BearHuddleston
402d8ee33d test(release): seed a table-shaped orphan in the stable page test
The receipt-only rendering test seeded a Linux AppImage orphan, which the
shared table drops whatever it is given, so the assertion held even for a
page built from a bucket listing. A same-version Hermes Light MSIX would
render if listed: with a renderer that also lists the archive, the old
test passes and this one fails.
2026-11-24 04:45:15 +00:00
BearHuddleston
dbebd80427 fix(release): gate feed promotion on the head update's own ordering check
publish_release refused a stale release before the feed writes with its
own copy of the ordering rule, read from the live build's request.json.
ChannelPublisher._promote applies the real rule later: the digest-checked
live manifest, the native versions, and the allocation sequence. The copy
had no sequence check, so a newer release allocated before an older one
published (its retry keeps the lower sequence it was pinned to) passed the
early gate, moved the stable feeds, DMG alias and page, and was then
refused by the head update. That leaves the feeds on an archive the
retention pointer does not protect.

ChannelPublisher.require_protected_successor now runs the head update's
ordering check (sequence, then versions against the digest-verified live
manifest) without writing, and _promote calls the same helper, so the
rule lives in one place for both the canary and stable policies.
2026-11-24 04:34:45 +00:00
BearHuddleston
205fdca51b fix(release): give copy_object one retry budget
copy_object retried a 5xx CopyObject three times, and each attempt went
through signed_request's own three tries, so a run of R2 503s sent nine
copies and held the release job for the summed back-off. signed_request
now gets tries=1, as multipart completion does, and copy_object's loop
owns the budget for HTTP errors, error documents sent with HTTP 200, and
dropped connections, which signed_request used to retry on its own.
2026-11-24 04:31:18 +00:00
BearHuddleston
4d4de7efb9 feat(release): publish stable macOS DMG alias and downloads page on promotion 2026-11-24 03:46:07 +00:00
BearHuddleston
5ac48bbadd fix(release): keep the dispatch log from raising on a malformed build commit
The pre-build dispatch log must not fail the build: admission, the next
step, refuses bad inputs with its own error. Since 19f57f1649 a tagless
commit dispatch off main builds its replay through
tagless_dispatch_command, whose require_commit raises on a malformed
BUILD_COMMIT, so the log step failed first with a less useful message.
Channel replays had the same exposure through channel_build's
dispatch_command.

release_command now returns no replay when building it raises
ValueError, for both kinds.

Found by the Sol review loop on #158714.
2026-11-22 22:17:58 -08:00
BearHuddleston
296e2c0a2f fix(release): log the release.py command for a tagless commit build off main
Since 36d5ae1303, release.py --build-commit dispatches the tagless
desktop-bundled-release.yml build when the repository's default branch
isn't main. The pre-build dispatch log still called every tagless commit
dispatch a legacy one that no release.py command recreates, so the run
started by that fallback printed no replay command.

dispatch_log.release_command now returns commit_build's
tagless_dispatch_command for a tagless commit dispatch whose default
branch isn't main (same all-jobs, no-upgrade, no-upload conditions as a
channel replay), and report prints its release.py and workflow lines.
From main it still says the run is one release.py no longer sends.

Found by the Sol review loop on #158714.
2026-11-22 22:17:58 -08:00
BearHuddleston
98ea47f590 fix(release): build tagless when the default branch isn't main
372116c747 answered Greptile's renamed-branch finding by refusing
--build-commit outright when the repository's default branch isn't the
Stable Release controller branch, so a fork defaulting to develop lost
the commit build that main gave it.

On such a repository --build-commit now dispatches the tagless
desktop-bundled-release.yml build on the default branch, exactly what
main did (commit_build.admit accepts the default branch there). No
claim is created, because Stable Release would refuse its run.
--only/--with/--without need Stable Release, so they are still refused
there before anything is dispatched. The page is the tagless
releases/commit/<sha>/index.html.

Reported by @kshitijk4poor on #158714.
2026-11-22 22:17:58 -08:00
BearHuddleston
46ff6a3bc6 fix(release): read a declared claim-build contract, not the claim readers' text
commit_supports_claim_tag chose the claim path when a commit's tree had
the three claim-tag readers (is_commit_tag, COMMIT_TAG_RE, the
canary|commit pattern). The PR's own first commit, bd507fa031, has all
three but none of the packaging: its desktop_inputs still pops
HERMES_BUILD_COMMIT for every tag and desktop_prepare reads only
canary_timestamp, so a claim on it failed its native builds with
"stable preparation requires its exact claim tag" instead of taking the
tagless path. Any git show failure also returned "legacy", so a failed
read looked like an old commit.

A claimed tree now declares the contract its packaging honours in
scripts/releases/commit_claim_build.txt, read with git (never by running
the tree). No file means the tagless path; a contract outside
stable.CLAIM_BUILD_VERSIONS, or any failed read, raises and stops the
run in stable verify. Every commit of this PR before this one now builds
as legacy, which works for all of them.

Reported by @kshitijk4poor on #158714.
2026-11-22 22:17:58 -08:00
BearHuddleston
4d4917fa9c fix(release): fall back to digest-pinned Termux base image on GHCR miss
In no-push commit mode, a GHCR miss previously built and passed a
job-local image tag (hermes-termux-builder-local:<short>) to
termux_build.sh, which unconditionally runs `docker pull` and inspects
`RepoDigests[0]`. Both fail on a local-only tag.

Fall back directly to the checkout's digest-pinned base image
(termux/termux-docker@<digest>) on a GHCR miss in both
scripts/termux/build_builder_image.sh (--no-push /
TERMUX_BUILDER_NO_PUSH=1) and .github/actions/build-termux-deb/action.yml
(for pre-PR checkouts). termux_build.sh pulls that pinned image, records
its RepoDigests[0], and provisions the container build toolchain when
clang/git are absent.

Add end-to-end replay tests through the real termux_build.sh wheelhouse
step for both current and pre-PR checkouts.

Addresses Sol S9 on #158714.
2026-11-22 22:17:58 -08:00
BearHuddleston
ee84d3271d refactor(ci): extract shared Termux build steps into composite action
Extract the shared secret-free Termux payload staging, builder-image
setup, wheelhouse build, and .deb assembly steps from termux-deb-release
and termux-deb-commit into .github/actions/build-termux-deb/action.yml,
checked out from github.sha via sparse-checkout so both release lines and
pre-PR commit claims resolve the controller's action.

Literal cache-mode, job permissions, setup-pm cache flags,
archive_inputs, and APT GPG signing steps stay in the separate release
and commit jobs; termux-deb-commit passes save-caches: false,
push-builder-image: false, and no github-token.

Addresses Greptile P2 thread on #158714.
2026-11-22 22:17:58 -08:00
BearHuddleston
293db9741b fix(release): block GHCR builder-image push and narrow Termux commit permissions
termux-deb-commit previously inherited the workflow-wide permissions
(including packages: write and contents: write), inherited job-level
GH_TOKEN and R2 credentials from termux-deb-release, and handed
GITHUB_TOKEN to the claimed checkout's build_builder_image.sh, letting
unreviewed commit code overwrite the shared GHCR builder image that
trusted release builds consume.

- Give termux-deb-commit explicit read-only permissions (contents: read,
  packages: read) and keep GH_TOKEN and R2 secrets out of its job-level
  env.
- Add --no-push / TERMUX_BUILDER_NO_PUSH=1 support to
  scripts/termux/build_builder_image.sh so registry misses build and
  smoke a job-local image (hermes-termux-builder-local:<short>) without
  docker login or docker push.
- Run termux-deb-commit's builder-image step with no GITHUB_TOKEN and a
  local-only fallback for pre-PR checkouts lacking TERMUX_BUILDER_NO_PUSH.

Addresses Sol S2 on #158714.
2026-11-22 22:17:58 -08:00
BearHuddleston
ced86a7ea8 fix(release): refuse a commit claim that builds no bundle
A commit build's only output is the page of the bundles it built, but
--build-commit --only smoke (or --without both desktop lanes) selected
no bundle lane. The CLI still pushed a claim, dispatched a run in which
no job ran, and printed a builds-page URL that never appears.

require_allowed now refuses a commit lane set with no bundle lane. It
backs both lanes.select (the CLI, before any tag exists) and
stable.stamped_claim (admission), so a hand-written claim is refused
too. Termux alone still counts as a bundle.
2026-11-22 22:17:58 -08:00
BearHuddleston
075bb3ac21 fix(release): refuse a commit build before claiming when its branch can't run
--build-commit dispatches Stable Release on the repository's default
branch, but stable.check_controller admits only the main-branch
controller. In a repository whose default branch is not main, the CLI
pushed the claim tag and the run then failed admission, leaving the
claim behind.

Refuse before the claim exists, naming both branches. Stable and canary
claims already require main; commit claims now share that controller.
2026-11-22 22:17:58 -08:00
BearHuddleston
96a3fcc194 fix(release): accept the tagless Termux version of a legacy commit claim
A claim of a commit from before claims builds Termux through that tree's
tagless --commit path, whose build_deb.sh stamps X.Y.Z+commit<sha12>
(since 063cf4428a, the first tree with a commit mode). The recorder and
the candidate validator both expected X.Y.Z-1, so every legacy claim
that selected Termux failed at staging.

Expect X.Y.Z+commit<sha12> in both. The recorder test builds a real .deb
with dpkg-deb, and the validator fixture now carries that version.
2026-11-22 22:17:58 -08:00
BearHuddleston
9e3247de8a fix(release): recognize commit-claim support in this tree's deb_version.py
commit_supports_claim_tag looked for a quoted "commit" literal in
scripts/termux/deb_version.py, which the file never contains: it reads
claim tags through the canary|commit alternation in _TAG_RE. Every claim
of a current commit therefore came out legacy and built through the
tagless --commit path with plain versions.

Look for the alternation instead, and test the check against the real
HEAD tree rather than invented source strings, so a later rename of any
marker fails here instead of silently turning claims legacy.
2026-11-22 22:17:58 -08:00
BearHuddleston
92fd59bdd5 test(release): cover commit-claim trust boundary, legacy compat and full page assets 2026-11-22 22:17:58 -08:00
ethernet
0c55aa6016 feat(release): wire commit claims into stable-release.yml with read-only native legs
Routes commit. and channel. claims to cache-mode: read native legs (Windows, macOS, and a split termux-deb-commit leg with no APT GPG signing key access), closes main's win32-assembly-v1 prefix restore-keys gap, keeps pre-claim commits buildable via trusted controller checkouts and legacyCommitBuild metadata, and renders every staged commit-claim asset (.msixbundle, .msix, .dmg, .zip, .deb) on the claim page.

Co-authored-by: BearHuddleston <bear@bearhuddleston.dev>
2026-11-22 22:17:58 -08:00
ethernet
716937f57f feat(release): bundles+smoke commit policy, claim admission, CLI and 90-day retention
lanes: add the commit policy restricted strictly to bundles + smoke
(COMMIT_ALLOWED = windows, macos-arm64, termux, smoke; default COMMIT =
windows, macos-arm64, smoke; COMMIT_REFUSED excludes ci, docker, nix,
pm-bundle, windows-live, install-e2e, bootstrap-version, termux-checks,
windows-store, linux and upgrade). POLICY_JOBS adds publish-commit for commit
and limits publish-docker to stable/canary.

stable: generalize canary_claim into stamped_claim (validating bundleEnv for
commit claims), require write/maintain/admin actor permission via
commit_actor_permissions, admit commit claims without a GitHub release, emit
bundle-env and refuse mismatched BUNDLE_ENV_JSON in verify.

commit_build / release / dispatch_log / r2 / stable-release-publication:
--build-commit claims an annotated commit.<stamp>-v<version> tag (advancing
past local same-second stamps) and dispatches stable-release.yml; legacy
tagless commit dispatches no longer mint receipts; r2 prune and --prune-canaries
keep commit builds for 90 days; the stable publication reconciler ignores
'Commit release ' runs in both concurrency and reconcile.if.

Salvaged from ca37ec5974, 37ca767d2a, 7e9f76ad80, 0f11098f12 and 4df7a745a0
in #145680, tightening commit policy to bundles + smoke only.

Co-authored-by: BearHuddleston <bear@bearhuddleston.dev>
2026-11-22 22:17:58 -08:00
ethernet
825d07e478 feat(release): commit claim packaging, handoff identity and fail-closed publishers
A commit claim versions packages from its tag stamp like a canary
(X.Y.Z+commit.<stamp>, stamped Windows quad and release epoch) while keeping
the Commit<sha7> identity, no feed and source commit-build via HERMES_BUILD_COMMIT.
handoff accepts commit.<stamp>-vX.Y.Z archives without letting the exported
HERMES_BUILD_COMMIT fall back into tagless commit mode.

r2.channel_for_tag, release_artifacts.release_channel and darwin.merge_mac_feeds
fail closed on commit claims so commit builds can never publish to a release
channel or feed; docker stays closed to commit tags as well.

Salvaged from c15b3c7f91, df7ae5e79c, 784aeb43d9, fdcaa79d68, ad1efe0f25 and
f161e6618d in #145680, keeping docker closed to commit claims.

Co-authored-by: BearHuddleston <bear@bearhuddleston.dev>
2026-11-22 22:17:58 -08:00
ethernet
4e2648106f feat(release): commit.<stamp>-vX.Y.Z claim tags and their version helpers
A commit build's claim tag has the canary claim shape with the commit kind;
its version is X.Y.Z+commit.<stamp> (Termux X.Y.Z~commit.<stamp>-1; APT repo
staging keeps refusing commit claims). release_version/tag_core/releaseVersion/
releaseTagVersion/deb_version accept it; tag_kind names the kind.

Install stamps and icon generation of a commit build may carry its own claim tag
and still say source commit-build, so every updater keeps refusing it; a commit
tag without HERMES_BUILD_COMMIT is refused by the stamp writers and product
identity rather than falling through to the stable identity and its latest feed.

Salvaged from 98ee7de7c6, f8a42b0cc9, d9ead4e507, f161e6618d and 0f11098f12
in #145680, keeping stage_apt_repo closed to commit claims.

Co-authored-by: BearHuddleston <bear@bearhuddleston.dev>
2026-11-22 22:17:58 -08:00
Teknium
ff19b196ba fix(dev): desktop/TUI pre-commit lint runs from a linked worktree again
The `{just}` template resolves `$(git rev-parse --show-toplevel)/scripts/hook-just`.
Git exports GIT_DIR to hooks in a linked worktree, and with GIT_DIR set
`--show-toplevel` answers the current directory instead of the worktree root. The
`root: apps/desktop/` (and ui-tui, shared, web, tests) jobs run there, so every
worktree commit touching those trees failed with
"cannot open apps/desktop/scripts/hook-just". Main-checkout commits were unaffected
(no GIT_DIR export), and Python-only commits too (their jobs run at the root).

Resolve the root with GIT_DIR unset. Regression: 27896fd2cd.
2026-11-22 01:06:50 -08:00
BearHuddleston
7345f81a3b test(bundles): pin the ioctl-failure refusal to its own cause
The last case of
`test_sandbox_check_refuses_root_active_addressed_routed_and_unreadable_network`
injected a failing ioctl while the route file from the previous case was
still deleted, and only asserted "cannot verify". The missing route file
alone produced that refusal, so the case passed even when ioctl errors
were swallowed. Restore the proc files first and assert the refusal
names the ioctl error.

A mutant that swallows ioctl errors in `_iface_flags` and
`_iface_has_ipv4` passes the old assertion and fails the new one.
2026-11-21 14:49:42 -08:00
BearHuddleston
1d4e2fce78 test(bundles): pin every network fact in the offline sandbox main() tests
`test_worker_main_allows_down_unaddressed_kernel_tunnels` faked the
interface list and the ioctl replies, but `main()` still read the host's
`/proc/self/net`. On a host with a route or address on `tunl0`, `sit0`,
`ip6tnl0` or `gre0` (a Calico IPIP node, say) the test raised
`SystemExit` instead of reaching the image check. Seed a fake proc
directory with `_write_proc_net`, route `main()`'s `_sandbox_problem()`
call to it, and pin `_ipv6_available` so the IPv6 files are read too.

`test_worker_main_verifies_image_before_extraction` had the same flaw
from this PR: `main()` now asks the real kernel for `lo`'s flags, so the
test failed in a namespace where `lo` is down. Fake that ioctl as well.

Red on 0477e3fd2a, green here, under a simulated host route on `tunl0`
and a simulated down `lo` respectively.
2026-11-21 14:49:42 -08:00
BearHuddleston
13141ee4ef fix(bundles): allow down unaddressed kernel tunnel interfaces in offline sandbox check
`scripts/bundles/appimage_checks.py::main` previously required
`{name for _, name in socket.if_nameindex()} == {"lo"}`. On Linux hosts
with tunnel drivers loaded or built in (`ipip`, `sit`, `ip6_tunnel`,
`ip_gre`, etc., with default `net.core.fb_tunnels_only_for_init_net=0`),
the kernel creates down, unaddressed fallback devices (`tunl0`, `sit0`,
`ip6tnl0`, `gre0`, ...) in every new network namespace, including
`docker run --network none`. That caused `scripts/ci/linux_x64_userland.sh
accept` to exit immediately on Blacksmith x64 runners (canary runs
44690154688 and 44876973873).

Verify via `SIOCGIFFLAGS`, `SIOCGIFADDR`, and `/proc/self/net/{route,
if_inet6,ipv6_route}` that `lo` is up and loopback and every other
interface is down with no IPv4/IPv6 address and no routes, failing closed
with the concrete reason on root, active/addressed/routed interfaces, or
unreadable network state.
2026-11-21 14:49:42 -08:00
BearHuddleston
fd2819da32 fix(release): find the MSIX executable under its percent-encoded part name
MakeAppx stores ZIP part names percent-encoded, so the stable bundled
package's Executable="app\Hermes Agent.exe" is the entry
app/Hermes%20Agent.exe (the published rc.3-v0.22.0 x64 MSIX reads that
way). The packaged-executable lookup compared raw entry names, found
nothing, and record() raised on every stable Windows candidate. Canary
never showed it because its executable is hermes-canary.exe.

Decode each entry name before comparing it with the manifest's path.
2026-11-20 18:01:13 -06:00
BearHuddleston
38c657f9cd fix(release): probe Windows executableVersion from the packaged MSIX 2026-11-20 18:01:13 -06:00
BearHuddleston
514e2cbda6 test(termux): find the APT staging step by the script it runs
6cc6a44508 renamed the Termux job's step to "Stage the APT repo handoff to R2" and passes
--pool-subdir "$RELEASE_CLAIM_TAG" unconditionally, so the candidate-workflow test's lookup
by the old display name raised StopIteration. It now finds the step that runs
scripts/termux/stage_apt_repo.py and checks the pool-subdir argument in either form.
2026-11-20 11:28:21 -06:00
BearHuddleston
c7895b733d fix(release): keep an unreadable desktop attempt image from aborting the sequencer
631b9d18c9's stable-desktop recovery check read the attempt's -desktop image through
_version_digest, which raises on any registry error. A failed read there, with the pointer
and the slim alias current, aborted the whole production pass before it could plan anything
newer. Either image failing to read is now inconclusive (not behind), like the alias itself;
promote_stable still reads both strictly when it actually moves them.
2026-11-20 11:28:21 -06:00
BearHuddleston
f6afe23f13 fix(release): never move stable aliases whose owner cannot be read
9bf56ac5a9 counted an unreadable `stable` alias as current. When the head read and the
recovery read both fail, a stale desktop pointer then got the full advance, whose Docker
promotion can move a newer Docker-only release's aliases back. An unreadable alias now leaves
the owner unknown, and like a newer owner it gets only the desktop-only `finish`.

Production always has the `stable` alias, so "unreadable" is a registry error there. A
registry where the alias was never created gets no Docker promotion from recovery either,
as on main, where channel_head counted the desktop head as done in that case.
2026-11-20 11:28:21 -06:00
BearHuddleston
477f1bd187 fix(release): pick a stale stable pointer's repair by alias ownership too
631b9d18c9 checked alias ownership only when the pointer was current. With a stale or
missing pointer the pass returned the desktop head straight away, and plan() chose a full
advance because the head read matched it, which it can only do after a registry error
dropped a newer Docker-only release out of the head. That advance repeats the Docker
promotion and moves the aliases back to the older release.

_unfinished_desktop_head now returns the step itself. While a newer release owns the
aliases (it holds the channel head, or the alias carries its digest) a stale pointer gets
the desktop-only `finish`; otherwise a stale pointer or provably behind aliases get the
full `advance`.
2026-11-20 11:28:21 -06:00
BearHuddleston
7097e7eaa8 fix(release): judge stable alias recovery on ownership and the desktop variant
4e8b5fd31b's alias check probed the registry a second time and compared the slim `stable`
alias with the desktop head's digest. Two gaps:

- A registry error on the head probe drops the combined head back to the desktop release;
  if the second probe then succeeds with a newer Docker-only release's digest, that digest
  read as a stopped promotion and the pass moved the aliases back to the older release.
- promote_stable moves the slim aliases before the desktop ones, so a slim alias that
  carries the release says nothing about stable-desktop/latest-desktop.

The aliases now count as behind only when the alias read succeeds, its digest belongs to no
newer published release, and either the slim alias misses the head's digest or the
stable-desktop alias misses the attempt's desktop image (docker.stable_desktop_alias_behind).
An unreadable alias proves nothing and is left alone.
2026-11-20 11:28:21 -06:00
BearHuddleston
41d337f084 fix(release): finish an unfinished stable head's Docker step and repair it under a newer head
91fbd83fc8 re-advanced the desktop head only when its candidate pointer was wrong. Two cases
still read as done: the pointer PUT landed but its read-back failed, or the Docker promotion
itself failed, so the next pass saw a matching pointer and the Docker vX.Y.Z tag and
stable/latest aliases never moved. And with a newer release at the combined head the pass
refused outright, leaving the stale pointer for an operator.

While the desktop head is also the channel head, a Docker-carrying release whose stable alias
does not carry its digest now counts as unfinished too, and advances again through the normal
production advance. Under a newer head only the desktop advance repeats (a new `finish` step,
advance_stable alone), so that release's aliases stay where the newer release put them.
2026-11-20 11:28:21 -06:00
BearHuddleston
4e99fdec97 fix(release): refuse to prune when a new canary head has no retention pointer
The pruner compared the canary pointer with the protected canary head only when the pointer
existed, and found the head by the record name `canary`. The first canary after today's legacy
v<stable>+canary.<stamp> head has no pointer until its write lands, so if that write failed the
live canary's archive was protected by nothing but its age; and a canary channel bootstrapped
under another name read as no head at all, so every prune refused with no way to fix it.

The pruner now picks the protected channel the way publication does
(channel_releases.select_channel): the one listed record whose policy is canary-release,
refusing when two claim it. It reads that head whenever the record exists, refuses when a
canary.<stamp>-vX.Y.Z head has no pointer, and fails closed on an unreadable record or head
manifest. A legacy head with no pointer prunes as before.
2026-11-20 11:28:21 -06:00
BearHuddleston
804de4b266 fix(release): advance an unfinished stable head again, Docker aliases included
The pointer repair from 196d082b74 ran after the pass, against the combined publication head,
and called only advance_stable. Two gaps: production_advance moves the Docker vX.Y.Z tag and
stable/latest aliases after advance_stable, so a pointer write that failed after the head
moved also skipped them and the repair never ran them; and a newer Docker-only release could
become the combined head and hide the desktop head's stale pointer.

The pass now asks, before planning, whether the protected desktop head's candidate pointer
names it. If not, plan() advances that release again ahead of anything newer, through the
normal production advance (idempotent desktop advance, then the Docker promotion), so a
newer release can never run before it finishes. If a newer release already holds the head,
the pass refuses instead of moving that release's aliases back.
2026-11-20 11:28:21 -06:00