5.1 KiB
R01: freeze new raw all-match rules into per-UID commands
New native ensure_batch_handoff calls request collect_components=True for raw rules as well as target rules. Validated read-only discovery expands each matching component into a separate exact UID command, including components with equal Values. The existing discovery cache, native/COM reader validation, reader-release checks, runtime forwarding and release_idle_for_fingerprint hook remain in use.
component-scope.json records the ordered original rule/options signature, base Value policy, project/sheet scope and captured component identities. Snapshot validation regenerates commands from that frozen inventory and the original rules. Resume and retry do not rediscover successful targets whose Part Numbers have already changed. Original custom Value, NC and Cell option changes are rejected.
An unmatched source rule produces a separate execution_unit=inventory_empty, empty-selector record with a preterminal batch_skipped / inventory_empty manual issue. It never reports a saved replacement. Other matched UIDs continue using their own commands. The dispatch boundary independently rejects inventory-empty/empty-target commands even if their terminal status disappears. No UID is invented. Missing or inconsistent actual component manifests fail closed rather than generating all-match mutations.
Existing unscoped raw queues and grouped target queues retain their original commands. Retry preparation inherits both the frozen scope and recorded split/group shape through prepare(..., component_scope_from=original). If a converted raw queue loses its sidecar, retry refuses to turn it back into an all-match queue.
Parent integration hooks are implemented outside this unit: service passes component_scope_from=original; execution_proof.capture_result calls component_scope.validate_empty_command(root, row), copies/hashes the sidecar into immutable proof, and marks the proof as inventory-empty; journal continuation accepts that manual no-mutation failure only with nonempty intact proof. The helper validates the entire active regenerated command queue against the sidecar.
Test-first evidence
python -m pytest tests/v1_1/test_component_scope.py -q --basetemp=F:/dx-nb-exp-1 -o cache_dir=build/pytest-component-scope-1
8 failed, 1 passed in 3.58s
The initial failures showed raw discovery requesting no components, grouped commands, changed original options silently rebuilding, absent frozen resume, missing retry inheritance and incomplete inventories falling back to all-match behavior. The passing case established the legacy queue boundary.
After the minimum frozen-scope implementation:
python -m pytest tests/v1_1/test_component_scope.py -q --basetemp=F:/dx-nb-exp-2 -o cache_dir=build/pytest-component-scope-2
9 passed in 1.35s
Additional boundary cases were red before their fixes:
python -m pytest tests/v1_1/test_component_scope.py -q -k "missing_terminal or empty_command_proof" --basetemp=F:/dx-nb-exp-3 -o cache_dir=build/pytest-component-scope-3
2 failed, 9 deselected in 2.05s
python -m pytest tests/v1_1/test_component_scope.py::test_retry_missing_frozen_sidecar_cannot_become_an_all_match_queue -q --basetemp=F:/dx-nb-exp-8 -o cache_dir=F:/dx-nb-exp-cache-8
1 failed in 1.73s
The first two exposed empty-selector dispatch after loss of terminal status, and a proof helper accepting one empty row despite changed inventory elsewhere in its queue. The last exposed a missing-sidecar retry reverting to all-match commands.
Actual service/SQLite/journal checks confirmed that ABSENT + OLD dispatches exactly uid-1, uid-2, retains one manual issue and two saved receipts, and never redispatches on queue reopen. A controlled prewrite failure on uid-1 followed by successful uid-2, shared DSH retry reservation and retry preparation dispatches exactly uid-1, uid-2, uid-1 while retaining the original sidecar. Initial integration fixture failures were corrected by providing a valid DxD project and keeping data outside the backed-up project directory.
Affected verification
python -m pytest tests/v1_1/test_component_scope.py tests/v1_1/test_target_execution.py tests/v1_1/test_retry_recovery_transactions.py tests/v1_1/test_nonblocking_items.py tests/trial_task_center/test_quick_run_snapshot.py tests/v1_1/test_discovery_cache.py::test_handoff_reuses_collected_inventory_without_second_cad_open tests/v1_1/test_discovery_cache.py::test_failed_worker_invalidates_before_it_runs tests/v1_1/test_nonblocking_resources.py::test_cache_hashes_after_verified_reader_release -q --basetemp=F:/dx-nb-exp-9 -o cache_dir=F:/dx-nb-exp-cache-9
55 passed in 13.97s
git diff --check
exit 0 (no output)
No real CAD/PCB, external AI, network tickets, or redundant full suites were run. Native interaction uses controlled worker/discovery boundaries; actual filesystem queues, SQLite receipts, backup/publication paths and dispatch counts were exercised. An earlier cache path under the synchronized workspace produced one Windows access warning; subsequent verification uses unique independent paths on F:. No source rules or existing grouped receipts were rewritten.