Commit 5b8d606
fix(firmware): populate detection_roots on tar/zip-rootfs shortcut paths
The two archive-shortcut branches in FirmwareService.create_firmware
(tar device-dump shortcut at line 338, zip-rootfs shortcut at line 418)
previously returned firmware rows with device_metadata=NULL. Downstream
walkers (hardware-firmware detection, SBOM generation, MCP file-tree
tools) have to re-derive roots from extracted_path on every call, and
Rule #16 explicitly names this as an anti-pattern.
Fix: before each early-return, call _compute_roots_sync(fs_root) and
_persist_roots(firmware, roots) to populate device_metadata['detection_roots']
inline. Both helpers are synchronous and safe inside loop.run_in_executor
(already proven in firmware_paths and other callers). The result is that
shortcut-path firmware now reaches the DB with detection_roots populated,
matching the behaviour of the full unpack pipeline (Phase 2).
Cost: one extra filesystem walk per successful shortcut, already an
async executor task — no event-loop blocking. Benefit: eliminates
Rule #16 violations on the two shortcut paths (previously, every ADB
device dump and every rootfs ZIP left the field empty).
Companion to commit 38d01d8 (find_filesystem_root fallback gate) —
together they close the gap between 'tar was extracted' and 'firmware
is queryable via detection_roots' for every shortcut outcome.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 38d01d8 commit 5b8d606
1 file changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
402 | 414 | | |
403 | 415 | | |
404 | 416 | | |
| |||
479 | 491 | | |
480 | 492 | | |
481 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
482 | 504 | | |
483 | 505 | | |
484 | 506 | | |
| |||
0 commit comments