Repository navigation
fix(artifacts): accept APFS image disks ejected with their container - #921
Conversation
An APFS disk image attaches as an image disk plus a synthesized APFS container, and hdiutil reports both as whole disks. Detaching the container also ejects the image disk, so the reverse-order detach then failed with "No such file or directory" and every APFS DMG inventory ended in "DMG detach or mount-root cleanup failed". APFS is the default format of `hdiutil create` on current macOS. When a detach fails, ask `hdiutil info -plist` whether the device is still attached. A device that is gone counts as detached; one that is still listed, or whose state cannot be read, remains a cleanup failure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b72c079a9a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| timeoutMs: DETACH_TIMEOUT_MS, | ||
| }); | ||
| const parsed = infoOutputSchema.parse(parse(info.stdout)); | ||
| this.#provenance.push(command(["info", "-plist"], ["read"])); |
There was a problem hiding this comment.
Record the fallback query before snapshotting provenance
When the APFS fallback succeeds, this provenance entry is added during close(), but scanCanonicalArtifactInventory() clones reader.provenance() into the snapshot before its finally block invokes close(). Consequently, successful CLI/MCP inventory results never report the new hdiutil info -plist observation—the unit test only sees it because it reads provenance after manually closing the reader. Finalize cleanup before capturing the result provenance, or otherwise propagate cleanup provenance into the returned snapshot.
AGENTS.md reference: AGENTS.md:L54-L54
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: scanCanonicalArtifactInventory builds the snapshot, including reader.provenance(), before the finally that calls close(). That timing already applies to the existing detach entries, so neither cleanup command reaches CLI or MCP results.
62634e4 stops recording the info -plist query rather than implying it is observable. The unit test no longer expects it.
Returning cleanup provenance in results would mean closing the reader before the snapshot is built. That changes inventory results for every DMG, so I've left it for a separate change.
The inventory snapshot captures reader provenance before close() runs, so a `hdiutil info -plist` entry recorded during cleanup never reached CLI or MCP results. Detach entries already share that timing. Record neither instead of implying the query is observable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(artifacts): accept APFS image disks ejected with their container
Summary
inspect_artifactfailed on every APFS disk image withDMG detach or mount-root cleanup failed(artifact_operation_failed, reasonunavailable). APFS is whathdiutil createproduces by default on current macOS, so this affects most freshly made DMGs.Problem and expected behavior
hdiutil attachreports an APFS image as two whole disks: the image disk and a synthesized APFS container.NativeDmgArtifactReader.close()detaches observed whole disks in reverse order. Detachingdisk5also ejectsdisk4, so the nexthdiutil detach /dev/disk4fails withNo such file or directory. The inventory was fine, but the detach failure turned the whole operation into an error.Reproduction on macOS 26.6.2 (arm64), with an APFS DMG from
hdiutil create -srcfolder dir -format UDZO:main:rea inspect-artifact image.dmg --jsonreturns"detail": "DMG detach or mount-root cleanup failed".hdiutil infolists nothing left attached.Change and scope
When a detach fails,
close()askshdiutil info -plistwhether that device is still attached.The query goes through the existing
NativeDmgHostseam, and theinfocommand is recorded in provenance with areadeffect. Detach order and the whole-disk filtering are unchanged.Contract and boundary impact
hdiutil info -plist, run only after a failed detach. Cleanup failures are still reported when a device remains attached.Evidence and regression coverage
tests/boundary/providers/native/nativeDmgArtifactReader.test.tshas two new cases. Both model the real APFS attach output:close()succeeds and recordsinfo. This fails onmain.close()still fails.The existing attach-cleanup failure test now answers
infowith the device still attached.Validation performed
npm run test:focused -- tests/boundary/providers/native/nativeDmgArtifactReader.test.ts: 5 passed.rea inspect-artifact): complete inventory, no image left attached.npm run check:changed: passed.Compatibility, safety, and release
🤖 Generated with Claude Code