4.3 KiB
Independent read-only BOM review
Reviewed the current diff in execution_problems.py, bom_import_report.py,
bom_pending.py, native_inventory.py, project_discovery.py, service.py, and
tests/v1_1/test_pr27_bom_failures.py, including the later ready-state source
hash/UTC provenance change. No tests, CAD, CLI, or external UI operations were run.
Only this review report was written.
Finding
[P1] Preserve cleanup failure when final diagnostic I/O also fails.
At the reviewed native_inventory.py:191-199, _read performs copytree,
rmtree, and the final native-inventory.json write from its outer finally
without retaining the active primary exception. If a process/scope close has
already raised TaskCenterError('inventory_cleanup', ...) and, for example,
the final JSON write raises PermissionError, Python replaces the cleanup
exception with that I/O exception. Disk/permission failures can affect both
cleanup diagnostics and the final write, so this is a concrete combined failure.
The resulting path is:
OwnedCliScope.closeor_run_toolreports unconfirmed release asinventory_cleanup; the record isuncertain.- Final evidence copy/write raises an
OSError, replacing that primary error. inspect_batchcatches onlyTaskCenterErrorfrom the collector, so the raw I/O exception bypassesBomInspectionErrorand original-row annotation.service._operation/logging_setup.py:64wraps it asunhandled_exception.task_queue.py:328-332classifies it withphase='read'while resolving BOM. That code isobserve, withcontinue_allowed=True, so the next project may be attempted despite the unresolved cleanup.
The narrow fix is to preserve the active primary cleanup exception and its
code/error ID across diagnostic failures, attaching/logging the secondary I/O
failure instead. The producer regression should combine cleanup failure with a
denied final JSON write or output copy and verify inventory_cleanup remains
visible through BOM resolution/queue admission. Broadly banning unknown codes
is not required.
Other reviewed boundaries
- The new
ReleasedProjectReadErrorproducers themselves do not certify a genuine close failure on the normal path._run_toolmarks close errorsuncertain; the scope close converts failures toinventory_cleanup; those paths do not enter the released read wrapper. Before-launch failures are safe to certify because no native process has been launched. classify_execution_failureuses a precise code set. It does not infer uncertainty from substrings such assessionorrelease. Known resource uncertainty takes precedence overphase='read'or certification.- Legacy inspection continues only for a released read error with a safe
classification. Task-local resolution can continue through pure input/read
failures.
BomInspectionErrorpreserves code/error ID and resolver annotation restores the original Excel file/row for the typed failures it receives. - The added lease does not introduce a same-thread queue conflict in the
inspected execution path.
_queue_leaseowns the queue lock, andassert_task_queue_idleexplicitly allows its current thread owner.resolve_pending_bomacquires/releases the quick-run lease beforeexecute_quick_run_queueacquires its own quick-run lease; those are sequential. In a supervised worker,_worker_context(root)letsmutation_leaseuse its established owner context.capture_history=Falseavoids holding a history transaction across the native read. External mutations remain excluded. - The three strict zips fail on a count mismatch instead of silently truncating
or misaligning source coordinates.
write_routed_bompreserves row order. - Imported requests contain their frozen record, source file/row and source
hash. Resolution rebuilds the temporary workbook from those records and does
not require the original Excel file to remain present. Existing
load_sourceschecks the source hash before and after reading. - The latest ready-state evidence now records the source project/database hashes and UTC start/finish times. This review did not independently execute its tests.
The reported finding concerns preserving an existing cleanup failure across a secondary diagnostic failure; it does not require a new global execution lock, new external-file gate, or a broader uncertain-code list.