merge(main): resolve PR19 review conflicts and run intervention regressions in CI
Core regression / Python core, intervention UI and release configuration (push) Failing after 2m42s
Core regression / JavaScript syntax (push) Successful in 6s
Core regression / Python core, intervention UI and release configuration (pull_request) Canceled after 1m17s
Core regression / JavaScript syntax (pull_request) Canceled after 0s

This commit is contained in:
阿白叔 committed 2026-11-09 11:35:29 +08:00
commit f8f07d30d2
127 files changed
+9390 -386

No files matched your search

@@ -0,0 +1,207 @@
# 非阻塞替换与问题轮次 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use `superpowers:executing-plans` to implement one task at a time. All boxes are pending; do not infer implementation from this plan.
**Goal:** 细化现有执行账本,单项问题不拖住其他独立项/工程;首轮结束后按 Git 规则自动重试一次,剩余问题集中处理。
**Architecture:** ExecutionJournal 继续作为真实替换回执的唯一权威;新增记录仅表达问题分类、持久重试额度和调度阶段。每工程独立 CAD 会话、正常项复用、异常后重建;不确定项不重放,同工程后继项能否继续由强制工程健康证明决定。
**Tech Stack:** Python 3.12、SQLite、现有 COM/VBScript、PrivateDesktop/Job、PySide6/DSH;经验规则使用标准库 JSON,不新增 YAML 依赖。
**Spec:** [无人值守流水线设计](../specs/2026-11-04-radical-optimization-design.md);独立校验复用[校验设计](../specs/2026-11-05-independent-netlist-verification-design.md),但可选校验不得成为强制写入准入的替代品。
## Global Constraints
- 替换项仍是工程 × 图页 × 单条换料规则;身份复用 task_id/round_id/operation_key。
- 已 verified/no_match 的终态不可因重建队列、清理历史或校验失败降级为 pending。
- 重试额度按原 task_id/round_id/operation_key 持久保存,不能按新 attempt/generation 重置。
- 只有首轮可运行项全部处理完且未暂停,才消费可重试问题。
- 无规则、冲突规则、未知错误、不确定写入状态均不自动重放。
- 正常项复用该工程会话,切换工程不共享 CAD 会话;异常后只重建当前工程会话。
- 每项失败分类、每个资源释放和每次重试均留证;DSH 解释不构成授权。
## 依赖与交付
`E01 → E02 → E03`;`E01 → E04`;`E02/E04 → E05`;`E03/E05 → E06 → E07 → E08`。E04/E05 在同工程继续策略启用前共同验收。独立校验可先交付,不是 E01~E06 的上线前置。
新文件职责:`execution_problems.py` 保存分类/额度;`execution_problem_contract.py` 定义逻辑身份/分类;`experience_rules.py` 读取固定版本策略;`project_session_health.py` 核对现有强制证明;`problem_pass.py` 处理第二轮次。只新增这些现有模块没有承担的职责。
## E01:问题分类和依赖范围
**Files:** Create `src/dx_productivity/trial_task_center/execution_problem_contract.py`;Test `tests/v1_1/test_execution_problem_contract.py`。
**Interfaces:** `problem_key(attempt: JournalAttempt) -> tuple[str, str, str]` 返回 task/round/operation;`classify_problem(*, mutation_possible: bool, readback_verified: bool, retry_rule: dict | None) -> str` 返回 retryable/manual/uncertain。pending 后继项另有 hold_reason;失败和未执行不能混为一类。
- [ ] 写不同 attempt/generation 同逻辑项仍共用额度键、跨轮次不同键、不确定风险不能被规则降为 retryable 的失败测试。
```python
def test_new_attempt_does_not_create_new_retry_budget():
from dx_productivity.trial_task_center.execution_journal import JournalAttempt
from dx_productivity.trial_task_center.execution_problem_contract import problem_key
first = JournalAttempt('task', 'round', 'operation', 'a' * 32, 1)
later = JournalAttempt('task', 'round', 'operation', 'b' * 32, 2)
assert problem_key(first) == problem_key(later)
```
- [ ] Run `python -m pytest tests/v1_1/test_execution_problem_contract.py -q`,确认缺失模块失败。
- [ ] 实现逻辑键/分类与项目/项依赖引用格式;禁止把“进程已退出”当作“没有写入”。未声明独立且当前基线无法证明时,后继项保持 project_recovery。
- [ ] 验证手动失败、未派发、用户暂停、状态不确定分别投影,不能把暂缓显示为成功。
- [ ] Commit `feat: define logical execution problem identity`。
## E02:问题记录和一次重试额度事务
**Files:** Create `execution_problems.py`;Modify `execution_journal.py` 的 schema 创建入口;Test `tests/v1_1/test_execution_problems.py`。
**Interfaces:** `ExecutionProblems(store).record(attempt, classification, evidence_ref) -> dict`、`reserve_retry(attempt, *, rule_id, rule_commit, input_fingerprint) -> bool`、`list_problems(task_id, round_id) -> tuple[dict, ...]`。额度唯一键使用 E01 的逻辑键;逐次决策另存 append-only 记录,绑定原 attempt。
- [ ] 用真实临时 SQLite 的 fixture 写以下测试,并覆盖两个连接竞争、先扣额度后崩溃、用户清空历史和旧回调。
```python
def test_retry_reservation_survives_new_attempt(problems, first_attempt, later_attempt):
options = dict(rule_id='DX-SESSION-001', rule_commit='c' * 40,
input_fingerprint='d' * 64)
assert problems.reserve_retry(first_attempt, **options) is True
assert problems.reserve_retry(later_attempt, **options) is False
```
`problems` fixture 在本任务测试文件构建真实 TaskStore;first/later 使用 E01 示例的同操作不同尝试,先提交合法失败,再申请额度。
- [ ] Run `python -m pytest tests/v1_1/test_execution_problems.py -q`,确认失败。
- [ ] 建表、唯一约束、事务内核对任务/轮次/原尝试,先持久扣减再允许派发;重启不补回已消耗额度。旧 DSH 已消耗预算迁移时保守继承,不通过更换键恢复重试权。
- [ ] 回归 `test_execution_journal.py`、`test_history_facade_concurrency.py` 和旧库升级,检查无竞争的第二份成功账本。
- [ ] Commit `feat: persist problem history and retry allowance`。
## E03:JSON 经验规则、版本锁定和校验 CLI
**Files:** Create `experience/schema.json`、`experience/rules/DX-SESSION-001.json`、`experience_rules.py`、`tools/validate_experience_rules.py`;Modify `dsh/failure_policy.py`、`packaging/Build-DxPartReplace.ps1`;Test `tests/v1_1/test_experience_rules.py`。构建时生成包内 `experience/manifest.json`,不把引用自身 Git commit 的 manifest 提交回源仓库。
**Interfaces:** `load_registry(root: Path) -> dict`、`classify_failure_context(context: dict, registry: dict) -> dict`;context 固定 error_code/stage/cad_version/mutation_possible/evidence_state/environment_fingerprint;输出 classification/rule_id/rule_commit/input_fingerprint/action。首条动作仅 reset_project_session_and_retry_item。构建 CLI `python tools/validate_experience_rules.py --root experience --emit-manifest <构建暂存目录>/manifest.json` 在构建机读取已提交规则版本并输出每文件摘要,运行客户端只校验包内 manifest。
- [ ] 写无匹配、重叠匹配、未知字段、任意命令动作、规则被修改、同输入重复判定的测试。
```python
def test_unmatched_error_is_manual():
from dx_productivity.trial_task_center.experience_rules import classify_failure_context
context = dict(error_code='unknown', stage='open_project', cad_version='7.9.5',
mutation_possible=False, evidence_state='prepared', environment_fingerprint='e' * 64)
assert classify_failure_context(context, {'rules': [], 'commit': 'c' * 40})['classification'] == 'manual'
```
- [ ] Run `python -m pytest tests/v1_1/test_experience_rules.py -q`,确认失败。
- [ ] 实现标准库严格 JSON 校验,默认 max_auto_retries=1;manifest 锁定 Git commit 与每文件摘要,批次执行中不热更新。客户端不调用 Git;脏/缺失规则拒绝自动重试但保留主轮次替换能力。
- [ ] Run `python tools/validate_experience_rules.py --root experience` 与 DSH failure_policy 组;验证 unknown、interrupted、pause 均不能被规则放宽。
- [ ] Commit `feat: version deterministic JSON experience rules`。
## E04:每工程 CAD 会话和强制恢复证明
**Files:** Create `project_session_health.py`;Modify `batch_runtime.py`、`project_session.py`、`batch_resources.py`;Test `tests/v1_1/test_project_session_health.py`、`test_batch_runtime.py`。
**Interfaces:** `evaluate_project_health(*, project_key, session_id, generation, release_proof, baseline_proof) -> dict` 返回 ready/blockers;release_proof 来自现有资源归属记录,baseline_proof 来自原有原生回读/expected_baselines。可选网表校验结果不是输入。
- [ ] 写工程间不复用 CAD、正常项复用、异常只重建该工程的计数测试;再写旧 generation 和仅 PID 消失不得准入。
```python
def test_process_exit_alone_does_not_prove_project_clean():
from dx_productivity.trial_task_center.project_session_health import evaluate_project_health
health = evaluate_project_health(project_key='A', session_id='s', generation=2,
release_proof={'process_exited': True}, baseline_proof=None)
assert health['ready'] is False
```
- [ ] Run `python -m pytest tests/v1_1/test_project_session_health.py -q`,确认失败。
- [ ] 按工程获得/释放 CAD 租约,保留已核验合法修改的最近基线;异常后的独立原生核验与资源释放必须同时满足才能允许当前工程继续。禁止用最初文件 hash 否定工具自身合法改动。
- [ ] 回归普通暂停/显式强制结束、自有进程清理、外部工程保护;unknown 会话仍被隔离,不靠重复启动覆盖证据。
- [ ] Commit `feat: prove project session health after failures`。
## E05:同工程失败后处理独立余项
**Files:** Modify `execution_journal.py`、`batch.py`、`service.py`;Test `tests/v1_1/test_item_failure_isolation.py`、`test_safe_cbb_continue.py`。
**Interfaces:** 保留 `ExecutionJournal.claim/finish` 签名;在领取新 pending 项前使用 E04 健康证明和原始目标范围进行准入。失败项留在 E02,后继项不因解除任务级失败门禁自动变为成功或被加入重试范围。
- [ ] 写 A1 安全失败/A2 独立/A3 依赖 A1/B1 独立的调用测试;A2/B1 执行,A3 dependency_blocked,A1 不立刻重试。
```python
def test_safe_failure_does_not_hold_independent_item(isolation_case):
isolation_case.run(outcomes={'A1': 'safe_failure'}, healthy_projects={'A'})
assert isolation_case.calls == ['A1', 'A2', 'B1']
assert isolation_case.state('A3') == 'dependency_blocked'
```
`isolation_case` 在本任务测试文件构造真实 ExecutionJournal 和 four-item frozen plan,注入的只是原生执行返回;必须实际走 claim/finish。
- [ ] Run `python -m pytest tests/v1_1/test_item_failure_isolation.py -q`,复现当前同工程余项暂缓。
- [ ] 将“任意 failed 就拒绝全部 claim”替换为当前项终态、范围/依赖、会话健康共同判定;无法证明的当前工程余项留 project_recovery。其他工程不受该逻辑错误阻塞。
- [ ] 验证 uncertain 从不自动重放;若有任何未解决写入风险,不能仅凭重启会话执行 A2。通过 E04/E05 后才启用此策略,旧服务接口保持兼容。
- [ ] Commit `feat: continue independent items after safe failures`。
## E06:持久首轮/问题轮次与问题项定向重放
**Files:** Create `problem_pass.py`;Modify `task_queue.py`、`retry_preparation.py`、`recovery_commit.py`;Test `tests/v1_1/test_deferred_problem_pass.py`、`test_retry_recovery_transactions.py`。
**Interfaces:** `run_problem_pass(service, queue_id: str, *, stop_event) -> dict`;`resume_problem_items(service, queue_id: str, problem_keys: tuple, *, stop_event) -> dict`。检查点 schema 增加 phase=primary/problems/finished、原轮次关联和确定的 operation_key 序列;保留 queue_id/checkpoint_id/expected_plan_hashes。
- [ ] 写 A1 失败/A2与B1成功的双轮次测试,要求首轮最后项先于首次 retry;暂停落在首轮最后一项时也不启动第二轮。
```python
def test_primary_pass_finishes_before_any_retry(two_pass_case):
two_pass_case.run(first_failure='A1')
assert two_pass_case.calls == ['A1', 'A2', 'B1', 'A1:retry']
assert two_pass_case.retry_reservations == 1
```
`two_pass_case` 在本任务用真实队列检查点、E02 SQLite 额度和 E03 最小规则构建,调用计数来自受控原生执行入口。
- [ ] Run `python -m pytest tests/v1_1/test_deferred_problem_pass.py -q`,确认失败。
- [ ] 首轮失败只记录问题并继续;首轮收尾后冻结可重试清单,逐项先扣额度、经原子重试准备再派发。重试成功不覆盖原失败证据;不确定/人工/成功项不进入自动清单。
- [ ] 注入 phase 发布/扣额度/重试准备目录切换/回执提交的中断,验证重启不回主轮次重做。人工重放只受理确认的原问题集合,拒绝外来/成功/过期轮次键。
- [ ] Commit `feat: persist primary and deferred problem passes`。
## E07:统一 DSH 重试路径、问题列表和双状态
**Files:** Modify `dsh/incidents.py`、`dsh/run_journal.py`、`dsh/task_lifecycle.py`、`ui/dsh_operations.py`、`ui/dsh_task_lifecycle.py`;Test `tests/dsh/test_work_item_incidents.py`、`tests/ui/test_dsh_operations.py`。
**Interfaces:** 事件绑定 task_id/round_id/operation_key/attempt_id;所有自动换料重试统一经过 E02/E06。`problem_projection(receipts: tuple, problems: tuple) -> dict` 在 `execution_problems.py` 定义,提供替换汇总、问题项和可继续范围;如独立校验已接入,引用其 verification_projection,不重建状态。
- [ ] 写同事件从 IncidentCoordinator 和问题轮次同时进入只派发一次、切任务不串事件、校验失败不能调用换料重试的测试。
```python
def test_dsh_and_problem_pass_share_one_allowance(shared_retry_case):
shared_retry_case.request_from_dsh()
shared_retry_case.run_problem_pass()
assert shared_retry_case.native_retry_dispatches == 1
```
`shared_retry_case` 在本任务绑定同一真实 E02/E06 记录,不能给两入口各自造一个计数器来模拟幂等。
- [ ] Run `python -m pytest tests/dsh/test_work_item_incidents.py -q`,确认失败。
- [ ] 解释/聚类仅来自持久证据,本地 ExperienceStore 不产生授权;UI 展示完成有问题、失败/暂缓/不确定、原生确认后仅重放问题项。旧事件预算迁移不能获得新额度。
- [ ] 回归现有 DSH 运行恢复/对话取消/原生确认与 Qt 页面,确保主轮次不中途弹诊断阻塞执行。
- [ ] Commit `feat: unify DSH problem handling and retry authority`。
## E08:混合批次、崩溃矩阵和真实会话验收
**Files:** Create `tests/v1_1/test_unattended_batch_acceptance.py`、`tools/verify_work_item_pipeline.py`、`docs/testing/2026-11-05-radical-pipeline-acceptance.md`;Modify `packaging/DxPartReplace.spec`、`docs/user/unattended-batch-and-problem-queue.md`(不存在时创建)。
**Interfaces:** `python tools/verify_work_item_pipeline.py --output <新目录>` 使用受控执行器跑真实账本/调度器,不启动 CAD;真实 CAD 单独记录,不与 mock 报告混计。
- [ ] 100 项中放入 5 个明确失败、2 个不确定项,93 个其余项独立或有合法恢复证明;断言其完成且每个成功项只派发一次。另设不确定工程有余项的场景,明确哪些余项暂缓。
```python
def test_uncertain_items_are_never_replayed(batch_100_case):
result = batch_100_case.run()
assert result['completed_safe_items'] == 93
assert result['status'] == 'completed_with_issues'
assert batch_100_case.uncertain_retry_dispatches == 0
```
`batch_100_case` 在本任务生成确定输入并真实经过 E01~E07;两项 uncertain 不与其余 93 项共享未恢复写入风险。
- [ ] Run `python -m pytest tests/v1_1/test_unattended_batch_acceptance.py -q`,确认失败,再实现 CLI 汇总和故障注入驱动。
- [ ] 在领取、原生修改、保存、回读、终态提交、phase切换、额度扣减、强制暂停、资源退出九个边界注入中断;必须核对实际派发次数而非只核对进度数字。
- [ ] 独立工程副本实测工程会话切换、异常后恢复、其他工程继续和问题轮次;若独立校验已交付,再验证“替换失败问题”和“校验差异问题”不会互相触发错误重试。
- [ ] 跑默认 suite、DSH/打包组和 CLI;发布包携带 JSON 规则及版本摘要,不要求用户 Git,不携带工程/模型凭据;记录实测范围后 Commit `test: verify nonblocking replacement and deferred retries`。
## 验收出口
E01~E04 为基础能力,E05 是同工程非阻塞策略,E06 是首轮/问题轮次闭环,E07 是真实 DSH 接入,E08 才是对外承诺门禁。现有 main 已有回执/恢复测试继续保留,不能以新测试代替原有防重复写入保护。
@@ -0,0 +1,71 @@
# 逐位号非阻塞修复与独立验收清单
**Goal:** 一个明确失败位号不挡住可安全执行的独立位号;工程不确定时隔离该工程,确认资源释放后继续其他工程。
**Architecture:** 复用现有执行账本、保存回读、恢复事务和进程归属证明。新增位号粒度、问题轮次与工程隔离;AI 等待退出执行通道。工作树基线为 8b4e8ee。
**Tech Stack:** Python 3.12、SQLite、PySide6、Windows 自有 Job/私有桌面、现有 VBS 原生执行器。
**Spec:** 本清单落实 2026-11-06 用户确认的筛查结论;排除独立校验工作台及其分支。
## 约束和默认选择
- 不确定写入不自动重放。自动请求安全退出;资源确认释放后可继续其他独立工程;卡死时强制结束需要操作者明确确认。
- 保留强制备份、UID/目标范围、保存与回读、旧尝试拒绝、原子恢复发布和源表来源信息。
- 每工程正常项复用会话,工程间串行切换;禁止任意多开 CAD,禁止清理外部 CAD。
- 新计划按位号执行;旧冻结整组回执保持原义,未决组必须先核验,不通过改 key 获得重放权限。
- Block/Symbol 属性来源尚未确认;仅加证据、歧义拒绝和样本,不推断层级、不以 Value 相同合并身份。
- BOM 允许显式接受通过的工程;默认仍整批确认。已是目标必须同时满足 Value/Cell 要求,否则不能假报成功。
- 自动问题重试限原 task/round/目标意图一次;首轮后进行;未知/确定性/不确定写入不自动重试。AI 无权放宽门禁。
- 仅新增功能的独立验证和必要受影响回归;用受控原生边界、真实 SQLite/队列、一次性进程/弹窗验证,不重复真实 CAD/PCB。
## 修复与验收 list
| ID | 需要修复/补齐 | 修复完成的独立验收标准 |
| --- | --- | --- |
| R01 | 新计划逐位号冻结和派发 | 同规则 R1/R2 各有单目标命令、独立回执;Value 相同仍为两目标 |
| R02 | 旧组回执兼容 | 已成功/未决组不被拆分重放;旧队列恢复保留冻结身份 |
| R03 | 同工程安全失败继续 | R1 明确失败、R2 独立成功;成功项只派发一次 |
| R04 | 位号继续健康准入 | 写入不确定、目标重叠、基线变化不能凭重启 CAD 解除 |
| R05 | 问题身份与分类 | 重绑 job/attempt、重启不生成新逻辑问题或新额度 |
| R06 | 持久首轮/问题轮次 | 首轮所有可运行项先执行;之后仅合规问题项最多重试一次 |
| R07 | 重试统一授权 | DSH 与问题调度竞争同一额度,实际仅派发一次;暂停不清额度 |
| R08 | 逐工程监督与检查点 | A 异常后记录 A;确认释放后 B 继续,冻结范围/顺序不变 |
| R09 | 工程独立 CAD 生命周期 | A/B 不共享 CAD;同工程正常项复用;无并行窗口累积 |
| R10 | 不确定状态与资源占用分离 | 进程确认退出可结束等待,但工程仍待核验且不能自动重放 |
| R11 | 业务进展监控 | 仅心跳不延长业务停滞;慢保存不被自动强杀 |
| R12 | 只读失败完整释放 | 读取超时/取消后关闭整代,确认后跳过;不重复打开失败工程 |
| R13 | 所有者失联及重启恢复 | 父进程退出只回收证明归属的只读残留;PID 复用/写操作拒绝 |
| R14 | 未知弹窗人工入口 | 能识别工程、显示窗口内容和待处理原因;提供受控处理入口并复核 |
| R15 | 退出观察覆盖所有等待路径 | worker/runtime/CAD 都可因自有进程确实退出结束等待;不清除 uncertainty |
| R16 | 资源残留再准入 | 有进程/桌面释放证明才解除资源挡板;坏证据仍阻断且可诊断 |
| R17 | AI 分析与网络等待解耦 | 模型等待/反思/工单发布时可执行独立任务;实际变更临时独占 |
| R18 | 问题结果汇总 | 成功/失败/暂缓/待核验分开;批次结束不误报全部成功 |
| R19 | BOM 按工程显式部分接收 | 用户明确选择通过工程后仅保存该范围;失败行和来源完整保留 |
| R20 | 已是目标识别 | 目标料号且 Value/Cell 均正确时跳过;属性不符明确报告、不能假完成 |
| R21 | 中心库目标预检 | 真实连接业务的只读预检在写入前发现目标/关联问题;缺工具不谎报已查 |
| R22 | 缓存内容与释放后复核 | 元数据变化可复核;内容变化/不可读不复用;失败释放后不陷重复读取 |
| R23 | 实际 Value 报告 | 报告绑定当前 job/UID/回执,取保存后实际值;旧/外国报告拒绝 |
| R24 | Block/Symbol 歧义证据 | 同值不去重;属性来源可记录;未知来源不猜写;样本明确当前支持边界 |
| R25 | 混合批次闭环 | 100 项混合故障核对真实派发/账本;成功不重做、不确定不重试、独立项完成 |
## 执行单元与验证入口
- [x] T1:R01~R07、R18。修改 target_plan、quick_run、batch、execution_journal、task_queue、service;新建 execution_problems/problem_pass(需要时)。先用真实账本/受控 worker 复现 R1 失败拖住 R2,再实现逐位号、旧回执兼容、持久问题轮次。测试 test_nonblocking_items、test_deferred_problem_pass 和受影响旧组。
- [x] T2:R08~R16、R22。修改 batch_runtime、batch_resources、batch_supervisor、batch_worker、worker_monitor、isolated_cad、discovery_cache;添加工程监督/所有者关联最小模块。先写资源归属、退出观察和逐工程超时样本,再实现;不以固定超时授权杀写进程。测试 test_nonblocking_resources 和必要 monitor/runtime/只读恢复组。
- [x] T3:R17。移植 PR19 的 AI 等待/变更准入分离,保留当前身份与取消保护;仅修改 dsh_automation、dsh_operations、dsh/incidents 和相关 UI 测试。模型永久未返回时独立任务仍可派发;真实 mutation 必须重新检查准入。
- [x] T4:R19~R21、R23~R24。修改 BOM 匹配/预览/保存合同与现有导入 UI,增加实际 Value 报告和来源证据。默认保持原子整批;显式部分接收必须绑定原预览与源表版本。先用 Excel/报告样本失败复现,测试真实预览/事务及 VBS 边界。
- [x] T5:R25 与集成审阅。整合各独立结果,补混合批次和崩溃恢复;按 R01~R25 逐项记录证据,运行一次必要集成集合;独立审阅并修复真实发现。
每单元遵循:失败复现 → 最小实现 → 对应功能通过 → 必要邻接回归 → 更新清单证据。未有证据的项不勾选完成。
## 验收记录
- 基线:test_task_queue + test_safe_cbb_continue,9 passed(保留旧行为对照)。
- 修复证据由各单元追加到 docs/testing/2026-11-06-nonblocking-repair-acceptance.md;结果不累加不同版本的重复测试数。
## 完成记录
R01~R25 已完成本轮开发、独立样本验证及限定代码复核。逐项证据见 [验收索引](../../testing/2026-11-06-nonblocking-repair-acceptance.md)。最后集成集合26 passed;独立连接额度竞争及中断恢复2 passed;BOM最后缺元数据与身份保护8 passed。不同阶段结果不累计。
真实 CAD/PCB 未重复执行,安装包和远程 CI 未在本轮运行;Block/Symbol 所属层级保持未知,交付的是证据保留与歧义写入保护。无法证明归属或释放的遗留资源仍保留人工核验门禁,不能把清理强制化作为完成标准。
@@ -0,0 +1,20 @@
# 问题项处理闭环
范围:补齐已批准的四个高优先级缺口。复用现有数据库、GUI 异步操作与失败项准备流程;不涉及校验工作台、PCB、经验规则系统或复杂弹窗输入。
1. 问题列表:当前轮次的失败、待执行、待核验和已解决项可见,显示工程、页、位号、UID、原因和自动重试余额。列表独立于截断日志。
2. 定向手动重试:只允许勾选当前失败项,确认范围后准备重试;原轮次和 generation 不符时拒绝。成功、未决、未选失败项不重放。保留旧工程级接口兼容。
3. 保留工作进程核销:记录系统启动身份,只有可验证的进程树退出或跨系统启动证据可解除资源阻塞;同次启动证据不足继续保护,业务待核验状态不清除。旧证据不能被静默放宽。
4. 安全超时:仅 open_project 安全阶段、清理完成、状态未变化且健康证明通过的超时转成可重试失败。其余仍待核验。自动重试与 DSH 共用一次额度。
验收:先编写能复现缺口的测试,再实现;分别验证列表与界面操作、选中 UID 实际派发范围、旧选择拒绝、资源核销正反例、安全超时正反例与一次额度。仅运行变更相关测试,不重复全量和 CAD/PCB 测试。最后记录受控验证与真实环境验证边界。
## 执行结果
- [x] 当前轮次问题列表及状态、身份、自动重试余额,入口在“更多操作 → 问题项 / 定向重试”。
- [x] 所选失败项准备重试,绑定 round/operation/generation;后续自动问题轮次、DSH 和旧崩溃预留恢复均遵守本次选择。
- [x] 保留工作进程记录的启动身份核销;旧记录先记录观察启动身份,同次启动证据不足继续阻塞。只解除资源门禁,保留业务待核验。
- [x] 安全打开超时接入问题轮次,取消内联重放;源文件、命令、状态或释放证据不足均保护为待核验。
- [x] 独立功能验证、相关回归、代码审查及审查发现项修复。
详细证据见 `docs/testing/2026-11-06-problem-workflow-acceptance.md`。其余中优先级项不在本轮完成声明内。
@@ -0,0 +1,12 @@
# PR #24 审查修复与重新提交
按用户批准的计划更新原 PR,不新开、不合并。保留逐 UID、实际回读与写入未决保护;不涉及校验工作台、真实 CAD/PCB 或发布 EXE。
1. 测量工具改为单 UID,三工程/两页/两规则/两个选中 UID 成功场景 24 次派发;安全失败 23 项成功;未决暂停;恢复不重放;未选项不变。
2. 结果表按七列表头验收;读取失败已释放异常、慢保存交互/非交互契约及监督请求权限分别验证。
3. 共享模拟工厂自包含初始化;测试只清理自身进程、桌面与监控器,组合运行无状态污染。
4. 缺页清单抛受控错误;问题轮次以 ProblemPassResult 保留已完成结果及阻塞任务/错误码/原因,再由外层落盘并返回暂停。不得扩大重试范围或清除未决状态。
5. 先跑定向及组合,全部通过后在最终代码/测试树运行一次 Windows Python3.12/Qt offscreen 全量 tests/v1_1,记录 JUnit、退出码和提交 SHA。新失败出现后才追加验证。
6. 补便携 CI 回归、行为变化说明和模块风险表;独立复核后推送原 PR,确认最新 CI 全绿。
审查依据:PR #24 评论 306;起点 e78cdd3。此前已复现八个单例失败;另一个失败与跨模块 Desktop.created 有关。
@@ -0,0 +1,28 @@
# CAD 弹窗与资源释放补丁
基于 `08ddf4c`,参考 `docs/reviews/2026-10-19-native-snapshot.md`:曾因 CAD 预定义 Vd 枚举被脚本重复声明,弹出编译错误框;定向确认错误框后 CAD 才能正常退出。该次异常记录仍保持 `clean=false`。
## 实际行为
- 从私有桌面枚举自有且仍存活的 CAD PID,只读取该进程的可见标准对话框。使用有超时的窗口文本读取,不切换输入桌面、不发送全局鼠标键盘输入。采样限制为每次约 0.5 秒、最多 8 个对话框、最多 64 个子控件;不完整快照不能授权点击。
- 目前自动确认范围仅为已知 VBScript 编译错误、匹配标题、单一且可用的“确定/OK”按钮。先原子保存标题、正文、按钮、句柄、PID、会话标识和阶段;发送消息前重新枚举并比对完整快照,避免旧 HWND 被复用。每个快照最多请求一次确认。
- 保存、覆盖、许可、其他未知提示均记录为 `manual_required`,不自动点击。证据写入失败也不能授权点击。
- 启动、工程关闭检查点、Quit 和 CAD 退出等待均检查弹窗。会话就绪后另有不调用 COM 的独立监测线程,业务线程被 COM 模态等待阻塞时仍能处理上述已知错误框;关闭前停止该线程。
- 生产 `BatchCadRuntime` 的桌面租约同步接入监测与动作,限定当前 generation 及本 lease 的存活进程。旧代次和其他 PID 不能继承该权限。
- 编译错误即使已确认关闭,也保持失败;证据最多 100 条,达到上限仍锁存致命错误,不点击无法记录的新对话框。
- Quit 超时后保留原进程与保护标记。人工处理弹窗后,只有 CAD 和原 Quit helper 都已实际退出,等待才自动结束;不重复 Quit、不自动重做替换、不把超时后的结果标记为正常成功。
- `cad-dialogs-<session-token>.json` 和会话概要进入现有脱敏诊断导出,包括批次 `generation-N` 子目录。证据以文本和控件信息为主,本轮没有增加截图或新的界面按钮。
## 定向验证
1. 修改前现有 `test_isolated_cad.py`:**34 passed**。
2. 新增弹窗测试先复现缺失逻辑;退出阶段集成用例先复现“错误框未处理”和“进程已退出仍必须点强制结束”。随后修复并通过。
3. 弹窗、隔离会话、用户停止、诊断导出的阶段性定向验证:**79 passed**。
4. 生产批次租约、证据上限修正后的弹窗与 batch runtime 定向验证:**55 passed**。
5. 最终 `python -m pytest -q tests/v1_1/test_cad_dialogs.py --tb=short`:**21 passed**,包括外国 PID、旧 generation、控件句柄复用、写盘失败、重复点击防护、启动致命错误、人工解除后退出、记录上限、两种目录诊断导出等独立用例。
上述范围重叠,不累加。21 项中包含 3 个真实 Win32 私有桌面 MessageBox 样本:已知脚本错误可关闭、保存提示保持不动、真实 BatchCadRuntime 租约下主线程等待时由后台监测解除已知错误框。样本使用独立 Python 进程,未启动真实 CAD,也未打开或修改工程。
独立只读复核发现证据上限可能漏记致命错误,已修正并以先失败后通过的用例验证;增量复核通过。现有保存证明、实例身份、强制结束授权与不确定状态保护保持生效。
本轮未执行真实 DxDesigner 换料、PCB、安装包构建或整库重复回归。Linux CI 加入本文件的可移植用例;原生 Win32 样本在非 Windows 上跳过,本机结果不能代替远端 Linux 检查结果。
@@ -0,0 +1,52 @@
# 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
```text
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:
```text
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:
```text
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
```text
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.
@@ -0,0 +1,42 @@
# lxb 非 UI 能力核对、运行验证与选择性吸收
对照:当前优化分支 `ce435dd`,lxb `4270952`(`origin/lxb/dxpartreplace-1.2.0-beta.31-windows-x64`)。两者分别在独立工作树检查;没有把 lxb 整个提交合并到当前分支。
## 能力与处置
| 能力 | lxb 实现 | 当前与本轮结果 |
| --- | --- | --- |
| 只读取消有独立期限 | `worker_monitor.py` 的 `READ_ONLY_CANCEL_GRACE_SECONDS=5`,有进度也不延长明确取消 | **本轮吸收 worker 层逻辑**;不代表整个 BOM 关闭/资源恢复链已完成迁移 |
| 只读读取与打开工程超时 | 只读空闲上限 45 秒;安全 `open_project` 45 秒请求停止、90 秒判定无响应 | **本轮吸收**;可能写入的阶段不使用该安全打开门禁 |
| 会话检查点等待期间响应暂停 | `project_session.py:run_step` 将 runtime 的停止事件送至本会话的 abort | **本轮吸收**;仍由 monitor 判定 safe/unsafe,普通暂停不变成强制结束 |
| GUI 失联和重启后只读残留回收 | 父进程 PID/创建时间、请求哈希、claim、操作类型关联;失联宽限及保护落盘 | 原分支相关模拟用例通过;**未移植整条所有权链**。需要同时适配 guardian 生存周期、当前新监督操作及已有证据格式 |
| 逐工程独立监督与超时后继续 | `workspace_execution.py` 每次执行单个 task;监督层不确定状态宽限 5 秒、无业务进度 360 秒后保护并退出,由外层尝试下一工程 | 原分支真实子进程模拟用例通过;**当前没有该外层调度**。不能只拷 wrapper,需一并核验释放证明、冻结范围、检查点、暂停/恢复和历史 |
| 只读失败释放整代资源再跳过工程 | `BatchCadRuntime`/`native_inventory.py` 的只读策略与 `project-read-release.json` | 原分支相关模拟通过;当前有 ReleasedProjectReadError 基础,但完整只读所有权策略**待适配** |
| 读缓存容忍元数据变化、释放后重验指纹 | `discovery_cache.py` 比内容哈希、运行数据库变化后二次等值读取、释放后重验 | 部分原用例通过,但发现一项异常样本结构不匹配而失败;**本轮不吸收**,不把该组标为全部验收通过 |
| 实际 Value 回读报告 | VBS 写 `value-readback.tsv`,解析器绑定 terminal job、UID、状态与版本,拒绝旧报告 | 原分支定向测试通过;**待独立吸收**,保留当前逐项策略和语义证明 |
| BOM 部分工程通过、已是新料号时跳过 | workspace 检查范围与 `allow_target`,不对已是目标的项再次替换 | 有实现;**本轮未改当前整批确认合同**,也不能据此宣称会修正已是目标但 Value 错误的项 |
| 中心库目标料号预检 | 有 `read_library_part_presence` 底层函数,但无 BOM 业务调用 | **lxb 也未启用**。测试明确禁止导入/保存时查询中心库,不能列为已完成能力 |
| 读链诊断与新近证据优先 | `read_trace.py`、读取状态、指纹差异、日志尾部和轮转 | 可独立吸收;诊断白名单必须与当前 CAD 弹窗、BOM source-map、监督证据取并集 |
| 中断资源 `cleanup=null` 与残留桌面复核 | null 转对象;核对 CAD PID、句柄证明和已退出 orphan owner | 原分支 null 用例通过;接受“空桌面”的策略涉及证据准入,**本轮未放宽当前释放条件** |
当前已具备:逐项 Value、迁移多表 BOM、来源映射、防重复执行账本、安全失败继续后续工程、已知脚本弹窗处理与退出确认。不应再次以 lxb 旧实现覆盖。
仍未完成:同工程失败后的安全余项继续;适配当前账本的工程隔离;首轮结束后按原逻辑项持久额度集中重试。lxb 的外层工程跳过不等于这些项级能力。PR #19 的 AI 等待/恢复增强仍在 DSH 分支,未因本轮核对而合入。
## 实际运行记录
- lxb 独立工作树:`test_read_session_recovery.py` + `test_workspace_stop.py -k "not stop_button_requests"`:**50 passed、1 deselected**。覆盖旧父进程退出、只读操作/写操作区分、PID 复用、请求/claim 关联、只读取消、资源恢复、超时保护当前工程并继续下一工程。部分使用真实 Python 子进程;CAD 和任务结果为受控替身,不是实际换料验收。
- lxb 额外能力组:指纹不可验证、null cleanup、Value 报告、库预检边界及三个缓存场景:**21 passed、1 failed**。失败为 `test_changing_readable_fingerprint_releases_session_and_skips_project`:测试构造二列指纹,`_fingerprint_difference` 访问真实指纹中的 size/hash 位置时出现 IndexError。已保留结论,不改原分支测试来制造通过,也不认定为已复现的真实 CAD 根因。
- 当前分支新对照测试:取消期限缺失、读取沿用执行期限、安全打开期限缺失、会话暂停未送达均先失败;会话用例先修正替身参数签名,再确认失败为 `[False] != [True]`,不将夹具错误当作功能复现。
- 选择性移植后:`test_lxb_blocking_recovery.py` + 既有 `test_worker_monitor.py`、`test_project_session.py`:**46 passed**。
- 写入保护专项:慢保存不被空闲超时终止、保护落盘前不得强制结束、不确定写入保留直到明确强制:**3 passed**。
- 独立复核进一步发现 lxb 暂停转发的旧安全状态竞态:worker 已发出 `safe=0` 并进入写入,但 monitor 尚未消费该帧时,普通暂停可能依据旧 `safe=True` 直接清理 worker。停止请求文件写入失败也可触发同一问题。两种情况均以真实 Python 子进程先复现失败,再修正:普通暂停只请求 worker 边界;写停止请求失败保留进程、显示控制错误并重试,不能凭旧遥测结束写入。
- 最终受影响集合(新增 6 个用例、既有 monitor/session 42 个用例及写入保护 3 项):**51 passed**。其中两条竞态样本覆盖正常 stop 写入和首次 PermissionError,不与上面的阶段性通过数累加。
测试使用独立短路径。最初 lxb 测试因 basetemp 父目录不存在而未进入业务,修正测试输出位置后得到上面的 50 项结果。各测试组不与以前历史结果累加。
## 保留的保护与边界
没有移植 lxb 对当前源码的回退:不删除 `_active_attempts`、关闭失败持久阻断、原子恢复发布、未决 job 校验、Value/UID/语义证明;不删除正文公式与料号类型校验、逐行 value_mode 或 source-map;不把 Part Label 缺失静默降级为沿用旧 Value。
本轮只修改 worker 取消/打开期限及会话暂停转发,并修正上述暂停竞态;保持 CAD 弹窗监测、原有 `resolved` 回调、诊断失败可见性、写入不确定性保护。CI 增加对应文件;Windows 子进程样本在其他平台跳过。本轮未运行真实 CAD、PCB、真实 AI、外部工单、安装包构建或整库重复回归。
+54
View File
@@ -0,0 +1,54 @@
# R17: AI waits and execution admission
Scope: T3 in `2026-11-06-nonblocking-repair-checklist.md`. Adapt the applicable PR19 admission/pool changes without importing its model-readiness UI or replacing current protections.
## Behavior
- Diagnosis, reflection, issue publication/resubmission, operations history/health/experience/impact reads, ticket synchronization, and schedule preparation use application-owned independent Qt pools. They do not enter the window execution worker set.
- Operations still publish their own activity/busy state, while native execution confirmation can proceed during an operations read. Schedule preparation rechecks GUI activity before opening a confirmation or dispatching work.
- Actual retry obtains GUI admission, checks cancellation, current run identity, dirty plans, open confirmations, loading and existing execution. The runner then compares the current task context against immutable pre-model evidence before reserving any retry.
- Admission spans preparation, actual execution and verification. Explicit GUI release acknowledgement precedes reflection/publication, including when GUI release takes longer than five seconds. A timed-out acquisition cannot acquire later.
- Finishing an old diagnosis preserves a newer manual run's stop object, owner and live state. Close cancels model waiters and waits for the AI worker before releasing application resources; cancelling the window close keeps subsequent automation available. Evidence remains pending and cancellation does not start a ticket submission.
- New service integration: `reserve_problem_retry(task_id, source='dsh')` returns the exact authorized operation keys, forwarded as `prepare_failed_quick_run(task_id, operation_keys=reserved)`. An empty reservation denies execution. The old exclusive retry-budget file is used only by legacy adapters without the shared API.
## Red/green evidence
Initial test-first command:
```text
python -m pytest tests/dsh/test_incident_admission.py tests/ui/test_dsh_ai_nonblocking.py -q
10 failed, 3 errors in 22.83s
```
The expected failures showed rejected admission still executing, changed model-time context still executing, retry scope missing, cancellation unsupported, shared retry denial ignored, operations reads reserving the lane, old diagnosis clearing a new manual run, and close not waking the waiter. The errors exposed baseline Qt widget teardown during blocked diagnosis plus one fixture ordering error; fixture order and cleanup were corrected.
Initial focused green after minimal implementation:
```text
python -m pytest tests/dsh/test_incident_admission.py tests/ui/test_dsh_ai_nonblocking.py -q
13 passed in 5.58s
```
Shared reservation forwarding was independently red (`[None] != [('uid-operation',)]`), then passed in the affected regressions:
```text
python -m pytest tests/dsh/test_incidents.py tests/dsh/test_incident_admission.py tests/ui/test_dsh_ai_nonblocking.py tests/ui/test_dsh_operations.py tests/ui/test_dsh_native_menu.py tests/ui/test_dsh_task_lifecycle.py -q
79 passed in 55.62s
```
Final concurrency review added targeted red cases: empty shared reservation incorrectly left `retry_budget_available=True`; delayed GUI release let reflection start before acknowledgement (`1 failed in 7.73s`); cancelled close left idle/finished automation permanently closing (`2 failed`). These justify only the subsequent focused rerun, not repeating the 79-test regression set.
Final focused verification after those fixes and Qt fixture cleanup:
```text
python -m pytest tests/dsh/test_incident_admission.py tests/ui/test_dsh_ai_nonblocking.py -q
17 passed in 17.85s
git diff --check
exit 0 (no output)
```
## Limits
Tests use real Qt worker scheduling, controlled model waiters and service doubles, plus the existing UI SQLite/service fixtures. No real AI, remote ticket creation, CAD, PCB or redundant full suites were run. The shared retry API is supplied by T1 and needs the parent task's integration verification with actual per-operation journals. A ticket request already in progress must finish or hit its existing network timeout before close completes; it does not reserve task execution while waiting.
`src/dx_productivity/dsh/task_lifecycle.py` and the UI lifecycle controller were not changed.
@@ -0,0 +1,38 @@
# T4:BOM 部分导入、目标库与实际 Value 证据
工作目录:`.worktrees/codex-nonblocking-items`。验证全部使用临时 Excel、真实 SQLite、COM 形状假对象和 Windows `cscript.exe` 执行生产 VBS 例程;未打开真实 CAD、PCB、Library Manager 或 AI。
## 行为与边界
- **R19**:默认整批校验仍为原子操作,Excel 前置错误不会启动采集。显式勾选“允许部分导入通过工程”后只核验没有前置错误的工程;返回报告不会自动暂存部分计划,必须在“选择通过工程…”中主动勾选。多来源的公式(包括未映射额外列中的公式)、数值 PN、非法 Value mode 保留为各自工程的失败行,不阻止其他完整通过工程;默认模式仍在任何采集前拒绝。只接收完整通过工程,失败/未检查行、原工作簿和行号保留。部分接收保存时要求原预览行完全一致,重新验证所有原工作簿 SHA-256、source-map SHA-256、工程成员和原库存;任何不符均拒绝。临时归一化工作簿删除后,绑定的是原工作簿。损坏工作簿、错误表头、相对工程路径或无法唯一归属的来源仍拒绝进入部分采集。
- **R20**:首次 BOM 采集同时请求源、目标 PN;普通源 PN 计划可复用已保存库存,但任何启用的“已到目标”跳过判定必须再次经过只读发现,不能把数据库里的旧读数当作当前证据。发现缓存仅可凭当前源内容指纹复用。`ComponentTarget` 增加可选实际 Part Label / Cell;官方 FLAT 生效报告解析其有效值,CAD 只读采集输出扩展 9 列,旧 7 列仍按未知接收。缺少所需证据时失效发现缓存并重新只读采集一次,仍不支持则明确报问题。实际 PN 已为目标时,四种 Value 策略及指定 Cell 都按实际读数判定,匹配生成禁用跳过行,不符拒绝,绝不使用计划 Cell 冒充实际 Cell。SQLite 可空列迁移保留未知状态,未知到已知的补证保留用户编辑和原 UID/ref/PN/Value 基线,已知证据冲突拒绝并记为工程失败行。真实 `QPCaptureAndSelect` 同样识别精确 UID 已到目标,实际 Value/Cell 符合时返回 `no_match / already_target`;不符或属性歧义直接拒绝。冻结旧分组中混有源和目标器件时明确要求逐器件处理,不声称整组完成。
- **R21**:`preflight_command_target` 调用现有物理库克隆、只读隔离读取和清理证明链;即使没有指定 Cell 也读取目标 PN,指定 Cell 必须属于该目标。源库内容/依赖指纹绑定缓存证据。缺件、歧义或关联错误在证明资源释放后转为 `target_cell_catalog`;没有正面桌面/Job 释放证据则保留 `batch_resources_pending`,不当作可继续的业务失败。主流程已接在 journal claim 后、原生启动/修改前,安全目标错误记独立失败回执。
- **R23**:原生保存重开核验、人工恢复核验和只读恢复核验后,写每 job 的 v2 `value-readback-<job>.tsv`。绑定 task/job/终态、完整 PN/Value/NC/Cell/UID 选择、当前快照原文;记录实际 PN、Value 存在性、实际 Value 和 Cell。启动前清除同 job 旧观测;Python 依据当前终态、精确 UID 集和当前快照验证,再原子保存 JSON。后续读取复核命令、终态、原始报告与快照哈希;旧/外国/不完整报告返回 rejected,缺报告返回 unavailable,不填计划值。显示表增加原 Value / 实际 Value 列,缺证据明确提示。
- **R24**:所有枚举属性按 UID 和 ordinal 保留原始 `Attr.Value` / `Attr.InstanceValue`,包括相同名称、相同文本的两个观察。层级固定记录 `unknown`,不把任一属性 API 等同于 Block 或 Symbol。选中器件写前和恢复事务前检查同名属性;歧义原始观察写入 sidecar 后拒绝修改。原有单一组件属性 InstanceValue 行为保留;**未证明 Block/Symbol 所有权,也未新增任何推测性的层级写入功能**。
## 验证记录
按失败用例先行验证了缺失的部分接收 API、严格原行/来源校验、目标库执行适配错误分类、已到目标的 BOM 匹配、实际 Value 报告、报告表格列和原生属性守卫,再最小实现。
- 新增定向组:`test_nonblocking_bom_values.py`、`test_value_readback.py`、`test_nonblocking_value_vbs.py`,连同 BOM 状态机:**34 passed**。
- BOM 既有行为、来源映射、迁移、每项 Value、原子确认:**90 passed**(加入最后两项定向来源/Cell 用例前的受影响组)。
- 原生守卫、生成的原生只读脚本和目标库克隆证明:**131 passed**。
- Value 可见报告与历史日志:**13 passed**。
在后续补齐实际 Part Label / Cell 前,完整受影响组合为 **219 passed**。补齐后:实际元数据、BOM、库存、原生解析/读取、服务/后端身份保护组合 **140 passed**;真实只读采集 VBS 入口、实际元数据、BOM 新例及完整 VBS 编译 **36 passed**。最终 BOM 来源/每项 Value 组合结果由本次末尾追加;不把重叠统计相加。测试使用独立 `--basetemp`,避免多个协作进程共享 pytest 临时目录保留清理。修正了旧 VBS 假环境缺失 `QP_Fso` 初始化及新增报告依赖桩;真实生产例程仍由 cscript 执行。
最终 BOM 组合:`test_bom_batch`、`test_bom_import_report`、`test_bom_plan`、`test_bom_import_review`、`test_item_value_and_bom_sources`、`test_bom_actual_metadata`、`test_nonblocking_bom_values`、`test_value_readback`:**115 passed in 51.47s**。`git diff --check` 无空白错误。
最后补测来源行隔离及空 Part Label:先观察公式/数值 PN/非法模式/额外列公式 4 个服务端到端用例失败,再接通显式部分来源读取;空 Part Label 必须拒绝,不能以空 Value 相等误报通过。最后 `test_nonblocking_bom_values`、`test_bom_actual_metadata`、`test_bom_import_review`:**42 passed in 27.71s**。库存合并可读性整理后的存储/扩展/报告小组:**39 passed**。新增源错误隔离后没有再次执行较早的 219 项完整组。
独立审查补修:数据库已有目标 PN 和完整 Label/Cell 仍可能过期。新增真实 SQLite/XLSX 用例,在数据库保持 `NEW / LABEL / CELL` 时修改实际源文件,读取器分别返回变化后的 Label、Cell、Value;4 项均先因读取次数为 0 而失败。修复后,所有已到目标判定都经过当前只读发现,源与已保存基线冲突时只产生失败报告、不生成禁用成功行、不修改数据库;当前源匹配时允许跳过。窄回归 `test_bom_actual_metadata`、既有普通源库存复用用例、`test_bom_import_report`、`test_nonblocking_bom_values`:**61 passed in 34.51s**,没有真实 CAD 调用或完整 VBS 重跑。
最终窄审补修:本轮已读取但 `actual_part_label` 或指定 `actual_cell` 返回 `None` 时,普通加法库存合并会保留旧已知值;该历史补值不能参与“已到目标”策略核验。匹配器现在独立接收本轮原始观察,按精确工程/图页/UID 核验启用目标的 Value/Label/Cell,库存合并继续保持原有语义。新增“历史已知、本轮未知 Label/Cell”2 项先失败,再修复为失败报告、无预览、无跳过,数据库原记录不变;当前观察匹配仍允许跳过。
最终精确回归选择当前源观察 6 项(匹配、Label/Cell/Value 改变、Label/Cell 未知)及普通库存扩展基线保护 2 项:**8 passed, 27 deselected in 7.06s**。普通源计划仍保留原 `target_identity` 异常语义;仅已到目标判定的基线冲突转为失败报告。未重跑广泛套件,`git diff --check` 无空白错误。
## 集成说明
主流程调用 `clear_value_readback`、`capture_value_readback` 和库预检;service 的来源标注调用 `bind_source_report`,保留原文件与 source-map 绑定。资源或异常退出包装器必须同时清除 `preview` / `passed_preview`。事件日志通过 `value_readback_details(result)` 读取已验证持久报告,不能从请求 Value 推导实际结果。
未进行真实工程回放。旧清单没有可选 Part Label / Cell 读数时会重新采集,仍未知则采用显式问题;实际有效属性证据不能视作已实现完整 Block/Symbol 语义。
@@ -0,0 +1,79 @@
# 非阻塞修复逐项验收记录
基线:8b4e8ee;工作树:codex/nonblocking-items。范围排除独立校验工作台。
## 本轮直接运行的集成证据
| 场景 | 方法和真实执行边界 | 已观察结果 |
| --- | --- | --- |
| 原缺陷与新粒度 | test_nonblocking_items 首次运行真实队列/SQLite,只有原生 worker 被替换 | 5 项先失败:R1/R2 被合并、无问题额度 API、无旧格式准备参数;修复后 5 passed |
| 同工程继续与旧保护 | execution_journal/task_queue/safe_cbb_continue/nonblocking_items/deferred_problem_pass 受影响集合 | 29 passed;保留旧无位号组的暂停语义与成功回执防重放 |
| 首轮后问题处理 | deferred_problem_pass 首轮四项均完成,再派发原失败位号 | 4 项先失败,修复后覆盖主轮次优先、持久一次额度、暂停收尾与 DSH 竞争 |
| 准入边界 | 未完成 prepared 尝试后领取另 UID、同 UID 不同命令同时绑定 | 两项先失败(未抛拒绝),加共享账本检查后 2 passed |
| 100 位号混合批次 | test_nonblocking_acceptance:真实工作区调度、子队列、备份、SQLite、问题轮次;仅进程传输与原生 CAD 用受控执行器 | 93 verified、5 failed、2 uncertain;100 次实际派发,各一次;恢复原批次零新增派发;关闭重开 DB 计数保留 |
| 额度扣减后中断 | 实际 SQLite 已保留额度,准备重试前注入 OSError,再恢复同队列 | 与 100 项样本一起 2 passed;恢复后仅原 R1 再派发,R2 不重复,额度仍为 1 |
| 新工作区检查点兼容 | RunJournal.inspect 读取工作区冻结队列,保留旧 task-queues;拒绝双重身份 | 新用例先失败,修复后 run_journal 13 passed |
| 隔离工程后的真实状态 | execute_confirmed_run 对已收尾但仍有 blocked 工程的结果 | 新用例先误报 completed,改为 blocked;与人工弹窗 UI 入口一起 2 passed |
| 活动任务中的人工弹窗入口 | 真实 Qt 窗口在 execution worker busy 时,复用原资源释放按钮 | 先被隐藏而失败;接线后可打开受控弹窗页面,禁止自动选择保存/许可按钮 |
| 部分导入安全撤销 | cleanup/shutdown 异常时不可保留 passed_preview | 两项先失败;修复后 supervisor_result + diagnostics_bundle 23 passed |
| 新证据诊断导出 | 工作区检查点、owner-loss、只读释放记录进入脱敏包;完整组件输入仍排除 | 先仅导出 manifest 而失败;修复后上述 23 项集合通过 |
## 分组证据
- [逐位号冻结与旧队列兼容](2026-11-06-component-scope.md):普通规则与位号计划均生成新逐 UID 命令;旧冻结组保留;对应 55 项受影响验证。
- [AI 执行入口解耦](2026-11-06-nonblocking-ai.md):模型/工单不占执行入口,真实变更临时准入,退出/释放确认;79 项邻接与最终 17 项定向验证(存在重叠,不相加)。
- [BOM 与实际 Value](2026-11-06-nonblocking-bom-values.md):临时 Excel、真实 SQLite、原生 VBS 函数样本与来源/报告绑定。
- [资源生命周期与独立审阅修复](2026-11-06-nonblocking-resources.md):涵盖主进程已退但后代仍活、Quit helper 保留、监测器异常/无控制对象、非交互 worker 寿命及显式强制入口;资源限定复核通过。
- [失败后的肯定健康证明](2026-11-06-project-health.md):12 个定向用例覆盖缺证据、源变化、过期尝试、篡改和成功基线推进;限定复核通过。
## 逐项验收索引
| ID | 验收证据(生产逻辑 + 受控原生边界) | 状态 |
| --- | --- | --- |
| R01 | component_scope / nonblocking_items:同规则同值两个 UID 各一命令、普通规则采集冻结 | 通过 |
| R02 | component_scope / execution_journal:旧整组回执保留、重试侧车继承、成功不拆分重做 | 通过 |
| R03 | nonblocking_items / nonblocking_acceptance:明确失败后 R2 和其他工程继续 | 通过 |
| R04 | project_session_health:空证明、旧尝试、待核验、源变化、篡改均拒绝;最新源检查点可推进 | 通过 |
| R05 | execution_journal / deferred_problem_pass:重绑 job、重启和原轮次问题身份 | 通过 |
| R06 | deferred_problem_pass / nonblocking_resume:首轮优先、问题轮次暂停、中断准备后恢复 | 通过 |
| R07 | 两个独立 SQLite 连接同时竞争 DSH/problems,只有一个额度;重启不重置 | 通过 |
| R08 | workspace_execution / nonblocking_acceptance:隔离两个不确定工程且独立工程完成 | 通过 |
| R09 | batch_runtime:工程间串行不同 CAD,正常同工程复用,异常先释放 | 通过 |
| R10 | resources / retained_write_owners:资源消失可解除等待,uncertainty 保留 | 通过 |
| R11 | resources:心跳不重置业务停滞;无控制对象的停滞同样不强杀写入 | 通过 |
| R12 | resources:只读失败关闭整代,不重复失败工程 | 通过 |
| R13 | owner-loss 身份/请求检查和重启资源复核,拒绝 PID 复用/未知写入回收 | 通过 |
| R14 | manual_dialog_native + nonblocking_controls:真实未知 MessageBox 仅按明确选择关闭,释放无强杀 | 通过 |
| R15 | retained_write_owners:成功 Quit 仍有后代、Quit helper 存活、监测异常等均保留完整所有权 | 通过 |
| R16 | retained_write_owners:活跃/保留 Job 均参与准入;确认/身份/保护记录缺失不得强制 | 通过 |
| R17 | dsh_ai_nonblocking / incident_admission:模型等待不占执行入口,真实重试临时准入 | 通过 |
| R18 | run_journal / nonblocking_resume / Value 可见报告:成功、失败、隔离分别呈现,恢复范围正确 | 通过 |
| R19 | nonblocking_bom_values:显式部分选择、原表 SHA/行/source-map、错误来源工程隔离、异常撤销预览 | 通过 |
| R20 | bom_actual_metadata:当前实际 PN/Value/Label/Cell;旧库存不可证明新鲜,缺当前元数据不得回填判通过 | 通过 |
| R21 | cell_catalog / nonblocking_bom_values:真实执行适配接通只读目标库预检,错误与清理失败区分 | 通过 |
| R22 | resources / discovery_cache:内容而非单纯元数据判别、释放后复核、未知实际属性保留 | 通过 |
| R23 | value_readback / nonblocking_value_vbs / report UI:真实读数持久绑定当前终态与快照,旧报告拒绝 | 通过 |
| R24 | native VBS 属性观察/重复属性守卫:全部原始观察保留,层级未知不猜写,同值不合并 UID | 通过 |
| R25 | 100 项真实调度/账本样本:93 verified + 5 failed + 2 uncertain;派发100次、恢复无重放 | 通过 |
## 最后集成与审阅
在最新肯定健康证明、实时源摘要和所有权修复后运行的集成集合:
```text
python -m pytest tests/v1_1/test_nonblocking_acceptance.py tests/v1_1/test_nonblocking_resume.py tests/v1_1/test_deferred_problem_pass.py tests/v1_1/test_manual_dialog_native.py tests/ui/test_nonblocking_controls.py tests/v1_1/test_supervisor_result.py -q --tb=short -o cache_dir=F:/dx-nb-final-cache --basetemp=F:/dx-nb-final-integration
```
结果:**26 passed,26.36 秒**。随后额度双连接竞争与准备中断恢复两个定向场景 **2 passed**。旧 DSH 恢复兼容出现的 11 个失败定位为临时更改了通用空文件证明语义;恢复旧兼容、仅在失败放行处要求肯定证明后,仅重跑失败集合 **11 passed、12 deselected**。
核心/健康和资源两个独立限定审阅均通过;审阅期间发现的暂停恢复、源证书新鲜性、所有者后代、旧库存跳过问题均有单独复现和修复证据。没有用重复大套件代替功能验收。
BOM 最后补充的两种当前 Label/Cell 缺失情况先复现失败,再与当前值变化、匹配及普通库存身份保护共 **8 passed、27 deselected**;限定复核通过。策略核验直接使用本轮对应 UID 的原始属性读数,不能由库存合并回填的旧值证明。至此 R01~R25 全部具有独立验收索引。
## 验收边界
没有重复运行真实 CAD 换料、PCB、真实模型请求、远程工单或发布安装包。一次性 Windows 进程、私有桌面弹窗和 cscript 样本属于本轮验证。
Block/Symbol 的属性所属层级仍未知:验收的是保留原始观察、不以相同 Value 合并 UID、歧义写入前拒绝;不宣称自动选择 Block 或 Symbol 已实现。
本文件中的测试数是不同阶段的证据,不能累计为互不重复的测试总数。最终逐项状态以修复清单和独立审阅收尾记录为准。
@@ -0,0 +1,90 @@
# T2 — nonblocking project resources, 2026-11-06
Scope: R08–R16 and R22 in `docs/superpowers/plans/2026-11-06-nonblocking-repair-checklist.md`. All changes stay in the shared `codex-nonblocking-items` worktree. No commit, real CAD/PCB execution, AI call, network send, or user environment-variable change was performed.
## Result and production wiring
- `workspace_execution.execute_workspace_projects` freezes ordered task IDs, plan hashes, parent phase, deterministic child checkpoint IDs, release flags, and problem-pass completion in `workspace-queues/<id>.json`. Each project calls the existing supervised task queue separately. A released uncertain A remains blocked with durable uncertainty while B can run. An unproved release pauses the parent. Resume skips blocked A after manual physical reconciliation; it never replays A. All primary projects precede deferred problem passes; paused/running problem passes resume the same child checkpoint.
- `BatchCadRuntime` reuses CAD within one project, then closes its complete owned generation before another project starts. Rebuilds still share the existing one-per-project retry budget; changing projects does not replenish it. Old leases retain their original generation.
- `reset_project_after_safe_failure(project, evidence_root, *, job_id=None)` requires the current owned close checkpoint and returns a persisted health proof. It binds the exact selected failed job to its current attempt/generation, hashes that attempt record, and checks `can_retry_attempt` for no mutation. It records a fresh after-release source fingerprint, whether the whole source fingerprint stayed unchanged, an immutable release snapshot/hash, checkpoint hash, and immutable per-job health file. A closed project alone is not a no-write certificate. Callers must require affirmative no-mutation/source/release proof or combine a verified native rollback baseline for that same job.
- Read provenance is fixed at admission (`bom_import` and `collect_target_inventory`). Failed/cancelled CAD reads release all owned workers, CAD, and desktop before raising `ReleasedProjectReadError`. Proven native read failure uses the same release path without spending a retry or opening another desktop. Execution-provenance native prewrite recovery retains its existing strict source/identity proof and one-shot budget.
- `batch_worker` observes the admitted GUI parent PID plus creation time, persists owner-loss evidence, and requests cancellation. Read workers use bounded cooperative cancellation. Owner loss never grants permission to kill a possible write.
- `ProgressWatch` tracks worker liveness and business progress separately. Repeated identical stdout/native counts cannot extend the business idle deadline. Unsafe write stalls request safe stop and retain the process. `BusinessProgressWatch` separately ignores supervisor heartbeats and unchanged state.
- Every retained worker/runtime/CAD/supervisor wait has an exact owned-process exit observer. Native observers check both root handles and Job descendants. A completed root cannot hide live descendants. Confirmed physical exit ends the wait while uncertainty remains.
- No-control write sessions retain their handles when orderly shutdown fails. They do not fall through to terminate-capable desktop cleanup. Raw retained CAD owners remain in a live registry, appear in pending resource status, block another CAD launch, and reconcile normally only once every retained owned tree has exited.
- `force_pending_owned_resources(root, *, confirmed=False)` is an in-process GUI API. Default/false refuses without action. Explicit true validates live retained handle identities against durable records, writes uncertainty/protection and force intent, then terminates only those exact owners. It supports GUI supervisor Jobs, batch runtimes, and raw retained CAD sessions. Corrupt/reused PID identity and denied protection both prevent termination. Ordinary resource cleanup refuses to force a retained write Job.
- Unknown/save/license dialogs retain their text and actual buttons. The worker accepts only one-shot requests bound to supervisor batch/attempt, generation, and CAD session token. The desktop re-enumerates and compares the complete dialog fingerprint before an explicit user's selected button is sent. Existing automatic acknowledgement remains restricted to a complete recognized VBScript compilation-error prompt with one permitted OK button. Startup CAD PID ownership is published before GUID binding, so startup prompts can also be handled manually.
- `ui.cad_dialog_operations.show_cad_dialogs(window)` displays the active project, original prompt text, and explicit original button choices. Root integration repurposes the existing resource cleanup button while the supervisor reports a blocking prompt. No global input, desktop switching, save decision, license decision, or automatic unknown-dialog click was introduced.
- Persistent/process-local discovery caches refresh metadata-only differences while hashing every file's content on lookup. File replacement, changed content, unreadable files, changed inventories, and unknown identities remain misses. Identity comparisons include optional actual Part Label/Cell metadata and preserve `None` versus an empty string. A verified reader-release hook runs before the after-discovery fingerprint to release file locks.
## Red/green evidence
Commands used Python 3.12 and pytest with unique short `F:/dx-nb-res-*` basetemp paths and `F:/dx-nb-res-cache`; no test output directories are in the repository.
| Regression introduced first | Observed red | Observed green |
| --- | --- | --- |
| Initial resource boundaries | 9 failures: CAD identity skipped, legacy CAD released without identity, a released label bypassed evidence, metadata-only changes reread, missing exit observer/business clock/read provenance/reset/manual action | Initial set expanded to 14 passing cases |
| Read generation cleanup and project switch | Unsupported read-only session flag and old CAD reused for another project | Read failure closes one generation without retry; next project starts only after previous CAD closes |
| Owner loss and worker exception wait | Missing recovery module and missing `resolved` observer | Verified parent identity evidence; unsafe worker exception resolves on owned exit |
| Frozen workspace queue | 5 missing-module failures | Ordered A/B isolation, no release proof holds B, exact resume IDs and stale hashes rejected |
| Manual transport/UI | Missing one-shot consumer and missing UI module | Generation/token mismatch rejected, one action only; actual prompt text shown, no action until button click |
| Failed cleanup ownership | CAD reference dropped and desktop closed after an active write owner cleanup failure | CAD/desktop retained; Job descendants keep exit observer false |
| Native read no replay | Read-only native failure created another session instead of raising released read error | One generation released, no retry budget spent |
| Identical heartbeat progress | Both stdout and native repeated count frames hid the business deadline | Both request safe stop then wait indefinitely for a possible write |
| Finished supervisor label | `finished` skipped an original live process | Live original remains pending |
| Crashed supervisor with harmless 6-second child | Existing five-second descendant grace automatically killed the possible-write Job (`forced_termination=True`) | Child exits naturally; `forced_termination=False`, durable uncertainty remains, resources released |
| No-control possible write | Harmless owned Python sleep process killed on failed Quit | Process remains alive and retained; only explicit confirmed force releases it |
| Explicit retained Job force | API absent | No confirmation, mismatched creation time and denied protection all refuse to kill; exact protected confirmed Job is terminated |
| Health/metadata proof | Reset returned a boolean; actual metadata unknown/empty compared equal | Current attempt/source/release hashes are persisted; unknown differs from empty |
| Paused deferred problem pass | Resume skipped paused project and falsely marked parent finished | Same child checkpoint resumes in the persisted problems phase |
| Raw owner natural exit | Exited raw session remained permanently pending | All owned trees observed exited; ordinary cleanup releases handles, retains uncertainty, never force-kills |
| Completed CAD root with active descendants/repeated force | Root exit permitted desktop cleanup; repeated force returned early from root PID alone | Tree-level proof is required; explicit force still reaches the retained Job |
## Targeted verification performed
- Initial necessary resource regression set (`test_batch_runtime`, `test_batch_supervisor`, `test_isolated_cad`, `test_isolated_desktop`, `test_cad_dialogs`, `test_discovery_cache`, `test_persistent_discovery_cache`, `test_worker_monitor`): **218 passed, 3 failed**. Two old assertions assumed CAD reuse between distinct projects; those assertions now verify required serial project isolation while retaining same-project reuse. The third was a native harmless modal probe's five-second transient timeout. Its evidence showed the recognized compilation prompt and recorded acknowledgement; the exact isolated rerun passed **1/1** in 1.48 seconds. No production workaround or timeout weakening was added.
- After the project-lifecycle assertions: runtime + initial new resource/workspace/Qt tests passed **59/59**.
- Native read resource change: native/resource/runtime focused set passed **55/55**.
- Business/liveness separation: resources + worker monitor passed **55/55**.
- Affected integration set (`resources`, `workspace`, Qt, supervisor, runtime integration, native reader and project discovery): **93 passed, 1 failed**. The failure was a previously supported injected `runtime=object()` without the new release hook. Root changed the caller to require a callable hook. The exact failed discovery case then passed **1/1**; the 93-test set was not repeated.
- Resources/workspace/Qt/runtime/isolated-CAD after no-control ownership and proof changes passed **106/106**. Additional real harmless raw/runtime force variants passed **2/2**.
- Final affected safety set (`test_nonblocking_resources`, `test_workspace_execution`, `test_cad_dialog_operations`, `test_batch_runtime`, `test_isolated_cad`, `test_batch_supervisor`, `test_safe_user_stop`): **150 passed** in 109.07 seconds. This includes all final retained-owner/descendant/force changes. All 12 edited/new resource modules parse successfully; `git diff --check` passes. No broad repository suite is claimed.
## Limits and review boundaries
Native behavior was verified through owned disposable Python processes, Windows Jobs/desktops, and a harmless modal dialog. Real Viewdraw/COM/CAD saving, actual license dialogs, and production design files were not exercised. An unverified or legacy CAD record without a PID creation-time identity remains pending rather than guessing ownership. After restart, reconciliation observes disappearance only; the force API never opens arbitrary PIDs or attaches to a foreign application. An unavailable source fingerprint fails closed. Business uncertainty is never cleared by resource release or force.
Root owns task-queue admission, receipts, rollback/native baselines, service/UI entry wiring, and integration acceptance. This T2 record does not claim those separate caller changes solely from helper availability; their own tests/review must verify the real admission path.
## Independent review fixes: complete owned write trees
The read-only review reproduced four additional ownership gaps, then the parent explicitly assigned their implementation to the reviewer. No real CAD/PCB or AI was used.
- Successful Quit now checks every owned CAD/helper/worker tree before desktop cleanup. Root exit code zero cannot authorize killing surviving descendants. Runtime cleanup retains the CAD owner when any retained Quit-helper or desktop process remains.
- Unsafe monitor exceptions, unsuccessful resolution observers, normal root completion with live children, and a stalled write without an interactive controller retain the exact process/Job handles. `RETAINED_WORKERS` exposes these owners through pending-resource status and explicit confirmed force. Force verifies creation identity against durable evidence and protects uncertainty before terminating. Ordinary cleanup only closes trees observed exited.
- A durable `retained-worker-<token>.json` record continues to block after registry/process restart. Without the original Job handle, root PID disappearance cannot prove descendant exit and cannot authorize force. Natural exit and explicit force in the owning process write a released tree proof; uncertainty is retained.
- Reconciliation consults both retained and active supervisor handles, so a finished/root-exited journal cannot hide a live owned Job.
- Every supervised worker uses `StopControl`, including noninteractive callers. Its finalization observes retained write owners before process exit can close Windows kill-on-close Jobs. A protected active supervisor is reachable through the existing explicit service force API: the API validates identity, durably records `force-request.json`, and signals its owning loop; the loop performs protected termination. It does not race the owner's handle cleanup or bypass the supervisor lease for direct termination.
- Diagnostic exports now include these two narrowly named sidecars; component-scope/input tables remain excluded.
### Focused evidence
`tests/v1_1/test_retained_write_owners.py` contains 18 cases. The first six ownership cases failed before their fixes. Additional red cases covered noninteractive worker lifetime, active owner reconciliation, resolution-error finalization, restart protection, and a no-controller business stall. Tests use mocked CAD boundaries and real harmless Python children, Windows Jobs, and private desktops.
The necessary affected suite was run once:
```text
python -m pytest tests/v1_1/test_retained_write_owners.py tests/v1_1/test_isolated_cad.py tests/v1_1/test_batch_runtime.py tests/v1_1/test_batch_supervisor.py tests/trial_task_center/test_worker_monitor.py -q --basetemp=F:/dx-review-resource-affected -o cache_dir=F:/dx-review-owner-cache
```
Result: **136 passed, 1 failed** in 65.62 seconds. The new natural-exit test incorrectly expected Job accounting to reach zero immediately when its root handle became signaled. The assertion was corrected to wait for actual full-tree exit. The exact natural/force variants then passed **2/2** (`-k retained_native_worker`, `F:/dx-review-owner-natural-final`); no production timeout or ownership guard was weakened and the affected suite was not repeated.
Afterward, the real noninteractive worker lifetime/active-force variants passed **2/2** (`-k noninteractive_worker`, `F:/dx-review-owner-supervisor-force`): a natural child wrote its completion marker, while the explicit-force variant retained it until the separate service call requested force and returned `user_forced_stop` with uncertainty evidence.
The final narrow previous-regression plus no-controller-stall command passed **9/9**:
```text
python -m pytest tests/v1_1/test_retained_write_owners.py tests/v1_1/test_nonblocking_resources.py -q -k 'unsafe_stall_without or unsafe_worker_exception_wait or no_control or force_pending or repeat_explicit_force or owned_exit_observer' --basetemp=F:/dx-review-owner-stall-green -o cache_dir=F:/dx-review-owner-cache
```
Diagnostic sidecar inclusion was red first, then `test_diagnostics_bundle.py` passed **9/9** (`F:/dx-review-owner-diagnostic-green`). Production modules parse and `git diff --check` passes. Counts overlap and are not cumulative. The earlier 150-case resource suite and the broad repository suite were not rerun.
@@ -0,0 +1,48 @@
# 非阻塞恢复 PR:软件验证(2026-11-06)
## 受测版本
PR 分支 `codex/nonblocking-recovery-pr` 从 `origin/main`(`08ddf4c`)建立,只移植 CAD 弹窗处理、读取取消与安全暂停、逐 UID 故障隔离、问题项闭环四个功能提交。
移植后,`src`、`tests`、`integration`、`packaging` 和 `tools` 与受测提交 `475783a` 的 Git 树相同。校验工作台草案不属于此 PR。当前工作区未提交的图标和 DSH 生命周期修改未打包进此次受测代码。
## 针对性软件测试
```text
python -m pytest tests/v1_1/test_problem_workflow.py tests/v1_1/test_problem_items_ui.py tests/v1_1/test_resource_reconciliation_ui.py tests/v1_1/test_retained_worker_reconciliation.py tests/v1_1/test_safe_timeout_problems.py tests/ui/test_trial_task_center_workflow.py tests/trial_task_center/test_application.py -q --tb=short
55 passed in 51.52s
```
覆盖本轮 29 个新增用例、Qt 操作与确认流程、任务切换与关闭、程序启动、异常记录和数据库重用。逐项功能与审查收尾详见 `2026-11-06-problem-workflow-acceptance.md`。此前已通过的全量及 CAD/PCB 校验没有重复执行。
## 实际 Windows 进程冒烟
在 PR 工作区使用独立临时数据目录执行,没有连接用户的现有任务库:
- 真实应用入口 `application.py --smoke-test --data-root <临时目录>` 连续运行两次,退出码均为 0。
- 日志含两次 `application_start` 和两次 `application_clean_shutdown exit_code=0`,没有 Traceback 或 CRITICAL。
- 同一任务数据库两次启动后 `PRAGMA integrity_check` 返回 `ok`。
- 调用应用的 `_smoke_batch_runtime`,实际派发 Windows 监督子进程,校验进程创建身份,创建并释放私有桌面。
- 监督会话最终 `state=released`;桌面句柄关闭、桌面消失均确认,清理错误为空。
- CAD 未启动;没有进行 PCB 操作。
本地原始证据:`build/software-smoke-9bd80c85ee15411598639dd615911df2/report.json`,同目录保留两次启动日志、任务库与监督会话证据。该临时目录不提交。
## CI 与验证边界
将新的定向重试和旧问题预留恢复用例 `test_problem_workflow.py` 加入现有便携 CI。远端结果以 PR 上的 commit status 为准。
本轮验证的是源码应用与真实 Windows 监督进程,未构建新发布 EXE,未模拟实际系统重启,也未执行真实 CAD 替换或线上 AI/工单请求。工程结果待核验时仍禁止直接重放;启动身份不足的残留记录继续受保护。
## 远端 CI 发现项修复
首次远端 Python 回归暴露项目键在 Linux 保留大小写、与库存及命令身份的 casefold 规则不一致,以及纯核心读取模块经 UI 包提前导入 Qt 的问题。另有一个 Qt 对话框用例混在无 Qt 的便携测试组中。
- `_path_key` 统一采用已有的大小写不敏感项目身份规则,未修改实际工程路径。
- 进度同步也使用同一项目键;源文件检查点从任务绑定工程查回实际路径读取,不把折叠的身份字符串当作文件路径。绑定缺失仍保持待核验。
- UI 包延迟导出主窗口,纯 execution_state/messages 导入不再要求 Qt;窗口的既有导出保持兼容。
- 对话框用例在有 PySide6/pytest-qt 的 Windows 环境仍执行,无依赖的便携环境明确跳过。
- 新增 `test_headless_core.py`,先复现项目键不一致和无 Qt 导入失败,再验证修复。
- 修复后的 Windows 定向回归:`test_headless_core.py`、`test_problem_workflow.py`、`tests/dsh/test_run_journal.py`、BOM 部分导入对话框用例和 `test_application.py` 共 **37 passed**,包含真实源码入口启动验证。
- 后续进度同步与源路径绑定修复后的 Windows 相关组:`test_headless_core.py`、`test_project_session_health.py`、`test_problem_workflow.py` 共 **23 passed**。覆盖源文件变化撤销放行、原生证明绑定、较新核验基线、旧轮次定向重试等保护条件。
- 独立审查未发现新的必要修复或保护放宽;远端最终结果见 PR 的最新提交状态。
@@ -0,0 +1,38 @@
# 问题项处理与资源核销验收(2026-11-06)
本轮补齐四个高优先级缺口,复用现有 SQLite、冻结命令和批次执行器。未修改校验工作台或其分支。
## 独立功能验收
| 功能 | 实测与断言 | 验收证据 |
| --- | --- | --- |
| 问题列表 | 实际数据库生成失败、尚未执行、待核验、已解决项;显示工程、页、位号、UID、原因和自动重试余额。待核验及尚未执行项不能勾选重试。 | `test_problem_workflow.py`、`test_problem_items_ui.py` |
| 定向重试 | Qt 界面勾选 R2 → 确认 → 实际准备 → 默认完整任务队列,只派发 R2,成功项和未选失败项不重放;轮次或代次过期拒绝。DSH 不能突破所选范围。原轮次在预留后崩溃,用户另选 R2 并完成,再恢复旧轮次,仍不派发 R1。 | `test_problem_workflow.py` 7 项、`test_problem_items_ui.py` 2 项 |
| 资源核销 | 实际读取 Windows 内核 BootIdentifier 并验证稳定、非零;替换启动身份的受控样本证明同次启动保持阻塞、跨启动才解除。旧记录先留下观察身份,后续启动改变才核销;损坏或缺失证据保持阻塞。核销后 uncertain.flag 原文不变。丢句柄只提示重启 Windows;有自有句柄时确认强制释放会实际提交。 | `test_retained_worker_reconciliation.py` 7 项、`test_resource_reconciliation_ui.py` 2 项 |
| 安全超时 | 真实一次性 Python 子进程报告 open_project 并停滞,监控器请求停止、清理并确认整棵进程树退出后才给出安全超时证明。运行时只释放,不内联重放。真实队列/SQLite/备份在受控原生边界下先继续独立 UID,再使用一次共享重试额度。反例覆盖源文件、状态、命令变化、取消、错误阶段和未确认释放。会话关闭/下一进程准备路径另有覆盖。 | `test_safe_timeout_problems.py` 11 项 |
新增用例共 29 项,均已分别通过。新功能和审查缺陷先复现失败再修复,反例用于确认原有安全边界继续生效。最终定向重试及旧预留恢复修改后的相关组:
```text
python -m pytest tests/v1_1/test_problem_workflow.py tests/v1_1/test_deferred_problem_pass.py -q --tb=short
13 passed
```
其余功能在对应最终修改后验证通过:问题项及资源 GUI 组 4 passed;资源核销及原有保留进程组 25 passed;安全超时组 10 passed,之后新增会话关闭回归 1 passed。合并新增五个文件的阶段验证曾为 28 passed;随后新增跨队列崩溃恢复用例并在上面的 13 项组中通过,没有为凑数重复全量测试。
相关回归:`test_batch_runtime.py`、`test_project_session.py`、`tests/trial_task_center/test_worker_monitor.py` 共 77 passed;原有延后重试和恢复事务组 10 passed;原有工程级 GUI 重试 2 passed。最终改动通过 `git diff --check`。
## 审查收尾
- 已修复安全超时已投递后,会话关闭访问空的正常返回值而再次异常。
- 已修复清理回调仍占用 GUI 操作通道,导致确认的强制释放没有执行。
- 已修复定向重试后,自动问题轮次和 DSH 扩展到未选的旧失败项。
- 已修复旧问题预留崩溃恢复绕过更新后的手动选择。
- 已补超时分支提交失败回执前的 current-command 身份复核。
- 独立审查复核最后一个阻塞修复后,未发现新的阻塞问题。
## 边界与剩余工作
- 没有真正重启 Windows;跨启动分支使用模拟启动身份,真实内核查询已独立实测。同次启动且原句柄丢失时,仍要求保存其他工作并重启 Windows,不能仅凭 PID 消失放行。
- CAD、桌面和原生替换边界使用受控样本;未运行真实 CAD/PCB、线上 AI/工单、发布 EXE 或远端 CI。此前旧执行链的 CAD 验证不计作本轮新链路实测。
- JSON 经验规则和完整决策审计、复杂弹窗输入、已到目标料号的单独属性修复、Block/Symbol 归属、跳过原因统计仍是未完成项;完整九个崩溃边界矩阵及发布验收亦未在本轮宣称完成。
+55
View File
@@ -0,0 +1,55 @@
# Affirmative per-component failure health — 2026-11-06
This follow-up closes the admission gap where `proof_intact({})` and an ordinary failed receipt allowed the next UID. Generic legacy success/import proof behavior is preserved. Component failure admission now requires an explicit, nonempty, durable health certificate.
## Production path
`quick_run.execute_step` records the logical journal attempt before dispatch. For a native failed result, an immutable dispatch certificate binds the frozen command and its journal task/round/operation/job/attempt/generation to the actual runtime session/attempt/generation and native attempt file. A later health proof from another native session or retry cannot certify that dispatch, even if the job ID is reused.
After a safe component failure, `batch.execute_batch` asks `reset_project_after_safe_failure(..., job_id=metric['job_id'])` for the owned generation's release proof, then calls `journal.certify_safe_failure(task_id, row, health)` before another UID can be claimed. Certification only updates the already-failed, exact current SQL operation. It verifies native no-mutation state, the physical released generation record, matching project-close/worker-close checkpoint, session/generation/job identities, and all artifact hashes. Evidence is copied into immutable execution-proof files rather than relying on mutable active handoff or session files.
A native current-attempt no-mutation proof can continue when the full source fingerprint is unchanged. When a retained worker's initial source fingerprint predates legitimate earlier successful steps, continuation additionally requires the intact last verified semantic baseline for the exact failed project's sheet. A baseline from another sheet, empty evidence, a changed baseline, missing release evidence, a different native dispatch, or a possibly mutated current native attempt cannot authorize continuation. A rollback marker's text alone is not upgraded to healthy execution; existing explicit rollback/recovery protections remain in effect.
Custom synchronous `process_runner` adapters use the same production gate. The preparer captures a full source fingerprint before dispatch. A correlated terminal failure gets a durable certificate only after a matching nonempty after-failure fingerprint and proof that the related runtime/retained CAD resources are absent. The certificate includes the frozen command, failed outcome, exact journal identity, source digest, no-mutation flag, and completion/release flags. A source change or retained owned resource becomes uncertainty and blocks remaining UIDs. This behavior applies to all synchronous adapters, without detecting tests or granting them an exception. Code 2/3 rejection receipts accept captured evidence; native rejection receipts carry the actual native dispatch binding.
`journal.independent_continuation_ready(task_id)` provides the UI/DSH with a read-only answer for the first pending item in frozen plan order. It uses the same affirmative gate, returns false on missing or changed evidence and unresolved attempts, and never chooses a later UID to skip a blocked first pending item.
## Red/green evidence
All commands use Python 3.12, pytest, short unique `F:/dx-nb-health-*` basetemp paths, and the existing short test cache.
The first four tests were run before implementation and failed for the intended defects:
- A bare `journal.finish(..., 'batch_failed', proof=None)` let another UID claim execution.
- Empty proof passed the existing generic integrity function and was incorrectly treated as admission evidence. The fix is local to affirmative component health; legacy success/import compatibility remains intact.
- An actual controlled synchronous runner changed the project source after R1 failed and R2 still ran.
- Failed receipts had no immutable failure-health artifact to protect or validate on resume.
Additional tests verify actual runtime reset proof and native/journal binding using the real runtime/journal logic with an injected CAD/desktop boundary:
- Matching current prewrite native health permits the next UID.
- A hashed release record containing only a `released` label without release evidence is rejected. This first reproduced as a failure, then passed after structural physical proof validation was added.
- A changed source with no verified sheet baseline and a mismatched native job are rejected.
- The exact intact last verified sheet baseline supports a current prewrite failure; tampering with that baseline revokes readiness.
- Reusing old native health for a new journal/native dispatch is rejected. The immutable dispatch-binding implementation was added after a red test exposed its absence.
- A safely paused R1 failure reports independent continuation readiness; certificate tampering and a bare failed receipt report false. These readiness tests failed before the API existed, then passed.
Focused acceptance and necessary adjacent regressions:
`test_project_session_health.py`, `test_nonblocking_items.py`, `test_deferred_problem_pass.py`, `test_component_scope.py`, `test_nonblocking_acceptance.py`, `test_execution_journal.py`, and `test_execution_proof.py`: **54 passed** in 24.21 seconds after the native dispatch binding changes. After adding readable frozen command fields to the certificates, all **8 health tests passed** in 4.41 seconds. The five affected modules parse successfully and `git diff --check` passes. No broad repository suite was run.
## Limits
These checks exercise real SQLite receipts, actual handoff/status parsing, controlled synchronous dispatch, source fingerprint changes, immutable evidence files, and the actual runtime health/reset code. CAD/desktop boundaries in these health tests are injected; no real CAD/PCB, AI, or network operation was performed. Native health certificates authorize only affirmative current-attempt no-mutation. Possible native mutation remains held for the established verified rollback/recovery path rather than being inferred from a terminal error or a marker's text.
Parent-owned service/DSH wiring and the separate review fixes for retained process cleanup require their own integration checks. No commit or index change was made.
## Stale-source follow-up from independent review
Review found that immutable certificate integrity alone did not establish the current source: after a safely failed UID and pause, a later edit to another project file still left readiness true. The actual pause/failure/edit regression was run first and failed. A second new case showed the same bypass after a later successful semantic baseline.
Certificates now record `source_digest_algorithm`, the exact `source_project_path`, and `source_excluded_root`. Every component continuation readiness/claim compares the current full project fingerprint with certified source. A newer successful same-sheet semantic baseline may supersede an older failure certificate only through an immutable source checkpoint that explicitly names that exact failure identity and certificate SHA. Its current full-source digest must match too. A pre-existing baseline or a certificate from another sheet cannot waive a source change.
Actual controlled-runner tests demonstrate that a legal verified R2 save creates the newer checkpoint and R3 remains executable, while an unrelated edit after that checkpoint revokes readiness. Native post-failure success gracefully finishes the retained worker and releases its verified generation before source checkpoint publication. The checkpoint reuses the released native source digest bound to the matching native attempt and release snapshot, avoiding a second full hash; the dedicated test rejects any duplicate source fingerprint call.
The focused health set now has **12 passing tests**. The earlier 54-test set was not repeated for this narrow review fix. Tests still use injected CAD boundaries and controlled local files; real CAD was not run.
@@ -0,0 +1,58 @@
# PR #24 审查修复与验收契约
审查起点:`e78cdd3`;对应评论 306。11 月 8 日更新原 PR;11 月 9 日用户授权复审修复、验收后合并。最终全量结果、JUnit 和受测提交 SHA 在 PR 描述中发布,不能用 Linux 便携白名单通过替代 Windows 全量验收。
## 有意改变的既有断言
| 审查项 | 保留的产品行为与修复 |
| --- | --- |
| 多工程测量工具仍按成组执行 | 新冻结队列每次仅派发一个 UID。三工程、两页、两规则、两个选中位号共 24 次;首项安全失败后其余 23 项继续;未决场景的非监督执行器暂停;暂停恢复不重复派发。真实 SQLite 回执、持久日志、CSV 和未选位号同时校验。 |
| 结果表旧列号 | 保留七列表头和真实 Value 回读。状态按“核验状态”列查找;原值/实际值缺证据时明确显示缺失,不拿计划值填充。任务切换必须清空。 |
| 深路径只读恢复旧返回值 | 只读失败释放原会话后抛出 `ReleasedProjectReadError`,不在原失败读取上下文内自动重放。测试校验规范路径、不可变源证明、释放记录和日志。非只读恢复原有返回值与预算测试保留。 |
| 慢保存未提供交互控制 | 有交互控制时等待真实慢保存安全收尾;无交互控制时保留句柄和未决证据,不自动结束或重放。真实样例自然退出后支持清理,业务未决标记仍保留。 |
| 监督进程是否有控制器 | 子进程始终持有内部停止控制器,以接收已授权的监督控制;父请求 `interactive_stop` 独立反映调用方权限。测试分别检查二者。 |
| 跨模块 Desktop.created 泄漏 | 共享模拟运行时工厂自身初始化 Desktop/Cad 状态,不依赖另一个测试文件的 autouse fixture。 |
| 未知弹窗样例的组合失败 | 先断言未知弹窗未被自动点击,再模拟操作员按记录指纹明确选择样例按钮、等待自然退出。确认无强制结束,不依赖异常杀进程清理测试窗口。 |
| 强制结束样例的就绪标记 | 子进程先写完临时 PID 标记再原子发布,父测试线程不能读到空文件。新增可控慢写样例,仍须通过完整强制结束保护和不重放断言;测试驱动出错时仅清理自己启动的样例。 |
| 安全清理后的确认强制释放 | 不再依赖零延时定时器抢占事件顺序。记录清理已结束与用户已确认,两者齐备才接续一次;覆盖确认框内先结束、确认后结束及拒绝授权,关闭中的窗口不接续。 |
## 生产逻辑修复
- 冻结清单缺少工程页映射时抛 `component_scope` 受控错误;不发布命令,不回退到 all-match。
- 问题轮次返回内部 `ProblemPassResult`,保留已完成工程及阻塞任务、错误码和原因;外层队列落盘为 `blocked` 并暂停,phase 保持 `problems`。范围变化/写入未决不再逃出队列或被跳过后错误标记完成。
- 仅转换 `problem_retry_scope`、`quick_run_uncertain` 两类安全拒绝;资源清理失败和存储中断继续升级,原预留和一次重试预算不重置。
- 安全打开超时清理时,根进程退出和 Job 子进程计数可能错开;在现有 10 秒清理预算内等待明确的整树退出证明。没有证明继续保留句柄,不扩大超时、不强制结束未知子进程。
- Job 枚举后 `OpenProcess` 返回 87 表示该 PID 已退出;仅在尚未取得句柄时忽略。取得句柄后的查询或结束错误仍保留为清理失败,并有反例测试。
- 清理线程完成回调释放执行通道后,才接续已明确授权的强制释放;模态确认框嵌套事件循环提前收到完成信号时也不会丢失授权或重复执行。
- 正常工作进程退出后,在包含输出收尾的 10 秒预算内等待整树自然退出;正常或非零退出码均原样保留,观测期间不杀进程、不重放。未能证明退出时继续保留归属和未决保护。错误 87 仅接受真实 Win32 异常的 `winerror`,不从普通异常参数推测。
## 问题轮次操作约定
主轮次的单 UID 安全失败仍允许后续独立项继续。所有主轮次完成后,问题重试轮次若遇到某工程写入未决或范围不符,会持久化该工程的阻塞原因并暂停同队列后续工程的问题重试;已完成结果与已预留额度保留。先核验阻塞工程,再恢复原队列,不跳过未决工程、不扩大选择范围。
## 2026-11-09 复审
`189ddc2` 的原验收记录为 1302 项通过;复审者随后两次全量分别报告 1 与 2 个原生进程用例失败。旧通过记录只代表当次运行,不能作为不存在时序问题的证明。本轮补充正常退出的确定性反例及未退出保护,修复 Job 退出观测窗口;新的受测提交、完整结果与 JUnit 在 PR 描述中单独发布,不以隔离、跳过或 serial 标记代替修复。
## 原 PR 的模块意图与风险
| 模块 | 意图 | 风险与保护 |
| --- | --- | --- |
| UID 冻结、日志回执、健康证明 | 安全失败后继续独立元件 | UID/页/工程范围不可扩大;源变化、旧证明、写入未决均阻止重放。 |
| 问题轮次、手动重试、DSH | 主轮次后只重试已选问题,共用一次预算 | 轮次/代次/预留恢复均核对原选择;成功项不重放,阻塞持久化。 |
| CAD/桌面/监控与弹窗 | 释放自有资源并支持明确人工操作 | 保留未知写入;自动点击仅限既有确定提示,人工动作核对完整窗口指纹;进程归属和自然退出必须有证明。 |
| BOM 和 Value/Label/Cell 回读 | 按通过工程导入并展示实际结果 | 来源摘要、行与 UID 绑定;缺失/歧义明确报告,不拿计划替代实际。 |
| AI/工单执行许可 | 等待期间释放执行通道,变更时重新准入 | 计划、任务和命令身份重新核验;等待不能绕过执行门禁。 |
| 结果表与旧工具 | 七列显示和单 UID 指标一致 | 既有状态不冒充 Value 核验;工具核对真实存储、日志和未选项。 |
## 验收命令
定向及组合验证覆盖审查报告的失败、原生窗口样例、工厂隔离、问题轮次拒绝及已有恢复/预算保护。通过后在最终提交执行:
```text
python -m pytest tests/v1_1 -q --tb=short --junitxml=build/pr24-revision/windows-v1_1.xml
```
环境为 Windows、Python 3.12、`QT_QPA_PLATFORM=offscreen`。同目录保留完整日志和包含受测 SHA、命令、退出码、JUnit 统计及 Git 源/测试树身份的 JSON。发现新的失败后才追加必要验证。
Linux CI 加入多工程测量、问题轮次阻塞收尾和清理确认回归。真实 CAD/PCB、Windows 实际重启核销、线上 AI/工单及发布 EXE 均不在此次验证范围内。
@@ -0,0 +1,32 @@
# PR #19 评论 #337 修复与合并验证
## 修复范围
- 合并 `origin/main` 的 `aff228e`(PR #24,18 个提交),解决 9 个冲突文件。保留单器件执行、问题轮次、健康证明、资源释放确认、局部 BOM 校验和原队列恢复,同时保留 DSH 取消、执行许可、防重复介入、原生选模和只读查询隔离。
- 重试使用 main 的共享问题项预算及精确 `operation_keys`;未获执行权、已撤销许可、用户已暂停或现场已变化时不执行,也不绕过预算退回旧重试路径。
- 合并 main 的互斥准入与释放确认协议。只在实际修复期间占执行权,复盘前等待释放确认;关闭被用户拒绝时诊断继续,确认关闭后才取消并等待收尾。界面关闭后排空独立读线程,再关闭任务数据库。
- 诊断结束后仅在原任务仍选中且没有新运行时被动刷新,使用 `auto_intervene=False`,恢复持久读取错误回显且不再创建诊断。
- 移除生产代码按 `offscreen` 平台关闭 AI 或屏蔽操作错误的分支。测试显式提供模型就绪状态与错误对话框替身;检查中、临时检查失败及尚无状态控制器时保留原始操作错误反馈,已确认未配置模型/凭据时继续仅显示状态灯。
- 纯圆点状态灯保留用户要求的样式、悬浮信息及无障碍名称。
## CI
Python 作业使用 runner 已可启动的 `node:20-bookworm`,保留 main 的 Debian HTTPS 与镜像回退;安装隔离 Python venv、Qt 依赖、锁定的 Node 24.11.1 和 `npm ci --prefix integration/dsh`。真实 Harness 的只读配置检查在运行回归前独立执行,不以跳过全部配置测试代替依赖安装。
回归清单合并两分支并补齐审查遗漏,共 46 个测试文件;JUnit 与作业摘要明确区分“未执行”和实际测试计数。Windows DPAPI 与真实 Win32 文件锁用例仅在非 Windows 上跳过。
## 冲突测试覆盖
- `test_incident_admission.py`:本分支 4 项与 main 6 项全部保留,共 10 项。
- UI 非阻塞:本分支 8 个测试函数/11 个参数场景保留原文件;main 9 个函数/11 个场景保留在 `test_dsh_ai_nonblocking_main.py`。合计 17 个函数、22 个场景。
- 两组总计保留 27 个原测试身份、32 个参数场景;不以选择一方解决 add/add。
- 原暂停/强停回归改用 main 允许的“写入前单器件连接失败”,保留真实共享预算及 IncidentRunner,仅延后队列问题轮次。8 个原停止意图场景全部保留。
## 本地验证
- 按上述 46 文件的 CI 清单运行:586 passed、1 skipped;一个与 main 字节一致的 Windows 私有桌面合成对话框测试在整组清理时失败,随后短路径单例复跑通过(自然退出、无强杀、桌面释放已核验)。不将该整组运行描述为全绿。
- 独立专项:准入 10 passed,合并后的非阻塞 UI 22 passed,原停止意图场景 8 passed;原生菜单/状态灯/诊断组 43 passed。以上与清单运行有重叠,不累计。
- 原生模型只读检查 23 场景通过;诊断取消、面板、模型结果离线 Node 验证通过。
- 变更文件语法解析、`compileall`、工作流 YAML/路径/脚本检查及 `git diff --check` 通过。
远端 CI 结果将在 PR 描述中按推送后的实际运行记录补充。没有发送真实模型请求、提交测试工单、运行真实 CAD 或构建发行 EXE。
+13
View File
@@ -0,0 +1,13 @@
# 逐位号执行与问题处理
新建自动队列先冻结工程中的位号身份,每个位号单独执行和记账。同名或相同 Value 不会让不同 UID 合并成一个执行项。旧队列保留原先冻结的整组范围,不因升级重新派发已经成功的位号。
明确失败的位号进入问题记录。当前工程可证明安全时,其余独立位号继续执行;工程状态不确定时暂缓同工程余项。资源确认释放后继续其他工程。所有可运行项完成后,明确列入安全临时错误规则的问题项最多自动重试一次。暂停、重启、换 job 或 AI 建议都不会增加额度。
保存或回读不确定不表示成功,也不会自动再次换料。程序先请求安全退出;仍卡住时需要你明确选择强制结束。强制结束仅作用于程序仍持有并能证明归属的进程,工程仍保留待核验状态。
后台出现未知弹窗时,原资源释放按钮会显示为“处理阻塞弹窗”。页面显示当前工程、原始弹窗内容及按钮,由你选择。程序不会自动替你选择保存、放弃或许可操作。
BOM 默认仍要求整批通过。只有明确启用部分导入并选择通过工程,才保存对应范围;失败行和原表来源继续保留。预览后原 Excel 或来源映射变化需要重新导入。资源释放异常会撤销所有可保存预览。
替换报告区分原 Value 与保存后实际 Value。缺少可验证报告时显示缺少证据,不能把计划值当成实际值。Block/Symbol 层级未确认的同名属性会保留诊断并拒绝歧义写入,不能用“Value 相同”推断应该修改哪一层。