Files
dxdesigner-part-replacement/docs/reviews/2026-10-19-target-cell-selection.md
T

16 KiB

目标封装选择:实现决策与审查

功能对应源码 ec75445。审查按阶段保留,最终功能结论应结合最终实机验收和本文件末尾的修复复审读取。没有发布或合并到其他分支。

本轮实现决策及代价

  1. 沿用已授权的 codex/bom-import-state 工作区继续迭代,保留未跟踪的 feedback/。理由是既有采集改动和实机任务正在该分支进行;若隔离边界判断有误,需要按分段提交回退重做,不能清除其他工作。
  2. target_cell 保存精确原生 Cell Name,不发明分区限定名。跨分区同名候选阻止执行;代价是这种库需要先人工消除歧义。
  3. BOM 保留原 11 列,封装从显式规则或相同料号映射中传递。料号变更清空失去绑定的选择;代价是旧规则及新映射需要手工补选。
  4. 原生 helper 只使用重新完整核对源及证据的缓存。原因是冷读最多可能等待互斥 120 秒再等待工作进程 90 秒,不能挤占原生写入的 120 秒预算;代价是缓存丢失或源变化后需回规则重新读取。
  5. 独立 Python 恢复预检允许在启动恢复 CAD 前冷读,但必须完全匹配原事务证据。它位于原生写入计时器之外,且中断时规则编辑可能锁定;代价是明确的恢复操作可能等待一次有上限的冷读,而不能用新证据替换旧事务的绑定。

规则/UI、目录及执行传输分别通过独立审查;BOM 先保存后补规则的空封装传播修正也已复审。以下保留整体验收审查及唯一一次最终修复复审。


Final feature review — explicit target Cell

Reviewed committed feature range 5ad0c66..4d1b825, including the shared-cache follow-up cf671a1 and BOM-first propagation fix 27dec68. This is a read-only implementation review; the only file written is this requested review artifact. No tests, CAD operations, process changes, source edits, Git mutations, or subagents were used.

Strengths and plan alignment

  • The exact native Cell name is preserved through schema migration, rules, batch signatures, saved target plans, BOM imports, target-rule grouping, queues, the separate L snapshot record, and native transaction evidence. Existing M positions and the default 11 BOM columns are preserved. Legacy selections stay empty rather than being guessed.
  • The BOM-first integration fix compares the effective OLD→NEW mapping after existing propagation and fills only blank Cells. Its added tests check add/update, disabled rows, independent nonblank selections, unrelated destinations, custom Value, and NC preservation (batch_rules.py:94; test_target_cell_rules.py:278).
  • Asynchronous UI results are bound to generation, destination PN, selection changes, dialog lifetime, and current project scope. Candidate loading does not automatically select a single candidate. The GUI checks missing selections before confirmation/startup; the native helper independently requires a valid L row before attaching.
  • The catalogue uses exact COM enumeration on a complete owned clone, verifies physical partition dependencies, rejects empty/ambiguous results, and checks original-source manifests around copying/reading. Its cleanup certificate and digest-bound evidence precede cache publication. No raw PDB negative filter was introduced.
  • Shared cache placement is safe with respect to authority: native_helper.py:77 only changes the evidence location. cell_catalog.py:185 still keys proof by resolved original library path, full source fingerprint, PN, and requested partition; evidence validation repeats those bindings and cache hits rehash the source. It does not turn into a PN-only cache.
  • The helper validates the actual active project's library, exact chosen membership, and native Part partition, then revalidates before native submit. Queue selection, snapshot hash, project/sheet, target UIDs, native identity, selected Cell, complete candidates, and source fingerprint remain bound through resume/recovery.
  • Selected Cell assignment is an explicit InstanceValue write on each preflighted target, after ordinary restoration and inside the existing undo transaction (QuickPartReplace.vbs:1597, :1672). The effective Cell check runs after restoration and through the shared verification routine after disk reopen. Recovery rejects changed/missing catalogue evidence before its worker, checks the actual recovery library, and does not allow Cell mismatch error 878 into its restore-only fallback.
  • NR2 retains the original selected C/A snapshot routine while combining it with correlated untouched U/G capture. The parser rejects incomplete/foreign/duplicate selected states and the consumer rechecks PN/target identity. NR1 saved/untouched verification remains in place.

Issues

Critical

None found.

Important

  1. New catalogue work consumes the unchanged hard native-mutation deadline.
    • Location: src/dx_productivity/trial_task_center/native_helper.py:517 and :699, under the timer at :816; catalogue lock wait at src/dx_productivity/trial_task_center/cell_catalog.py:342 and worker wait at :389.
    • Trigger: execute a persisted valid selection with an unpopulated/invalidated cache, or while an obsolete asynchronous UI catalogue read still owns the catalogue mutex. Closing the dialog does not cancel its background read. The catalogue permits a 120-second lock wait plus a 90-second worker operation, while run() starts one 120-second timer before all catalogue and native replacement work. The actual standalone cold read evidence is already 83.9345502 seconds; subsequent native selection/replacement/verification and the second source check must fit into the remaining budget.
    • Impact: an otherwise valid operation can be killed by os._exit(2) during preflight or, worse operationally, after native submit and before verification. Existing rollback/uncertainty handling should prevent a false success, but this creates avoidable failed/protected tasks and makes a warm UI cache an undocumented prerequisite for reliable execution. Concurrent catalogue work can exhaust the deadline before replacement even begins.
    • Fix: give read-only catalogue preflight its own bounded phase and preserve an independent native-mutation deadline; coordinate outer worker idle/progress limits with those phases. Keep the immediate pre-submit source/membership revalidation. Do not merely assume the UI warmed the cache or relax the performance acceptance threshold. Add focused clock-controlled coverage for a cold/queued catalogue read and for timeout after the mutation phase begins.
    • Accepted alternative proposed by root after this review: explicitly forbid cold catalogue launches in both native-helper checks and recovery. A fully fingerprint-revalidated cache hit may proceed; absent, stale, corrupt, or otherwise invalid evidence must fail before mutation with an actionable “重新读取目标封装” instruction. UI explicit reading may perform the cold read. This removes the mutex/worker delay from the mutation budget without weakening authority. Cover each miss/error path with assertions that no isolated reader launches, cover successful validated reuse, and document the reread requirement. This proposal is sufficient in principle; implementation has not yet been reviewed.
    • Evidence limit: this finding follows the actual timeout composition and inspected cold-read evidence. The root is observing a new cold-cache cross-Cell run; this review has not inspected or certified that still-running result, and does not claim it has already timed out.

Minor

  1. User instructions refer to a target-plan column that is not displayed.
    • Location: docs/user/target-cell-selection.md:11.
    • The step asks users to inspect the target plan's “目标封装”. ui/target_table.py:6 and its data() still expose ten columns without Cell; only the rules table displays the new selection. Users cannot perform that stated check.
    • Correct the wording to the actual rules table, or deliberately add a read-only plan display in a separate authorized UI change. No BOM column change is needed.

Evidence inspected and limits

  • Read the spec, plan, task 2/3/4 reports, their independent reviews, the BOM fix review, ledger, all changed implementation areas, and focused test code for catalogue/NR2/Cell transport/BOM-first behavior. Bounded surrounding reads checked current-command publication, exact queue comparisons, the helper watchdog, shared cache location, undo boundaries, saved verification, and recovery fallback behavior.
  • Parsed existing build/cell-transport-verified-20261019.xml: 137 tests, zero failures/errors/skips, 49.444 seconds. Parsed build/native-selected-commit-20261019.xml: 55 tests, zero failures/errors/skips, 16.669 seconds. These are existing reports, not fresh reruns or a whole-suite pass claim.
  • Independently checked the recorded v3 catalogue evidence offline: all 86 before/after manifest entries match; recomputed fingerprint is 7b66672325b41c0915b1f4c1f8fb64b7cd2bda526e64721d85b66a17647b5d9f; cache digest matches catalogue bytes; worker verification and Quit are true; both Jobs report zero active processes and closed handles with no cleanup errors; private desktop release is confirmed; the clone is absent. The inspected summary records cold 83.9345502 seconds and cache 2.3448634 seconds.
  • The task reports retain 138 scoped rule checks, 64 BOM-fix checks, and 29 catalogue/application checks. The reviewed test bodies substantiate their intended contracts; this review did not independently rerun those commands.
  • Inspected the retained simulated-worker comparison: current 33.6976356 seconds versus baseline 30.0630522 seconds; both fail the unchanged 30-second threshold. Neither general speed improvement nor release readiness is established. Broader-suite/legacy-UI limitations remain in the task reports.
  • Prior selected-capture acceptance is same-Cell evidence; it does not certify this feature's cross-Cell writes. The root's current explicit cross-Cell BOM/save/reopen/source-hash/owned-resource acceptance remains a separate pending gate. No packaging or frozen-release acceptance was performed, consistently with scope.

Assessment

Ready to merge: With fixes. Resolve the Important deadline integration issue and collect the pending explicit cross-Cell acceptance before claiming the feature complete. Apart from that issue, the reviewed implementation consistently maintains Cell choice and source authority across the existing execution safety boundaries; no additional Critical or Important defect was identified.


Final scoped fixwave review — 4d1b825..ec75445

Findings disposition

Important: catalogue work inside the native 120-second deadline — ADDRESSED

  • native_helper.py:90 explicitly passes allow_cold_read=False, and the shared binding helper defaults to the same mode at :93. Both the initial active-project catalogue check and final pre-submit check use this route. The native watchdog remains 120 seconds (:817); no timeout or performance threshold was relaxed.
  • cell_catalog.py:175 retains a backward-compatible, keyword-only optional mode. Source manifests, the path/fingerprint/PN/partition cache key, evidence SHA256, exact evidence binding, candidate validation, worker/Quit verification, and owned cleanup proof remain necessary. A valid hit still performs the second full source manifest check. Source changes during that check fail closed.
  • Missing/stale cache or damaged/invalid evidence cannot reach read-directory creation, cloning, the launch mutex, or a cold worker when cold reading is forbidden (cell_catalog.py:199, :203). The error tells the user to reread target Cells in the rule editor. Catching invalid evidence object shapes as AttributeError closes the malformed-proof path without accepting such proof.
  • The new behavioral native test reaches the first and second actual catalogue calls in turn and asserts explicit cache-only mode, no replacement submit, and no transaction publication on failure (test_target_cell_execution.py:117). Catalogue tests cover absent, changed-source, damaged-digest, invalid-cleanup and malformed proof; the latter two recompute the digest to exercise validation beyond hashing (test_cell_catalog.py:96). Positive reuse and change during the second rehash are also covered (:128, :142).

Standalone recovery exception accepted. recovery.py:98 deliberately permits a cold read, but the call at :166 precedes CAD launch at :225 and does not run inside native_helper.run() or its watchdog. It still compares the complete current catalogue binding to the original transaction before proceeding. This avoids a lost-cache recovery dead end while interruption protection locks the rule editor, without reintroducing the reported native timeout composition. The new test verifies explicit cold permission before the recovery worker and the continued protection lock (test_recovery.py:323); the existing source/choice/proof mismatch negatives still prevent worker launch. My earlier suggestion to require cache-only mode in recovery was broader than the actual deadline defect; this reviewed exception supersedes it.

Full source hashing still consumes native time, as required for authority. This change removes the specific 120-second mutex/90-second cold-reader waits; it does not claim unlimited library size or universal runtime guarantees.

Minor: nonexistent target-plan Cell column in instructions — ADDRESSED

docs/user/target-cell-selection.md:11 now directs users to check the actual 本批料号规则 table. The guide also explains execution cache misses and the separate recovery preflight behavior. No new table or BOM column was introduced.

New issues

  • Critical: 0.
  • Important: 0.
  • No new actionable minor issue found in this scoped fix.

Evidence and scope

  • Reviewed the supplied seven-file 4d1b825..ec75445 diff and final-fix-report.md, focusing on the two original findings and new breakage. No tests rerun, CAD/LM operation, process changes, Git mutation, source edits, or subagents. Only this requested review artifact was written.
  • Independently parsed build/cell-finalfix-scoped-20261019.xml: 177 tests, 0 failures, 0 errors, 0 skips, suite time 75.853 seconds. The report's 76.24 seconds is its CLI elapsed result, not a conflicting suite count. Reviewed focused test bodies rather than relying on counts alone.
  • Read the completed pre-fix cross-Cell acceptance build/explicit-cell-formal-bom-20261019/report.json, independent-graph-verification.json, and desktop-observation.json. They record two saved/reopened replacements at 267.375 seconds, actual saved Cell instances RESC1608N_0603 replacing RESC1005N_0402, 55 untouched components, 103 pins, 22 nets, unchanged connectivity, source-hash equality reported, no owned CAD foreground/input-desktop takeover, and released owned processes/desktop. These artifacts support actual cross-Cell behavior but are not evidence that the new cache-only execution path has completed its current live acceptance. The source-hash equality here is the inspected report's assertion, not a fresh full source-file rehash by this reviewer.
  • The post-fix warmed-rule-read/BOM run under ec75445 remains root-owned and was reported running at review time. I did not inspect its incomplete artifacts or certify its outcome. Existing performance limitations, broader-suite qualifications, and no-package/no-release scope remain unchanged.

Assessment

Scoped fixwave: Approved. Both original findings are addressed; no new Critical or Important issue was found. The native deadline fix preserves source authority and failure-before-submit behavior while the recovery exception stays outside that deadline. Root should collect the running post-fix live acceptance before the final whole-feature completion claim.