Skip to content

firmware: take radio firmware only from the stub's restore image - #226

Merged
RyanTheTide merged 6 commits into
mainfrom
ipsw-only/radio-firmware
Nov 24, 2026
Merged

RyanTheTide merged 6 commits into
mainfrom
ipsw-only/radio-firmware

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

aurora-wifi-firmware kept a Linux install's Wi-Fi and Bluetooth firmware on whatever macOS happened to be installed: the newest System volume on any APFS container, or a directory passed with --macos. So the firmware a Mac ran depended on how far its owner had updated macOS, or on whether macOS was still there. tools/speaker-tuning likewise collected speaker tuning from macOS or from a mounted macOS volume.

Change

  • New asahi_firmware/ipsw.py: the one restore image source for Linux tools. For a board and a macOS version, it lists that version's restore images and uses the first whose BuildManifest carries the board. The list comes from the packaged restore-images.json first (every stub firmware the installer admits; a test keeps it in step with NativeInspectionPolicySource), then Apple's IPSW feed. It reads the image's System volume by HTTP ranges. An image that is not the build or version it is listed as, or no image for the board, is a refusal; an unreachable image is "not now".
  • Readers: aea_ro (Apple Encrypted Archives, the same port speakerguardd ships), the new udif_ro (the plain UDIF disk images of releases before AEA, e.g. 13.5, bounded and read chunk by chunk), and apfs_ro, which moves here from tools/wifi-firmware so there is one reader.
  • aurora-wifi-firmware now takes radio firmware only from the restore image of the stub's version (/chosen/asahi,os-fw-version) for the board in the device tree's first compatible. A boot with nothing changed decides without the network; the unit is ordered after network-online.target for the rest. The installed-macOS scan, --macos, the directory volume and the stub filter are removed. The Makefile installs the reader modules and catalog; packages need python3-cryptography and liblzfse.
  • tools/speaker-tuning is removed. speakerguardd's aurora-speaker-upgrade takes the tuning from the pinned restore image instead (upgrade: take the speaker tuning only from the pinned restore image speakerguardd#248).

Testing

  • python3 -I -m unittest discover -s tests: all pass (2 skipped, as on main). The Wi-Fi tool's suites pass (101 tests), plus the new tests/test_ipsw_source.py: catalog/policy sync, image selection, mislisted images, offline, and UDIF reads and malformed images.
  • make -C tools/wifi-firmware install DESTDIR=... installs the expected tree.
  • Live dry runs (check, status) with the installed tree, ESP unchanged (manifest SHA-256 identical before and after), SELinux Enforcing, 0 failed units:
Mac stub image result
MacBook Air 15" M3 (J615) 27.2 26B123, 70 s Wi-Fi 489 + Bluetooth 114 files identical to the ESP; nothing to do
MacBook Pro 14" M4 Pro (J616s) 26.6.2 25G83, 63 s would replace 1 Wi-Fi and 2 Bluetooth images (see below); package check passed
MacBook Neo (J700) 26.6.2 - no radio set this tool follows; no-op
  • Offline: the 13.5 image (22G74) for J413 opens through udif_ro in 8 s and lists its Wi-Fi firmware.

Behaviour change: the J616s's ESP currently holds the set the old tool took from its installed macOS 27.0. With this change, its boot service moves it to its stub's 26.6.2 set, which is the older firmware. Macs whose stub is older than their installed macOS get the stub's radio firmware until the stub firmware is updated.

Still to run

  • The Fedora and ALARM packaging (the python3-cryptography requirement and the pin bump) follows the merge, in one PR per repo.

Rows at f605ed2 (J615 boot no-op, a real J616s update with a reboot and verify, a J413 13.5 UDIF dry run) are in the comment below.

Notes for reviewers
  • ipsw.open_system() checks the System volume's SystemVersion.plist against the listed build, as well as the BuildManifest.
  • udif_ro only materialises compressed chunks (zlib/LZFSE), capped at 64 MiB each. Raw, zero and ignored chunks are read in place, because the 13.5 image has raw and ignored runs larger than that cap.
  • The tool's state and refusal records keep their shape; device now names the restore image file instead of a block device.

Assisted-by: LLM (Claude:Opus 5.5)

aurora-wifi-firmware kept an installed system's Wi-Fi and Bluetooth
firmware on whatever macOS happened to be installed: it scanned every
APFS container, skipped the stub and took the newest System volume, or a
directory given with --macos. The firmware a Mac ran then depended on how
far its owner had updated macOS, or on whether macOS was still there.

Radio firmware is per-model, per-version data, so take it from one
source: Apple's restore image of the version the stub firmware runs
(/chosen/asahi,os-fw-version), for the board in the device tree's first
compatible. The new asahi_firmware.ipsw lists that version's images (the
packaged catalog, which holds every stub firmware the installer admits
and is checked against NativeInspectionPolicySource by a test, then
Apple's IPSW feed), uses the first whose BuildManifest carries the board,
and reads its System volume by HTTP ranges: aea_ro for Apple Encrypted
Archives, the new udif_ro for the plain disk images of older releases
(13.5), and apfs_ro, which moves here from tools/wifi-firmware so every
tool shares one reader. An image that is not what it is listed as, or no
image for the board, refuses; an unreachable one is "not now".

The installed-macOS scan, --macos, the directory volume and the stub
group filter are removed, and so is tools/speaker-tuning, whose two
collectors read the tuning from macOS or a mounted macOS volume:
speakerguardd's aurora-speaker-upgrade now takes it from the pinned
restore image.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-PR checklist review (§1–§6) at 7c197f632eef.

Taking radio firmware only from the stub's restore image is the right call. The read path fails closed: a mislisted build or version, a BuildManifest that doesn't carry the board, or a System volume whose SystemVersion.plist doesn't match the listed build each refuse. An unreachable image is "not now". Nothing falls back to an installed macOS or a host path, and --macos/DirVolume are gone. The suite passes locally at this head (python3 -I -m unittest discover -s tests: 314 tests, OK).

Requesting changes for one §2 blocker, plus the open items the PR lists itself.

Blocker (§2, works by default): the boot service now needs the network but isn't ordered after it

  • main() calls restore_image() (tools/wifi-firmware/aurora_wifi_firmware.py, found = restore_image()) before the "checked before, nothing to do" shortcut. So every boot run fetches Apple's IPSW feed and does an HTTPS HEAD, reads the central directory and BuildManifest, and (for AEA) gets the key and reads the APFS System volume, even when nothing has changed.
  • aurora-wifi-firmware.service is unchanged. It is still After=local-fs.target only, with no Wants=/After=network-online.target. At that point in boot the network usually isn't up, so the boot run ends "not now" (exit 2, which SuccessExitStatus hides), and the boot path effectively never updates. If the network happens to be up, every boot contacts Apple and pays the read cost. The PR table shows 63–70 s per check.
  • The unit's description and comments still describe the installed macOS and lsblk ("Wi-Fi and Bluetooth firmware of the installed macOS", "The macOS partitions sit on the disk…").
  • Suggested fix: in boot, short-circuit offline. restore-images.json already maps the stub version to a build, so when state.build matches it and the ESP and tool digests match, return without touching the network. Order the unit after network-online.target for the case that does need to read the image, and update the unit text. Please also add a boot run to the evidence, both no-op and with a change pending; only check and status ran.

§5 evidence: still open, as the PR says

  • J413 (13.5 stub) hardware dry run. The UDIF path has only been run offline.
  • Fedora Requires: python3-cryptography lzfse-libs. Without it, an installed package hits ImportError or "not now" on every run.
  • Behaviour change noted: the J616s moves from the 27.0 set to its stub's older 26.6.2 set. Please run that move as a real update, then do one reboot to confirm the radios come up with the 26.6.2 set (the verify/revert path), not only check.

Non-blocking

  • images_for_version() reads the IPSW feed on every run, even when the catalog already answers. It could ask the feed only when the catalog has no image that carries the board.
  • remotezip.UA is aurora-speaker-upgrade/1 and is now also used by the Wi-Fi tool. Consider a neutral aurora-firmware/1.
  • The trust boundary is TLS to Apple's CDN plus the BuildManifest and SystemVersion build checks. That is fine for AEA images, which are authenticated. The 13.5 UDIF path has no content check beyond TLS. The catalog could pin a digest of the BuildManifest per build. Not required.

Checklist

  • §1 model gating: ✅ board from the DT's first compatible, version from /chosen/asahi,os-fw-version, no chip/board tables.
  • §2 production-ready: ❌ boot ordering and offline shortcut, above.
  • §3 safety: ✅ no speaker or safety values touched. The tuning source moves to speakerguardd#248.
  • §4 clean-room / attribution: ✅ the only commit (7c197f6) has Ryan Murray as author and committer, with his Signed-off-by and no agent trailers. The catalog holds public URLs only. The PR body has its Assisted-by: line.
  • §5 evidence: ⚠️ J615/J616s/J700 dry runs are good. J413, a boot run and the Fedora Requires are still open.
  • §6 naming: ✅ nothing touches Vulkan or the driver name. Aurora names are used.

CI at 7c197f6

  • Portable checks, policy and selftest: pass.
  • macOS checks: still running.
  • Conformance matrix: fails, but this PR didn't cause it. The failures are branch pins: aura 56299352d9f4, pin 3ff778945672 plus synthetic-profile plan rows, and the same workflow fails on main at e1ddef7 and on other branches. This PR touches no Swift, pins or planning code.

Assisted-by: LLM (Claude Opus 5.5)

A file stored uncompressed in its decmpfs attribute (type 9) is a 0xcc
marker byte followed by exactly the file. The reader returned the first
usize bytes of the body, so the marker plus a file one byte short. In
macOS 27.2 (26B123) this corrupted ADM/config.plist of AID25, 26, 32, 33,
36, 47 and 48. Return the bytes after the marker, and refuse a body
without it or of another length.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-PR checklist re-review (§1–§6) at 385ce7daec35.

The new commit 385ce7d ("apfs_ro: decode decmpfs type 9 as a marker byte and the file") is a real fix. Type 9 bodies are a 0xcc marker followed by exactly the file, and the old reader returned the marker plus a file one byte short. The new code returns body[1:] and refuses a body that has no marker or the wrong length, so it fails closed. tests/test_apfs_decmpfs.py covers the good case and all three malformed cases. The suite passes locally at this head: python3 -I -m unittest discover -s tests ran 316 tests, OK. It's good that this was caught. The 27.2 (26B123) ADM/config.plist corruption matters for the speakerguardd#248 path too.

Still requesting changes. None of the blockers from the review at 7c197f632eef is addressed in this push.

Blocker (§2, works by default): boot service ordering and offline shortcut, unchanged

  • main() still calls restore_image() (tools/wifi-firmware/aurora_wifi_firmware.py, found = restore_image()) before the "checked before, nothing to do" shortcut. So every boot run still needs the IPSW feed and the image's HTTP ranges.
  • aurora-wifi-firmware.service is byte-for-byte unchanged. It is still After=local-fs.target only, with no Wants=/After=network-online.target. Its description and comments still talk about "the installed macOS", lsblk and macOS partitions. At that point in boot the network usually isn't up, so the run ends "not now" (exit 2, hidden by SuccessExitStatus), and the boot path effectively never updates.
  • The fix is the same as before:
    • Short-circuit boot offline. Resolve the stub version to a build via restore-images.json, and return early when the state build, the ESP digest and the tool digest all match.
    • Order the unit after network-online.target for the runs that do need to read the image.
    • Update the unit text.
    • Add boot runs to the evidence, one no-op and one with a change pending.

§5 evidence: still open

  • J413 (13.5 stub) hardware dry run. The UDIF path has still only been run offline.
  • Fedora Requires: python3-cryptography lzfse-libs. The Makefile comment names the run-time dependencies, but no package requires them yet.
  • J616s: run the 27.0 → 26.6.2 move as a real update, then reboot once to show the verify/revert path brings the radios up.
  • New, from this commit: the decmpfs fix changes bytes the J615 row compared ("489 + 114 files identical to the ESP"). Please re-run that row at this head, and say whether any of the files that row compared were type-9 files.

Non-blocking (carried over)

  • Ask the IPSW feed only when the catalog has no image that carries the board.
  • remotezip.UA is aurora-speaker-upgrade/1, but the Wi-Fi tool now uses it too. Consider a neutral name.
  • Consider pinning a per-build BuildManifest digest in the catalog for the UDIF (13.5) path.

Checklist

  • §1 model gating: ✅ unchanged. The board comes from the DT's first compatible and the version from /chosen/asahi,os-fw-version.
  • §2 production-ready: ❌ boot ordering and offline shortcut, above. The decmpfs fix itself is ✅.
  • §3 safety: ✅ no speaker or safety values touched.
  • §4 clean-room / attribution: ✅ both commits (7c197f6, 385ce7d) have Ryan Murray as author and committer, with his Signed-off-by: and no agent trailers. The type-9 layout is documented in public APFS/decmpfs references and checked against our own image reads.
  • §5 evidence: ⚠️ J413, boot runs, the J616s real update plus reboot, a J615 re-run at this head, and the Fedora Requires are all still open.
  • §6 naming: ✅ nothing touches Vulkan or the driver name.

CI at 385ce7d

  • Portable checks, policy and selftest: pass.
  • macOS checks: still in progress.
  • Conformance matrix: fails, but this PR didn't cause it. The failures are the same synthetic-profile rows as before (j575d-synthetic/fresh/*: FAIL, expected UNTESTED-ON-HW) plus the aura branch-pin mismatch, which also fail on main. This PR touches no Swift, pins or planning code.

Assisted-by: LLM (Claude Opus 5.5)

… changed

Taking the radio firmware from the stub's restore image made every boot
fetch the IPSW feed and the image's ranges before the "checked before"
shortcut, while the unit ran right after local-fs.target, so a boot
without the network ended "not now" and the boot path did not update.

The source is the restore image of this board and stub firmware version,
both read from the device tree. A boot whose board, version, ESP package
and tool (which now covers the restore image catalog) were checked
before, or refused, or put back by hand, now finishes before any network
access. Any other boot reads the image; the unit wants and runs after
network-online.target for that, and an unreachable image or key service
(aea_ro.AeaUnavailable, ipsw.IpswUnavailable) is "not now" with no
refusal remembered. State and refusal records carry the board and
version.

Apple's IPSW feed is asked only for a version the packaged catalog does
not list, and the range reader identifies itself as aurora-firmware/1.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at exact head f605ed22138e (§1–§6 of the pre-PR checklist), covering the diff since 385ce7daec35.

Cleared since the last review

  • Boot ordering and offline behaviour (was blocker 1). source_key() reads the board and stub version from the DT. The "checked before", "refused before" and "put back by hand" shortcuts now run before restore_image(), so an unchanged boot finishes without touching the network. The unit now has Wants=/After=network-online.target, and its description and comments name the restore image. AeaUnavailable/IpswUnavailable/OSError come out as "not now" (exit 2) and no refusal is remembered. The feed is asked only for a version the catalog lacks. The new tests (test_a_checked_boot_needs_no_network, test_unreachable_at_boot_is_not_now, the feed-only-when-missing test, and the board/version-keyed refusal_stands cases) cover this.
  • tool_digest() now covers restore-images.json, so a catalog change triggers one recheck.
  • §1, §3, §4 and §6 are still clear. All three commits have human author and committer (Ryan Murray), a human Signed-off-by:, and no AI trailers.
  • CI at this head: Portable checks and policy/selftest pass.

Still blocking

  1. §5 hardware evidence at this head. The PR body's "Still to run" list is unchanged, and the PR has no new evidence comments. Still needed:
    • the J413 13.5-stub hardware dry run;
    • on hardware, a boot run with nothing changed and the network down (exit 0, no fetch), plus a pending-update boot run (verify/revert after the unit's new network-online.target ordering);
    • a real J616s update + reboot + verify;
    • the J615 check re-run at the final head;
    • the regression row (0 SELinux denials, 0 failed units, 0 new kernel errors).
    • The Fedora Requires: python3-cryptography lzfse-libs wiring is still listed as to-do; please link it.
  2. CI not finished. macOS checks and Conformance matrix are still pending at f605ed22138e. Conformance failures that already happen on main are fine, but macOS checks must pass.
  3. A short range read on the UDIF path now latches a refusal. In ipsw.open_system() this head moved remotezip.RemoteZipError from IpswUnavailable to IpswError. On the pre-AEA (13.5, J413) path the System volume is read through Member.pread → RemoteFile._block, which raises RemoteZipError("short range response") for a truncated CDN or proxy reply. That error becomes Refused in restore_image(), and boot remembers it, so a one-off transport glitch is skipped at every later boot until the stub, ESP or tool changes or someone runs update by hand. find() still treats the same exception as unavailable. Suggested fix: raise a distinct transport error (or OSError) for short or failed range responses and keep RemoteZipError for real format errors. Add a test that a short read at boot is "not now" with no refusal remembered.

Non-blocking

  • The service now starts after network-online.target even when it only verifies a pending change. If the staged firmware broke Wi-Fi, the revert waits for the wait-online timeout first. That is acceptable, but please note it in the unit comment.
  • The f605ed2 subject line is long (wraps to "… changed").

Verdict: REQUEST_CHANGES. The code-side boot-ordering blocker is fixed. Item 3 is a small fix. What remains is mostly §5 hardware rows at the final head and green macOS checks.

Assisted-by: LLM (Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Independent re-review at f605ed22138e4e2b4c9fd6ee5a8817197c19415a. The exact installer Python suite reports 319 tests with two skips. The known-state boot exits before restore_image(), and the unit orders the changed-state fetch after network-online.target. The state includes the board and stub version and the tool digest covers the packaged catalog. These changes address the boot ordering and repeated download finding.

IPSW-ONLY's J615 and J616s records show the offline no-op and the real update followed by reboot and radio verification. Please attach those exact hardware rows to this PR and add the J413 13.5 row and Fedora runtime dependency receipts when complete.

Assisted-by: LLM (Codex)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Addressed at f605ed2:

  • Boot without the network: the source is the restore image of (board, stub version), and both come from the device tree. So boot now decides before any network access. When the board and version were checked before, and the ESP package and the tool (which now covers restore-images.json) match, it is a no-op; the same holds for a remembered refusal or a hand revert. Only a changed input reads the image. The unit now Wants=/After=network-online.target, and its text is updated. An unreachable image or key service (AeaUnavailable, IpswUnavailable) is "not now" (2) with no refusal recorded. State and refusal records carry board and version. Tests: test_a_checked_boot_needs_no_network (no read when checked; a new stub version reads once) and test_unreachable_at_boot_is_not_now.
  • Feed: Apple's feed is asked only for a version the catalog doesn't list (test_the_feed_is_asked_only_for_a_version_the_catalog_lacks).
  • UA: remotezip and aea_ro now use aurora-firmware/1.
  • Type 9 and the J615 comparison: none of the radio files in 26B123 or 25G83 is a type 9 file (750 LZVN resource-fork files, 221 plain), so that comparison was unaffected. I reran it anyway, below.

Rows at f605ed2 (fleet kernels, SELinux Enforcing; 0 AVC denials, 0 new kernel errors, 0 failed units in every run):

Mac stub run result
J615 27.2 check, update, boot, status 26B123 set identical to the ESP. boot was a no-op in under 1 s with no network access. ESP manifest unchanged
J616s 26.6.2 real update, then one reboot The update moved the ESP to the 25G83 set, with a backup. At the next boot, the unit's verify passed: brcmfmac BCM4388/6 23.50.20.2.41.51.209 came up, Wi-Fi carried the session, and Bluetooth was powered. The boot then took the offline no-op path (6.5 s total)
J413 13.5 check, status 22G74 read through the UDIF path on hardware; package check passed; dry run, ESP unchanged
Neo 26.6.2 check no radio set this tool follows; no-op

The J616s's new set has a higher version number than the 27.0 set it replaced. The J413 is a real downgrade: its ESP holds a 27.2.1 set the old tool took from its installed macOS, and its stub is 13.5.

Fedora Requires: python3-cryptography (lzfse-libs is already there) and the new description are ready on a fedora-aurora branch. They go in one PR together with the pin bump to this PR's merge commit.

Conformance matrix: it fails on main at e1ddef7 as well, with the same rows.

http.client.IncompleteRead is an HTTPException, not an OSError, so a
range body cut short while staging escaped the retry loop and ended the
run as an internal error instead of a retry. Retry it like any other
transfer failure and raise AeaUnavailable after the last attempt.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The pre-AEA System volume reads the stored UDIF member through RemoteFile.
A short body was treated as a format failure and an HTTP IncompleteRead
could escape the handler. Retry these transport failures and report
unavailability after the existing attempt limit.

Preserve the format-error path for data received in full. Translate a
transport failure to the boot command's retry outcome both during source
inspection and during later reads of the System volume. A retry leaves the
ESP and remembered refusal state alone.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The short ZIP range finding is fixed at b109466ae66b87fdfa1a06314f4844618b32dbdb. This fast-forward includes IPSW-ONLY’s separate AEA range fix at 2672723.

I reproduced both failure forms through the J413-style stored UDIF reader at f605ed2. A short body returned IpswError and an IncompleteRead escaped. The new transport class retries both within the existing attempt limit. The radio boot wrapper also returns exit 2 when a later transfer stops during staging, with the ESP and refusal record unchanged. The structural ZIP/UDIF validation still uses the format-error path.

The exact local installer suite ran 322 tests with two skips. Please re-review the short-transfer change. The hardware comments above cover the earlier successful read/update paths. The new hosted run is pending.

Assisted-by: LLM (Codex)

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at exact head b109466ae66b87fdfa1a06314f4844618b32dbdb, against the pre-PR checklist §1–§6. Since f605ed2 the PR adds 2672723 (aea_ro) and b109466 (remotezip/UDIF).

Cleared at this head

  • Transport retry, AEA path (2672723). Ranges.get now retries http.client.HTTPException (IncompleteRead) and raises AeaUnavailable after the last attempt. The test checks HEAD plus three GETs and then AeaUnavailable.
  • Transport retry, pre-AEA path (b109466). RemoteFile._block now treats a short body and IncompleteRead as RemoteZipUnavailable, retries them, and raises after four attempts. find() and open_system() map RemoteZipUnavailable to IpswUnavailable. A structurally bad ZIP or UDIF (RemoteZipError) still refuses. main() returns 2 when a transfer stops during staging, and leaves the ESP and the refusal record unchanged. The new tests cover both forms on the J413-style stored-UDIF path and the boot wrapper. Locally python3 -I -m unittest discover -s tests runs 322 tests, OK (2 skipped).
  • §4 commit hygiene. All five commits have Ryan Murray as author and committer, each with a human Signed-off-by:. There are no AI trailers in any commit.
  • §1/§2/§3/§6. Unchanged from the last review and still clear. The retry count (4) is the attempt limit that already existed. It does not paper over a race.
  • §5 (earlier rows). The rows at f605ed2 were posted after my last review: J615 boot offline no-op, a real J616s update + reboot + radio verify, a J413 13.5 UDIF check, and Neo. Each reports 0 AVC denials, 0 new kernel errors and 0 failed units. They answer the hardware asks from the last review for the paths these two commits don't change. The Fedora Requires: python3-cryptography change is ready on a fedora-aurora branch and lands with the pin bump (lzfse-libs is already there). That is fine as the one follow-up PR per repo.
  • Conformance matrix. It also fails on main (e1ddef7, the last three runs), so it is not caused by this PR.

Still blocking

  1. One pre-AEA transport path still ends as a refusal. udif_ro.Partition.__init__ reads the UDIF property list inside except Exception as e: raise UdifError(...), around plistlib.loads(src.pread(xml_len, xml_off)). A RemoteZipUnavailable raised by that pread therefore becomes UdifError, then IpswError in _open, then Refused in restore_image(). It reproduces at this head: a source whose pread at xml_off raises RemoteZipUnavailable gives UdifError: UDIF property list: range fetch failed: cut. The run prints "Refused: no macOS 13.5 restore image for j413" and exits 1, not 2. It is not remembered, because restore_image() runs outside the try that records refusals, so the next boot tries again. It is still the same misclassification this push set out to fix. Fix: split the read from the parse (xml = src.pread(...) outside the try, only plistlib.loads/indexing inside), or re-raise remotezip.RemoteZipUnavailable before the catch-all. Add a test case for the XML read alongside test_incomplete_http_range_keeps_the_udif_source_retryable.
  2. CI. macOS checks (and Conformance matrix) were still in progress when I checked this head. macOS checks has to finish green.
  3. §5 at the final head. These commits change the range fetch on every read, including successful ones. Please re-run the J413 13.5 check (the UDIF path) once on the final head, and add one regression line (0 AVC denials, 0 failed units, 0 new kernel errors). The other rows at f605ed2 can stand.

Verdict: request changes. Only the small fix in item 1 and green CI remain, plus the one J413 re-run.

Assisted-by: LLM (Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Exact-head hardware row at b109466ae66b87fdfa1a06314f4844618b32dbdb. J413 MacBook Air M2, running and saved 7.3.0-aurora-fleet86, normal boot and mounted ESP. I ran aurora-wifi-firmware check from the exact source in a temporary runtime directory.

The source was macOS 13.5 22G74, exercising the stored UDIF path on real hardware. The proposed package held the converted radio set and preserved all other vendor firmware files by path, hash and mode. The command exited 0. Independently compared ESP radio hashes and state file bytes were identical before and after.

Boot identity and the saved custom entry remained fleet86, with empty next entry, SELinux Enforcing, 0 failed units, 0 AVCs and 0 new kernel errors. The Linux boot stayed in place throughout.

Assisted-by: LLM (Codex)

The UDIF property list was read inside the catch-all that turns a bad
image into UdifError, so a transfer that failed there (a range cut
short, RemoteZipUnavailable) became a refusal instead of "not now".
Read it first, then parse; only the parse and its indexing are the
image's answer.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Item 1 is fixed at e81a137. udif_ro.Partition now reads the property list before the parse, so only plistlib.loads and its indexing are inside the catch-all; a short read is UdifError. A RemoteZipUnavailable from that read now propagates, and open_system maps it to IpswUnavailable (not now, exit 2). New test test_a_failed_property_list_read_stays_retryable: a source whose pread at the XML offset raises RemoteZipUnavailable makes Partition re-raise it, and open_system raises IpswUnavailable. On the previous code it fails with UdifError. The full suite passes locally (2 skipped). The J413 13.5 check rerun at this head is queued behind the fleet87 rollout on that Mac; I'll post it with the regression counts.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at exact head e81a137c27ec935f2a2bda1f2fdcd9ede5e986ec, against the pre-PR checklist §1–§6. Since b109466 the PR adds one commit, e81a137 (udif_ro: read the property list outside its parse).

Cleared at this head

  • Item 1 (pre-AEA XML read refusal): fixed. Partition.__init__ now calls src.pread(xml_len, xml_off) before the try. A short result becomes UdifError("short read of the UDIF property list"). Only plistlib.loads and the resource-fork/blkx indexing stay inside the catch-all. So a RemoteZipUnavailable from that read propagates, and open_system maps it to IpswUnavailable, which means "not now" and exit 2. The other source reads in udif_ro (koly, _chunk, RAW in pread) were already outside any catch-all. I found no other except Exception around a source read.
  • Regression test. test_a_failed_property_list_read_stays_retryable checks two things: Partition re-raises RemoteZipUnavailable when the read at xml_off is cut, and open_system raises IpswUnavailable. I checked it locally in a scratch clone. With the b109466 udif_ro.py in place, the test fails with UdifError: UDIF property list: range fetch failed: cut, which is the failure I reproduced last round. With e81a137 it passes. The full python3 -I -m unittest discover -s tests run is 323 tests, OK (2 skipped).
  • No new issues. The diff is 7 lines of code plus the test. A short XML read is still classed as a bad image, which matches the existing koly/chunk short-read handling. (RemoteFile already turns a short HTTP body into RemoteZipUnavailable underneath.)
  • §4. All six commits have Ryan Murray as author and committer, each with a human Signed-off-by:. There are no AI trailers. The PR body ends with Assisted-by:.
  • §1/§2/§3/§6. Unchanged and still clear.
  • §5 CI at this head. Portable checks, both policy jobs and selftest are green (the second selftest is skipped as usual). Conformance matrix is in progress. It also fails on main, so it is not a blocker here.

Still open (not code)

  1. macOS checks is still in progress at this head. It has to finish green.
  2. §5 final-head J413 row. You said the J413 13.5 check re-run is queued behind the fleet87 rollout. Please post it with the regression line (0 AVC denials, 0 failed units, 0 new kernel errors).

Verdict: comment. The code is clean and item 1 is fixed with a regression test. I'll approve once macOS checks is green and the J413 row at e81a137 is posted.

Assisted-by: LLM (Claude Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Item 3: J413 (MacBook Air 13" M2, stub 13.5) at e81a137, on fleet87. aurora-wifi-firmware check read the 22G74 restore image through the UDIF path: 316 Wi-Fi and 52 Bluetooth files, package check passed. It was a dry run, and the ESP manifest is unchanged. Regression since the row started: 0 AVC denials, 0 new kernel errors, 0 failed units.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promoting to APPROVE at exact head e81a137c27ec935f2a2bda1f2fdcd9ede5e986ec — both remaining items from the earlier COMMENT review are now closed:

  • macOS checks: completed SUCCESS on e81a137c27 (alongside Portable checks, both policy runs, and selftest; Conformance matrix matches the pre-existing main baseline).
  • Exact-head J413 13.5 HW row: aurora-wifi-firmware check at e81a137 on J413 (fleet87, stub 13.5) read the 22G74 restore image through the UDIF path (316 Wi-Fi + 52 Bluetooth files, package check passed, ESP manifest unchanged, 0 AVC denials, 0 new kernel errors, 0 failed units).
  • Code & §1–§6: all prior blockers (including udif_ro.Partition.__init__ keeping RemoteZipUnavailable retryable with regression test test_a_failed_property_list_read_stays_retryable, 323 tests passing) are verified clear.

Assisted-by: LLM (Gemini 4 Neon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants