Move flash-target policy out of hai-core - #82
Open
justanotherariel wants to merge 2 commits into
Open
Conversation
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stacked on #81. hai-core's disk code becomes pure mechanism; policy lives at the app boundary.
validate_device_pathis removed fromwrite_image; insteadflash_imagerequires the target to be a device thatlist_devices()currently reports as removable (find_flash_target).list_block_devicescommand already does that check.compile_error!instead of shipping untested runtime stubs.Behavior changes to review: internal non-boot disks on Windows are no longer flashable (previously only PhysicalDrive0 was blocked), and
hai_core::disk_writer::write_imagewrites to whatever it is given — callers own target selection.Type of Change
Related Issues
Stacked on #81 (part of the #14 stack); base of #83.
Testing
find_flash_targetaccept/reject cases; validation tests removed with the code they tested)cargo test -p hai-core --features mockandcargo test -p hai-desktoppass on Linux.Screenshots
N/A — no UI changes.
Checklist
cargo fmtandnpm run lintDO NOT MERGE. After reviewing, merge #14 to merge all directly