Compare commits
60
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a9fbce9b2 | ||
|
|
1bd7589fef | ||
|
|
1acfbd6374 | ||
|
|
aea6192ef9 | ||
|
|
53118bae19 | ||
|
|
beb2b06fdf | ||
|
|
4ebe098ef0 | ||
|
|
00db1cf5f2 | ||
|
|
477a5a46e3 | ||
|
|
2587d33c5a | ||
|
|
223655fe00 | ||
|
|
29959e2988 | ||
|
|
e14a864b37 | ||
|
|
cb1326688b | ||
|
|
ef652f3ada | ||
|
|
8180a8a302 | ||
|
|
c902ffbe9a | ||
|
|
de952a68d6 | ||
|
|
c85696080d | ||
|
|
7527800128 | ||
|
|
d36b6bcad0 | ||
|
|
5eac654c36 | ||
|
|
b26e2f2f62 | ||
|
|
9ac2f91dde | ||
|
|
e915aaa865 | ||
|
|
f21781f170 | ||
|
|
55a82fdc5f | ||
|
|
89500cbb5f | ||
|
|
63f3417f19 | ||
|
|
ca84bce24f | ||
|
|
b97556dcc1 | ||
|
|
07a9c1eaaf | ||
|
|
f8f2dd53aa | ||
|
|
2085ec770f | ||
|
|
d76475a1d7 | ||
|
|
99a708b40c | ||
|
|
9806ef8f66 | ||
|
|
aa6684b588 | ||
|
|
5a758ee3b6 | ||
|
|
b635432cff | ||
|
|
4cbca0b5a6 | ||
|
|
e39dc63ded | ||
|
|
4f741cd176 | ||
|
|
122bafcc7a | ||
|
|
8e486c1097 | ||
|
|
bb98fe66dd | ||
|
|
1f69480ed8 | ||
|
|
ffa7e84d43 | ||
|
|
46c3e72364 | ||
|
|
dd1fcea7e2 | ||
|
|
797a79c30e | ||
|
|
3415e010ff | ||
|
|
29c154d2ca | ||
|
|
877e3b4c76 | ||
|
|
b90a9bbfab | ||
|
|
747ce1add2 | ||
|
|
c823a4b92d | ||
|
|
aa760c2839 | ||
|
|
44b808b8e2 | ||
|
|
ec78dd722c |
No files matched your search
@@ -1,4 +1,6 @@
|
||||
# CBB 中心库上传后校验工具
|
||||
|
||||
当前临时分支的备份策略(2026-11-03):应用不再自动备份中心库或 CBB 工程。新增、替换、移除、校验、ICDB 维护和恢复在执行前提示手动备份;请自行保留可用副本。导入暂存、恢复用隔离验证库和轻量操作证据仍会生成,Mentor 原生 Repair 自身的备份行为保持不变。详见[自动备份检查与调整](docs/releases/2026-11-03-manual-backup.md)。此条优先于下方历史版本的备份说明。
|
||||
|
||||
当前补丁:**[v0.2.3-beta.1](docs/releases/v0.2.3-beta.1.md)(Beta 预发布,待现场验收)**,替代 0.2.2-beta.1。数据库所有权或关闭状态不确定时停止批次、保留现场;不自动移走地址文件、接管带锁设计或强杀 PCB 进程树。新增全库 ICDB 维护、同名 CBB 完整备份恢复弹窗及严格的原生复核流程。详见 [v0.2.3-beta.1 发布说明](docs/releases/v0.2.3-beta.1.md)。下方日期记录描述历史版本,以本补丁说明为准。
|
||||
|
||||
@@ -7,7 +9,7 @@
|
||||
针对 `The last server session ... lost the connection to the database`,修复分支增加
|
||||
`ICDB_REPAIR_REQUIRED` 专项识别、共享符号库路径诊断及停止批次处理。现场原生修复步骤及实现边界见
|
||||
[iCDB 旧服务器会话失联分析](docs/diagnostics/2026-10-27-icdb-lost-server-session.md)。
|
||||
当前分支会在目标明确、完整备份和所有权释放证据齐全时尝试一次同版本原生 Repair;共享符号库没有 PRJ 入口时停止并要求人工处理。
|
||||
当前分支会在目标明确、所有权释放和独占访问证据齐全时尝试一次同版本原生 Repair;操作前请手动备份,共享符号库没有 PRJ 入口时停止并要求人工处理。
|
||||
|
||||
## 功能边界
|
||||
|
||||
@@ -201,7 +203,7 @@ Mentor 桥耗时需在目标机器另行测量。
|
||||
- `save.log`:`LICENSE_OK / SAVE_OK / IS_SAVED / POST_SAVE_SYNCHRONIZED / CLOSE_OK / QUIT_OK`;
|
||||
- `result.json`:状态、中心库标志读取结果、阻断原因;
|
||||
- `image-status-map.json`:按中心库路径隔离的本机动态 `image_id` 校准快照(当前格式 `schema_version=2`);旧版本或无版本缓存会自动忽略并重新校准,日志会记录当前样本、缓存样本、Ready 主 ID、未映射 ID 和逐项决策原因;
|
||||
- `backup/`:仅本地盘操作前的稳定文件副本;网络盘/UNC 跳过前置递归备份(`backup_skipped`);`database/LogFiles/tmp` 等易变目录和日志文件会排除,备份超时或失败不会阻断 PCB 校验。仅在成功且确认安全后清理该目录,失败时保留已有副本及日志;它不是完整数据库回滚备份。
|
||||
- `backup/`:历史版本的辅助文件副本;当前分支不再生成,所有路径记录 `backup_skipped / manual_backup_policy`。已有历史副本不由本轮改动清理。
|
||||
|
||||
超时采用无进展计时:界面和批量请求默认 600 秒无进展超时;它不是整个 CBB 的固定总时限,而是连续 600 秒没有可观察进展时才终止。PCB/COM 阶段切换、Project Integration 状态变化、保存标记变化和弹窗处理都会刷新计时器;重复的状态轮询不算进展。需要更快失败时仍可在界面将单项预算调低,但 30 秒只适合已确认 PCB 启动稳定的环境。
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# ICDB 持续失败:公开资料与实际入口核对
|
||||
|
||||
调查日期:2026-11-03。当前源码 `c856960`。本轮是网上资料检索及只读诊断,没有修改库、服务器设置或产品代码,不能作为修复验收。
|
||||
|
||||
## 本机确定的缺口
|
||||
|
||||
目前找到最近一次实际失败为隔离完整库 IP101GR 的 2026-11-03 16:19(北京时间)记录:
|
||||
|
||||
`diagnostics/feedback-final-ui/evidence/verify-85fd17bc6ed2/result.json`
|
||||
|
||||
错误为 `DATABASE_RECOVERY_REQUIRED`,阶段为 `PCB_STARTING`。原生提示询问:
|
||||
|
||||
> Continue to open the design with read/write access permission?
|
||||
|
||||
提示说明可能是文件系统/网络在 15 秒内未确定谁打开了设计,也可能是上一会话异常退出;要求确认没有其他用户正在使用。它没有证明数据库内容已损坏,也不是本轮原生 Repair 的失败结果。
|
||||
|
||||
代码及只读复核证据 `diagnostics/icdb-web-research-20261103/routing-evidence.json`:
|
||||
|
||||
1. `maintenance_entry.maintenance_needed` 仅在存在库阻止检查点或数据库地址记录时返回真。
|
||||
2. 当前 IP101GR 没有地址记录、没有阻止检查点,尽管请求 `maintenance=True`,仍返回 `routes_to_native_repair=false`。
|
||||
3. `select_maintenance_target` 额外要求恰好一个地址记录;无地址时返回 `需要唯一工程地址记录`,因此只改外层判断也不能打通流程。
|
||||
4. `verify_runner` 的自动补救仅针对 `ICDB_REPAIR_REQUIRED`;当前读写确认错误归入 `DATABASE_SAFETY_STOP`,不会触发该分支。
|
||||
5. 修复后一次性读写确认已有 `PostRepairProof` 机制,但只有本轮原生修复成功且释放已核实时才授权。当前入口绕过 Repair,自然没有这份证明。
|
||||
|
||||
因此,明确维护不能以“没有 sAddress.adr”推断无需维护。地址记录用于定位/占用判断,不应成为识别异常关闭状态的唯一依据。
|
||||
|
||||
## 网上资料:已读取原文
|
||||
|
||||
### 原生 Project Repair
|
||||
|
||||
[Mentor XP 如何修复文件](https://blog.csdn.net/qq_53931654/article/details/147240707)
|
||||
|
||||
原文步骤为打开 iCDB Project Backup,指定损坏工程路径,执行 `Project → Repair`。与本机已经接入的官方工具入口一致。本文是用户经验文章,没有证明当前完整自动链路或 CBB 校验限制已经解决。
|
||||
|
||||
本轮首次访问返回脚本验证页,后续正常请求取得正文;正文与截图链接保存在 `native-repair.json` / `native-repair.html`。
|
||||
|
||||
### 工程备份恢复
|
||||
|
||||
[“Unable to open iCDB connection”的解决方案](https://blog.csdn.net/zhangyang125/article/details/136188112)
|
||||
|
||||
原文建议从工程 `ProjectBackup/backups` 选择备份,恢复对应文件后重新打开。文章把复制/转移时文件丢失或损坏列为可能原因。该方案会回退版本,不等于保留最新内容的无损 Repair;仍需用户选择可接受版本,恢复后做工程身份与校验确认。
|
||||
|
||||
### 连接/监听地址
|
||||
|
||||
[Xpedition 2409 Designer 无法打开 iCDB 连接](https://blog.csdn.net/kkisscj/article/details/144323677)
|
||||
|
||||
原文描述在工作目录的 iCDB Server 配置中设置 `Network/Address` 为本机地址,并引用 VX2.8 管理文档。这说明“无法连接 iCDB”也可能是监听配置问题,不能一律解释为损坏。
|
||||
|
||||
但文章环境是 Xpedition 2409,本机是 EE7.9.5。现有日志未证实本机出现同类监听失败;本轮没有修改 Server 配置、服务或端口。
|
||||
|
||||
### 检索限制和排除项
|
||||
|
||||
英文 Google/DuckDuckGo 请求连接超时;Bing 多个精确错误查询无结果或结果无关,360 搜索提供了可进一步核对的中文线索。没有取得可直接适用于 EE7.9.5 当前弹窗的 Siemens 官方支持答复。检索及抓取原文保存在 `diagnostics/icdb-web-research-20261103/`。
|
||||
|
||||
标题/推荐摘要中含 “iCDB Server Monitor” 的另一页面,正文实际讨论 Android Studio Monitor,已排除,未把无关搜索结果当作技术依据。本机已有帮助文件检索也未找到能补足该弹窗处理条件的准确段落。
|
||||
|
||||
## 建议的修正与验证次序
|
||||
|
||||
1. 明确维护入口支持“无地址记录但需要检查”的工程:通过用户所选 CBB、唯一 PRJ/PCB 关系和明确数据库映射绑定目标;多个候选数据库必须明确区分,不能猜测共享库或另一个工程。
|
||||
2. 在本任务 PCB/启动器正常退出、库锁与数据库独占访问确认后,执行一次原生 Project Repair。不要因为看不到地址文件就直接退回打开 PCB。
|
||||
3. 仅在原生成功、目标一致、进程与地址释放确认后,使用已有修复后读写授权重新打开。未知或外部占用仍停止,不能把同意读写弹窗作为一般重试策略。
|
||||
4. 如要求选择 PCB 历史版本,明确记录选择及版本回退;随后验证集成、保存、关闭和权威 READY。
|
||||
5. 如果数据库检查通过,但仍被“已验证 CBB 不允许重新执行 BackAnnotate”阻止,应作为独立的 CBB 注册/校验状态问题处理。此前完整依赖库中“原生重新导入 → 自动校验 → READY”已通过,但不能把重新导入偷偷塞进 Repair 或称为无损修复。
|
||||
|
||||
此处已定位入口缺口和可验证的修正方向;尚未实现并完成“无地址记录”维护路径的真实自动链路验收。
|
||||
@@ -0,0 +1,37 @@
|
||||
# 普通校验阻塞修正
|
||||
|
||||
基准 `477a5a4`。按用户最新指示暂停 ICDB 自动修复研究,本轮只修普通校验的入口、单项失败后的继续条件、取消和退出,以及状态桥部署/重试。没有对原库运行新的校验、Repair、恢复或移除;遗留的 Project Backup 进程未被终止。
|
||||
|
||||
## 修改依据与最终行为
|
||||
|
||||
| 阻塞来源 | 修改 |
|
||||
| --- | --- |
|
||||
| 原生进程已退出,但单项失败仍使整批跳过 | 统一使用本轮、同库、同 CBB 的释放记录判断继续资格。FAIL/TIMEOUT/未知弹窗保持原失败状态和备注;自动化工作进程、保存/失败关闭助手及本任务原生进程全部确认退出后可继续下一项。失败不会变成 PASS。 |
|
||||
| 保存或失败关闭助手漏检;工作进程已关闭句柄后再查询退出状态 | 停止和检查两类精确脚本路径、精确父 PID 的助手。退出状态在关闭句柄前读取并缓存,清理可重复调用;助手和原生 PID 合并记录。任何查询异常或客户端仍活着都不解除执行锁。 |
|
||||
| 超时只写取消文件,客户端可能继续 Save/Close | 先请求协作取消,宽限到期后仅停止本任务自动化工作进程及已识别的自动化助手。保留原生 PCB/iCDB,不终止进程树。普通校验的取消事件已传入监督循环。监督程序丢失后,Verify 看门狗也限时停止已登记客户端。 |
|
||||
| 启动器和迟到子进程未完整纳入清理 | 监督器清理前重读剩余事件中的目标/启动器 PID;追踪这些已确认原生进程的新后代,排除任务开始前的无关会话。 |
|
||||
| 任意 PCB 已打开就禁止校验 | 精确命令参数指向同一 PCB 时才阻止启动;其他工程保留。实际 COM 文档身份和保存助手身份检查仍必须通过。保存关闭后存在其他文档时,不调用该应用的 Quit。 |
|
||||
| WMI 占用查询可能无限等待 | 普通校验的进程查询统一复用已有隔离查询助手,最多等待 10 秒。超时表示无法确认,保留具体原因;不在 GUI 线程做 WMI。 |
|
||||
| 端口少量抽样被当作整个原生端口区间不可用 | 默认仅发出警告并执行真实原生调用。保留内部显式严格诊断参数,不作为默认入口条件。 |
|
||||
| `0 errors` 被错误关键字命中;原生工程编码误判 | 仅忽略完整的零错误计数,仍拒绝非零错误、明确错误或坏退出码;复用现有 UTF-8 BOM / UTF-16 / Windows ACP 工程读取器。 |
|
||||
| 状态桥 x86 MFC 运行库缺失;加载失败对每项重复启动 | 打包时验证并携带 x86 MFC/VC 运行库到桥的独立目录,避免误用 x64 Qt DLL。识别明确的 Windows DLL 缺失/架构错误,只记录一次全局桥故障并为余项保留状态;不因此禁用维护或管理入口。 |
|
||||
| 状态查询重试复用旧 TIMEOUT/ERROR | 断点读取仅复用 READY/PENDING;失败状态下次重查,不要求修改库文件才能重新查询。普通界面读取仍使用本轮权威状态。 |
|
||||
|
||||
执行互斥只用于实际仍运行/释放未确认的客户端;历史诊断和 CBB 内容问题不应变成跨功能永久禁用。处于原生操作中的未知弹窗不会被盲目确认:当前项失败并留证,是否继续仍取决于该操作是否实际结束。
|
||||
|
||||
## 验证
|
||||
|
||||
新回归先复现单项已释放仍停批、取消未传递、零错误误判、编码与端口拦截等问题,再验证修改。还覆盖原生迟到子进程、保存/失败关闭助手保留,以及已关闭 Win32 句柄不再被读取。
|
||||
|
||||
使用真实 Windows 子进程验证监督程序退出后的客户端停止和原生模拟进程保留;VBS 在真正的 32 位 cscript 中使用伪 COM 对象验证 Save/Close、取消及剩余文档不被 Quit。它们没有加载现场工程,也不等于 Mentor 实机验收。
|
||||
|
||||
最终完整 Python 回归、冻结模块一致性、程序启动/正常退出、桥 JSON 编解码及实际加载 app-local x86 DLL 的结果记录在 `diagnostics/batch-blockers-20261104/`。现场日志和原始证据不随代码提交。
|
||||
|
||||
- 最终完整回归:**1,244 passed**,退出码 0,222.90 秒;1 条既有 pywinauto STA 警告。`pytest-final.log` / `pytest-final-result.json`。
|
||||
- PyInstaller 构建、编译和差异检查通过。10 个关键 Python 模块及两个 VBS 脚本与冻结程序一致,启动及正常退出冒烟返回 0。
|
||||
- 桥的 Unicode/UNC 编解码返回 0。通过真实进程模块枚举确认 `mfc140.dll`、`MSVCP140.dll`、`VCRUNTIME140.dll` 均从包内桥目录加载;不是仅检查文件名存在。系统 PATH 缩为 Windows System32,本检查没有加载 Mentor 数据库。
|
||||
- 独立审查发现并修正失败关闭助手漏检;复审无剩余必要 P1/P2。构建记录保留 `icdb_automatic_repair_acceptance=false`、`release_ready=false`。
|
||||
|
||||
## 仍待验证
|
||||
|
||||
没有把本次阻塞修正称为 ICDB 自动修复成功。Project Backup 挂起问题保持暂停;Windows 10 干净系统、其他 Mentor 环境、两个真实 PCB 同时打开的 COM 注册行为、跨机并发写库、3000 项网络库完整耗时仍需实机验证。状态桥无法读取时仍不能宣称 READY;本轮补齐了已确认的 x86 部署依赖,没有伪造状态,也未加入新的全功能禁用入口。
|
||||
@@ -0,0 +1,40 @@
|
||||
# ICDB 批量检查
|
||||
|
||||
## 当前行为
|
||||
|
||||
应用原“非 READY ICDB 检查与修复”入口改为“ICDB 批量检查”。检查可见非 READY 工程,有勾选时仅处理可见勾选项,READY 即使被勾选也排除。普通 CBB 校验、中心库管理和手动“版本历史与备份…”继续使用各自入口。
|
||||
|
||||
检查通过原生 Project Backup 加载所选工程,收集本次 Output 和占用结论,不启动 PCB,不调用 Repair、Restore 或版本选择。检查入口即使收到旧请求的 `auto_repair=True` 也只执行检查;其原生请求始终携带 `inspection_only=True`。内部显式恢复辅助 API 及其既有测试保留,应用批量检查不再调用它们。
|
||||
|
||||
结果分为:
|
||||
|
||||
- 未发现异常:返回 CHECKED,仅表示本次原生检查未发现已识别的 ICDB 异常,不推定 CBB READY。
|
||||
- 发现 ICDB 问题:保留 FAIL 和明确的 ICDB 故障分类,不执行修复。
|
||||
- 工程占用:记录占用,不把它解释成数据库损坏。
|
||||
- 无法确认:缺少有效工程、输出不完整、目标不符、未知错误等均保留原始证据,不显示健康。
|
||||
|
||||
本项检查的原生进程确认退出后,发现问题、占用或未知结果可继续下一项;本次检查尚未退出或缺少退出证据时停止剩余批次,不强制终止原生进程。用户取消也停止队列。需要修复或回退时,由用户通过原生备份窗口选择操作。
|
||||
|
||||
## 去除检查路径的修复限制
|
||||
|
||||
目标绑定复用手动原生入口的唯一主 PRJ 和明确的工程内 `iCDBDir`。检查不要求 PCB、Layout 或 `icdb.dat` 预先存在,也不借用 Repair 的地址记录唯一性和多个数据库候选排除规则。缺失或损坏由原生加载检查给出结论;无法识别的结果保留为未知。
|
||||
|
||||
原生 worker 的检查模式不再因本机存在其他 PCB/Library Manager 而直接拒绝,也不执行 Repair 专用的数据库独占准入;它仍在启动前检查所选工程的文件链接,目标是否占用由原生 Output 判定。
|
||||
|
||||
检查使用实际库协调锁,忽略历史协调检查点,不自动归档旧记录或删除地址文件。释放必须有明确的原生退出证据,或 worker 明确报告“尚未启动原生进程”;结果字段/PID 缺失不推定释放。该调整只覆盖新检查路径,不能据此宣称维护/管理/释放检查中的所有过宽条件均已解决。
|
||||
|
||||
## 界面及报告
|
||||
|
||||
批量检查不再显示手动备份要求、自动修复承诺或“修复并校验通过”计数。确认清单、进度、备注、汇总及完整/异常/JSON 报告均按检查目标和检查分类输出。占用和未知备注不加“ICDB 问题”标签。默认副本恢复仍排除缺少 PCB 的工程,检查候选可以包含它们。
|
||||
|
||||
## 验证边界
|
||||
|
||||
本轮先以失败测试确认旧入口会打开 PCB、可进入 Repair、使用修复准入及误标未知结果,再修改入口。测试覆盖健康、明确故障、占用、未知、异常修复返回、缺少退出证据、明确未启动、取消、队列继续、缺 PCB/Layout/icdb、多数据库、READY 排除、仅检查汇总和报告。
|
||||
|
||||
全量测试、冻结模块一致性、启动冒烟及隔离库实际按钮记录保存在 `diagnostics/icdb-batch-check-20261104/`;最终包的 `BUILD.json` 记录实际结果。隔离验证只执行新批量检查,不在原库运行 Repair/Restore。
|
||||
|
||||
最终全量 **1304 passed**,270.79 秒,退出码 0,1 条既有 pywinauto STA 警告;编译和差异检查通过。冻结的 14 个关键 Python 模块及两个 VBS 与源码一致,启动/退出、Unicode/UNC 协议及包内 x86 运行库加载通过。独立审查发现的修复准入误用和缺字段推定释放均以先失败后通过的回归修正,复审无剩余必要 P1/P2。
|
||||
|
||||
最终冻结包通过真实按钮在自有隔离库的 PENDING `IP101GR` 上检查,原生返回数据库不一致且未占用,应用记录 `ICDB_REPAIR_REQUIRED`、`safe_to_continue=true`,汇总“发现问题 1”。原生请求为 `inspection_only=true`,返回 `repair_requested=false`,没有 PCB 请求或恢复尝试。原生及应用均正常退出,中心库 LMC 和工程 PRJ、DXP、icdb.dat、PCB、LayoutDB 六个文件的 SHA-256 前后一致。
|
||||
|
||||
原生加载检查不能保证 PCB 实际打开一定正常,也不能替代普通 CBB 校验。现场自动修复问题不作成功结论;工单和 WIP PR 保持开放。
|
||||
@@ -0,0 +1,47 @@
|
||||
# 工单 #4 与独立操作复核
|
||||
|
||||
复核基准:最新工单 [#4](https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/issues/4)(更新于 2026-11-04 15:20),当前代码起点 `2587d33`,用户随后要求校验与 ICDB 维护独立执行。原工单基准为 `29959e2`,下表按当前源码重新核对,不能照搬原报告的测试数或认定全部已修复。
|
||||
|
||||
后续用户要求暂停 ICDB 自动修复、先修阻塞。新的修改和最终 1,244 项完整回归见 [普通校验阻塞修正](2026-11-04-batch-blockers.md);下表保留首次复核状态,不能作为最新未修项数量使用。
|
||||
|
||||
## 本次用户失败的实际链路
|
||||
|
||||
最新测试程序的日志位于 `dist/issue2-tabs-release-candidate/CbbRefreshVerify-Background/data/`。北京时间 17:41:55 开始维护 `1GPHY_8212`,17:42:24 进入原生检查,17:43:17 启动 Project Backup,17:43:50 报 `TIMEOUT_UNRELEASED`。本轮没有发出 Repair,8 个后续条目被跳过。17:44:54 再运行另一工程,遗留 PID 60000 被全局进程检查拦截。
|
||||
|
||||
只读打开对应私有桌面后确认:原生主窗口及 RichEdit Output 控件均存在,但主窗口和 Output 连 WM_NULL 都返回 1460(超时)。不是已经取得 ICDB 损坏结论后修复失败,而是原生检查本身无响应,且本应用没有提供足够的阶段证据。没有向该原库发出新的 Repair、恢复、删除地址文件或强制结束操作。
|
||||
|
||||
原有逻辑还把“存在历史检查点”直接解释为整个库只能维护,普通校验默认自动 Repair,并把地址记录存在直接解释为会话未释放。这些产品耦合与用户最新要求冲突。
|
||||
|
||||
## 12 项仍需修改或验收
|
||||
|
||||
| 工单项 | 当前结论 | 后续工作及验收 |
|
||||
| --- | --- | --- |
|
||||
| K2-1 状态桥前置检查 | 仍缺少批次级能力诊断;在原生刷新后才检查权威 READY | 批次开始只诊断一次并明确说明状态不可读取;不能因此封锁 ICDB 和库管理。不能把原生调用完成当作 READY。 |
|
||||
| K2-1b x86 运行库部署 | 发布候选中的桥为 x86,导入 `mfc140.dll/MSVCP140.dll/VCRUNTIME140.dll`,未随包提供 x86 MFC | 选择静态链接或正式部署 x86 运行库;干净 Windows 实机验证。x64 Python/Qt 的同名 DLL 不能替代。 |
|
||||
| K2-2 未知弹窗分级 | 输入法误报已有过滤;真正未知交互弹窗仍使当前项失败并停批 | 区分无交互辅助窗口与实际模态提示;后者记录具体原因,正常释放后才继续独立项,不能盲点未知确认按钮。 |
|
||||
| K2-3 取消与超时 | 协作式取消已存在;看门狗和 `_stop_worker` 仍可能返回时客户端活着 | 检查当前 automation client/保存客户端是否实际退出,防止迟到 Save/Close;不得以删除历史记录代替停止仍在写入的任务。 |
|
||||
| K2-6 ICDB 自动维护 | 隔离副本曾成功执行 Repair;本次原库原生检查无响应,不能验收 | 当前修复:独立维护、独立校验、缩小检查范围、记录原生等待阶段。仍需一致副本上的真实按钮验收;原生窗口挂起成因待查。 |
|
||||
| K2-4 跨机共享库并发 | sidecar 排他句柄只协调遵守协议的工具,Mentor 不参与 | 明确共享库操作协议,基于实际原生文件占用处理冲突;两台机器同时写同一工程的验证尚未完成。 |
|
||||
| K2-5 地址记录及全局 PCB 拦截 | 地址文件和历史记录的普通校验硬拦截在本次拆除;“任意 PCB 已开即拒绝”仍存在 | 改为按工程身份判断占用;独立 CBB 不应相互禁用;跨会话 COM 绑定需实际验证后调整。 |
|
||||
| K2-7 Windows 10 | 当前没有 Win10 实机完成证据 | 在 Win10 + EE7.9.5 验证私有桌面、启动、保存、释放及 READY;不能以 Win11 回归替代。 |
|
||||
| K2-8 内容文本与 PRJ 编码 | 探针确认成功文本含 `0 errors` 仍返回 FAIL;preflight 仍按 UTF-8 读取 | 复用已有工程编码读取器,区分零错误计数与真实错误;补 UTF-16、ACP 和真正失败样本。 |
|
||||
| K2-9 CentralLibrary 改写与说明 | 写入前已有原始 `pcb.prj` 证据副本和原子替换;旧“没有直接改写”说明不准确 | 核对异常回退与说明,按用户要求提示手动备份,不能重新加上自动整库备份。 |
|
||||
| K3-1 初次扫描规模 | 状态指纹与逐项 preflight 仍有全库开销;本次只缩小了维护检查范围 | 首屏增量读取、扫描进度和取消;381/3000 项及网络盘测量仍需做。 |
|
||||
| K3-2 队列恢复 | 已有状态/管理检查点,但没有完整校验队列的确认续跑 | 保存目标、已完成项和具体结果,重启后由用户决定继续;管理写操作不得自动重放。 |
|
||||
|
||||
共 12 项:5 项 P0、7 项原工单 P1/规模化条目。它们不等于 12 个已复现的代码错误:包含明确缺陷、部分修复、部署风险及缺少实机验收。优先处理操作解耦、原生检查无响应、桥部署、取消后仍存活的客户端;其余独立提交,不混在一次维护修复中。
|
||||
|
||||
## 本次实现与验证范围
|
||||
|
||||
普通校验默认不调用 Repair;历史检查点不再切换清单读取方式或禁用普通校验。合作式库锁跟随实际客户端释放,不为普通校验创建新的永久诊断阻止记录;已有历史记录保留。已退出的只读原生检查不会因为旧地址记录而锁住管理入口。实际仍存活或尚未确认退出的客户端继续保有执行锁;监督工作进程已经退出、只剩已记录的原生 PID 时,重试会检查这些 PID 是否实际退出,校验和维护均可直接重试,不要求先运行另一个功能。工作进程仍在运行时不采用这一简化判定。
|
||||
|
||||
维护成功报告 `REPAIRED / UNKNOWN` 和“待单独校验”,不自动重开 PCB、不执行反标注、不标为 READY。历史备份恢复仍需核对版本。维护预检查只扫描当前 Work、相关共享符号数据库及中心库定义,并保持链接、文件集合变化和独占句柄检查。扫描真实原库的 5,218 项用时 14.109 秒(只读,未启动原生工具);原用户流程的两层预检查合计约 76 秒,不能把这两个口径直接当作完整维护耗时对比。
|
||||
|
||||
验证证据在 `diagnostics/independent-operations-20261104/`(原始现场记录不提交):
|
||||
|
||||
- 操作拆分后的相关回归 509 项通过;审查发现并补正真实客户端仍在写入时的执行锁保留,以及直接重试维护的入口问题。
|
||||
- 执行锁、维护、占用、校验、导出保护和恢复等相关回归 **214 passed**,退出码 0;最后“无需修复”展示与独立入口回归 **37 passed**,退出码 0。不是对最终源码重新跑完整 Python 套件的声明。
|
||||
- 独立静态审查的必要问题已修正。编译及差异检查通过。
|
||||
- 冻结包核对 10 个关键模块与当前源码一致,并运行无原生写入的启动/正常退出冒烟。构建元数据明确保留 `native_acceptance=false`、`release_ready=false`。
|
||||
|
||||
本轮没有重启现场挂起的原生进程、强制结束该进程、在原库执行新的自动修复,或将单元测试当成 ICDB 实机验收。原生窗口长时间无响应的具体内部原因仍未查明;此文档不能作为原生自动修复已验收的证明。
|
||||
@@ -0,0 +1,31 @@
|
||||
# 原生版本历史、备份与回退入口
|
||||
|
||||
## 用户操作
|
||||
|
||||
在“ICDB 维护”页勾选一个非 READY CBB,点击“版本历史与备份…”。应用将所选工程的唯一 PRJ 传给已安装的 `iCDBProjectBackup.exe -p`,打开可见的原生窗口。当前 Layout 数据缺失但 PRJ 仍在时也可以进入。
|
||||
|
||||
版本列表、备份详情、操作日志和 Restore backup 由原生窗口提供。选择版本、手动保存/自动保存分支以及恢复确认均由用户操作;应用不代点 Restore、Repair、删除或清理菜单。用户已报告手工回退能够走通,本轮接入该原生入口,不把手工成功当作自动 Repair 验收通过。
|
||||
|
||||
原生窗口正常关闭后重新读取受影响 CBB 的权威状态。窗口关闭仅记为 `CLOSED`,始终记录 `restore_confirmed=false`,不自动执行校验,不伪造 PASS/READY。需要验证恢复后的工程时,单独使用“检验”页。
|
||||
|
||||
## 会话与独立操作
|
||||
|
||||
- 可见原生窗口由独立辅助进程启动和监督;Qt 线程不等待原生会话,清单搜索、筛选、横向页面和库切换保持可用。
|
||||
- 使用 Windows Job 跟踪本次原生进程及后代,根进程退出但后代仍在时继续等待。Job 不设置 kill-on-close;关闭本应用不强制关闭原生窗口。
|
||||
- 实际会话持有现有中心库协调锁,同库写入等待该会话关闭;其他库不因这个窗口禁用。没有新增历史 ICDB 失败标记作为普通校验前置条件。
|
||||
- 状态或结果文件写入失败不结束原生监督。辅助进程退出后,只有返回身份一致且 `safe_to_continue=true` 才清除应用内会话和路径租约;缺失、损坏或释放未确认时保留同库冲突,可通过已有“检查占用…”取得新的释放证明。
|
||||
- 切换到同一共享上的其他库时,旧会话结束会把临时盘符所有权交给当前租约,避免断开当前路径。关闭应用时为仍打开的原生窗口保留所需盘符。
|
||||
|
||||
## 本机验证
|
||||
|
||||
证据目录:`diagnostics/native-backup-ui-20261104/`(本地诊断目录,不包含原库发布副本)。
|
||||
|
||||
源码实际按钮验证使用自有隔离库 `C:/Temp/CbbTabsRelease20261104/library/mentor_lib.lmc` 的 `1GPHY_8212`,由测试夹具提供 PENDING 清单状态,确认原生 Output 加载同一 PRJ、报告工程未使用、完成备份目录加载,再向该原生空闲窗口发送正常关闭。未点击 Restore/Repair,也未操作原库。详见 `source-acceptance.json`。
|
||||
|
||||
冻结候选包读取真实权威清单时,`1GPHY_8212` 为 READY,其维护入口按规则禁用。随后选择同一隔离库中实际 PENDING 的 `IP101GR`,验证真实 Qt 按钮、原生备份列表加载、正常关闭和应用状态刷新;最终仍为“待校验”,应用正常退出。原生 Output 明确报告该隔离副本的数据库不一致,本轮只验证入口,不点击 Repair/Restore,也不将此报错当作自动修复已通过。记录在 `frozen-acceptance.json`。
|
||||
|
||||
相关功能回归 88 项通过;最终全量回归 **1260 passed**,188.94 秒,退出码 0,1 条既有 pywinauto STA 警告。冻结的 13 个关键 Python 模块及两个 VBS 与源码一致,冻结启动/退出冒烟、Unicode/UNC 协议和包内 x86 运行库加载通过。全量回归、冻结模块一致性和启动冒烟结果分别保存在 `pytest-final.log`、`frozen-result.json`;最终构建记录随包保存到 `BUILD.json`。一次按系统 GBK 模式运行的全量测试因既有测试未指定 UTF-8 读取原生日志而失败,保留 `pytest-locale-failure.log`,最终回归使用 `python -X utf8 -m pytest -q`。
|
||||
|
||||
## 验收边界
|
||||
|
||||
本轮覆盖“应用入口 → 原生备份列表加载 → 用户可操作窗口 → 正常关闭 → 状态刷新”。不自动回退数据,不以本轮打开/关闭试验代替恢复后的保存关闭与 READY 验收。现场失联故障的完整自动修复、Win10 干净系统和跨机共享库并发仍未验收;ICDB 自动修复研究按用户要求暂停。工单和 WIP PR 保持开放。
|
||||
@@ -1,366 +0,0 @@
|
||||
# CBB 中心库上传后校验工具(cbb-refresh-verify-795)全面扫描与阻塞分析
|
||||
|
||||
- **扫描对象**:`https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795`
|
||||
- **默认分支**:`main` @ `39985f7`(`chore: release v0.2.3-beta.1`,2026-10-29)
|
||||
- **活跃分支**:`codex/temp-issue-2-icdb-recovery` @ `29959e2`(2026-11-04 14:16,领先 `main` **49 个提交 / +13,173 行**,未合并、未发布)
|
||||
- **标签**:`r4-stability-20260929`、`v0.2.2-beta.1`、`v0.2.3-beta.1`
|
||||
- **扫描时间**:2026-11-04
|
||||
- **扫描方式**:全量克隆 + 逐模块源码阅读(38 个源文件 / 8,180 行)+ 两个分支完整 pytest + 32 位桥 PE 导入表解析与实机启动 + 关键判定函数行为探针 + 与 `docs/` 现场记录交叉核对
|
||||
|
||||
---
|
||||
|
||||
> 关联工单:<https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/issues/4>
|
||||
>
|
||||
> 扫描基准:`main@39985f7`(v0.2.3-beta.1)、`codex/temp-issue-2-icdb-recovery@29959e2`。
|
||||
> 本文是扫描时的静态与实测记录;修复进展以工单和后续 PR 为准。
|
||||
|
||||
## 0. 一页结论
|
||||
|
||||
1. **单机、Win11、有 32 位状态桥、CBB 无异常** 的条件下,`v0.2.3-beta.1` 的"ReusableCircuit PCB → Project Integration → Save/Close → `IsVerifiedReuseBlock` READY"链路是成立的(发布说明有隔离实机 PASS 记录),工具没有伪造绿色状态,失败即阻塞的设计方向正确。
|
||||
2. **批量场景是这个工具真正的短板**:状态判定依赖外部 32 位桥,但**桥的 x86 VC++/MFC 运行时不随包提供**(本机实测 `0xC0000135` 无法启动);没有桥时工具仍会对每个 CBB 做完整刷新再判 FAIL;叠加"未知弹窗即停批""残留 `sAddress.adr` 即阻断""本机任何 PCB 打开即拒跑",批量任务在现场高概率中途停止。
|
||||
3. **Win10 是明确的未验收边界**:LM 原生菜单在私有桌面上不派发 MFC 命令(`docs/API-FINDINGS.md`),直接 PCB 路线在 Win10 上是否会提交 Verify 状态没有现场证据。
|
||||
4. **共享中心库并发没有真正的互斥**:`main` 只有进程内 `Local\` 命名互斥 + 本机进程探测;另一台机器/另一个工程师同时操作同名 CBB 时无任何防护。活跃分支新增了 sidecar 库锁,但它是"合作式"文件锁,Mentor 本身不参与。
|
||||
5. **ICDB 失联修复尚未闭环**:分支已经做到"原生 Repair → 重开 → 历史版本选择 → 校验 → READY",但文档明确"服务器会话失联经实际按钮触发的完整链路仍需通过",并且出现过"Repair 后 BackAnnotate 被原生拒绝"的失败结论。
|
||||
6. 代码质量整体高于同类现场工具(分层清晰、证据链完整、失败关闭),但存在若干**可复现的功能缺陷**(内容检查文本误判、`.prj` 编码假设、超时后孤儿 worker、save helper 无超时等),详见第 3 节。
|
||||
|
||||
**一句话**:这个工具现在能"证明一个 CBB 是否真的绿",但还不能稳定地"把一批 CBB 刷成绿";阻塞点不在算法,而在**判定链的部署完整性、现场弹窗/占用环境、以及批量的工程化**。
|
||||
|
||||
---
|
||||
|
||||
## 1. 系统定位与运行链路
|
||||
|
||||
### 1.1 定位
|
||||
|
||||
| 项 | 内容 |
|
||||
| --- | --- |
|
||||
| 处理对象 | 已上传到 Mentor 中心库(`.lmc` + `ReusableBlocksLP`)的 CBB 条目 |
|
||||
| 核心动作 | 打开该 CBB 的 ReusableCircuit PCB → Project Integration 四项同步 → 保存 Reusable Block cell → 关闭 → 只读读取权威 Verify 状态 |
|
||||
| 不做什么 | 不做 Part Number 替换、不做上传、不直接改写中心库数据来伪造绿色 |
|
||||
| 成功判据 | `worker` 完成 + 32 位桥 `IsVerifiedReuseBlock` 返回 `READY / raw=1`,二者缺一即 FAIL |
|
||||
|
||||
### 1.2 主链路(`main`)
|
||||
|
||||
```
|
||||
GUI (ui/main_window.py)
|
||||
└─ run_batch (verify_runner.py) # 串行,max_workers=1
|
||||
└─ run_verify # 会话级互斥 Local\CbbRefreshVerify795
|
||||
├─ preflight # Work 下唯一 PRJ / PCBDesignPath / 链接越界
|
||||
├─ unreleased_addresses # sAddress.adr 残留即 BLOCKED
|
||||
├─ ReuseBlockImporter -chkContents # 可选:LibSpec + DMS 登录配置
|
||||
├─ icdb_ports_bindable # 10000-10100 端口预检
|
||||
├─ DesktopWorker (私有桌面) # 32 位桥/弹窗代理同桌面
|
||||
│ └─ execute_job (mentor_adapter.py)
|
||||
│ ├─ 备份(仅本地盘) / CentralLibrary 路径修正
|
||||
│ ├─ ExpeditionPCB.exe <pcb> -ReusableCircuit
|
||||
│ ├─ wait_for_target_document (COM 身份核对)
|
||||
│ ├─ refresh_integration (四项 InSynch)
|
||||
│ └─ cscript save_verified_block.vbs (Validate/Save/IsSaved/Close/Quit)
|
||||
├─ cleanup_verify_processes # 只观察退出,不强杀
|
||||
└─ IsVerifiedReuseBlock (status_bridge.py) → READY / PENDING / UNAVAILABLE
|
||||
```
|
||||
|
||||
对话框监督是一条独立链路:`DesktopWorker` 在私有桌面启动 `--dialog-agent` 伴生进程,agent 用 Win32 + UIA 抓窗口快照,`dialog_supervisor` 按 `assets/dialog_rules.v1.json` 的**阶段化白名单规则**决策,通过 JSONL loopback IPC 回传。
|
||||
|
||||
### 1.3 每次校验的产物
|
||||
|
||||
`evidence/verify-*/`:`result.json`、`events.jsonl`、`dialogs.jsonl`、`save.log`、`performance.json`、`bridge-status.json`、`diagnostics/`(preflight、native-logs、icdb-recovery)、失败时的 `recovery-required.json`。
|
||||
|
||||
### 1.4 现场自述的验证状态(文档)
|
||||
|
||||
- `v0.2.3-beta.1`:`pytest` 471 passed;EE7.9.5 隔离实测"破坏 ICDB 文件头 → 备份恢复 → 重新打开 → PASS/GREEN/READY"。
|
||||
- 明确未验收:Win10、真实网络库大批量、现场 ICDB 失联的自动 Repair 全链路。
|
||||
- 旧批次 68 项中 51 PASS / 17 FAIL,失败类型已在 `docs/2026-09-29-stability-r4.md` 分类。
|
||||
|
||||
---
|
||||
|
||||
## 2. 规模与结构
|
||||
|
||||
| 指标 | main | temp-issue-2 分支 |
|
||||
| --- | --- | --- |
|
||||
| 提交数(相对 main) | — | +49 |
|
||||
| 源文件 / 行数 | 38 / 8,180 | 47 / 约 13,000+ |
|
||||
| 测试文件 / 行数 | 35 / 5,752 | 约 50 / 9,000+ |
|
||||
| 测试用例 | 471 | 1,196 |
|
||||
| 本机 pytest 结果 | **463 passed / 8 failed** | **1,178 passed / 18 failed** |
|
||||
| Python / 依赖 | 3.12 + PySide6 6.11 + pywin32 + pywinauto + Pillow | 同 main |
|
||||
| 打包 | PyInstaller onedir(`CbbRefreshVerify-Background`) | 同 main |
|
||||
|
||||
> 本机失败均与环境有关(未完成 `pip install -e .`、无 Mentor 安装、缺 x86 VC 运行时、长路径/编码),不是断言暴露的产品逻辑失败。具体归类见第 7 节。
|
||||
|
||||
---
|
||||
|
||||
## 3. 功能性问题清单
|
||||
|
||||
严重度:**P0** 阻塞交付 / 数据安全风险;**P1** 现场高概率失败或明显功能缺陷;**P2** 可用性、可维护性、规模化问题。
|
||||
|
||||
### 3.1 判定链与证据
|
||||
|
||||
| 编号 | 严重度 | 问题 | 代码证据 | 影响 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| **F-01** | P0 | **状态桥不可用时仍执行完整刷新,最后才判 FAIL**。批量入口不检查桥是否可用;桥只在 worker 成功后才查询 | `verify_runner.py:981-1000`;UI 读库 `ui/main_window.py:63-68`;`batch_status.authoritative_status_map` 失败只返回 `UNAVAILABLE` | 每个 CBB 白做 2-10 分钟原生刷新 + 一次 Save/Close,然后 `BRIDGE_UNAVAILABLE`;3000 项批量等于 3000 次无效写库 |
|
||||
| **F-02** | P0 | **32 位状态桥依赖 x86 `mfc140/MSVCP140/VCRUNTIME140`,打包清单只带 exe、未声明或检测该运行时**。本机 SysWOW64 无 x86 运行时,桥启动即 `0xC0000135`(发布 ZIP 不在仓库中,需在发布包上复核是否另行分发) | `packaging/CbbRefreshVerify.spec:4-14` 仅 `binaries=[CbbStatusBridge32.exe]`;PE 导入表实测:`KERNEL32, mfc140, MSVCP140, VCRUNTIME140, api-ms-win-crt-*` | 未额外安装 VC++ 2015-2022 x86 运行时的机器,桥永远不可用 → 所有项最终 FAIL |
|
||||
| **F-03** | P1 | 内容检查结果用正则 `failed\|error\|cannot connect\|bad data` 判失败,**"0 errors"、路径含 `error` 也会判 FAIL** | `verify_runner.py:30-31, 128-141`;本机实测 `classify_output(0, "...successfully! 0 errors...") == 'FAIL'` | 内容检查偶发误报阻断,且现场难以看出是文本匹配导致 |
|
||||
| **F-04** | P1 | `preflight` 用 `read_text(encoding='utf-8', errors='replace')` 解析 `.prj`;UTF-16/ANSI 工程会读不到 `PCBDesignPath` → 误判"工程没有 PCBDesignPath" | `verify_runner.py:157-161`;对照 `backup_recovery._project_text`(`backup_recovery.py:129-136`)已正确区分 UTF-16/UTF-8/mbcs | 老工程/修复后工程被预检直接判 BLOCKED,且看起来像"工程数据坏了" |
|
||||
| **F-05** | P1 | 内容检查报告写入**中心库目录** `LogFiles/`;写失败只拼进局部 `stderr`,PASS 路径下该信息被丢弃 | `verify_runner.py:688-693` | 只读共享/权限不足时无任何提示;中心库额外产生日志文件 |
|
||||
| **F-06** | P2 | 备份只在 PASS 且 `safe_to_continue` 时清理;失败项 `backup/`(可能数 GB)永久保留,无保留策略 | `verify_runner.py:641-651`;`mentor_adapter.cleanup_evidence_backup` | 长时间批量后磁盘被失败证据占满 |
|
||||
|
||||
### 3.2 现场自动化(弹窗 / 桌面 / 进程)
|
||||
|
||||
| 编号 | 严重度 | 问题 | 代码证据 | 影响 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| **F-07** | P0 | **任何不在白名单里的弹窗 = `UNKNOWN_DIALOG` = 当前项 FAIL + 整批停止**。规则要求精确英文文本、`GXWND`+`Button` 类名 | `dialog_rules.py:216-236`、`188-236`;`dialog_supervisor.py:458-471` | Mentor 版本/语言/主题差异、任何新提示("Reusable block already exists""license checkout failed"…)都会中断整批;现场 6 项 IME 语言栏误判即此类 |
|
||||
| **F-08** | P1 | 弹窗代理客户端**每请求 2 秒超时**,而 agent 端 `capture()` 最坏为"N 个窗口 × 0.75s UIA + 子控件枚举";UIA 探测超时后线程泄漏继续跑 | `dialog_agent.py:383-388`(默认 2.0s)、`dialog_probe.py:37-44, 242` | 机器繁忙/窗口多时 `DIALOG_PROTOCOL_TIMEOUT` 被当成致命错误;泄漏的 STA 线程与主探测并发调用 UIA,进一步拖慢 |
|
||||
| **F-09** | P1 | **Win10 私有桌面上 UIA `InvokePattern` 只关闭原生菜单、不派发 MFC 命令**;`native_lm_verify` 默认关闭,只有显式勾选才走菜单路线 | `docs/API-FINDINGS.md` §7、README「Win10/Win11 兼容性边界」;`verify_runner.py:466-470` | Win10 现场两条路线都不保证成功;目前只能以"Win11 已验证"交付 |
|
||||
| **F-10** | P1 | **本机只要有任何 `ExpeditionPCB.exe` 在跑就拒绝校验**(即使与本 CBB 无关) | `mentor_adapter.py:619-621` | 工程师日常开着 PCB 时无法点击校验;现场"先关掉所有 PCB"成为隐性前置条件 |
|
||||
| **F-11** | P1 | `sAddress.adr` 任一残留即 `ICDB_SESSION_UNCONFIRMED` 阻断;正常/异常退出后残留都要人工处理 | `icdb_ownership.py:13-16`;`mentor_adapter.py:644-650`;`verify_runner.py:661-670` | 一次现场崩溃会让后续每次校验都失败,且错误信息指向"未释放",与真实原因(陈旧文件)难区分 |
|
||||
| **F-12** | P1 | save helper 轮询循环**无超时、无取消检查**;helper 卡在 `doc.Save()` 时 worker 只能等监督器 600s 空闲超时 | `mentor_adapter.py:794-816` | 网络库/许可异常时单次长时间挂起;超时后 helper 仍可能继续写 |
|
||||
| **F-13** | P0 | **超时/取消只"请求停止"(touch 取消文件),不终止 worker**;worker 只在启动前、PCB 启动循环、保存前 3 处检查取消 | `desktop_worker.py:149-157`;`mentor_adapter.py:684-689, 744-746, 787-789`;`verify_runner.py:892-903` | 监督器已返回 TIMEOUT/FAIL 并释放互斥;worker 仍可能在随后的几秒内完成 Save/Close。若清理时恰好观察到 PCB 已退出,会判定 `safe_to_continue=True` 并启动下一项,而上一项仍可能有迟到的原生写入 |
|
||||
| **F-14** | P1 | supervisor 崩溃看门狗在 `cancel_path` 存在时(**生产总是存在**)只写取消文件然后返回,**不退出 worker**;只有 `cancel_path=None` 才 `os._exit(75)` | `desktop_worker.py:34-52`;`verify_runner.py:724` 恒写入 `cancel_signal` | 与 F-13 叠加:父进程崩溃后可能留下无监督的自动化进程继续写库 |
|
||||
|
||||
### 3.3 数据、权限与边界
|
||||
|
||||
| 编号 | 严重度 | 问题 | 代码证据 | 影响 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| **F-15** | P1 | 工具会**改写中心库内 `PCB/pcb.prj` 的 `CentralLibrary`**;修改前只在本次证据目录留单文件副本,网络库不做整工程备份 | `mentor_adapter.py:93-162, 707-712`;README 第 22 行亦承认 | 现场(网络中心库)没有可回退的工程副本;与 README「不允许直接改写中心库 .prj」的表述冲突 |
|
||||
| **F-16** | P2 | `Work` 下 `.prj` 不唯一即预检跳过;修复/导入后残留的备份 PRJ 会被当作"无法唯一确定" | `verify_runner.py:152-155`;`preflight_skip_reason` | 条目被静默跳过(黄行),用户以为已校验 |
|
||||
| **F-17** | P2 | Cert 完全不参与判定(设计取舍),但也没有"保存成功但未提交"的独立证据维度 | `verify_runner.py:313-330`;`collect_cert_evidence` 仅记路径 | 只能靠桥区分 PASS/PENDING;桥抖动时无法自证 |
|
||||
| **F-18** | P2 | 备份策略:网络盘直接跳过递归备份(`backup_skipped`),本地盘 3-30s 预算 | `mentor_adapter.py:632-640, 399-453` | 现场中心库基本都在网络盘 → 实际上没有前置备份 |
|
||||
|
||||
### 3.4 性能与规模化
|
||||
|
||||
| 编号 | 严重度 | 问题 | 代码证据 | 影响 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| **F-19** | P1 | 每次"读取 CBB"都会:整文件 SHA-256 `.lmc` + 顶层目录指纹 + 逐 CBB 桥查询 + **逐 CBB `preflight_skip_reason`(网络 stat/glob/读 PRJ)** | `batch_status.py:95-122, 194-197`;`ui/main_window.py:257-263` | 3000 项网络库首屏可能数分钟到数十分钟;期间只有一个"正在读取中心库…"标签,无进度、不可取消 |
|
||||
| **F-20** | P1 | 批量无进度条(仅全库 ICDB 模式有)、**不能取消当前项**(只能"当前项完成后停止")、崩溃后队列不持久化、不续跑 | `ui/main_window.py:417-454, 547-548`;`run_batch` 只在项间检查 stop | 长批次一旦中断只能从头再来;现场无法预估剩余时间 |
|
||||
| **F-21** | P2 | 每次桥查询(单条路径)都新起一个 32 位进程;批量依赖常驻 `--server`,桥崩溃后整段剩余项直接标 UNAVAILABLE | `status_bridge.py:141-203, 206-332`;`batch_status.py:258-270` | 单条校验慢;桥异常时"剩余全部不可用",无法只重试当前项 |
|
||||
| **F-22** | P2 | 多处 0.2s 轮询叠加 WMI 查询(`Win32_Process` 每次约 50-200ms)、integration 每次 `native_error()` 读 3 个原生日志 | `mentor_adapter.py:744-761, 800-809`;`integration.py:33-39`;`post_verify_diagnostics.py:32-39` | CPU/网络 I/O 放大;网络日志读取可能反过来拖慢原生操作 |
|
||||
|
||||
### 3.5 工程性 / 可维护性
|
||||
|
||||
| 编号 | 严重度 | 问题 | 证据 |
|
||||
| --- | --- | --- | --- |
|
||||
| **F-23** | P2 | 38 个源文件里 **102 处** `except Exception`/裸 `except`,大量 `except: pass`;故障常被降级成 `UNKNOWN/FAIL`,根因只留在日志 | 静态统计 |
|
||||
| **F-24** | P2 | GUI/CLI 顶层异常只 `return 1`,不打对话框、不打印到控制台;批处理用户只看到退出码 | `application.py:134` |
|
||||
| **F-25** | P2 | 无 CI 配置、无 lint/类型检查、无 LICENSE/CHANGELOG;300KB 二进制入库;`.gitattributes` 全量 `-text` | 仓库根目录 |
|
||||
| **F-26** | P2 | 测试依赖"本机已 `pip install -e .` + 已装 Mentor + 有 x86 运行时",新克隆机器直接 pytest 会有 8 项环境失败 | 第 7 节 |
|
||||
| **F-27** | P2 | 分支 49 个提交、+13k 行,`pyproject.toml` 版本仍是 `0.2.3b1`,候选包与正式包同版本号 | `pyproject.toml:6`(两分支相同) |
|
||||
|
||||
---
|
||||
|
||||
## 4. 阻塞点划分(任务视角)
|
||||
|
||||
把"阻塞"分成三类,避免把平台限制、工程缺陷、规模问题混在一起:
|
||||
|
||||
- **K1 平台/产品硬约束**:Mentor/Windows 决定,改代码无法消除,只能绕行、限定验收范围或推动替代方案。
|
||||
- **K2 交付阻塞**:团队可修,但当前版本不满足"可交付/可批量"的最低条件。
|
||||
- **K3 规模化阻塞**:单机少量可用,上批量/上团队前必须解决。
|
||||
|
||||
### 4.1 阻塞点总表
|
||||
|
||||
| 编号 | 阻塞点 | 类型 | 证据 | 受影响任务 | 解除条件 | 优先级 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| **K1-1** | Library Manager 没有公开的 CBB `Verify()` COM 方法,只有内部 32 位导出 | K1 | `docs/API-FINDINGS.md` §3;`LibraryManager.tlb` 审计 | 所有"编程触发 Verify"的路线 | 接受"只读判定 + ReusableCircuit 刷新"路线,或继续 ABI 研究 | — |
|
||||
| **K1-2** | 状态判定只能靠 32 位 MFC ABI 桥,64 位 Python 不能直连 | K1 | `docs/API-FINDINGS.md` §3、§9 | 状态读取 | 保持独立 x86 桥(现状) | — |
|
||||
| **K1-3** | 私有桌面上 LM 原生菜单不派发(Win10 UIA),`SwitchDesktop` 在本机不可用 | K1 | `docs/API-FINDINGS.md` §7 | Win10 现场 | 现场 Windows 10 真机验收;或限定仅 Win11 | — |
|
||||
| **K1-4** | iCDB 服务器端口必须落在 10000–10100,可能被 Hyper-V/WSL 保留 | K1 | `mentor_adapter.py:978-1082`;文档 §8 | 所有 PCB 启动 | 管理员 `net stop winnat && net start winnat`(工具已给提示) | — |
|
||||
| **K1-5** | Mentor 对"已验证工程"禁止 BackAnnotate;共享符号库没有 PRJ 入口 | K1 | 工单 #2 文档、`integration.py:93-100` | 已绿工程复检、共享库修复 | 按原生限制记录为"已同步/不支持",或人工处理 | — |
|
||||
| **K2-1** | **桥不可用(缺 x86 运行时 / 未打包 / 路径找不到)仍可启动批量** | K2 | F-01、F-02 | 全部批量 | 打包 `VC_redist.x86` 或 `/MT` 静态链接;启动自检;无桥禁止批量 | **P0** |
|
||||
| **K2-2** | **未知弹窗即停批**,白名单覆盖不了现场提示 | K2 | F-07 | 批量、Win10 | 规则分级(致命/可确认/仅记录)、未知弹窗可配置停机或继续并留证 | **P0** |
|
||||
| **K2-3** | **超时/取消不终止 worker,孤儿进程可能继续写库** | K2 | F-13、F-14 | 数据安全、连续批量 | 明确"取消=停自动化客户端、保留原生会话"的边界;对 worker 进程做可验证的终止/对账;看门狗在崩溃时真正退出 | **P0** |
|
||||
| **K2-4** | 共享中心库无跨机互斥;`main` 只有进程内互斥 + 本机 PCB 探测 | K2 | `verify_runner.py:504-547, 742-746`;分支 `library_lock.py` | 多人/多机使用 | 合并分支库锁并让上传工具/Mentor 侧协同;或规定"单人独占窗口" | **P1** |
|
||||
| **K2-5** | 残留 `sAddress.adr` 永久阻断;本机任意 PCB 打开即拒跑 | K2 | F-10、F-11 | 日常使用 | 区分"陈旧地址文件"与"活会话"(探测可达性已具备,但策略过严);PCB 占用按 CBB/工程匹配而非全局 | **P1** |
|
||||
| **K2-6** | ICDB 失联的自动 Repair 全链路未验收;Repair 后 BackAnnotate 被拒 | K2(分支) | `docs/releases/2026-11-03-field-feedback.md`、`2026-11-04-icdb-review-fixes.md` | 库损坏恢复、全库维护 | 现场真实失联库端到端验收;修复后重开/保存/READY 全绿 | **P0(分支)** |
|
||||
| **K2-7** | Win10 未验证,且没有可用的菜单触发兜底 | K2 | F-09 | Win10 现场 | Win10 真机单 CBB 验收,或书面限定 Win11 | **P1** |
|
||||
| **K2-8** | 内容检查文本误判 + `.prj` 编码假设 | K2 | F-03、F-04 | 启用内容检查的批次 | 修正解析/判定,补回归 | **P1** |
|
||||
| **K3-1** | 首屏扫描 O(全库) + 逐 CBB 预检,无进度/不可取消 | K3 | F-19 | 3000 项批量 | 增量扫描、缓存指纹、预检并行/惰性、进度条 | **P1** |
|
||||
| **K3-2** | 队列不持久化、不能取消当前项、无断点续跑 | K3 | F-20 | 长批次 | 队列清单落盘 + 逐项检查点 + 取消当前项 | **P1** |
|
||||
| **K3-3** | 失败证据/备份无上限 | K3 | F-06 | 长期运行 | 证据保留策略(按天/按大小) | **P2** |
|
||||
| **K3-4** | 质量门禁缺失(无 CI、版本号不变、环境耦合) | K3 | F-25、F-26、F-27 | 发布/回归 | CI(无 Mentor 的 mock 层 + 一台 Mentor 自托管 runner)、版本号规范 | **P2** |
|
||||
|
||||
### 4.2 任务可达性矩阵
|
||||
|
||||
| 任务场景 | 结论 | 关键阻塞 |
|
||||
| --- | --- | --- |
|
||||
| 单 CBB,Win11,本地/网络库,桥可用,无人占用 | ✅ **可用**(有隔离实机 PASS 记录) | 无 |
|
||||
| 单 CBB,桥不可用/未装 x86 运行时 | ⛔ **必然 FAIL** | K2-1 |
|
||||
| 小批量(10–50),工作时段 | ⚠️ **可用但易中断** | K2-2、K2-5、F-12 |
|
||||
| 大批量(数百–3000) | ⛔ **时间与稳定性不可接受** | K3-1、K3-2、K2-2 |
|
||||
| Win10 现场 | ⛔ **未验收** | K2-7、K1-3 |
|
||||
| 共享中心库多人同时操作 | ⛔ `main` 无锁;分支为合作式锁 | K2-4 |
|
||||
| 库损坏/ICDB 失联恢复 | ⚠️ 诊断与手动路径可用;自动 Repair 未闭环 | K2-6 |
|
||||
| 无 Mentor 的开发机 | ✅ 仅单元测试(需先装包) | F-26 |
|
||||
|
||||
### 4.3 建议的解除顺序
|
||||
|
||||
1. **先让"批量的失败是可信且廉价的"**:桥预检 + 打包运行时(K2-1)→ 不做无用刷新。
|
||||
2. **再让"批量的中断可控"**:弹窗分级(K2-2)、取消/超时语义(K2-3)、占用与残留地址策略(K2-5)。
|
||||
3. **然后才谈规模化**:增量扫描、进度、续跑(K3-1、K3-2)。
|
||||
4. **平台边界单独验收**:Win10(K2-7)、共享库并发(K2-4)、ICDB 修复闭环(K2-6)。
|
||||
|
||||
---
|
||||
|
||||
## 5. 现场失败模式 → 代码根因映射
|
||||
|
||||
| 现场现象(文档) | 代码根因 | 对应问题 |
|
||||
| --- | --- | --- |
|
||||
| 6 项 `UNKNOWN_DIALOG: TF_FloatingLangBar_WndTitle` | IME 语言栏过滤条件过窄(类名+标题+无控件同时满足) | F-07 |
|
||||
| `TUNER_R836` Save/Close 后桥返回 PENDING | 桥判定 + Verify 未提交;或原生 BackAnnotate 被拒 | F-17、K1-5 |
|
||||
| `TUNER_R836_A` 数据库打开失败被记 UNKNOWN_DIALOG | 早期靠文本分类;现走规则白名单 | F-07 |
|
||||
| `1GPHY_8211` 打开时失联 → 后续 Repair `REPAIR_DATABASE_IN_USE` | 失败打开的 PCB 未被关闭(分支已修:启动失败关闭路径) | K2-6 |
|
||||
| 5 项 Project Integration 符号错误 | 工程/符号数据问题,工具只负责分类与留证 | — |
|
||||
| 3 项 JobPrefs / 本地 Cell Library 失败 | 环境/工程状态;工具仅诊断不修复 | — |
|
||||
| 端口 10000-10100 被保留 | `WinError 10013`,Hyper-V/WSL 动态预留 | K1-4 |
|
||||
| 桥 UNAVAILABLE 但报告"四绿"风险 | 已被 fail-closed 设计排除(不会伪造 READY) | — |
|
||||
|
||||
---
|
||||
|
||||
## 6. 活跃分支现状(`codex/temp-issue-2-icdb-recovery`)
|
||||
|
||||
### 6.1 新增能力(相对 main)
|
||||
|
||||
- 库锁与占用探测:`library_lock.py`、`owner_probe.py`、`native_occupancy.py`(与上传工具兼容的 `.cbb-upload.lock` / `.blocked.json` 协议)。
|
||||
- CBB 管理:`management.py`、`native_management.py`、`management_transaction.py`、`native_engineering_identity.py`、`native_export_guard.py`(新增/同名替换/移除、身份与导出副本保护)。
|
||||
- 恢复:`reimport_recovery.py`、`scoped_manifest.py`、`post_repair_consent.py`、`pcb_restore_prompt.py`、`maintenance_entry.py`(库外完整工程副本恢复、历史 PCB 版本选择)。
|
||||
- 策略调整:取消应用自动备份,改为**弹窗提醒手动备份**(`docs/releases/2026-11-03-manual-backup.md`)。
|
||||
- 启动失败关闭:`failed_session.py` 扩展为"预检失败/数据库打开失败也协作关闭 PCB"。
|
||||
|
||||
### 6.2 本机验证结果
|
||||
|
||||
- 1,178 passed / 18 failed;其中 8 项与 main 同因(环境),新增失败集中在:
|
||||
- **长路径**(`native_add_failures` 两个用例,150 字符目录名 → Windows `MAX_PATH`);
|
||||
- **owner probe 依赖安装**(`native_export_guard` 6 个用例:子进程 `-m cbb_refresh_verify` 不可用);
|
||||
- **编码**(`native_repair` 一个用例按 cp1252 解码失败);
|
||||
- **无 Mentor 安装**(`native_repair` 取消用例)。
|
||||
|
||||
### 6.3 分支仍未满足的门槛(文档自述)
|
||||
|
||||
- 服务器会话失联 → 实际按钮触发 → 自动 Repair → 重开 → 保存关闭 → READY 的**完整链路未验收**。
|
||||
- `1GPHY_8212` 原生 Repair 后 **BackAnnotate 仍被拒**,结论未变。
|
||||
- Windows 10 未验证(当前实机 Win11 / EE7.9.5)。
|
||||
- 历史 PCB 版本恢复记为 `RESTORED_REVIEW_REQUIRED`,**不等于无损修复**。
|
||||
- 目标缺 `PartsDB` 分区时无法完成完整校验。
|
||||
- 共享符号库不支持自动修复。
|
||||
- 版本号未递增、分支未合并。
|
||||
|
||||
> 结论:分支在"管理 + 恢复"上补齐了很多能力,但**没有解除 K2-6(ICDB 自动修复闭环)和 K2-7(Win10)**;同时引入了新的环境敏感性(长路径、owner probe 子进程、编码)。
|
||||
|
||||
---
|
||||
|
||||
## 7. 测试与质量评估
|
||||
|
||||
### 7.1 本机结果
|
||||
|
||||
```
|
||||
main: 463 passed, 8 failed, 1 warning, 37.09s
|
||||
branch: 1,178 passed, 18 failed, 1 warning, 92.29s
|
||||
```
|
||||
|
||||
main 的 8 项失败归因:
|
||||
|
||||
| 失败 | 原因 |
|
||||
| --- | --- |
|
||||
| `test_application`(2 项)、`test_abnormal_shutdown`、`test_extended_safety`、`test_failure_lifecycle`(共 5 项) | 子进程 `python -m cbb_refresh_verify` 依赖 `pip install -e .`,本机安装未完成 |
|
||||
| `test_native_repair::test_repair_cancellation...`、`test_verify_runner::test_pcb_launch...` | 本机无 `D:\Mentor\7.9.5EE` 安装 |
|
||||
| `test_packaging_status_bridge::test_compiled_bridge...` | 缺 x86 VC/MFC 运行时,`0xC0000135` |
|
||||
|
||||
### 7.2 覆盖情况
|
||||
|
||||
**做得好的**:状态判定(PASS 只能来自桥 READY)、对话框规则/后置条件、ICDB 日志新鲜度、备份/恢复、进程释放、UI 交互都有大量单测,且测试直接编码了"不得伪造绿色"的安全契约。
|
||||
|
||||
**缺口**:
|
||||
- 没有真实 Mentor 的集成测试(全部依赖 fake COM/进程边界);
|
||||
- 没有 Win10 测试矩阵;
|
||||
- 没有网络库并发/多人场景;
|
||||
- 没有长时间稳定性与性能回归(600s 空闲超时、3000 项批量);
|
||||
- 测试与"本机安装 + 本机 Mentor 路径"耦合,换机即红;
|
||||
- 无 CI,测试结果靠人工粘贴进 release note。
|
||||
|
||||
### 7.3 代码静态指标
|
||||
|
||||
- 38 个源文件 / 8,180 行;**102 处**宽泛异常捕获;15 处 `time.sleep`;15 处 subprocess 调用。
|
||||
- 硬编码 `D:\Mentor\7.9.5EE\SDD_HOME` 兜底 5 处(可作为默认,但需在 UI/日志里明确"发现失败")。新机器上会静默落到不存在的路径,报错信息偏底层。
|
||||
|
||||
---
|
||||
|
||||
## 8. 修复路线图(建议)
|
||||
|
||||
### P0(1–3 天,先让批量"失败得正确")
|
||||
|
||||
1. **桥部署闭环**
|
||||
- 打包 `VC_redist.x86.exe`(或桥改 `/MT` 静态链接),安装脚本检测/安装;
|
||||
- 启动时执行一次桥自检(`--codec-test` 或空查询),失败则禁用"批量校验"并给出可操作提示;
|
||||
- `read_library_fast` 返回 `UNAVAILABLE` 时,UI 明确"无法判定绿色,批量将全部失败",不静默入队。
|
||||
- 验收:干净 Win11 + 无 VC 运行时 → 工具提示安装而不是跑 3000 次无效刷新。
|
||||
|
||||
2. **未知弹窗分级**
|
||||
- 规则增加 `on_unknown: stop | record_continue | block_item`;
|
||||
- 默认对"无按钮/纯文本/IME/浏览器宿主"仅记录,对"数据库恢复/许可/保存失败"阻断;
|
||||
- 每次未知弹窗都落 `dialogs.jsonl` + 截图证据,批量结束汇总"待人工确认弹窗"。
|
||||
- 验收:新增一个未登记弹窗的模拟场景,批量不中断且证据可查。
|
||||
|
||||
3. **取消/超时语义**
|
||||
- 明确"取消 = 停止自动化客户端,保留原生会话";对 worker 增加强制终止开关(仅在未进入 Save 阶段可用);
|
||||
- 看门狗在 supervisor 退出时按"是否处于 Save/Close"决定终止或保留,并落 `watchdog-decision.json`;
|
||||
- `run_verify` 在 worker 未确认退出时不得释放互斥、不得继续下一项(当前已部分满足,需把"进程仍活"纳入 `safe_to_continue`)。
|
||||
- 验收:模拟 Save 卡死 → 工具超时后 worker 确实退出或明确标记"仍活",下一项不启动。
|
||||
|
||||
### P1(1–2 周,现场可用性)
|
||||
|
||||
4. 弹窗代理超时预算与 `capture()` 并发控制(F-08);UIA 探测改为按进程白名单 + 单窗口超时,禁止泄漏线程。
|
||||
5. 占用/残留策略(F-10、F-11):PCB 占用按 CBB 路径匹配;`sAddress.adr` 增加"不可达 + 非本机进程 + 超时"三条件判定为陈旧并可清理(需用户确认)。
|
||||
6. 内容检查判定(F-03)与 `.prj` 编码(F-04)。
|
||||
7. 中心库写入保护(F-15):改写 `pcb.prj` 前做整文件副本 + 变更清单,网络库至少保留原文件并可一键回滚。
|
||||
8. 合并分支库锁(K2-4),并与上传工具约定锁协议。
|
||||
|
||||
### P2(2–4 周,规模化)
|
||||
|
||||
9. 增量扫描/指纹缓存、预检惰性化、进度条、取消当前项、队列持久化与续跑(F-19、F-20)。
|
||||
10. 证据保留策略与磁盘配额(F-06)。
|
||||
11. CI:mock 层全量测试 + 一台 Mentor 自托管 runner 做冒烟;版本号规范(`0.2.3b1+candidate.49`)。
|
||||
12. 清理宽泛异常,至少在关键路径保留 `error_code` 与原始异常链(F-23)。
|
||||
|
||||
---
|
||||
|
||||
## 9. 附:关键证据索引
|
||||
|
||||
| 主题 | 文件:行 |
|
||||
| --- | --- |
|
||||
| 成功判据(桥 READY) | `src/cbb_refresh_verify/verify_runner.py:313-330, 981-1000` |
|
||||
| 内容检查判定 | `src/cbb_refresh_verify/verify_runner.py:30-31, 128-141` |
|
||||
| 预检(PRJ/PCB/链接) | `src/cbb_refresh_verify/verify_runner.py:144-174` |
|
||||
| 端口预检 | `src/cbb_refresh_verify/mentor_adapter.py:1061-1082` |
|
||||
| 数据库地址阻断 | `src/cbb_refresh_verify/icdb_ownership.py:13-16` |
|
||||
| PCB 全局占用检查 | `src/cbb_refresh_verify/mentor_adapter.py:619-621` |
|
||||
| CentralLibrary 改写 | `src/cbb_refresh_verify/mentor_adapter.py:93-162, 707-712` |
|
||||
| save helper 循环 | `src/cbb_refresh_verify/mentor_adapter.py:790-816` |
|
||||
| 取消信号 | `src/cbb_refresh_verify/desktop_worker.py:149-157`;`mentor_adapter.py:684-689, 744-746, 787-789` |
|
||||
| 看门狗 | `src/cbb_refresh_verify/desktop_worker.py:25-56` |
|
||||
| 弹窗规则 | `src/cbb_refresh_verify/dialog_rules.py:188-236`;`assets/dialog_rules.v1.json` |
|
||||
| 弹窗代理超时 | `src/cbb_refresh_verify/dialog_agent.py:383-388`;`dialog_probe.py:37-44, 242` |
|
||||
| 状态桥 | `src/cbb_refresh_verify/status_bridge.py:115-203, 206-332` |
|
||||
| 批量状态扫描 | `src/cbb_refresh_verify/batch_status.py:95-122, 184-277` |
|
||||
| UI 读库/队列 | `src/cbb_refresh_verify/ui/main_window.py:225-335, 417-548` |
|
||||
| 打包清单 | `packaging/CbbRefreshVerify.spec:4-25` |
|
||||
| 分支库锁 | `src/cbb_refresh_verify/library_lock.py:80-200`(分支) |
|
||||
|
||||
### 复现命令
|
||||
|
||||
```powershell
|
||||
git clone https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795.git
|
||||
cd cbb-refresh-verify-795
|
||||
python -m pip install -e .
|
||||
python -m pip install pytest pytest-qt
|
||||
python -m pytest -q # main: 463 passed / 8 failed(本机环境)
|
||||
git worktree add ..\cbb-branch origin/codex/temp-issue-2-icdb-recovery
|
||||
cd ..\cbb-branch; python -m pytest -q # branch: 1178 passed / 18 failed(本机环境)
|
||||
```
|
||||
|
||||
桥依赖验证:
|
||||
|
||||
```powershell
|
||||
# 1) 导入表:KERNEL32 / mfc140 / MSVCP140 / VCRUNTIME140 / api-ms-win-crt-*
|
||||
dumpbin /dependents .\tools\status_bridge\bin\CbbStatusBridge32.exe
|
||||
|
||||
# 2) 实机启动:缺 x86 运行时时的退出码 -1073741515 (0xC0000135)
|
||||
.\tools\status_bridge\bin\CbbStatusBridge32.exe --codec-test
|
||||
```
|
||||
@@ -0,0 +1,32 @@
|
||||
# 按本次工程启动错误决定 ICDB 维护
|
||||
|
||||
## 问题
|
||||
|
||||
旧的显式维护入口对 `maintenance=True` 恒定返回“需要维护”,所有可见非 READY 候选都先进入 Project Backup 检查。虽然 Repair 仍要求原生检查明确报告故障,这一流程没有先确认 PCB 是否实际打不开,也会让健康工程进入维护环境和占用检查。
|
||||
|
||||
非 READY 表示未通过 CBB 校验,不能作为 ICDB 损坏证据;普通服务器、授权、COM、路径及内容错误也不能据此转换成 ICDB 修复。
|
||||
|
||||
## 调整后的流程
|
||||
|
||||
1. 维护按钮保持针对可见非 READY 候选。每项先通过既有 `diagnostic_only` 路径实际打开所选 PCB:核对工程/中心库身份,不改工程路径、不执行集成、不保存、不提交 Cert、不运行普通 CBB 校验。
|
||||
2. 同一工程正常打开并确认会话释放后返回 CHECKED,备注为“无需 ICDB 修复”,不启动 Project Backup,不推定 READY。
|
||||
3. 普通失败保留原状态和原始错误。没有完整 ICDB 原生失联特征、数据库路径或会话信息时,不进入维护。历史地址、协调检查点或旧诊断文件不代替本轮启动证据。
|
||||
4. 仅本轮诊断 FAIL、会话已释放,且失联报错数据库属于当前工程时进入原生维护。共享库、其他工程、未知目标、超时及取消结果不自动修复当前 CBB。
|
||||
5. 原生维护取得锁及工程证明后,再核对目标必须与本次报错数据库相同。原生检查仍需确认空闲且明确要求修复,才调用既有单次 Repair 路径。目标不一致时不启动原生工具,不因已释放的单项错误阻塞其他独立 CBB。
|
||||
6. 诊断在文档身份确认后和关闭完成后各复查本轮日志,避免延迟写入的启动错误被误判为健康。日志沿用启动前基线和增量判定,不从历史日志猜测故障。
|
||||
|
||||
普通“检验”按钮继续独立执行,不要求先通过 ICDB 维护;手动“版本历史与备份…”继续直接进入可见原生窗口,由用户选择版本。此修改只调整维护触发条件,不宣称修复了原生 Repair 内部失败。
|
||||
|
||||
## 测试与边界
|
||||
|
||||
先新增回归测试,在旧代码上验证健康工程及普通错误仍会进入 Project Backup 的失败,再实现入口修正。测试覆盖完整失联特征、无会话/只含错误码、共享库/其他工程、目标变化、正常打开、未释放、超时、取消、旧诊断文件、日志写入失败和延迟启动错误。
|
||||
|
||||
关联回归 151 项通过,后续新增的报告失败及等价路径用例纳入最终回归;维护入口专项最终 21 项通过。最终全量 **1283 passed**,643.89 秒,退出码 0,1 条既有 pywinauto STA 警告。编译和差异检查通过,冻结的 13 个关键 Python 模块及两个 VBS 与源码一致,启动/正常退出、Unicode/UNC 编解码和包内 x86 运行库加载通过。
|
||||
|
||||
独立静态审查发现目标的字面路径比较可能误拒绝映射盘与 UNC 身份,已改为比较两边解析后的工程及数据库路径,实际原生启动路径保持不变;等价路径回归先失败后通过。真实网络共享与 Win10 验收仍保留。复审无剩余必要 P1/P2。
|
||||
|
||||
关联回归、全量回归、构建与冻结检查保存在 `diagnostics/icdb-startup-gate-20261104/`,最终测试包的 `BUILD.json` 记录实际执行结果及源码哈希。
|
||||
|
||||
最终冻结包通过实际按钮在自有隔离库的 PENDING `IP101GR` 上再次打开手动备份列表、正常关闭并刷新为“待校验”,应用正常退出。没有点击 Repair/Restore;该试验用于确认手动入口独立性,不作为新的启动诊断或自动修复实机验收。
|
||||
|
||||
本轮不对原中心库执行 Repair/Restore,不以模拟诊断或隔离副本备份窗口打开成功代替现场自动修复验收。ICDB 自动修复内部问题仍未验收,工单及 WIP PR 保持开放。
|
||||
@@ -0,0 +1,37 @@
|
||||
# 后台 ICDB 检查与原生任务排队
|
||||
|
||||
## 用户约定
|
||||
|
||||
ICDB 检查保持界面可用;校验、库管理、恢复、原生版本窗口等操作提交后串行排队,检查每完成一个 CBB 让出原生执行机会。检查与校验相互独立;检查不自动 Repair、Restore,不改变权威 READY 状态。
|
||||
|
||||
## 已确认的原因与修改
|
||||
|
||||
- 旧检查占用 MainWindow 的整批 busy 标志,缓存筛选及其他入口随整批禁用。改为独立 IcdbCheckTask、独立取消信号和捕获的工程/库快照;NativeQueue 每项准入,可取消等待,暂停检查不挡后续任务。
|
||||
- 全局 PCB COM/ROT 可能等待其他工程的模态窗口。检查改为本任务完整 PCB 参数/PID、当前私有桌面、目标 MDI 和本次原生日志联合取证;正式校验继续使用原 COM 集成接口。
|
||||
- PCB 参数匹配原为子串匹配,会把 `.pcb.backup` 或 `-ReusableCircuitOther` 误认。现按完整命令行参数匹配。
|
||||
- DialogAgent 在读取子控件/UIA 之前按本任务 PID 范围过滤,执行前重新确认 HWND/PID/class;不读取或点击同桌面的无关弹窗。
|
||||
- PCB 的临时启动窗口、普通/Reused Block 标题转换及 WM_CLOSE 后 IE 辅助窗口的短暂变化,不能解释为 ICDB 损坏。关闭前必须有目标加载证据;关闭后等待本任务退出,未知窗不点击、不重新发 WM_CLOSE。持续未知窗至期限结束才保留现场并报告。
|
||||
- 诊断跳过无关集成历史日志,日志读取限定内容和两秒读取期限;超时结束该项,不反复堆积读线程。历史目录较多、历史日志较大不能直接判工程异常。
|
||||
- ProcessWatch 用已打开的进程句柄观察退出,避免 COM 等待阶段每次轮询都启动 WMI 辅助进程。
|
||||
- 原生退出后才产生完整 PCB Job Name 的缓冲日志必须在关闭后再核对。PASS 同时要求新 PCB 成功日志、新数据库路径和 PCB PID 装载日志,以及完整 PCB Job Name。
|
||||
- 失败性质和实际释放事实分别记录。错误包含 ICDB 才标明 ICDB 错误;读写确认、版本选择和未确认原因单独显示。单项失败且释放已确认时继续下一项。
|
||||
- 后台切库时只更新匹配的库清单;旧工程检查建议在后续管理操作后失效。旧库结果的释放入口不能释放当前另一个库。
|
||||
- 网络映射由全部活跃 lease 登记保护,包括读取线程尚未交付给界面的 lease;拥有者结束时向仍在使用者转移映射。网络收尾需离开 Qt 线程,避免慢网络同步冻结界面。
|
||||
|
||||
## 原生验证范围
|
||||
|
||||
Windows 11、Mentor EE7.9.5。实验仅使用 `C:/Temp/CbbBackground-*` 中的完整隔离库;原始六个主要文件记录 SHA-256,来源保持不变。故意修改副本 `icdb.dat` 文件头得到 `SingleFile: ERROR ... in old, unsupported format`,用于验证当前错误分类和失败后的安全退出,不能代替现场失联故障验收。
|
||||
|
||||
`diagnostics/icdb-authority-20261105/validate_background_native.py` 运行应用的 `run_verify(maintenance=True)` 完整检查入口,在每次工作桌面放置另一个 PID 的真实模态窗口。要求损坏项报告明确 ICDB 错误并安全退出,下一正常项完成打开检查;无关弹窗在本任务结束前保持未操作;不得执行自动修复。
|
||||
|
||||
原始日志及结果在 `diagnostics/icdb-authority-20261105/background-native-result.json` 和对应 C:/Temp 证据目录。冻结包的 BUILD.json、VALIDATION.json 分别记录源码哈希与本包验收证据。
|
||||
|
||||
源代码完整链路于 19:16—19:17 通过:损坏项 FAIL / ICDB_REPAIR_REQUIRED / safe_to_continue=true,耗时 62.062 秒;下一正常项 CHECKED / safe_to_continue=true,耗时 26.704 秒。两个其他 PID 的模态窗口均保持未操作,来源六文件哈希不变。此记录另存 `background-native-source-result.json`;最终候选包必须再次通过自身冻结执行器的原生验证。
|
||||
|
||||
`validate_background_gui.py` 额外通过真实检查按钮提交检查,再提交权威状态读取并测试排队期间缓存筛选。其单行目录 PENDING 状态为测试注入,原生打开、退出和后续状态读取均实际执行;这不构成现场真实库状态的验收。
|
||||
|
||||
r9 冻结执行器实测通过同一批次:故障项 68.531 秒,安全释放;正常项 33.313 秒,CHECKED 且安全释放,其中启动 17.093 秒、关闭 8.703 秒;两个无关弹窗未操作。界面实测 34.703 秒,检查和状态读取顺序为 check-start → check-end → status-start → status-end,排队期间缓存筛选可用,50ms 事件循环计时器最大间隔 79ms,后续原生状态为 READY。该时间只是本机当前样本结果,不作跨样本速度提升比例。
|
||||
|
||||
## 保留限制
|
||||
|
||||
检查仍需实际启动 Mentor。去掉 COM/WMI 和无关日志开销,不等于消除原生程序启动和数据库加载时间。日志或文档身份不足时报告未确认,不推断 ICDB 损坏。实际未释放的当前任务会停止后续原生写入并提供释放入口,界面缓存操作继续可用。ICDB 自动修复和现场服务器会话失联恢复未验收;本候选包不关闭工单、不作为正式发布。
|
||||
@@ -0,0 +1,28 @@
|
||||
# 阻塞范围收紧记录
|
||||
|
||||
> 后续审查已修正本记录中“切库清除旧标志”和“只检查 Work”的不足。当前行为与验证请以 [全链路审计](2026-11-05-blocking-lock-audit.md) 为准:状态按库保存,释放包含共享数据库并绑定原任务范围。
|
||||
|
||||
本轮处理的是“一个 CBB 出问题后把整批和其他库一起停掉”的误阻塞。
|
||||
|
||||
## 已收紧
|
||||
|
||||
- 批次继续条件保持按实际释放证据判断。单项 FAIL、ICDB 检查发现问题或普通内容错误,只要本次原生/自动化客户端已经退出并返回 `safe_to_continue=true`,下一项继续;只有进程仍存活、退出状态无法确认或共享写入安全无法证明时才停止后续写操作。
|
||||
- 管理失败状态现在绑定实际中心库。切换到另一个中心库会清除旧库的 `_management_unsafe`,不会把库 A 的失败带到库 B;释放检查完成回调也只清除同一库的状态。
|
||||
- 显式维护的原生占用检查按目标 PRJ 命令行过滤无关 PCB/Library Manager。旧的零参数占用探针仍兼容,目标路径可用时不再被其他 CBB 阻塞。
|
||||
- 释放证明支持目标 CBB 范围。提供目标名称时,只检查该 Work 工程的地址记录、主要数据库文件和命令行包含该工程的原生客户端;其他 CBB 的 `sAddress.adr` 不再阻塞当前恢复。无目标范围的全库释放检查继续保守处理。
|
||||
- 释放接口新增参数保持旧调用兼容;旧插件或测试没有 `block_name` 参数时继续走全库证明路径。
|
||||
- UI 比较中心库身份不再对不可达 UNC 路径调用会访问网络的 `Path.resolve()`。网络共享暂时不可达时保持可用状态和错误提示,不在界面刷新中抛异常。
|
||||
|
||||
## 仍然必须停止的情况
|
||||
|
||||
- 当前项的 PCB、Project Backup、保存助手、Importer 或管理工作进程仍在运行。
|
||||
- 进程查询失败、原生窗口身份不明、退出状态缺失,或库锁/共享写入归属无法确认。
|
||||
- 用户明确点击取消,当前批次停止后续项目。
|
||||
|
||||
这些停止条件保护共享数据库和原生写入现场;移除它们会把一个仍在写入的工程与下一个 CBB 并行运行,可能造成更大范围的数据损坏。
|
||||
|
||||
## 验证
|
||||
|
||||
新增回归覆盖单项已释放失败继续批次、切库清除管理阻塞、目标 CBB 过滤无关进程/地址、旧释放接口兼容和不可达 UNC 路径。最终全量回归 **1309 passed**,1 条既有 pywinauto STA 警告;`compileall` 与 `git diff --check` 通过。
|
||||
|
||||
本轮没有修改图标等其他工作区文件,也没有对现场中心库执行写入、Repair 或 Restore。
|
||||
@@ -0,0 +1,132 @@
|
||||
# 全链路阻塞与锁审计(2026-11-05)
|
||||
|
||||
本次目标:枚举从按钮到批次结束的阻塞条件;消除把单项失败、历史记录或无关进程当成本任务仍占用的情况;用实际运行核对退出和下一项继续。
|
||||
|
||||
这是一份开发与验证记录,不把维护说明加入产品 UI。ICDB 批量检查不执行自动 Repair,不把普通打开失败推定为 ICDB 损坏。真正仍在运行的同库写会话继续串行;不能通过删除 Mentor 地址/锁文件、强杀数据库进程来制造“已释放”。
|
||||
|
||||
## 已复现的现场链路
|
||||
|
||||
旧候选包对 IP101GR 打开检查时,原生 PCB 显示完整的 `Continue to open the design with read/write access permission?` 问题。程序报 `DATABASE_RECOVERY_REQUIRED`,启动收尾函数却只接受 ICDB/数据库加载失败类别,返回 `STARTUP_FAILURE_UNCONFIRMED`,未取消打开。PCB 60544 和启动器 63824 留在本任务私有桌面,导致后续会话不释放。
|
||||
|
||||
2026-11-05 使用修改后的真实退出函数,核对本次进程、工程参数、私有桌面和精确原生全文后点击 **No (7)**;两个进程均退出。6 个主要文件(LMC、PRJ、PCB、工程数据库、Layout、PCB工程配置)前后 SHA-256 一致。原有两个 Project Backup 会话没有被终止,没有执行 Repair/Restore。
|
||||
|
||||
证据:`diagnostics/icdb-authority-20261105/field-readwrite-cleanup/result.json`。旧候选包原始 evidence 保留,不覆盖。
|
||||
|
||||
## 逐阶段清单
|
||||
|
||||
“保留”表示正在执行或归属无法确认时仍需要该条件;“修正”表示本次已定位误阻塞并实施回归修复。最终运行结果在文末登记,不能仅凭表格认为现场验收成功。
|
||||
|
||||
|序号|阶段 / 代码入口|触发条件及原有影响|处理|
|
||||
|---|---|---|---|
|
||||
|1|UI `busy` / ServiceWorker|真实任务执行中禁用启动、编辑路径、关闭;任务异常后必须恢复按钮|保留串行;检查 finished/failure 收尾|
|
||||
|2|UI 已加载路径|输入路径改变但仍使用旧清单|保留身份检查,不启动旧目标|
|
||||
|3|UI 选择 / 筛选|隐藏项、READY、缺工程进入检查队列|保留:隐藏项取消勾选;READY 即使选中也排除检查;管理选择独立|
|
||||
|4|UI 状态刷新|检查结束后条目仍按旧状态禁用或勾选|刷新受影响条目,保留搜索;READY 清旧勾选|
|
||||
|5|UI management unsafe|切换库清掉唯一的未释放标志,返回原库失去状态|修正:按库保存;A 不影响 B,回到 A 仍保留真实未释放事实|
|
||||
|6|UI 原生版本会话|正在运行的同库版本窗口与写任务冲突|保留;其它库和清单筛选独立|
|
||||
|7|版本窗口返回|启动器退出但结果缺失/身份错/子会话未确认|保留当前会话,不因窗口消失虚报恢复成功;释放入口可独立重查|
|
||||
|8|全局原生 mutex|真实另一个校验/管理/恢复正在使用共享原生通道|保留实际串行;不把互斥失败持久化成本任务数据库 owner|
|
||||
|9|库协调 OS handle|上传工具/本程序对同库持有独占句柄|保留真实冲突;不能用删文件绕过|
|
||||
|10|协调文件创建|权限/路径/网络错误也被统一报“有锁”|修正:区分 sharing/lock violation 和访问错误;启动前失败可重试|
|
||||
|11|历史 checkpoint|同库旧记录、pending、损坏 JSON 一律阻止管理|提供有证据的释放/归档;归属完全丢失时不能证明未知分析副本,列明未确认原因,不擅删|
|
||||
|12|retained 管理 lease|失败时保留的句柄没有可再次检查的 release probe|修正可重查的精确 operation / scope;未退出仍保留|
|
||||
|13|显式释放 scope|全机 retained exporter/worker 阻止另一库释放|修正按 operation / library 范围,不采用同名即归属|
|
||||
|14|释放范围|只检查目标 Work,遗漏共享符号库;或遍历全部库和快照|修正目标库 / 目标 CBB / 实际共享路径,保留共享库互斥|
|
||||
|15|owner 匹配|原始字符串包含 Work 会误匹配 WorkOld,job.json worker 又漏匹配|精确参数/目录边界及记录的 operation 归属;无法读取归属单列未确认|
|
||||
|16|PID 重用|旧 PID 恰巧分给另一进程,形成永久旧 owner|新记录绑定创建时间/句柄,旧格式需独立释放证据|
|
||||
|17|工程 preflight|缺 PRJ/PCB、无工具、非法参数|保留单项失败;未启动会话不保留执行锁、不停其它项|
|
||||
|18|post-repair proof|非法凭证在任何 worker 创建前被标为 unsafe|修正为启动前拒绝,下一项可继续|
|
||||
|19|content-check timeout|只读辅助进程超时与真实原生会话混淆|必须区分子进程是否退出,不以 timeout 字样推断 owner|
|
||||
|20|DesktopWorker 构造|CreateDesktop/CreateJob/CreateProcess 失败,未创建 worker 仍被标 unsafe|修正句柄回滚并返回显式 no-process 证据;已部分启动仍未确认|
|
||||
|21|原生读写确认|要求确认无其他用户,原程序不 Yes 也不 No,留下 PCB|修正:仅精确全文、PID、工程、桌面一致时 No;等待退出,绝不自动 Yes|
|
||||
|22|PCB 历史版本选择|有两个版本,需要用户选择;不能代选|记录候选版本;扫描不执行历史回退,取消已识别的本次打开后收尾|
|
||||
|23|其它已知 fatal|确认错误后仍存在空 PCB|正常关闭本任务空壳;不能要求先判为 ICDB 才允许收尾|
|
||||
|24|未知弹窗 / 文档|不能证明是空壳、存在文档、非本进程、不同桌面|保留,不盲点按钮;显式给出未释放窗口证据|
|
||||
|25|PCB 先退出|common 启动器延迟退出|等待 PCB 与启动器,不在任一仍活着时说释放|
|
||||
|26|No 后旧地址|尝试打开被明确拒绝,但旧地址让本任务空壳不能退出|修正:取消本次打开不要求先取得外部数据库;保留地址,不声称数据库无人占用|
|
||||
|27|COM 无文档 / ROT|COM 指向他人会话或 ActiveDocument 为空|只依据本任务进程/路径/桌面关闭空壳,不借全局 ROT 关闭他人工程|
|
||||
|28|保存 / Close 超时|COM 仍可能在写;第二个 close helper 会重复操作|保留已有 helper,观察其释放,不强杀 PCB/数据库或重复保存|
|
||||
|29|取消 / 主窗口关闭|取消发生在启动、校验、保存任意阶段|合作停止本任务,禁止新项;收尾确认后可再次启动|
|
||||
|30|会话释放证据|worker 已退出,但 native/automation client 仍在|保留真实未释放;只有独立退出证明才能提升安全状态|
|
||||
|31|可选报告/性能记录|释放成功后写报告失败又变成 unsafe|修正:报告失败保留告警,不覆盖执行结果和退出事实|
|
||||
|32|progress / 批次报告|回调/磁盘写入异常终止循环,UI generic failure 挂锁|修正隔离展示错误,保留已完成结果与释放事实|
|
||||
|33|批次单项 FAIL/BLOCKED/TIMEOUT|某项失败但已正常退出,被错误扩大成全批失败|依据实际 release 继续;用户取消/真正未知会话仍停止同通道任务|
|
||||
|34|管理预检查|desktop/mapping/capability/source 失败,尚未原生激活即 unsafe|修正显式 activation-start 状态;未启动可重试|
|
||||
|35|管理 catalog 失败|返回 success=false/safe=true 被异常丢掉 release|修正操作成功与会话释放分别传播|
|
||||
|36|管理检查点恢复|catalog_before 中断就阻止所有 CBB,和实际 remove 中断混同|区分 mutation 前失败和已发生修改;后者保留数据恢复要求|
|
||||
|37|无关 LM/PCB/viewdraw|全机任意同名进程阻止目标库检查/恢复/导出|绑定目标工程、库和共享数据库;COM 激活若无法证明隔离仍单独说明|
|
||||
|38|工程内容导出|收养所有同名 iCDB server / exporter,等待无关进程永不退出|修正仅本次后代和精确分析副本 owner;保留实际后代|
|
||||
|39|导出副本回收|一个库的 retained export 挡住另一个库|修正 registry 库/副本身份,配合数据库独占读取|
|
||||
|40|sAddress.adr|存在即被称为“有人占用”|存在只表示需原生确认;保留文件,NOT_IN_USE 只能由严格绑定的 inspection 得出|
|
||||
|41|备份恢复异常|源路径/清单预检失败也报 unsafe、UI 挂锁|修正沿用是否实际启动/释放事实;目标改动与内容冲突仍阻止安装|
|
||||
|42|批量状态读取协议|A 响应不匹配就把未查的 B 等都标 MALFORMED|修正重启桥接并逐项读取,不伪造后续状态|
|
||||
|43|状态缓存身份|只凭字节/名称复用另一库的结果|修正规则版本 + canonical library / block type 身份|
|
||||
|44|映射关闭|先置 closed,再取消映射;失败以后不能重试|修正确认成功才关闭;保留用户/被改指向的映射|
|
||||
|45|无关盘枚举失败|另一个盘查询失败阻止目标 share 复用|修正独立确认目标盘;未知盘只作为不可用盘符|
|
||||
|46|真实地址/共享库占用|同目标 / 实际共享数据库活动 writer|保留实际写互斥;普通错误不得扩展成永久禁用其它独立功能|
|
||||
|47|未知执行异常|无法知道是否已经启动/改数据|保持未确认;修已知 prelaunch/reporting 根因,不能把一切异常默认放行|
|
||||
|48|退出后 cscript owner 查询|3 秒包含 helper/Python/COM 启动,现场实际约 4.75 秒,误报查询超时|真实隔离批次复现;改为统一 10 秒有上限查询,超时仍是未确认而非确认占用|
|
||||
|49|导出全进程 WMI|直接 WMI 卡住会让 supervision 长期保留 worker|移入有上限只读 helper,保留所有名称的真实后代;启动前查询失败不会制造 native owner|
|
||||
|50|操作后内容/状态失败|移除/新增已返回安全退出,但后续读取失败又丢失释放结论|内容恢复状态与进程释放分别保留,不能用 mutated 标签代替活动会话证明|
|
||||
|51|启动前证据磁盘错误|目录/request/worker.log 创建失败,被通用异常当原生会话未释放|明确尚未创建 worker 的失败可继续;runtime 指纹写入为可选,不掩盖真实结果|
|
||||
|52|证据查看器|打开证据路径失败进入通用 worker 错误处理,错误保留映射|只显示查看失败,不创建数据库未释放状态|
|
||||
|53|维护库归属|目标 RepairTarget 可证明所属库,却仍全局检查 retained worker/export|从原 PRJ 的唯一有效 CentralLibrary 解析身份,复用统一归属检查;普通扫描保持独立|
|
||||
|54|同库路径别名|同库 drive/UNC/大小写别名被当成另一个库,或 UI resolve 访问失联网络|使用已有 lease 映射和本地规范键,不在控件更新中访问网络|
|
||||
|55|同盘符多个 retained 库|A 释放后所有权转到当前 A,关闭 A 会断掉仍有 B 会话使用的盘符|关闭前把所有权交给同盘符/共享路径的 retained B;B 未释放不取消映射|
|
||||
|56|目录输入的库身份|原始输入为目录,释放同目录任意 LMC 都可能误匹配|读取时绑定选中的实际 LMC;未绑定目录不接受 sibling LMC 释放证明|
|
||||
|57|已释放但待数据恢复|同目标正确阻止重放,却把旧 safe=true 改成 false,进而停止独立目标|保留同目标数据恢复要求,同时保留已释放事实,独立目标可继续|
|
||||
|58|真实 EDIF 参数形式|程序发出 `-icdb <目录>`,归属解析器只认 `-icdb=<目录>`|兼容实际分离参数并按完整目录边界匹配,不把明确无关的导出器当未知 owner|
|
||||
|59|Add 的 pre-capture 准备|原始库引用/清单/工程对齐失败发生在导出前,却继承 unsafe|准备阶段失败明确未启动;实际 capture 后始终沿用真实释放证据|
|
||||
|60|最后一笔导出进程记录|native 和数据库已释放,但 finally 中的 process.json 写入异常覆盖结果|最终报告 I/O 保留真实 release;无退出证明的分支仍保留 owner|
|
||||
|61|冻结代理启动与 PCB 门禁|代理十秒未就绪可误报,工作进程又只等十五秒|代理启动 30 秒、工作进程门禁 45 秒共享常量;日常 IPC 仍为 2 秒,监听以 0.2 秒轮询响应取消|
|
||||
|62|连接握手/门禁取消竞态|用户在 handshake 时取消,父进程仍可能先放行 PCB|认证后、门禁放行前、worker 执行原生前都再次检查取消;等待门禁时也响应取消|
|
||||
|63|残留释放入口|只显示存在进程即拒绝,没有正常关闭、保存提示或确认后结束的路径|增加精确名单、逐项关闭、保存选择、独立强制确认、重新证明与继续未执行项;未知归属也显示供定位|
|
||||
|64|释放后的全库证明|对普通输出逐个重复 resolve,同一副本 23,218 条记录导致原生退出后仍等待约 97 秒|一次规范库路径;复用已拒绝链接的扫描 metadata,先筛原生数据库候选再独占读取;同一库证明约 6.9 秒|
|
||||
|65|管理启动前历史阻止|旧记录让新任务尚未启动便失败,却被 LibraryBusy 类型强制改成 unsafe,UI 永久禁用;扫描也不显示记录和无 JSON 的 retained lease|新任务在互斥内先做完整复核,归档旧记录并恢复句柄/映射;未启动不制造 owner,UI 旧标志转为重查要求,历史/内存记录可见;同目标未恢复修改仍禁止重放|
|
||||
|
||||
## 执行与验收顺序
|
||||
|
||||
1. 保存现场弹窗、PID、request、release 和主要文件 hash;正常取消本次遗留打开。
|
||||
2. 各域先写失败回归,分别修空壳/弹窗、UI/批次、库协调/管理、导出/恢复、网络/状态桥接。
|
||||
3. 统一串行运行全量测试,避免测试之间竞争真实 Windows named mutex。
|
||||
4. 在新隔离库运行应用检查入口:故障/提示项 → 正常项;确认无自动 Repair,无遗留本次 native owner,原来源文件保持不变。
|
||||
5. 新目录生成候选冻结包;校验冻结源码一致、启动/退出、x86 桥接、冻结检查链路,再打开供用户测试。
|
||||
|
||||
## 验证记录(持续更新)
|
||||
|
||||
- 现场遗留读写确认:真实 No 取消,PCB 60544 / launcher 63824 退出,6 项 hash 一致。
|
||||
- startup / desktop / native repair 相关回归:194 passed(后续统一全量再次覆盖)。
|
||||
- 第一轮真实副本批次:**未通过**。成功复现原始读写确认;新取消路径正常退出,但随后 cscript owner helper 的 3 秒超时将结果重新标为 unsafe,后两项 SKIPPED。原库 6 项 hash 一致。保留 `blocking-live/result.json` 与完整原始记录。该误阻塞已新增回归修正,原副本重跑结果见下一条。
|
||||
- 修正后的真实副本批次:**通过退出与继续验收**。`blocking-live/retry1/result.json`:现场副本 `FAIL / DATABASE_SAFETY_STOP / safe=true`(No 正常取消);故意损坏副本 `FAIL / ICDB_REPAIR_REQUIRED / safe=true`;健康副本 `CHECKED / safe=true`。三项各自 `session-release.json` 均为 worker 已退出且 remaining_pids=[]。源 6 项 hash 一致,无 Repair/Restore/保存集成。此结果证明失败项能够退出并继续,不证明故障内容已修复。
|
||||
- 第一轮统一全量:1452 passed / 3 failed。三项为旧测试的相对路径归属 fixture、缺 library 的内部请求 fixture,以及新增的应用 JSON 回收 callsite 未纳入静态审计白名单。已限定修正 fixture 和 JSON callsite;未放宽未知原生归属、未允许删除 Mentor 文件。审查额外发现的 55–60 项已补回归并纳入下述复跑。
|
||||
- 统一全量复跑:**1479 passed**,1 条既有 pywinauto STA warning;`blocking-final-pytest.xml`。编译与 diff 检查通过。
|
||||
- 后续冻结实测:现场副本 FAIL 退出后继续;损坏样本遇到 `DIALOG_AGENT_START_TIMEOUT`,同样已释放并继续;健康样本 CHECKED。该结果只通过退出/继续验收,损坏样本本轮未进入 PCB,不能算内容检查通过。由此补充 61–62 的启动/取消修正。
|
||||
- 启动修正增量:**239 passed**,含代理、worker 门禁、普通验证、批次、保存/退出、修复凭证与 UI 回归;`startup-delta-pytest.xml`。本机另有独立 pytest 使用相同产品 mutex,增量回归使用专有测试 mutex 名,产品互斥名不变。
|
||||
- **最终 r3 冻结链路通过**:`blocking-live/frozen-r3/result.json` 中现场副本 `FAIL / DATABASE_SAFETY_STOP / safe=true` → 损坏样本 `FAIL / ICDB_REPAIR_REQUIRED / safe=true` → 健康样本 `CHECKED / safe=true`。三项实际启动 PCB,三项本次会话均退出、没有未执行项、没有 Repair/Restore,原库 6 项主要文件 hash 一致。
|
||||
- 冻结验证使用与包内字节码逐项比对一致的控制层,worker、弹窗代理、原生日志和进程探测均运行实际冻结 exe;没有把源码子进程冒充冻结子进程。24 个 Python 模块及 2 个 VBS 内容一致;实际 GUI 启动/退出、x86 codec、包内 VC runtime 加载、完整进程快照 helper 通过。
|
||||
- 最终独立只读复核:已报告的 P2 修正后无剩余 P1/P2;后续启动预算/取消竞态也单独复核通过。当前实测环境为 Windows 11 / Mentor EE7.9.5,Windows 10 未实机验收。
|
||||
- 候选包目录:`dist/blocking-locks-20261105-candidate-r3/CbbRefreshVerify-Background`。`BUILD.json` 记录源码基线/实际文件 hash,`VALIDATION.json` 记录全量与增量测试和原生链路结果;仍是候选包,不合并发布、不关闭工单。
|
||||
|
||||
本次不宣称 ICDB 自动修复已通过验收。生产库的其它原生 Project Backup 会话保留;它们连接失败不等于数据库损坏,也不等于可强夺写权限。
|
||||
|
||||
## 确认释放会话(后续增量)
|
||||
|
||||
用户反馈 r3“释放检查”遇到两个 Project Backup 进程只返回不能解除,没有关闭入口。本次增加“释放残留会话…”:先列当前库关联进程和工程,确认后逐项正常关闭。已加载 PCB 允许正常关闭;标准保存问题由用户明确选择保存、放弃或取消。已知启动确认可正常取消。单项未退出继续处理其它项;全部退出后再证明库文件可独占读取,归档本应用旧 checkpoint,解除保留句柄与映射,恢复按钮。
|
||||
|
||||
正常关闭无法完成时,提供独立的“强制结束所列会话…”警告确认,默认取消,列出项目、进程和 PID,明确未保存修改丢失及写入中断风险。仅对已证明属于当前库、重新核对 command/creation/image/进程句柄身份的列表发送结束请求;不是全机按进程名清理。此显式功能不改变普通检查/关闭/取消任务的合作退出策略,不删除 Mentor 地址、数据库或锁文件。
|
||||
|
||||
不安全批次结果可直接进入释放;取得当前库释放证明后,重新显示结果框,用户可点击“继续未执行项”。只恢复原检查/校验中 SKIPPED 的条目,重新套用当前可见性及非 READY 资格。失败项不自动重放,库增删改不自动重放。
|
||||
|
||||
原生实际验证:`diagnostics/icdb-authority-20261105/confirmed-release-b00c3b7c/result.json`。在 `C:/Temp/CbbBlocking-15cb2f99/healthy` 一致副本运行真实 Qt 确认按钮,正常关闭 Project Backup PID60404,监督 worker PID13008 随后退出,full release proof 通过;6 个主要文件 SHA-256 前后一致,未执行 Repair/Restore。截图 `preview.png` / `released.png` 保留。初次试验遇到不存在的 pywin32 查询 API,已改用 Windows QueryFullProcessImageNameW 并增加真实句柄回归后重跑通过;初次证据不覆盖。
|
||||
|
||||
当前边界:跨机器会话、不可读归属、操作系统拒绝权限或原生数据库地址未释放,不能通过本机结束请求制造成功。最终证明失败会保留原始原因与证据。强制结束仅证明进程结束,不证明工程数据完好;ICDB 自动修复仍未验收。标准 PCB 保存提示有精确消息/按钮与 UI 单元验证,尚无真实未保存 PCB 工程的端到端保存验收。
|
||||
|
||||
验证记录:统一全量 **1509 passed**(`residual-release-pytest.xml`,328.25 秒,1 条既有 STA warning);最新释放/未知归属/确认名单竞态/界面继续入口/库协调/文件保护增量 **83 passed**(16.42 秒)。未知归属进程现在显示为诊断行;只有预览时和执行时都证明属于当前库的项才可以关闭,执行时恢复可读不能扩大用户确认过的名单。代码复核发现的结果框隐藏及确认名单竞态均补先失败的回归后修正,最后只读复核未发现剩余 P1/P2。编译与 diff 空白检查通过。
|
||||
|
||||
r4 冻结增量的第一次实际试验没有通过 100 秒测试门槛:原生 PID25260 / worker PID61916 已正常退出,旧 checkpoint 已完整归档且 release proof 成功,但全库证明对 23,218 条记录反复路径解析约 97 秒,测试控制器已提前超时。证据 `confirmed-release-dfb29e88` 保留,不能算该轮通过。新增失败回归后修正了普通文件的多余解析,同一副本实际 proof **6.906 秒 / 12 个独占文件**;最新涉及库释放、维护范围、网络映射和 UI 的回归 **105 passed**(17.09 秒)。新的 r5 候选需再次执行完整冻结释放链路。
|
||||
|
||||
**r5 冻结链路已通过**:`confirmed-release-99f3f4e0/result.json`。真实 Qt 确认入口关闭 Project Backup PID48080,包内监督 worker PID23040 退出,旧 checkpoint 归档并清除,12 个原生文件独占读取证明通过,6 个主要文件 hash 一致。整个试验约 27 秒(含启动后等待 15 秒、列表查询、关闭及复查),原生退出至释放完成约 6 秒。随后立即使用同一 r5 exe 运行真实 PCB 检查,`next-check-result.json` 返回 `CHECKED / safe=true`,实际打开正常并退出、remaining_pids=[]、没有 Repair/Restore,证明清理后可以继续后续任务。此检查耗时约 100 秒,其中 PCB 启动约 86 秒;不能把该启动耗时称为释放卡死。
|
||||
|
||||
r5 包内 26 个 Python 模块及 2 个 VBS 与当前源码一致,实际主窗口启动/退出、x86 codec、包内 runtime 和冻结进程探测 helper 均通过。性能改动经独立只读复核,未发现新 P1/P2。只交付候选包,不关闭工单或宣称 ICDB 数据已自动修复。
|
||||
|
||||
r6 用户中心库误阻止的根因、源日志、修正和冻结管理链路见 `2026-11-05-management-phantom-blocker.md`。统一全量 1518 passed;完整原生移除与重新读目录验证通过。历史记录本身不再被直接当作活跃会话,管理入口允许重新复核;生产库工程未改动。
|
||||
@@ -0,0 +1,47 @@
|
||||
# 导出身份比对与备份恢复:阻塞审计及修正
|
||||
|
||||
本记录只覆盖 `native_engineering_identity.py`、`native_export_guard.py`、`backup_recovery.py`。没有启动原生工具,没有修改生产库、Mentor 地址、锁或数据库文件。完整应用现场验证由主任务单独记录。
|
||||
|
||||
## 从前到后的阻塞点
|
||||
|
||||
| 阶段/触发条件 | 修正后行为 | 保留原因/证据 |
|
||||
|---|---|---|
|
||||
| 输入工程身份、库引用、工程完整性或独立目录不符 | 本项拒绝;没有创建原生会话时可继续下一项 | 防止替换错误工程;不是占用锁 |
|
||||
| EE7.9.5 导出程序缺失或二进制版本未通过能力探测 | 本项拒绝;未启动即不宣称会话未释放 | 不猜测原生接口 |
|
||||
| CBB 操作互斥量实际被其它操作持有 | 不并行启动;保留原有串行约束 | 原生 COM/共享库任务串行运行 |
|
||||
| 库协调句柄确实独占或已有未释放任务 | 保留互斥 | 句柄/释放证明由 `library_lock` 负责 |
|
||||
| 机器上存在其它工程的 PCB、LM 或原理图进程 | 不再单凭进程名阻塞恢复 | 完整工程/数据库/库路径参数匹配;`WorkOld` 不匹配 `Work` |
|
||||
| 有原生进程但没有可识别的工程参数 | 本项返回 `TARGET_NATIVE_OWNER_UNCONFIRMED` | 尚不能通过进程名称判断它打开的文档;不称为确认占用 |
|
||||
| 进程参数明确属于目标工程或目标库 | 本项返回 `TARGET_NATIVE_OWNER_ACTIVE` | 不抢占用户或其它任务会话 |
|
||||
| 目标/共享数据库仍有 `sAddress.adr` | 本项返回地址状态未确认;保留地址原件 | 地址存在不等于活动占用;目前该写入入口仍需原生判断 |
|
||||
| 目标 LMC、工程/PCB 的 `icdb.dat` 或 Layout 无法独占读取 | 拒绝安装 | 补上实际文件句柄探测,包含共享 `__ReusableBlocksSymb` |
|
||||
| 源、目标、验证副本内容在复制/验证期间变化 | 本项拒绝覆盖;已证明释放时不制造未释放状态 | 保留原文件与清单 |
|
||||
| 其它工程的 iCDB 导出器/服务器存在 | 不再全机拒绝导出,也不收养为当前任务后代 | 仅追踪本次后代和命令明确指向本次分析副本的原生进程 |
|
||||
| 当前导出器或后代仍活跃/句柄未释放 | 保留导出任务及它所属库的排除 | 不杀原生进程;库 A 的已绑定记录不排除 B |
|
||||
| 创建导出进程遭明确 FileNotFound/Permission/CreateProcess 拒绝 | 返回失败且本任务会话安全;可重试 | `native_started=False` 及 `export-launch=false` 绑定证明 |
|
||||
| 导出构造异常但可能已经启动原生进程 | 保持未确认,不能因没有返回 Python 对象就放行 | 明确区分未启动和部分启动 |
|
||||
| 导出前完整进程树查询超时/失败 | 本项失败且明确未启动;释放本任务未启动的 guard,可继续独立项 | 不把查询失败视为空进程列表或数据库无人占用 |
|
||||
| 已启动导出后的完整进程树查询超时/失败 | 10 秒以内返回未确认,保留本次进程与已记录句柄 | 不无限等待 WMI,也不强杀原生进程 |
|
||||
| 导出器已退出,但输出错误或不完整 | 内容失败与释放结论分开 | 不因业务失败制造活动会话 |
|
||||
| 导出后的汇总报告写入失败 | 保留已确认释放;报告写入错误另行返回 | 先完成释放证明及清除本次导出 guard,再写可选汇总 |
|
||||
| 恢复开始前检查失败或恢复结果报告写入失败 | 保留 `release_confirmed`;没有原生会话则允许其它独立项继续 | 不再统一返回 `safe_to_continue=False` |
|
||||
| 程序重启后导出 PID 被其它进程复用 | 新记录比对 creation identity 与 executable;不同身份不当成旧 owner | 旧记录没有创建身份时仍需新鲜独立证明 |
|
||||
| 正常导出 checkpoint 存在 | 重新核对库、lease、token、独立副本、进程身份、地址和数据库句柄 | 不把其它同名服务器当作当前副本 owner |
|
||||
| 应用 checkpoint 损坏 | 默认拒绝;显式释放入口持有完整库/原生证明时可使用 `allow_unknown_checkpoint` | 此路径仍要求全机已知导出 owner 和 retained registry 均空;调用者必须归档未变化的原字节 |
|
||||
|
||||
## 回归验证
|
||||
|
||||
首次新增的六项失败测试均先观察到旧实现失败,然后实现修正。领域测试曾串行运行 `81 passed in 62.78s`;后续增加了未知启动、损坏 checkpoint 显式释放、无 PID 证明、报告 I/O 及 PID 复用的正反测试,新增子集 `12 passed`,汇总报告 I/O 正反 `2 passed`。主任务须再进行最终全量运行;多进程并行运行这些测试会争用产品全局 named mutex,不能把相互争用的结果当成业务失败。
|
||||
|
||||
全进程树查询现已移入现有 `--owner-probe` 只读 helper,使用版本化 snapshot 协议并保留 PID、parent、未知可执行文件名称、命令、路径和创建身份。上限统一为 10 秒,为 helper 启动及 WMI 查询保留余量;超时只结束读取进程的 helper。回归覆盖启动前与启动后的查询超时、未知后代、PID 0 系统项、协议版本、重复 PID、缺少创建身份等。新增相关子集 `17 passed`。实际本机只读 helper 返回 457 个进程(包括非 `.exe` 系统名称),457 项创建身份,耗时 4.75 秒;该数值是一次观察值,并非上限,没有启动 Mentor。
|
||||
|
||||
最后补充了 `capture_identity` 的启动前异常边界:来源校验、当前 lease 证明、证据目录范围、导出器能力检查、目录创建或 mutex 创建失败,均返回明确未启动的安全失败,不把被调用者异常变成活动会话。六项对应的失败测试先观察到旧实现抛异常,再验证修正;与查询预算、已启动失败的正反测试合并为 `11 passed`。这些测试没有取得产品全局 mutex。
|
||||
|
||||
最后一次只读复审补齐了进程诊断记录写入边界:已证明导出进程/后代退出且副本数据库已释放后,最终 `*-process.json` 写入失败只附加报告警告,不能抹去释放事实;仍有活跃原生进程时保持未确认。首个 `export-launch.json` 在任何启动前写入失败,则返回明确未启动;仅凭本进程当前 lease、匹配的一次性 token、独立副本 owner 和零 process records,清除此任务尚未启动的 guard。缺少日志不能由重启后的无身份记录借用此通路。三项报告异常回归先失败,修正后与未释放正反测试合计 `7 passed`,未使用产品全局 mutex。
|
||||
|
||||
## 仍需明确保留的验收缺口
|
||||
|
||||
- 没有在真实 Mentor 环境验证本轮恢复/导出功能。上述证据为回归测试及只读代码审查。
|
||||
- 恢复写入入口中的旧地址,需要原生 inspection 确认;本次没有自动删地址,也没有仅凭文件不存在就确认释放。
|
||||
- 无工程参数的外部原生会话仍是未确认;不能自动 Attach 到全局 COM 并操作他人的文档。
|
||||
- 当前没有解决所有原生内容失败;本轮不表示 ICDB 自动修复或现场问题验收成功。
|
||||
@@ -0,0 +1,124 @@
|
||||
# ICDB 判定接口与本次检查失败的只读调查
|
||||
|
||||
日期:2026-11-05。基于 `1acfbd6`。本轮新增离线元数据探测脚本,读取安装的
|
||||
类型库、PE 导出和既有日志;没有改变应用判定、打开工程、调用 Repair/Restore、
|
||||
删除地址文件或终止原生进程。自动修复仍未验收通过。
|
||||
|
||||
## 结论
|
||||
|
||||
“打不开 PCB 并出现弹窗”是有价值的直接观察,但一般数据库打开失败、服务器
|
||||
连接失败、版本恢复选择,都不能单独等同于 ICDB 数据损坏。现阶段最可靠的
|
||||
ICDB 维护依据,是**本次打开的同一工程/数据库发出的明确原生诊断**。
|
||||
|
||||
尚未找到已验证、无需打开数据库、能直接预测 PCB 将发生 ICDB 故障的独立接口。
|
||||
底层确有原生错误类别和错误码,但只有导出名称,没有取得对应 SDK 声明和
|
||||
完整枚举,也没有建立真实故障与数字的映射;不能猜测参数调用后接入产品。
|
||||
|
||||
## 1. 已解析的 PCB 原生类型库
|
||||
|
||||
前一轮探测对 PCB 启动器执行 LoadTypeLib 失败,并不意味着安装缺少类型库。
|
||||
本轮按 32 位注册表定位到:
|
||||
|
||||
```text
|
||||
HKCR\TypeLib\{EDEDED00-D5F6-4B04-8FE7-EDEDEDEDED00}\1.0\0\win32
|
||||
D:\Mentor\7.9.5EE\SDD_HOME\wg\win32\bin\XtremeDesignSessionWG.exe
|
||||
```
|
||||
|
||||
成功读取 `MGCPCB (AutoActive series) Type Library`,共 614 个类型。没有创建
|
||||
COM 实例,也没有连接正在运行的 PCB。
|
||||
|
||||
| 元数据 | 实际声明 | 能证明什么 |
|
||||
| --- | --- | --- |
|
||||
| `IMGCPCBApplication.OpenDocument(filename)` | 返回 Document,没有 ICDB 专用返回码声明,`scodeArray` 为空 | 可作为实际打开尝试;不能据声明直接解码 ICDB 故障 |
|
||||
| `ActiveDocument` | 返回当前 Document | 空文档只表示尚未取得文档,不说明失败原因 |
|
||||
| `IMGCPCBError` | `ErrorString`、`Severity`,没有 ErrorCode 属性 | 提供文字/严重级别;不是统一的打开错误码接口 |
|
||||
| `EPcbErrorSeverity` | `epcbWarning=0`、`epcbError=1`、`epcbFatalError=2` | 是错误严重级别,不是三种 ICDB 健康状态 |
|
||||
| `Errors` 集合使用方 | CopperBalancing、DFFSliverAnalysis、IDFImport、DXFImport | 不能把这些集合当成 PCB 启动错误队列 |
|
||||
| 应用事件 | 打开前/打开后事件;`OnOpenDocument` 标志为 Open=1、Reload=2 | 没有声明 ICDB 打开失败事件和专用数字码 |
|
||||
|
||||
类型库没有专用错误表,不代表运行时绝不会返回 HRESULT/EXCEPINFO。真正执行
|
||||
调用时仍应记录 HRESULT、EXCEPINFO 的 wCode/scode/source/description 和调用阶段,
|
||||
但尚未实测的 HRESULT 不能赋予“数据库损坏”的含义。
|
||||
|
||||
## 2. 底层 iCDB 候选接口
|
||||
|
||||
静态解析 `iCDBPI.dll`、`iCDBDiagPI.dll`、`iCDBCAPI.dll`,三者均为 x86 PE。
|
||||
`diagnostics/icdb-authority-20261105/metadata.json` 保存实际文件 SHA-256、
|
||||
原始符号名称、类型库说明及常量,避免跨版本混用。
|
||||
|
||||
| 接口线索 | 已证实内容 | 未证实内容 |
|
||||
| --- | --- | --- |
|
||||
| `Result_get_iErrorCategory` / `Result_get_iErrorCode` / `Result_get_sResult` | 原生 Result 有错误类别、编号、文字 | 对象布局、调用约定、错误枚举及故障映射 |
|
||||
| `CDBPI_IsOpenCDB` / `IsOpenCDBEx` | 存在数据库打开状态查询符号 | 未打开、不可达、损坏之间如何区分;不是已验证的健康检查 |
|
||||
| `PIMgr_GetStatus` | C++ 对应声明返回/填写 `ESynchStatus` | 不能把同步状态当 ICDB 健康状态 |
|
||||
| `Diag.GetProjectStatus` / `GetActiveIssues` / `GetStatus` | 存在诊断、工作区及项目状态接口 | 结构体、枚举、初始化方式、查询范围及副作用 |
|
||||
| `Diagnostic.Check` / `CDBPI.IsDatabaseAvailable` | 存在相关诊断符号 | 参数语义、是否只读、超时/释放行为;未执行 |
|
||||
|
||||
导出名的存在不证明这是厂商支持的外部自动化 API。不能用 ctypes 默认 int
|
||||
返回类型和猜测指针去调用这些接口;尤其不能在主界面线程内调用。
|
||||
|
||||
## 3. 本次“全部失败”的具体证据
|
||||
|
||||
旧记录:`diagnostics/live-open-20261105/evidence/icdb-check-1738989c1dae/`,
|
||||
原生 PID `63480`,目标为 IP101GR 的 `Work/database`。
|
||||
|
||||
这次补读该 PID 的原生进程日志:
|
||||
|
||||
```text
|
||||
D:\Mentor\7.9.5EE\SDD_HOME\standard\iCDB\ProjectBackup\Logs\
|
||||
2026-11-05 08.08.40-63480\2026.11.05.iCDBProjectBackup.txt
|
||||
```
|
||||
|
||||
日志从 08:08:41 读取该数据库的 ServerProperties,依次尝试所记录的多个地址
|
||||
和主机名,端口 10002。08:09:14 报 `Network: ERROR: Could not connect to IP [...]`
|
||||
后,再次读取同一数据库的服务器属性并继续重试。调查时读到的后续日志中仍有
|
||||
相同循环。摘录和来源保存在 `diagnostics/icdb-authority-20261105/network-evidence.json`。
|
||||
|
||||
因此,这一次没有取得 Output 的直接线索是**原生工具正在反复连接数据库记录的
|
||||
服务器地址**,不是仅仅窗口标题不匹配。此前允许通用标题的修改不足以解决它。
|
||||
尚不能仅凭这些日志确定是服务器已退出、地址过时、监听配置或防火墙问题,
|
||||
也不能证明数据库内容损坏,更不能据此确认目标无人占用。
|
||||
|
||||
同批另两项缺少唯一 PRJ,不能把它们与此连接失败合并成一个损坏结论。
|
||||
本轮没有再次启动原库检查,也没有强制结束 PID 60000/63480。
|
||||
|
||||
## 4. 检测规则的遗漏与证据等级
|
||||
|
||||
安装 DLL 包含以下明确的原生维护消息:失联、整理中断、升级中断、重要操作
|
||||
中断、跨机失联、自动修复中断,均带厂商的 Repair project 指引。
|
||||
把这六段原生模板传给当前 `parse_session_loss`,只有跨机失联模板被识别。
|
||||
这确认了规则覆盖范围偏窄;**模板存在不证明此次工程触发了这些错误**。
|
||||
|
||||
| 本轮实际证据 | 合理结论 |
|
||||
| --- | --- |
|
||||
| 同一数据库的完整失联/不一致/检查失败原生诊断 | 明确 ICDB 异常,记录子类、数据库路径、会话及证据 |
|
||||
| 服务器地址重试、连接失败、一般 Could not run server | 连接/启动失败,尚不能认定损坏或无人占用 |
|
||||
| `problem encountered while opening ...` / `loading ... failed` | 一般打开失败,还需具体数据库日志/弹窗 |
|
||||
| Database Restoration 的手动/自动保存版本选项 | 需要用户选择版本,不自动判为损坏或代选 |
|
||||
| Project Backup 未占用、备份目录已加载 | 占用/备份信息,不保证 PCB 完整打开或设计健康 |
|
||||
| 无 Output、超时、未知错误 | 无法确认,不能推成健康或需要 Repair |
|
||||
| READY/PENDING、地址文件、历史日志 | 均不能单独决定本次 ICDB 是否有问题 |
|
||||
|
||||
## 5. 建议的接入顺序与验证缺口
|
||||
|
||||
普通检验继续实际打开工程;同步捕获本次弹窗、增量日志和同一工程身份。
|
||||
打开成功就继续普通检验,不以 Project Backup 预检作为其前置门槛;打开失败
|
||||
仅在有明确 ICDB 原生诊断时标注 ICDB 子类,其他错误分别记录。检查结果不应
|
||||
禁用普通检验或原生版本管理,也不据单项诊断设置永久的全库失败标志。
|
||||
|
||||
独立批量检查仍只做用户明确启动的检查。原生日志补采应绑定启动时间/PID、
|
||||
目标路径和读取预算,保持增量及有界;网络日志中的“连接失败”不等同会话释放。
|
||||
如果新检查不能退出,应显示实际滞留目标和原生连接阶段,不能靠伪造释放证明
|
||||
继续对同一目标执行写操作。
|
||||
|
||||
下一轮动态探测应使用完整隔离库,分别记录正常打开、会话失联、文件损坏、
|
||||
连接不可达、版本恢复选择的 PCB/原生证据;只运行诊断打开,不执行 Repair/Restore。
|
||||
提取真实 HRESULT/EXCEPINFO 与原生文字的对应关系,并验证取消与正常关闭。
|
||||
即使没有数字码,已确认的原生消息仍可用于分类;不能为等一个状态码阻塞普通流程。
|
||||
|
||||
本轮只验证元数据提取、既有日志关联和解析器覆盖范围,没有执行新的 PCB 打开
|
||||
对照,没有验证底层 C API、解决原生网络重试或修复 ICDB。没有生成新应用候选包。
|
||||
|
||||
后续经用户授权完成了真实损坏/正常/缺文件对照,见
|
||||
[损坏弹窗与错误码实测](2026-11-05-icdb-corruption-error-code-probe.md)。取得了 PCB
|
||||
COM 两层错误码,但损坏与缺文件返回相同值,仍不能把该码当 ICDB 健康状态。
|
||||
@@ -0,0 +1,102 @@
|
||||
# ICDB 损坏弹窗与错误码实测
|
||||
|
||||
2026-11-05,Mentor EE7.9.5,PCB `2013.0.543.380`。按用户授权,只在新建的
|
||||
`C:\Temp\CbbCodeProbe-7f1b0307` 内制造损坏。应用判定代码没有修改,没有执行
|
||||
Repair、Restore、版本回退、集成或保存。
|
||||
|
||||
## 实测结论
|
||||
|
||||
成功触发数据库打开失败弹窗,并取得 `OpenDocument` 的 HRESULT 和 EXCEPINFO。
|
||||
但**数据库损坏与文件不存在返回完全相同的两层错误码**,因此这两个数字不能
|
||||
单独用于判断 ICDB 异常,更不能单凭它们自动请求 Repair。
|
||||
|
||||
| 对照 | `OpenDocument` 结果 | 外层 HRESULT | 内层 EXCEPINFO.scode | 原生证据 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| 未修改副本 | 返回正确工程文档 | 没有失败异常 | 不适用 | 工程身份匹配,数据库 GUARD OK,连接成功 |
|
||||
| 损坏 `icdb.dat` 前 64 字节 | 失败,ActiveDocument 为空 | `0x80020009` / `-2147352567` | `0x8004021E` / `-2147220962` | 数据库文件打开失败弹窗;本轮日志明确指出损坏副本的数据库格式不受支持,并建议 Repair |
|
||||
| 不存在的 PCB 路径 | 失败,ActiveDocument 为空 | `0x80020009` / `-2147352567` | `0x8004021E` / `-2147220962` | 文件不存在弹窗,没有数据库损坏依据 |
|
||||
|
||||
两次失败的 EXCEPINFO 全部字段相同:
|
||||
|
||||
```text
|
||||
wCode: 0
|
||||
source: Expedition PCB - Reusable Block
|
||||
description: Failed to open document.
|
||||
helpFile: ...\hssd\win32\bin\mgcpcbautomation.hlp
|
||||
helpContext: 10187
|
||||
scode: -2147220962 (0x8004021E)
|
||||
```
|
||||
|
||||
外层 `0x80020009` 是 COM 调度异常。内层码在本次对照中表示通用的
|
||||
`Failed to open document.`,尚不能赋予它 ICDB 专用含义。这里取得的是 PCB
|
||||
自动化接口的错误,**没有调用未验证的 iCDB C API,也没有取得其内部 Result
|
||||
错误枚举的可靠映射**。
|
||||
|
||||
正常、损坏、缺文件三种情况在等待 COM 注册时,都出现过
|
||||
`0x800401E3` / `-2147221021`。正常副本随后成功打开,故此码也不能视为 ICDB
|
||||
故障;它记录的是当时 COM 对象尚不可取得。
|
||||
|
||||
## 复现条件与证据
|
||||
|
||||
种子来自已有的隔离测试库:
|
||||
`diagnostics/icdb-auto-recovery-20261027/verify-library`,不使用生产库作破坏对象。
|
||||
完整复制得到 control 和 damaged 两份库,每份 21,029 个文件、557,187,955 字节。
|
||||
复制后核对 LMC、PRJ、DXP、icdb.dat、PCB、LayoutDB 六个主要文件的 SHA-256。
|
||||
仅在 damaged 副本清零工程 `database/icdb.dat` 的前 64 字节,其余字节保留。
|
||||
正常副本和损坏副本在启动前彼此独立。
|
||||
|
||||
通过同一个原生入口启动空白 Reusable Block PCB,然后在专用私有桌面执行
|
||||
`app.OpenDocument(绝对PCB路径)`。调用前核对 COM 主窗口 PID 的启动器父子关系,
|
||||
记录 InstanceGuid,确认没有已有文档,且 PRJ/PCB 工程配置的 CentralLibrary
|
||||
均解析到该副本自己的 LMC。没有创建生产库 COM 写会话。
|
||||
|
||||
正常对照 PID 15536,10:16:44 开始 OpenDocument,10:17:06 返回正确文档。
|
||||
随后授权匹配的关闭助手执行 `doc.Close False`,未保存,正常退出。
|
||||
|
||||
损坏对照 PID 63384,10:18:10 开始 OpenDocument,10:18:51 取得异常。
|
||||
弹窗原文:
|
||||
|
||||
```text
|
||||
Problem encountered while opening one of the database files.
|
||||
See PCBLogFile.txt for details. Loading of the job has failed.
|
||||
Do you wish to view the log file now?
|
||||
```
|
||||
|
||||
截图:
|
||||
`diagnostics/icdb-authority-20261105/live-damaged/database-failure-75566502.png`。
|
||||
先记录弹窗,再点击“否”关闭可选的查看日志提示,未发送修复指令。
|
||||
本轮 `PCBLogFile.txt` 增量为:
|
||||
|
||||
```text
|
||||
Database cannot be loaded and the server cannot be started, the project will
|
||||
not be opened. Please use iCDB Project Backup 'Repair project' functionality
|
||||
to fix this issue. (Database [C:\Temp\CbbCodeProbe-7f1b0307\damaged\
|
||||
ReusableBlocksLP\IP101GR\Work\database\icdb.dat] in old, unsupported format)
|
||||
```
|
||||
|
||||
“旧格式”是原生对被清零文件头的诊断文字;本试验没有证明实际存在版本过旧。
|
||||
iCDBManager 同一 PID 的日志也指向该损坏副本。原生层先重复读取损坏数据库后
|
||||
才显示弹窗;COM 异常在确认弹窗后返回,故不能只等 COM 异常而省略限时的
|
||||
独立弹窗/日志观察。
|
||||
|
||||
缺文件对照最终 PID 61776,记录为 `live-missing-3174b7/com-result.json`,
|
||||
10:25:08 发起调用,10:25:10 取得异常。首轮缺文件试验的单按钮提示未被助手
|
||||
识别,助手按 180 秒上限停止,原生会话保留;之后核对窗口 PID 和明确的缺文件
|
||||
文字,确认原生按钮 ID 为 2,正常确认提示并关闭空白 PCB。修正试验助手后重跑
|
||||
取得上述完整错误码。该超时不是 ICDB 故障证据,首轮记录保留。
|
||||
|
||||
## 验证结果与边界
|
||||
|
||||
`diagnostics/icdb-authority-20261105/verify_live_probe.py` 对真实记录执行断言,
|
||||
汇总保存在 `live-comparison.json`:正常文档身份、两种失败完全相同的 EXCEPINFO、
|
||||
损坏弹窗与数据库路径、来源六文件哈希、损坏文件未被修复、测试进程退出及
|
||||
已有原生会话保留均核对通过。三个最终试验都正常结束,前台窗口句柄前后相同。
|
||||
没有剩余测试 PCB 或 iCDBNetServer;既有 Project Backup PID 60000、63480 保留。
|
||||
|
||||
检测可使用“实际打开失败 + 本次明确 ICDB 诊断 + 数据库目标一致”的组合证据。
|
||||
文件不存在、一般打开失败和 COM 注册等待要分别记录。明确的单项故障只应
|
||||
成为该项备注,不据此永久禁用普通检验或版本管理。
|
||||
|
||||
本次验证了**文件头损坏**,没有复现现场“先前服务器会话失联”,也没有验证自动
|
||||
修复、READY 或完整产品维护入口。没有运行/宣称全量应用测试;本轮只增加
|
||||
调查脚本与记录。不能将本次复现算作现场 ICDB 修复通过。
|
||||
@@ -0,0 +1,86 @@
|
||||
# ICDB 扫描按实际打开错误内容分类
|
||||
|
||||
## 当前行为
|
||||
|
||||
批量检查复用 PCB 诊断打开路径,不再先启动 Project Backup 检查所有条目。
|
||||
诊断请求固定关闭自动修复、原生 Verify 菜单及恢复确认;只打开、核对目标并
|
||||
正常关闭,不执行集成、保存、Repair 或 Restore。普通检验和原生版本管理
|
||||
继续使用独立入口,界面既有 READY 排除规则保留。
|
||||
|
||||
只有实际打开错误中包含 iCDB 内容,或本轮原生日志明确给出 iCDB 错误,才
|
||||
将该条目标为 ICDB 问题。通用错误码、工具内部类别名称、路径中出现 icdb、
|
||||
成功输出以及历史错误均不能单独决定分类。没有 iCDB 具体原因的一般打开
|
||||
失败仍保留原始错误和未确认结果,不显示成数据库损坏或健康。
|
||||
|
||||
正常打开只返回 CHECKED,不推定 CBB READY。单项失败在实际会话已释放后
|
||||
继续后续项;未确认释放或用户取消时仍保留真实状态。没有增加永久的故障
|
||||
锁,也没有把扫描结果作为普通检验或版本管理的前置条件。
|
||||
|
||||
## 重复扫描的证据
|
||||
|
||||
实机发现同一工程连续打开失败时,PCBLogFile.txt 可能逐字相同。仅比较内容
|
||||
会把本次故障误当成旧日志。补充采集当前 PCB PID 对应的 iCDBManager 日志,
|
||||
核对日志创建/修改时间、PID 头和目标数据库路径后,保留具体 ERROR 内容。
|
||||
采集在既有的限时只读助手中执行,保留 16 KiB 头和最多 128 KiB 尾的读取
|
||||
预算,不在 Qt 线程中等待日志,不递归扫描整个库,也不调用修复接口。
|
||||
|
||||
文件日志仍采用启动前检查点及有界增量读取;未知基线、无法确认历史的日志
|
||||
重写,不提升为本轮证据。扫描只读取本次诊断子目录的错误证据,不能引用
|
||||
上一次操作的证据目录来标记当前条目。
|
||||
|
||||
## 实际验证
|
||||
|
||||
使用上一轮完整复制的两个隔离库,通过应用的 `run_verify(maintenance=True)`
|
||||
及 `run_batch` 执行真实生产调度路径。请求故意带旧 `auto_repair=True`,内部
|
||||
诊断仍强制关闭修复。
|
||||
|
||||
- 损坏副本:保留清零前 64 字节的 icdb.dat。原生再次弹数据库打开失败提示;
|
||||
扫描读取本轮 PID 3060 的日志,返回 FAIL / ICDB_REPAIR_REQUIRED,并保留
|
||||
`in old, unsupported format`、目标数据库路径及日志证据。
|
||||
- 随后正常副本:原生 PID 28948 打开正确工程,正常关闭,返回 CHECKED。
|
||||
- 两项均 `safe_to_continue=true`、`library_flag=UNKNOWN`、恢复尝试为空;没有
|
||||
请求 Project Backup、Repair、Restore、集成或保存。测试 PCB 和数据库服务器
|
||||
均退出;没有终止已有 Project Backup 会话。
|
||||
|
||||
证据:`diagnostics/icdb-authority-20261105/product-scan-comparison.json`,以及
|
||||
相邻的 `product-scan-damaged` 和 `product-scan-control`。首次复测暴露的重复日志
|
||||
漏判记录也保留,没有清空故障日志来让测试通过。
|
||||
|
||||
回归覆盖实际损坏报文、未知 iCDB 错误内容、相同错误码的非 ICDB 失败、正常
|
||||
输出、旧日志残留、日志重写、旧操作证据隔离、当前/其他 PID、日志新旧、
|
||||
其他数据库路径、取消、会话未释放、失败后继续,以及原有界面/报告行为。
|
||||
最终测试命令为 `python -X utf8 -m pytest -q`,1326 项通过,436.32 秒,保留一条
|
||||
既有 pywinauto STA 提示;详细结果保存在同目录 `pytest-scan-utf8.xml`。
|
||||
系统默认 GBK 模式的一次运行中,既有测试用默认编码读 UTF-8 报告失败;该项
|
||||
在 UTF-8 模式下单独复测通过,未因此修改原生修复逻辑。
|
||||
|
||||
冻结候选包构建及启动/正常退出冒烟通过,16 个关键 Python 模块和两个 VBS
|
||||
与源码一致,包内 x86 运行库及 Unicode/UNC 协议检查通过。使用冻结程序的
|
||||
限时日志采集入口回放当前 PID 证据,确认能保留实际 ICDB 原因;未在冻结包中
|
||||
再次执行整条原生扫描批次。独立候选包不覆盖此前的程序目录,未合并发布。
|
||||
|
||||
只读独立复核未发现必要 P1/P2,指出批量报告残留旧的 Project Backup 流程名称。
|
||||
随后仅将该报告名称改为实际的 PCB 打开检查,并增加报告输出断言,104 项相关
|
||||
回归通过;同步重建并复核最终 r2 候选包。完整回归记录保留在上述 XML,文案
|
||||
修正后的相关回归记录为 `pytest-scan-post-review.xml`。
|
||||
|
||||
## 文件头损坏与版本管理
|
||||
|
||||
“版本历史与备份…”打开原生 iCDB Project Backup,入口只核对 LMC 和唯一 PRJ,
|
||||
不以 icdb.dat 文件头可读作为准入条件。有效的完整历史备份包含数据库文件,
|
||||
原生 Restore 可以替换损坏状态,而不是计算或补写丢失的 64 字节。
|
||||
|
||||
这份隔离样本的备份配置为相对 `./backups`,列出的多个历史 ZIP 中包含
|
||||
`database/icdb.dat`。文件头非零仅是清单检查,不能代替原生验证备份有效性。
|
||||
清单保存在 `version-backup-inventory.json`。
|
||||
|
||||
已有同类隔离实测中,原生 Repair 从已有备份恢复了该文件头损坏,随后重新
|
||||
打开并验证成功;没有有效备份的对照则明确失败。见
|
||||
[此前有备份的恢复记录](../releases/2026-10-28-icdb-open-repair-reopen-validation.md)
|
||||
及[无备份的失败记录](../releases/2026-10-28-icdb-no-history-repair-validation.md)。
|
||||
那次是 Repair 调用原生备份恢复,不等同于本轮已通过当前版本管理按钮执行
|
||||
Restore;本轮没有选择恢复版本或发起恢复。
|
||||
|
||||
恢复会回到所选备份的内容版本,应保留原始损坏副本,恢复后重新打开并单独
|
||||
检验。PCB 启动时“最后手动保存/自动保存”的选择不应直接视作工程 iCDB 已
|
||||
恢复。没有有效恢复源时不能承诺恢复。现场会话失联和自动修复仍未验收通过。
|
||||
@@ -0,0 +1,58 @@
|
||||
# 管理、协调租约与状态扫描阻塞审计
|
||||
|
||||
审计范围:`library_lock.py`、`management.py`、`native_management.py`、`management_transaction.py`、`native_backup.py`、`network_path.py`、`batch_status.py`、`status_bridge.py`、`owner_probe.py`、`native_export_guard.py`、`icdb_ownership.py`、`native_occupancy.py`。本文仅说明这些边界,原生窗口清理、普通校验入口与界面由本轮其他修改覆盖。
|
||||
|
||||
本轮没有在该审计任务中启动 Mentor、Repair、Restore,未修改现场中心库,也没有删除原生地址、锁或数据库文件。测试使用临时文件和替代原生边界。
|
||||
|
||||
## 已落实的误阻塞修正
|
||||
|
||||
| 入口或条件 | 原误阻塞 | 修正及验证重点 |
|
||||
| --- | --- | --- |
|
||||
| `native_management.NativeOperationError`、`management.run_management.invoke` | 原生目录失败已退出,异常丢失释放事实 | 操作成功与释放证据独立传播;已退出目录失败可以重新取得协调锁 |
|
||||
| `management_worker_main` | 桌面、映射、能力或来源校验在原生启动前失败,却报告未释放 | 原生启动前保持 safe;进入实际原生边界前才变为未确认 |
|
||||
| `NativeManagementAdapter._worker`、`_launch_worker` | 请求准备或桌面构造失败制造假会话 | 准备失败为 safe;构造失败仅消费明确的 process_created=false、worker_exited=true、remaining_pids=[]、safe=true 协议;部分启动和缺证据仍未确认 |
|
||||
| `NativeManagementAdapter._add_transaction` | Add 已退出后,路径、引用对齐、被动占用检查失败再次保留库锁 | 仅实际启动下一原生调用前重置释放状态;异常在租约退出前传播已知释放事实 |
|
||||
| `NativeManagementAdapter.prepare_add_transaction` | 来源缺 CentralLibrary、staged/asset/lease 校验失败制造假未释放 | 原生 capture 前的完整准备块返回 safe=true 失败;capture 后准备事务记录失败保留 capture 的实际释放事实 |
|
||||
| `management_worker_main` 的 CleanWGLib remove | wait 已退出但输出文件读取失败,或明确创建拒绝仍 unsafe | wait 确认退出立即记录 safe=true 与 exit_code;FileNotFoundError/PermissionError 的创建拒绝为 safe,未知创建错误和 timeout 保持未确认 |
|
||||
| `management.run_management` | 移除后被动检查异常、报告写入异常把已释放改成未释放 | 保留释放事实;报告存储错误写入返回 detail;不重复抛出最终报告异常 |
|
||||
| `management.RECOVERY_REQUIRED` | 目标数据恢复要求被混同为原生会话仍存活 | 可同时返回 RECOVERY_REQUIRED 和 safe=true;同目标禁止自动重放,明确不同目标不被旧数据恢复记录误挡 |
|
||||
| `management._may_have_mutated` | 末阶段看似 prewrite 即忽略曾经写入的 history | 仅完整且一致的 prewrite history 可确认未写入;缺失、混合历史保持未知 |
|
||||
| `LibraryLock.__enter__` | retained checkpoint 租约永远不再检查回调 | 同一租约 release probe 证明退出后,可清理身份相符且无未决 export/pending 的应用检查点并重新取得锁 |
|
||||
| `NativeManagementAdapter.release_confirmed` | 超时 worker 后来正常返回仍永久保留 | 按库跟踪原 worker;只有它已退出且其独立结果 safe=true 才回收;缺失/损坏/unsafe 结果不推定释放 |
|
||||
| `LibraryLock`、`release_retained_library` 的 CreateFile | 权限、网络、路径失败统一称 competing writer | 仅 Windows sharing/lock violation 32/33 分类为 LibraryBusy,其余保留实际错误 |
|
||||
| `has_blocker` | 完整快照中的异库 pending 一律阻止 | 主记录与 pending 采用一致规则:只有完整、有效且明确搬迁的源记录可忽略 |
|
||||
| `release_retained_library` | torn、malformed 应用检查点没有恢复路线 | 显式释放强制全库 fresh owner/native-file/export proof,复核原字节未变化,先归档再清应用 JSON;未知 proof 标记不足时拒绝归档 |
|
||||
| `release_retained_library` 的范围 | 选择 Target 却清除全库旧检查点,可能漏 Other 真实会话 | 只有检查点和进程内 owner 都绑定相同 block_name 才使用所选目标范围;旧无 scope、范围不符、损坏记录一律 full proof |
|
||||
| `_prove_library_released` 的目录范围 | 目标释放仍扫描所有 CBB,且漏共享 SymbolLibs | 已绑定目标时仅扫描目标 Work、共享 SymbolLibs 和所选 LMC;共享地址与数据库始终参与证明 |
|
||||
| `_prove_library_released` 的 retained registry | 库 A 的 worker 阻止库 B | 新 worker 绑定 cbb_library;明确异库可排除;旧无 scope registry 保留未确认 |
|
||||
| `_owner_matches_scope` | Work 子串匹配 WorkOld,worker 只带 job 路径时反而漏检 | Windows argv 精确路径边界;读取有大小限制的 worker 请求以绑定 library/project/database;没有可判定路径时不推定无关 |
|
||||
| `_owner_matches_scope` 的 EDIF 命令 | 不识别产品实际 `-icdb <database>`,异库 exporter 被当全局未知 owner | 同时支持实际位置参数与 `-icdb=`、`-project=`,带空格路径和大小写按 Windows argv 解析,目录前缀相似不当作同库 |
|
||||
| full known library process proof | 全机同名原生程序都被称本库占用 | 命令行明确指向异库可排除;无范围证据仍保持未确认;损坏检查点 full recovery 不使用范围排除 |
|
||||
| `_persist_blocker`、`_recorded_supervisor_alive` | maintenance 只凭旧 PID 存在,PID 复用会误挡 | 新 version=1 记录附 machine 和 supervisor_created;只有进程创建身份匹配才称原监督进程仍在;旧身份缺失需额外 fresh native-idle 和原独占/目标 guards |
|
||||
| maintenance 新 owner | retained 后缺 release_probe | 保存明确的 release callback,复用协调租约的再证明路径 |
|
||||
| `BatchStatusSession.scan` | 单个请求/CBB/path mismatch 把后续未查询项全部标错 | 错配记录只属于当前项;支持 server 时先 restart 再逐项查询;已确认基础设施不可用仍批量标 UNAVAILABLE |
|
||||
| `fingerprint_library`、batch record | 相同字节/时间的另一库或另一 block_type 复用旧 READY/PENDING | cache 绑定绝对库路径和 block_type;不 resolve 映射路径,不递归扫描工程负载 |
|
||||
| `LibraryPathLease.close` | 映射查询或取消一次失败后 closed 永久为 true | 成功后才结束租约,瞬时失败可再次 close |
|
||||
| `release_after_recovery`、`release_retained_path_leases` | retained mapping 永久不释放,旧界面丢引用后也不可回收 | 核对 RELEASE_CONFIRMED 与该库 display/mentor/已知 UNC 身份;registry 保留旧对象;共享当前映射先转移所有权再释放旧租约 |
|
||||
| `WindowsWNetBackend.mapping`、`mappings` | 无关盘符读取失败让目标映射不可用 | 目标盘直接查询;全枚举跳过不可查盘但把它保留为已占用,避免抢占未知盘符 |
|
||||
|
||||
对应集中回归:`tests/test_management_retry_blockers.py`。既有管理、事务、租约、网络路径、状态扫描、导出与维护测试也纳入定向回归。
|
||||
|
||||
## 仍保留的真实互斥和未确认边界
|
||||
|
||||
| 条件 | 当前行为与可用路线 |
|
||||
| --- | --- |
|
||||
| uploader 或真实同库任务仍持有独占协调句柄 | 继续互斥;不删除 `.cbb-upload.lock`,文件中的旧 PID 文本不作为当前持锁证据 |
|
||||
| 全局 `Local\\CbbRefreshVerify795` mutex | 仍序列化本应用原生 COM/管理操作。尚未证明所有 Mentor 全局状态可按库并发,未直接删掉此保护 |
|
||||
| `native_management._catalog_com` 已有 LibraryManager.exe | 仍在 COM 激活前保守拒绝。尚无证据证明本机 DispatchEx 不会复用已有服务、Quit 不会关闭他人窗口;本轮仅修为 prelaunch safe,不声称已支持并存 |
|
||||
| `_catalog_native` 激活后无 native_pids、原生 PID/退出状态缺失 | 仍未确认,可能 COM 已启动不可追踪服务。新请求不自动把空 PID 列表视为已释放;提供显式 fresh release 路线 |
|
||||
| `native_management._wait_native_exit` | 运行时仍以已观察 PID 等待退出,未新增 Library Manager 全部后代的 JobObject/creation-time 追踪;超时转显式释放证明 |
|
||||
| 旧无创建身份的外部/导出进程记录 | 不能把活 PID 直接证明是旧进程,也不能无条件忽略;新记录创建身份由本轮相应 exporter 修改提供。无法独立确认时保留现场与明确未确认原因 |
|
||||
| `sAddress.adr` 仍存在 | 地址存在本身不证明当前活跃,但显式“释放”也不冒充原生 NOT_IN_USE。应走既有 inspection-only 的精确 project/database 原生占用检查;本任务不手删地址,也不自动 Repair/Restore |
|
||||
| `owner_probe` 超时、访问受限、空 command、请求文件不可读 | 不把它称已确认活跃;也不猜已退出。明确异库证据可以排除;范围不明时保留未确认,并允许独立只读检查 |
|
||||
| export ownership 元数据有效但副本目录/数据库缺失,或 token/lease 不匹配 | 仍拒绝自动清理,因为无法证明原副本的原生写入已结束;未知元数据恢复通路不能覆盖掉已知但尚未证明释放的 export copy |
|
||||
| native backup 的自身 JobObject/子进程仍活动或查询失败 | `native_backup.py` 已使用 checkpoint=false;等待其自身会话树退出,不因主窗口/launcher 先退就推定全部释放,不 terminate/kill 原生事务 |
|
||||
| 二进制 hash、flow、ASCII removal contract、来源/目标/证据隔离、Add nonce 和 duplicated lease handle | 继续作为能力或身份校验;它们不是 native busy。失败不授权绕过未验证原生写入路径 |
|
||||
| 损坏检查点的全局 fresh-proof 路线 | 为弥补未知 scope,可能要求全机已知 native/app workers 均退出;这是显式未知记录恢复的限制,不适用于具有明确异库范围的普通重试 |
|
||||
|
||||
维护入口的 PID 创建身份、原生文件独占和 fresh guards 是不同证据:创建身份匹配只说明原监督进程仍在;创建身份不同/旧 schema 缺失只消除错误 PID 归属判断,不能替代原生或数据库释放证明。
|
||||
@@ -0,0 +1,37 @@
|
||||
# 中心库无活跃会话却被阻止(r5 现场反馈)
|
||||
|
||||
## 现场证据
|
||||
|
||||
用户运行 `blocking-locks-20261105-candidate-r5` 后反馈中心库操作仍提示上次未安全释放,扫描看不到活跃会话。
|
||||
|
||||
- r5 `data/logs/application.log` 中,15:54(北京时间)的 IP101GR PCB 检查因原生读写确认退出;相应 `session-release.json` 为 `safe_to_continue=true`、`worker_exited=true`、`remaining_pids=[]`。这次打开失败不等于释放失败。
|
||||
- 随后版本工具 `native-backup-6bc7146a0eee/result.json` 为 `CLOSED / safe_to_continue=true / native_exit_code=0`,原生 PID60660 已退出。
|
||||
- 中心库仍存在 11 月 4 日的 `.mentor_lib.cbb-upload.blocked.json`:PID57076、lease `eae80a06f23e4664b00c70b6bf81b01d`、`OWNER_RELEASE_UNCONFIRMED`。这是一条旧操作记录,并非当前进程存在的证据。
|
||||
- 本轮只读实查:关联进程列表为空,协调文件可独占读取,库内没有 `sAddress.adr`,原有完整释放证明也通过。未为诊断删除源库任何记录或工程文件。
|
||||
|
||||
## 根因
|
||||
|
||||
`run_management` 在 `LibraryLock.__enter__` 因历史记录拒绝时尚未启动任何原生会话,但异常收尾用 `isinstance(error, LibraryBusy)` 强制把结果改成 unsafe。互斥通道尚忙也返回相同 unsafe。UI 随后把这一结果记为按库保留的 unsafe 标志,直接禁用后续管理;此时没有 PID 可供扫描。失败发生在创建本次 checkpoint 之前,也没有对应的管理尝试日志。
|
||||
|
||||
原残留扫描只列进程,不列历史 JSON 或 `checkpoint=False` 的进程内 retained lease,进一步造成“明明没有会话但永远不能继续”的表现。
|
||||
|
||||
## 修正
|
||||
|
||||
1. 有旧 JSON、同库进程内 retained lease、旧管理标志或未确认释放的历史修改时,在操作互斥范围内、任何新原生调用前执行已有完整释放证明。证明通过才归档本应用旧记录并释放本应用句柄;真实 owner、地址、共享访问冲突仍拒绝。未知归属不假定无人占用。
|
||||
2. 管理尝试先记录 `release_check`;未启动的新操作被拒绝时保留本次 `safe=true`,不制造新的原生 owner。已启动原生后仍沿用实际退出证据,不能把超时统一放行。
|
||||
3. UI 的旧 unsafe 标志成为重新复核要求,不再直接禁用管理。匹配当前库的证明且本批结果全部安全后,先恢复 retained 路径 lease,再清旧标志。映射恢复失败保留重试状态。
|
||||
4. 扫描明确显示历史记录日期与内存保留记录,和活跃进程分开。空进程列表不再隐藏历史阻止原因。
|
||||
5. 同目标历史修改未完成仍保留“需恢复,不能重放”;会话已释放与数据是否恢复分别处理。没有修改的 BLOCKED 结果不再触发额外原生目录读取。
|
||||
6. 管理结果记录操作类型、CBB、状态、安全状态、原因及证据位置,包含启动前拒绝。
|
||||
|
||||
## 验证
|
||||
|
||||
- 按现场旧记录结构新增回归,初次 4 项均失败;修正后通过。覆盖无 owner 继续、真实地址保留、执行通道忙不制造 owner、空列表显示历史记录。
|
||||
- 后续覆盖无 JSON 的 retained Verify 锁、匹配证明后恢复路径 lease、UI 可以再次发起复核。相关 **119 passed**。
|
||||
- 实际隔离 UI 链路 `diagnostics/icdb-authority-20261105/legacy-management-a1c609ec/result.json`:从已验证原生 CRUD fixture 创建新隔离副本,预置相同旧记录与 UI unsafe 状态,通过应用“移除 CBB”确认入口完成复核、旧记录原字节归档、原生移除 IP101GR、重新读取目录确认缺失、UI 与路径 lease 恢复。**REMOVED / safe=true,59.016 秒,原始 fixture 全文件哈希不变**。生产库工程与旧记录未改动。
|
||||
|
||||
- 统一全量 **1518 passed**(`management-release-pytest.xml`,268.10 秒,1 条既有 STA warning);编译与 diff 检查通过。
|
||||
- **r6 冻结复验通过**:`legacy-management-b3a65315/result.json`。控制层源码与包内字节码一致,真实管理 worker 与进程探测运行 r6 exe;相同 UI 链路返回 `REMOVED / safe=true`,原生目录再次确认缺失,旧记录归档、保留映射与 UI 标志恢复,原 fixture 未修改;96.313 秒。包内 26 个 Python 模块及 2 个 VBS、实际 GUI 启停、x86 codec 和包内 runtime 加载通过。
|
||||
- 独立复核确认没有新增 P1/P2。候选包为 `dist/blocking-locks-20261105-candidate-r6/CbbRefreshVerify-Background`。
|
||||
|
||||
生产库的旧记录保留到用户下一次实际管理操作或确认释放时,由同一完整证明流程复核、归档。没有直接删除源库锁文件,也没有替用户重放增删改。不把本次阻塞修复算作 ICDB 数据自动修复验收。
|
||||
@@ -0,0 +1,27 @@
|
||||
# r9 补充审查:4 个已复现问题
|
||||
|
||||
本次只审查和构造回归复现,未修改产品源码、未启动 Mentor、未操作真实库。源码与 r9 BUILD.json 的 SHA-256 比对另行确认。先前 1,564 项测试通过没有覆盖以下组合场景。
|
||||
|
||||
复现:`python -X utf8 -m pytest -q diagnostics/icdb-authority-20261105/test_r9_remaining_review.py --junitxml=diagnostics/icdb-authority-20261105/r9-review.xml`。四项均在预期断言处失败,收尾完成,无残留测试线程。
|
||||
|
||||
1. **P2:停止整队列不会取消后台检查。** 后台 Beta 检查期间提交前台任务,再点击“取消当前任务并停止队列”。`request_stop()` 在 busy=true 时只设置前台 stop,没有设置 IcdbCheckTask.stop。前台任务取消后后台继续执行 Gamma。实测 calls=['Beta', 'Gamma'],期望仅 ['Beta']。位置:`ui/main_window.py:1484`。
|
||||
2. **P2:排队项目变成 READY 后仍重复检查。** 检查启动时捕获目标列表,后续权威刷新将 Gamma 更新为 READY,恢复执行时只检查 invalidated,未重新核对 READY 操作资格。实测 Gamma 仍进入 verifier。用户要求 READY 即使被勾选也应排除。位置:`ui/icdb_check_task.py:66`、`ui/main_window.py:781`。
|
||||
3. **P2:释放失败被误显示成读写确认。** 注入 `DATABASE_SAFETY_STOP` 和原始错误 `PCB_RELEASE_UNCONFIRMED: launcher still running`,表格固定显示“未确认:需处理读写确认”。该分类也包含普通会话释放失败,不能据此断定存在读写提示。位置:`ui/main_window.py:819`。
|
||||
4. **P3:普通校验排队时隐藏后台检查进度。** 检查 Beta 仍运行时提交普通 Gamma 校验;`_run(maintenance=False)` 无条件隐藏 icdb_progress 和 icdb_phase,后台任务仍活跃。实测 isHidden=true。位置:`ui/main_window.py:1215`。
|
||||
|
||||
建议先修 1、2,再修 3、4;把这四个复现并入正式 tests 后复测。没有依据将这些结果扩大成数据库损坏或“所有释放又失败”。
|
||||
|
||||
仍保留此前验收缺口:ICDB 自动修复、现场服务器失联完整恢复以及 Windows 10 关键流程没有因本轮检查验收而变成通过。
|
||||
|
||||
## r10 修复
|
||||
|
||||
- “停止队列”同时取消后台 ICDB 任务和当前前台队列;独立“停止检查”仍只取消 ICDB 检查。
|
||||
- 每项在真正取得原生执行机会后检查最新 READY 集合。权威状态读取在让出队列之前发布状态,不等待界面回调;重新加载和局部状态刷新均按库匹配,其他库的同名 CBB 不受影响。
|
||||
- 仅本次错误明确含 read/write access permission 时显示读写确认;释放未确认和其他安全状态分别显示,原始错误保留在提示中。
|
||||
- 普通校验排队时保留活跃 ICDB 任务的进度条和阶段标签。
|
||||
|
||||
4 个原始复现已转入 `tests/test_background_queue_regressions.py`,修复前均红,修复后均绿;另补权威状态在 Qt 回调前发布、跨库同名隔离以及不同安全原因显示,共 10 个回归。第一轮相关 49 项通过。产品源码仅修改 `ui/main_window.py`、`ui/icdb_check_task.py`;具体最终测试、冻结和原生验收见 r10 的 VALIDATION.json。
|
||||
|
||||
最终全量 1,574 项通过(0 失败、0 错误、0 跳过);有既有 pywinauto STA COM 初始化提示 1 条。编译和 diff 检查通过。r10 冻结包 37 个模块/脚本与源码比对、GUI 启动冒烟和包内 x86 状态桥运行库加载检查通过。
|
||||
|
||||
r10 实际冻结执行器隔离批次通过:损坏项 FAIL / ICDB_REPAIR_REQUIRED / safe=true(68.563 秒),随后正常项 CHECKED / safe=true(26.812 秒);无关的同桌面模态窗口未被操作,来源六文件哈希不变。实际界面按钮检查及排队状态读取通过,顺序 check-start → check-end → status-start → status-end,筛选可用,最终 READY,50ms 定时器最大间隔 79ms,整体 23.656 秒。目录行的初始 PENDING 为测试注入,原生打开和状态读取实际执行;不冒充现场服务器失联恢复验收。
|
||||
@@ -0,0 +1,95 @@
|
||||
# CBB 管理候选实现(Issue #2 Task 4)
|
||||
|
||||
本次在当前应用增加新增、同名更新和移除入口、逐项检查点、库外完整备份、
|
||||
来源工程暂存和明确的结果状态。READY 条目可以勾选用于管理;原有校验和恢复
|
||||
仍仅处理当前可见的非 READY 合格条目。
|
||||
|
||||
## 原生能力边界
|
||||
|
||||
移除路线来自 EE 7.9.5 随附 Tcl 的 `CleanWGLib <lmc> F4 <list>`,输入为
|
||||
`REUSE_BLOCK\tLogical-Physical\t<name>`。协调端已在独立库副本完成真实移除
|
||||
和原生目录缺失复读。运行时核对已验证的 LibraryManager、CleanWGLib、
|
||||
LMCDLL70 和 LMCDocAddin70 文件 SHA256;仅允许匹配版本、DxDesigner 流程、
|
||||
Logical-Physical 分区及 ASCII 名称。输出必须包含对应名称/分区的 Removed
|
||||
消息且不含 Warning/Error,之后重新打开原生目录确认条目缺失。
|
||||
|
||||
新增和同名更新默认禁用,界面说明缺少哪项隔离验证。已发现原生新增对话框
|
||||
不等于完成库注册;不能仅凭返回值或出现目录启用。通用引擎已实现新增冲突
|
||||
拒绝、暂存来源、名称/分区/工程内容复读、可选自动校验,以及明确更新时的
|
||||
原生移除后重新导入。更新必须同时有两个原生路线和同名端到端验证才可启用。
|
||||
移除后重新导入失败会报告 `RECOVERY_REQUIRED`,停止队列,不自动回滚或重放。
|
||||
|
||||
## 操作与恢复证据
|
||||
|
||||
每项结果包含 operation、library、name、partition、source、auto_verify、stage、
|
||||
status、safe_to_continue 和 evidence_path。`management/management-<id>/`
|
||||
保存原子更新的 `checkpoint.json`、完整 `library-before`、主数据清单、来源
|
||||
暂存副本、原生请求/输出和后续校验记录。结果区区分:
|
||||
|
||||
- `UPLOAD_FAILED`:上传失败;不能解释为已上传。
|
||||
- `UPLOADED`:原生注册与工程身份已确认,本批次未自动校验。
|
||||
- `UPLOADED_VERIFY_FAILED`:已上传,但自动校验没有达到 PASS/GREEN。
|
||||
- `UPLOADED_VERIFIED`:已上传且自动校验达到 PASS/GREEN 并确认释放。
|
||||
- `REMOVED`:原生移除且重新读取目录确认缺失。
|
||||
- `RECOVERY_REQUIRED`:原生写入可能发生,或更新已移除但重新导入未完成;
|
||||
保留完整库备份和所有中间状态,需要人工审查。
|
||||
|
||||
启动时显示未完成和释放不确定的检查点,不自动执行。存在同一库的未完成
|
||||
检查点时,新的管理任务被阻止。先由管理员检查原生进程、目标目录和备份,
|
||||
按现场恢复流程处理;确认恢复完毕后把已审查的操作证据目录移至独立归档位置,
|
||||
再重新读取库。不要删除锁文件,不要强制结束持有数据库的原生程序。
|
||||
|
||||
## 并发和来源保护
|
||||
|
||||
管理、校验和备份恢复共享 `Local\CbbRefreshVerify795` 及原上传工具兼容的
|
||||
`.<LMC stem>.cbb-upload.lock` 独占句柄。只有相同线程持有的相同库锁允许嵌套;
|
||||
完整备份通过已经持有的句柄读取锁内容,不重新打开或删除独占锁。
|
||||
管理任务不能确认原生所有者释放时,在本应用进程内保留该独占句柄,阻止旧上传
|
||||
工具抢入;不会仅因自动化线程返回或超时而释放锁。
|
||||
直接校验与备份恢复也保留释放不明确的锁。库旁保存
|
||||
`.<stem>.cbb-upload.blocked.json`,本应用重启后拒绝写入和原生读取。
|
||||
该记录在取得库锁后、原生调用前写入,正常确认释放才清除。只有精确保留文件名、
|
||||
协议版本和所有权字段匹配的记录被归类为运行时元数据;完整副本仍保留其字节,
|
||||
主数据比较忽略其生命周期变化。同名普通文件或损坏记录保持原样并阻止自动解除。
|
||||
“检查会话释放并解除协调阻止”入口先确认管理工作进程已返回、相关原生进程
|
||||
均已退出、库内不存在 sAddress.adr,且能同时以独占只读句柄打开所有 LMC、
|
||||
icdb.dat 和 LayoutDB.lyt。全部通过才归档阻止记录并关闭本应用保留的句柄;
|
||||
不会删除上传锁文件,也不把会话释放解释为数据恢复成功。
|
||||
|
||||
进程崩溃会使 Windows 释放其句柄;旧上传工具不认识新增阻止记录,因此本方案
|
||||
不能保证本应用崩溃后旧上传工具仍被排除。崩溃后应先正常结束原生会话,并通过
|
||||
上述释放检查和未完成任务审查,再使用本工具或旧上传工具继续写入。
|
||||
|
||||
备份与来源不能置于目标库内部,来源必须是完整且引用位于工程内的 PRJ/PCB。
|
||||
来源工程根目录和目标库根目录也不能相互包含或相同,避免操作嵌套库时改变原始来源。
|
||||
链接、外部数据库引用、源文件变化、备份失败和同名新增冲突均会阻止写入。
|
||||
来源先完整复制;工程身份比较使用顶层块、原理图数据库和布局数据库内容指纹,
|
||||
原生规范化若改变数据库字节则保守拒绝确认,需要进一步语义验证,不能声称等价。
|
||||
|
||||
原生管理在私有 Windows 桌面运行,不移动鼠标或占用前台输入。只操作当前
|
||||
已识别原生进程。读取目录遇到旧库升级或 Select flow type 对话框时取消并报错,
|
||||
绝不将升级作为只读读取的一部分。超时保留原生所有者和证据,不强杀数据库进程;
|
||||
确认前不继续下一项,不启动最终 Verify。
|
||||
通过网络盘租约选择的盘符路径在原生 OpenLibrary、CLI、暂存工程库引用和后续
|
||||
Verify 中保持原样;规范化路径仅用于身份、包含关系和锁键比较。工作进程按原
|
||||
租约的盘符/共享目录上下文确认映射,不把原生盘符路径改回 UNC。
|
||||
|
||||
## 独立新增诊断
|
||||
|
||||
`python tools/validate_native_management.py SOURCE.prj NEW_OUTPUT_DIRECTORY NAME`
|
||||
只接受不存在的新目录,先完整复制来源,再由私有工作进程调用原生
|
||||
`CreateLibrary(..., kFLOW_DX=1)` 创建固定的新库。随后使用已验证的
|
||||
Reusable Blocks / UIA Logical - Physical 页签和 New 按钮、1103 对话框字段。
|
||||
诊断会记录原生消息、关闭后的重新打开清单、工程内容比较和原始来源不变检查。
|
||||
它不接收生产库参数,不存在跳过生产能力门禁的开关,也不自动修改能力门禁。
|
||||
可加 `--replacement-source OTHER.prj` 在同一个新建隔离库中验证同名更新:
|
||||
先备份完整旧库,再原生移除并检查缺失,然后重新导入替换工程。重新导入必须
|
||||
匹配本次 CreateLibrary 记录的固定路径和随机所有权令牌,不能指向外部库。
|
||||
监督进程先创建新的空 fixture 目录并持有库锁,原生工作进程核对准备令牌、
|
||||
检查点协议和监督 PID 后才创建 LMC。初次创建、所有复读和替换阶段均按生产
|
||||
操作的释放规则持锁;超时或释放异常保留独占句柄和重启阻止记录,必须重新
|
||||
通过会话释放检查才能解除。
|
||||
|
||||
本阶段单元测试通过注入文件模拟的原生边界执行,不启动 Mentor、不操作实际库。
|
||||
候选冻结包、最终 Windows 11 原生场景由协调端单独验收。Windows 10 和真实
|
||||
现场失联样本仍未验证;文件头损坏与模拟故障不能替代这些验收。
|
||||
@@ -0,0 +1,77 @@
|
||||
# 工单 #2 候选包验收记录
|
||||
|
||||
分支:`codex/temp-issue-2-icdb-recovery`。本记录区分软件回归、隔离原生试验和现场验收;未合并、发布或关闭工单。
|
||||
|
||||
最终候选程序源码提交:`8e486c1`。新增和同名更新保持禁用;原生新增虽已成功注册并复读,但原理图数据库被原生工具重写,尚未证明内容等价。移除已在新建隔离库通过完整管理流程验证。
|
||||
|
||||
最终全量回归:`python -m pytest -q` 在 `122bafc` 上 **887 passed,1 个已有 pywinauto STA 模式警告,68.62 秒**。`122bafc` 只调整安全测试,`src` 和 `packaging` 的 Git 树与打包提交 `8e486c1` 完全一致。编译检查及 `git diff --check` 通过;整分支审查和后续修正复审均无未处理问题。
|
||||
日志:`build/issue2-final-tests-122bafc.log`。安全测试明确保留工程文件、上传锁以及损坏/外来检查点,只有本工具拥有且验证通过的运行时检查点允许清理。
|
||||
|
||||
## 已实现范围
|
||||
|
||||
- ICDB 启动失败后,仅在任务进程、工程路径、私有桌面、空闲窗口及地址释放可确认时正常关闭 PCB;同时等待启动器退出。Repair 区分缺少健康备份、原生失败、占用、未知窗口和释放超时。最终重新打开、校验及 READY 状态共同决定修复成功。
|
||||
- 名称/分区搜索和状态筛选使用已加载数据;隐藏条目清除勾选。READY 可以用于管理,不能进入默认校验、维护和恢复队列。受影响条目刷新后重新判断资格。
|
||||
- 完整备份保留全部文件;版本化清单对主要工程文件和库依赖计算 SHA-256,复制时同时核对文件集合、大小和时间。日志及其他运行时变化不再等同于工程内容变化。
|
||||
- 管理请求、逐项结果、完整旧库备份、检查点、来源暂存、共享锁和安全释放入口已集成。新增/更新未达到原生验收门槛时禁用。重启只展示未完成任务,不自动重放写操作。
|
||||
|
||||
## 原生证据与边界
|
||||
|
||||
| 场景 | 实际观察 | 限制 |
|
||||
| --- | --- | --- |
|
||||
| 最终冻结程序启动失败退出 | `8e486c1` 的 PCB 和启动器自动正常退出、无数据库地址;`startup-close.json` 为 CLOSED,safe_to_continue=true | 人工损坏副本,不是现场服务器失联 |
|
||||
| 最终冻结程序 Repair 缺少健康备份 | `8e486c1` 返回 MISSING_HEALTHY_BACKUP,原生工具自动退出、地址为空、允许安全继续 | 验证明确失败和释放,不代表修复成功 |
|
||||
| 官方原生移除 | 独立副本中 CleanWGLib/F4 返回 0,之后原生目录重新读取为空 | 旧库升级存在告警;生产读取遇到升级必须拒绝 |
|
||||
| 隔离新增首次完整探测 | 新建库后打开编辑器失败,尚未提交新增;来源保持不变,保留失败证据及协调阻止记录 | 不启用新增或同名更新,不作为成功验收 |
|
||||
| 最终移除适配器命令 | 实际捕获 `# Note: Removed REUSE_BLOCK 'IP101GR' from partition 'Logical-Physical'.`,释放确认成功,来源清单未变 | 随后的旧库复读拒绝 Select flow type;不能宣称该库完整自动移除验收通过 |
|
||||
| 新建隔离库完整移除 | 管理引擎完成原生读取、完整旧库备份、原生删除、重新读取确认缺失;最终 REMOVED,safe_to_continue=true | 仅代表此安装版本、库流程和 Logical-Physical 分区 |
|
||||
| 新建隔离库原生新增 | 收到成功消息,正常关闭、重新打开仍有正确名称/分区,原始来源不变;布局哈希一致 | 原理图数据库哈希改变,identity_matches=false;新增/更新不启用,未执行同名更新和重新导入恢复验收 |
|
||||
|
||||
原始证据位于 `diagnostics/issue2-frozen-20261102/`、
|
||||
`diagnostics/issue2-management-native-20261102/` 和
|
||||
`C:/Users/ABS_Windows/.cbb-management-e2e-20261102-a/`。
|
||||
首次新增失败后,仅向已确认的隔离 Library Manager 主窗口发送正常 WM_CLOSE;
|
||||
随后进程查询为空,没有强制终止数据库所有者。
|
||||
|
||||
第二次新增探测的 `dispatch-diagnostics.jsonl` 在加载 pywinauto 前记录方法
|
||||
DISPID 17/26/6,加载后全部返回 `CO_E_OBJNOTCONNECTED`(-2147220995)。
|
||||
这证明失效发生在 UI 自动化依赖初始化边界,尚未提交新增;来源未变。
|
||||
第二次隔离会话同样正常关闭。移除适配器及旧库拒绝证据保存在
|
||||
`diagnostics/issue2-remove-adapter-20261102/`;旧库拒绝流程后出现的
|
||||
“Unable to determine flow type”通知由协调端确认后正常退出,不能记为无人值守释放通过。
|
||||
|
||||
`ffa7e84` 冻结包的 GUI 冒烟通过,但真实批处理在启动 Mentor 前报
|
||||
`No module named 'win32timezone'`。此包不能作为最终可用包交付;必须补齐打包依赖并重建验证。
|
||||
`1f69480` 补齐依赖后运行了真实 PCB 流程;`8e486c1` 又收紧了隐藏基础设施窗口的精确识别条件,最终冻结测试自动通过退出分支。
|
||||
|
||||
最终证据:
|
||||
|
||||
- `diagnostics/issue2-frozen-20261102/full-8e486c1-startup/evidence/verify-97173dae8a21/startup-close.json`
|
||||
- `diagnostics/issue2-frozen-20261102/full-8e486c1-nohistory/repair-result.json`
|
||||
- `diagnostics/issue2-management-final-20261102/probe-result.json`
|
||||
- `diagnostics/issue2-management-final-20261102/full-remove-result.json`
|
||||
- 移除前完整旧库保留在 `C:/Users/ABS_Windows/.cbb-management-e2e-20261102-e/full-remove/management-e90d69ad7f624fb18f5401119b96856d/library-before/`。
|
||||
|
||||
冻结启动失败试验的批处理退出码为 2,因为输入是损坏工程;通过项是自动安全退出,而不是工程校验成功。缺少健康备份的 Repair 同样是已验证的明确失败分支。
|
||||
|
||||
## 仍需现场验收
|
||||
|
||||
工单附件只有日志,没有现场 `1GPHY_8211` 故障工程及其必要共享库的一致副本。
|
||||
因此现场服务器会话失联尚未复现,也没有完成该现场故障经应用实际维护按钮触发的完整自动链路验收。
|
||||
必须取得副本、记录来源/工程身份/主要文件哈希,在隔离环境记录失败、退出、Repair 调用、重新打开、保存关闭和 READY 查询的完整证据,并核对来源未改变。
|
||||
复制后不能复现时应记录“未复现”,不能用数据库文件头损坏试验替代。
|
||||
|
||||
Windows 10 尚未验证。现有原生试验环境为 Windows 11 / Mentor EE 7.9.5。
|
||||
历史备份恢复保持“已恢复,版本待核对”,不宣称无损修复。
|
||||
|
||||
## 候选包
|
||||
|
||||
`dist/issue2-repair-candidate-877e3b4.zip` 保留独立修复候选包及构建清单。
|
||||
完整候选程序位于 `dist/issue2-full-candidate-8e486c1/`,由 `git archive 8e486c1` 的不可变源码构建。构建与 GUI 冒烟通过,真实冻结原生证据见上。
|
||||
分发压缩包:`dist/issue2-full-candidate-8e486c1.zip`。解压后运行 `CbbRefreshVerify-Background/CbbRefreshVerify.exe`;包根目录保留构建清单、本文及关键验证证据。
|
||||
`dist/issue2-full-candidate/` 和 `dist/issue2-full-candidate-1f69480/` 是被后续修正取代的中间试验构建,不作为交付包。
|
||||
|
||||
## 后续验收顺序
|
||||
|
||||
1. 取得现场故障工程及必要共享库一致副本,优先完成实际维护按钮触发的完整自动链路验收。
|
||||
2. 针对原生导入会重写 ICDB 的行为,使用经过验证的 Mentor 语义读取/导出建立工程内容等价证据;不能只放松哈希检查。之后才能启用新增,并验证重复冲突、同名更新、部分失败及备份重新导入。
|
||||
3. 在 Windows 10 / EE 7.9.5 重跑冻结关键路径,并在具备网络测试环境时验证真实断网、取消和恢复场景。现有模拟测试不能替代这些环境验收。
|
||||
@@ -0,0 +1,182 @@
|
||||
# Issue #2: release the PCB launched by a failed database open
|
||||
|
||||
Branch: `codex/temp-issue-2-icdb-recovery`.
|
||||
|
||||
## Field failure
|
||||
|
||||
The issue attachment records an iCDB lost-server-session error while opening
|
||||
`1GPHY_8211`. The supervisor declined the database log viewer and cancelled the
|
||||
worker. Because document identity had not been established, the existing
|
||||
document-close helper was never called. PCB and its launcher remained alive;
|
||||
the subsequent Repair attempt returned `REPAIR_DATABASE_IN_USE` and the other
|
||||
380 queued entries were skipped. There is no evidence of native Repair actually
|
||||
running on that field database.
|
||||
|
||||
## Change
|
||||
|
||||
The worker now has a separate startup-failure close path. It requires a current
|
||||
iCDB diagnosis or a database-load-failure dialog belonging to this PCB during
|
||||
startup. It checks the private desktop, excludes pre-existing process IDs, and
|
||||
matches the complete PCB path and ReusableCircuit argument. Only an enabled
|
||||
empty PCB main window, without modal dialogs, MDI documents or database address
|
||||
records, receives a cooperative `WM_CLOSE`. A requested close is not treated as
|
||||
success until process exit is observed. Ambiguous or busy sessions are retained.
|
||||
|
||||
The supervisor allows up to 40 seconds for fatal-error cleanup so that the
|
||||
worker's 20-second startup-close window can complete before recovery begins.
|
||||
The existing repair preconditions, backups and success checks remain in force.
|
||||
Each attempt writes `startup-close.json` and close-request/result events.
|
||||
|
||||
## Verification
|
||||
|
||||
Regression tests cover the missing pre-identity cleanup route, real observed
|
||||
empty-window titles, exact path matching, pre-existing processes, another
|
||||
desktop, live address records, modal and MDI windows, disabled windows, unrelated
|
||||
failure records and a close request that does not result in exit.
|
||||
Delayed dialog/address release and delayed process exit are also covered.
|
||||
Validation: `python -m pytest -q` — 491 passed, one existing pywinauto COM-mode
|
||||
warning; `python -m compileall -q src tests` and `git diff --check` passed.
|
||||
|
||||
A new isolated local library was created with the existing
|
||||
`tools/validate_icdb_open_repair_reopen.py` tool, output
|
||||
`diagnostics/issue2-startup-20261102`. No production library was changed.
|
||||
The test damages only the new copy's database header; it does not reproduce the
|
||||
field server-session-loss condition.
|
||||
|
||||
The real Mentor opening run produced `MENTOR_DATABASE_LOAD_FAILED`, then:
|
||||
|
||||
- `startup_close_requested` for the launched PCB PID 6532;
|
||||
- `startup_close_result: CLOSED`;
|
||||
- worker and supervisor both recorded `process_exit_confirmed`, with no
|
||||
remaining PCB processes.
|
||||
|
||||
The subsequent separate native Repair run was able to start and completed as
|
||||
`RESTORED_REVIEW_REQUIRED`, using the fixture's historical backup. This proves
|
||||
the failed-open session no longer blocks the next repair operation in this
|
||||
fixture. It does not prove automatic recovery of the field database or establish
|
||||
that an older backup contains the desired design revision.
|
||||
|
||||
The separate `open-after` run on the same restored fixture completed native
|
||||
integration, Save/IsSaved/Close/Quit, confirmed process release and returned
|
||||
`PASS`, `safe_to_continue=True`, `READY (IsVerifiedReuseBlock, raw=1)`.
|
||||
The `compare` phase passed all seven checks, including absence of the original
|
||||
opening error and unchanged source-fixture database SHA-256. Its
|
||||
`server_session_loss_reproduced` field is explicitly `false`.
|
||||
|
||||
Reproduction commands (set `PYTHONPATH=src`; setup requires a new output name):
|
||||
|
||||
```powershell
|
||||
python tools/validate_icdb_open_repair_reopen.py setup --output issue2-startup-20261102
|
||||
python tools/validate_icdb_open_repair_reopen.py open-before --output issue2-startup-20261102
|
||||
python tools/validate_icdb_open_repair_reopen.py repair --output issue2-startup-20261102
|
||||
python tools/validate_icdb_open_repair_reopen.py open-after --output issue2-startup-20261102
|
||||
python tools/validate_icdb_open_repair_reopen.py compare --output issue2-startup-20261102
|
||||
```
|
||||
|
||||
The stages are deliberately separate: the test fixture has a format-corruption
|
||||
error and historical-backup recovery, not the field lost-session auto-repair
|
||||
trigger. The test does not change production handling of old-backup recovery.
|
||||
|
||||
READY filtering, hash-scope changes and CBB CRUD are outside this focused fix.
|
||||
|
||||
## Approved Task 1 follow-up: lifecycle and repair outcomes
|
||||
|
||||
The empty-PCB close path now receives the launcher process handle and waits for
|
||||
its normal exit after PCB exits. It checks database addresses again during that
|
||||
wait, so a late address record prevents a false `CLOSED` result. The startup
|
||||
record includes PCB, launcher and address release state. A connected COM server
|
||||
with no active document emits `pcb_document_wait`; it remains in startup and
|
||||
continues reading the current native failure rather than implying identity.
|
||||
|
||||
Native Repair reads bounded Output text and records only the text appended after
|
||||
this run's Repair invocation as operation evidence. Database logs are restricted
|
||||
to the current native PID and start time. Output, native log copies, the complete
|
||||
backup, native result and attempt record remain available under `native-repair`.
|
||||
Detailed native evidence is preserved separately from its directory path.
|
||||
|
||||
The result distinguishes `MISSING_HEALTHY_BACKUP`, `NATIVE_REPAIR_FAILED`,
|
||||
`DATABASE_BUSY`, `UNKNOWN_DIALOG`, and `TIMEOUT_UNRELEASED`. A failed tool receives
|
||||
cooperative close only after a terminal native error, an enabled exact-project
|
||||
main window, no other windows/prompts and no target database address. The worker
|
||||
then waits for normal process exit. Unknown/custom prompts and incomplete native
|
||||
operations receive no close action. A failure classification can coexist with
|
||||
unreleased state; that state always stops the queue. Terminal `DATABASE_BUSY`
|
||||
errors also retain the native tool without close, reopen or queue continuation.
|
||||
Unreadable, absent, hung or truncated initial Output waits within the deadline
|
||||
and retains the tool without requesting Repair; a readable empty string is a
|
||||
valid invocation baseline. A busy-project message in
|
||||
this fresh native process's initial loading Output prevents Repair invocation
|
||||
entirely; it is not hidden by the later invocation baseline.
|
||||
|
||||
Before reopening or continuing, the parent independently checks relevant PCB,
|
||||
Library Manager, Repair, importer and close-helper processes, all known project/
|
||||
PCB/shared-library addresses, and exclusive read access to every existing known
|
||||
database. Process-observation errors and exclusive-access failures block reuse.
|
||||
Only a conclusively failed, released, independently revalidated project-local
|
||||
target may allow the next CBB. Shared or unknown scope, busy owners, timeouts,
|
||||
unknown prompts and historical restores stop for review.
|
||||
|
||||
Before accepting native success, the parent validates native process identity
|
||||
and true exit, exact project/database, empty address state, confirmed backup/
|
||||
repair evidence and absence of restore/failure/unknown-prompt contradictions.
|
||||
Missing or wrong-typed fields fail closed. Independent process, address and
|
||||
database-handle probes remain additional requirements.
|
||||
|
||||
Native `REPAIRED` is retained as `native_status`; summaries count a repair only
|
||||
after the same request reopens, completes Verify and returns authoritative
|
||||
`PASS/GREEN` with confirmed release. A failed reopen becomes
|
||||
`REPAIR_VALIDATION_FAILED`; incomplete or contradictory native success/release
|
||||
becomes `UNCONFIRMED` and prevents reopening.
|
||||
Historical restoration remains `RESTORED_REVIEW_REQUIRED`. The original error,
|
||||
stage and evidence references, a `pre-repair-result.json` snapshot, native
|
||||
evidence and validation evidence remain attached even if the retry raises.
|
||||
|
||||
`tests/fixtures/issue2-lost-session-sanitized.json` contains selected fields from
|
||||
the actual issue attachment, with paths, machine and process identities
|
||||
sanitized. Replay asserts `PCB_STARTING`, the selected PRJ/database, normal PCB
|
||||
and launcher release before native Repair, and exactly one automatic repair and
|
||||
one reopen even if the opening error repeats. Separate replays cover the actual
|
||||
2026-10-28 missing-backup Output, delayed exits/addresses, unknown custom prompts,
|
||||
successful native repair and historical restoration. These are nonnative tests.
|
||||
|
||||
The attachment contains logs only. No matching `1GPHY_8211` faulty project was
|
||||
found in the sibling `Skyworth_CBB_Lib` collection. This host runs Windows 11;
|
||||
Windows 10 behavior and recovery of the real field database remain unverified.
|
||||
The coordinator's prepared `diagnostics/issue2-frozen-20261102` fixture damages a
|
||||
copied database header; it does not reproduce field lost-server-session loss.
|
||||
Candidate packaging and frozen/native tests remain coordinator work after review.
|
||||
|
||||
Task 1 checks: full suite once, 532 passed with the existing pywinauto COM warning;
|
||||
after the final initial-busy gate regression, the related final suite passed all
|
||||
234 tests. Compileall and `git diff --check` passed. The coordinator will run
|
||||
candidate/frozen validation against the final implementation.
|
||||
|
||||
Task 1 review fix round: 259 related tests passed (17.86s); compileall and
|
||||
`git diff --check` passed. These checks include busy retention, real readback
|
||||
failure branches, 30 malformed-success variants at both release and reopen/
|
||||
counting boundaries, and a complete actual worker-result replay control.
|
||||
|
||||
Runtime fix round 2 adds `iCDBProjectBackup.exe` and `ReuseBlockImporter.exe` to
|
||||
the process helper's fixed query whitelist. Without these entries, the real
|
||||
parent release probe rejected its own required queries and always denied safe
|
||||
release. New tests keep the release validator and process helper real and stub
|
||||
only WMI: no owners permits release, either native owner prevents it, and
|
||||
arbitrary query names remain rejected. Focused validation: 172 passed. Candidate
|
||||
`c823a4b` must be rebuilt with this correction before frozen/native validation;
|
||||
field recovery remains unverified.
|
||||
|
||||
Runtime fix round 3 uses the actual frozen-worker window capture. A single Afx
|
||||
shell titled exactly `iCDB Project Backup` now waits, before invocation only,
|
||||
for the exact project title within the existing deadline. Two owned-process
|
||||
input-indicator classes (`UAC_InputIndicatorOverlayWnd`, `UAC Input Indicator`)
|
||||
are ignored only with empty titles. Wrong/duplicate target windows, ambiguous
|
||||
shells, named/lookalike auxiliary windows, unknown prompts, missing Output and
|
||||
busy verdicts still retain the tool without unsafe commands. The native loading
|
||||
line `Checking if project is in use.` is excluded from busy evidence; the actual
|
||||
ownership verdict continues to control the busy gate.
|
||||
|
||||
Sanitized recorded-shape replay includes real shell children, RichEdit Output
|
||||
readback, startup-to-loaded transition and both input indicators before and
|
||||
after load. Focused validation: 189 passed (12.40s); compile and scoped diff
|
||||
checks passed. New source/frozen native validation and rebuilding the candidate
|
||||
remain coordinator work; these replay results do not establish field recovery.
|
||||
@@ -0,0 +1,251 @@
|
||||
# Scoped recovery manifests and complete verified backups
|
||||
|
||||
Status: implemented; review finding P1 addressed with focused validation. Started on b90a9bb; paused at
|
||||
the RED checkpoint for the coordinator's native startup-window repair fix and
|
||||
resumed on 877e3b4. No native UI/process/live-library actions were performed by
|
||||
this implementer. Original untracked review.diff was preserved and not staged.
|
||||
|
||||
## Result and scope
|
||||
|
||||
Complete backup trees are still copied and retained. SHA256 and semantic
|
||||
before/after comparisons now cover only primary design/project/database/
|
||||
constraint files and required central-library dependencies. Runtime changes
|
||||
after a successful snapshot do not stop install. Primary content changes,
|
||||
additions and deletions do stop install, with copies retained as evidence.
|
||||
|
||||
The validate-copy -> conflict checks -> retain original Work -> install ->
|
||||
reopen/native verification flow is preserved. Source equality now runs after
|
||||
incoming Work preparation, immediately before target equality, closing the old
|
||||
late-source-change window. Source idle/address ownership is rechecked there as
|
||||
well: excluding address bytes from semantic hashes does not bypass idle checks.
|
||||
|
||||
Initial implementation: 29c154d. The review correction is described below.
|
||||
Durable documentation lives here; an ignored review copy remains at
|
||||
.superpowers/sdd/2026-11-02-issue-2-management/task-3-report.md.
|
||||
|
||||
Scoped production files: backup_recovery.py and new scoped_manifest.py. Scoped
|
||||
tests: test_backup_recovery.py and new test_scoped_manifest.py. No Verify public
|
||||
types, Task 2 helpers/READY logic, native repair classifiers/process whitelist,
|
||||
or library binary contents were changed.
|
||||
|
||||
## Exact classification rules
|
||||
|
||||
Project scope retains every unclassified file as primary. This includes PRJ,
|
||||
PCB, DXP, icdb.dat, Layout databases, schematic/logic/symbol assets, CES/config,
|
||||
unknown binary/engineering formats, and text files outside explicit excluded
|
||||
categories. Rules are case-insensitive; manifests preserve relative path case.
|
||||
|
||||
Explicit semantic exclusions, still copied and metadata-validated:
|
||||
|
||||
- Runtime/history child directories **at a project workspace root**, its PCB
|
||||
workspace root, a selected Work/Cert root, or the library root: log, logs,
|
||||
temp, tmp, __pycache__, backup, backups, output, outputs, report, reports,
|
||||
gerber, gerbers, odb++, Log Files, LogFiles, and Work.before-restore-*.
|
||||
- ProjectBackup/backups only at those workspace roots. Other ProjectBackup
|
||||
content remains conservative primary data.
|
||||
- Known native runtime below database/cdbsvr and PCB/database/cdbsvr: log,
|
||||
dbcheck and dbrestore subtrees. In shared library databases, those same
|
||||
subtrees below SymbolLibs/<partition>/cdbsvr or <shared-root>/cdbsvr. Other
|
||||
unknown files below cdbsvr remain primary; the directory is not dropped.
|
||||
- File suffixes: .log, .tmp, .temp, .lck, .lock, .bak, .backup, .pdf.
|
||||
- File names: sAddress.adr and editor files starting with ~$.
|
||||
|
||||
Directory exclusions are contextual rather than arbitrary ancestor matching.
|
||||
ReusableBlocksLP/<selected-block>/Work and Cert are structural identity
|
||||
components, never runtime labels. CBB names Logs, Temp, Backup, Output, Report,
|
||||
Log Files, ProjectBackup and Work.before-restore-engineering remain valid and
|
||||
their primary files are hashed in both semantic manifests and complete-copy
|
||||
validation. Case variants have the same protection.
|
||||
|
||||
Shared dependency partitions and nested engineering folders keep their names:
|
||||
SymbolLibs/temp/icdb.dat, SymbolLibs/Temp_a/device.sym,
|
||||
SymbolLibs/Backup/device.sym, hdl/Logs/design.v and hdl/Backup/design.v are
|
||||
primary. Runtime directory labels apply at the known roots above, not inside
|
||||
arbitrary engineering/dependency hierarchies. File suffix/name exclusions are
|
||||
applied to files, not to engineering directories with matching suffixes.
|
||||
|
||||
The uploader-compatible .<stem>.cbb-upload.lock falls under .lock, so it is
|
||||
runtime and never primary. It is **not** silently removed from complete copies.
|
||||
|
||||
Central-library scope includes only target ReusableBlocksLP/<block>/Work and
|
||||
Cert, root configuration files (the selected .lmc, other root config files),
|
||||
and shared/configuration dependency directories outside ReusableBlocksLP. Known
|
||||
examples include SymbolLibs/__ReusableBlocksSymb, CellDB and PartDB; new unknown
|
||||
dependency directory names remain primary conservatively. Other root .lmc files,
|
||||
other ReusableBlocksLP CBBs, target historical/non-Work/non-Cert trees and the
|
||||
explicit runtime/generated categories above do not enter semantic equality.
|
||||
Those unrelated files still enter the complete copy and its metadata checks.
|
||||
|
||||
Later semantic scans prune ignored/runtime/unrelated CBB directories before
|
||||
entering them, so transient/unavailable runtime or unrelated trees cannot
|
||||
interfere with the post-snapshot content check.
|
||||
|
||||
## Reusable API contract for Task 4
|
||||
|
||||
Import from cbb_refresh_verify.scoped_manifest:
|
||||
|
||||
```python
|
||||
scope = ManifestScope.library(block_name, selected_lmc.name)
|
||||
before = copy_verified(library_root, private_backup, scope=scope, progress=callback)
|
||||
current = build_manifest(library_root, scope=scope, exclude=private_incoming)
|
||||
if current != before:
|
||||
# stop install; retain evidence
|
||||
...
|
||||
```
|
||||
|
||||
- `ManifestScope()` is project scope. `ManifestScope.library(block_name,
|
||||
library_name)` requires nonempty single-component names; no path traversal.
|
||||
- `build_manifest(root, *, scope=None, exclude=None, progress=None,
|
||||
hash_function=hash_file)` returns a semantic manifest. `exclude` is an optional
|
||||
private incoming subtree, **not** a copy exclusion. Hash injection is a test
|
||||
hook; normal callers use the default.
|
||||
- `copy_verified(source, destination, *, scope=None, progress=None,
|
||||
hash_function=hash_file)` requires a fresh destination outside source. Copies
|
||||
all files/directories, returns the same semantic schema, retains partial
|
||||
destination on failure, and raises ValueError/OSError for unsafe/changed data.
|
||||
- `scan_tree(root)` scans complete membership and refuses links/junctions and
|
||||
special files. Its optional scope/exclude is used by semantic scans only;
|
||||
complete copies always scan without filters.
|
||||
- `hash_file(path)` streams SHA256 in 1 MiB chunks. Files are processed with up
|
||||
to eight workers, retaining the existing concurrency bound.
|
||||
- Progress callback accepts **one dict**, not the old private `(count,total)`
|
||||
pair: `stage` (`copy` or `hash`), `hashed_files`, `hashed_bytes`, `total_files`,
|
||||
plus `copied_files` for copy. Hash counts/bytes count unique primary snapshot
|
||||
files/logical bytes, not aggregate disk IO. `total_files` counts all files for
|
||||
copies and primary files for standalone manifest generation. Initial zero and
|
||||
each 256/final-file event are emitted. Recovery keeps existing public progress
|
||||
stage/message keys and adds `manifest_stage` and these counters.
|
||||
|
||||
Version 1 JSON-compatible output (relative paths are POSIX, no machine-specific
|
||||
absolute paths or mtimes in equality):
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"scope": {"kind": "library", "block_name": "A", "library_name": "target.lmc"},
|
||||
"files": {
|
||||
"ReusableBlocksLP/A/Work/A.prj": {
|
||||
"size": 123, "sha256": "<sha256>", "scope": "target_work"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Entry scope labels are project, target_work, target_cert, library_config and
|
||||
shared_dependency. Default project's descriptor uses empty block/library names.
|
||||
Recovery persists both library-before-manifest.json and
|
||||
source-before-manifest.json. The shape changed only for private backup helpers;
|
||||
VerifyRequest/VerifyResult contracts are unchanged. There is no old-manifest
|
||||
loader or destructive migration: existing historical evidence remains intact.
|
||||
|
||||
## Copy integrity and old strict equality compatibility
|
||||
|
||||
Copy validation remains strict for the **entire** snapshot: before/after source
|
||||
file/directory membership, file type, size and nanosecond mtime must agree;
|
||||
destination membership/type/size/mtime must match too. Primary regular source
|
||||
files are SHA256 read before copy and again for validation; destination hashes
|
||||
must match. All native icdb.dat and .lmc files retain exclusive read handles
|
||||
during copying. For scoped primary native files, the expected digest is built
|
||||
from the source ReadFile stream independently of destination SHA256. Identical
|
||||
size/mtime destination corruption is therefore rejected, including locked DBs.
|
||||
Unrelated native DBs are still locked/copied; their bytes are not SHA256 hashed.
|
||||
|
||||
The old final `_manifest(source) == complete_copy_record` was an all-file hash
|
||||
comparison that rehashed every runtime and unrelated project file. It is
|
||||
replaced by full-tree copy metadata validation and primary byte verification at
|
||||
snapshot time. Later equality compares version/scope and primary relative
|
||||
path/size/hash/scope only. Thus log-only additions/changes/deletions after a
|
||||
successful copy are accepted, while primary keyset/content changes remain real
|
||||
conflicts. No conflict tests were weakened or deleted; additional source,
|
||||
target, Cert, shared dependency, late-source and active-address regressions were
|
||||
added. Empty directory metadata is intentionally not part of semantic equality.
|
||||
|
||||
## RED/GREEN and verification evidence
|
||||
|
||||
The original full-suite evidence below belongs to initial commit 29c154d. The
|
||||
P1 review correction has fresh focused validation, and has **not** rerun the
|
||||
full suite; the coordinator requested focused tests only for this fix.
|
||||
|
||||
1. Initial RED, before production edits:
|
||||
`python -m pytest tests/test_scoped_manifest.py tests/test_backup_recovery.py -q`
|
||||
-> **29 failed, 26 passed in 7.89s**. Failures demonstrated missing versioned
|
||||
manifest/schema/progress and post-snapshot runtime/unrelated tolerance.
|
||||
Copy/conflict protections already present continued passing.
|
||||
2. Initial GREEN -> **55 passed in 11.93s**.
|
||||
3. Additional RED for semantic traversal of an unavailable ignored/unrelated
|
||||
tree -> **1 failed, 36 passed in 2.79s**; fixed by pruning semantic scans.
|
||||
4. Additional RED for source mutation during incoming Work preparation and
|
||||
source address reappearance -> **2 failed, 20 deselected in 1.56s**; both had
|
||||
incorrectly installed before the final-source-check changes.
|
||||
5. Final focused:
|
||||
`python -m pytest tests/test_scoped_manifest.py tests/test_backup_recovery.py tests/test_backup_recovery_dialog.py -q`
|
||||
-> **64 passed in 9.93s**.
|
||||
6. Coordinator was notified **before** the full suite and explicitly confirmed
|
||||
no native owner/mutex and paused all native probes. Exactly one final suite:
|
||||
`python -m pytest -q` -> **693 passed, 1 warning in 47.99s**. Warning:
|
||||
pywinauto's existing "Revert to STA COM threading mode" warning in
|
||||
test_library_reader.py::test_status_log_records_unseen_id_inference.
|
||||
7. `git diff --check` passed. Review confirmed no unrelated/native-helper edits.
|
||||
|
||||
Coverage includes every primary category, unknown engineering formats,
|
||||
runtime/history/generated exclusions with complete-copy retention, hash-path
|
||||
scope, relocatability, source changed/deleted/added during copy/validation,
|
||||
target changes/deletions/additions, Cert/shared-library conflicts, unrelated
|
||||
CBB tolerance, copied corruption with preserved metadata, locked stream bytes,
|
||||
source content changes with preserved metadata, complete copy membership and
|
||||
nonprimary size consistency, idle/address rechecks, retained copies on failure,
|
||||
and unchanged native reopen/retained-Work recovery behavior.
|
||||
|
||||
## Review correction: contextual runtime directory classification
|
||||
|
||||
Review found that the initial unconditional directory ancestor rules could
|
||||
classify valid selected CBB names (Logs/Temp/Backup) or real SymbolLibs/temp
|
||||
engineering partitions as runtime. That removed primary paths from both the
|
||||
baseline manifest and later conflict comparison, and from copy byte checks.
|
||||
|
||||
The classifier now resolves the structural role first and only applies the
|
||||
runtime directory rules at documented workspace/native DB locations. Semantic
|
||||
directory traversal and complete-copy byte classification share that rule.
|
||||
Complete tree copy/metadata validation remains unchanged. This also protects
|
||||
nested engineering folders with names Logs/Backup, and avoids broad dropping
|
||||
of unknown cdbsvr files.
|
||||
|
||||
Independent regressions cover Work and Cert under 11 colliding CBB names/case
|
||||
variants, real SymbolLibs/temp and Temp_a partitions, arbitrary nested
|
||||
engineering folders, source and destination corruption with unchanged size/
|
||||
mtime, independent locked database destination corruption, and end-to-end
|
||||
recovery conflicts that previously overwrote concurrent target/shared edits.
|
||||
Known native Log Files, ProjectBackup/backups and DB server log/dbcheck/
|
||||
dbrestore data remain semantically ignored and completely copied.
|
||||
|
||||
Review-fix RED:
|
||||
`python -m pytest tests/test_scoped_manifest.py tests/test_backup_recovery.py -q --tb=short`
|
||||
-> **47 failed, 74 passed in 18.41s**, before production changes. The failures
|
||||
included silently accepted primary corruption and installs over concurrent
|
||||
target/shared edits. Additional conservative-boundary regressions prevented
|
||||
reintroducing the same bug through Log Files/ProjectBackup/retained-Work names
|
||||
or broad cdbsvr directory exclusion.
|
||||
|
||||
Final review-fix focused GREEN:
|
||||
`python -m pytest tests/test_scoped_manifest.py tests/test_backup_recovery.py tests/test_backup_recovery_dialog.py -q --tb=short`
|
||||
-> **141 passed in 18.28s**. No native UI/process actions, live-library mutation,
|
||||
or full-suite run was performed during this fix round.
|
||||
|
||||
## Limitations / follow-up boundary
|
||||
|
||||
- No real field lost-session reproduction, native GUI success reproduction, or
|
||||
Windows 10 run was performed for this task; file-based tests do not substitute
|
||||
for those required native/field validations.
|
||||
- Task 4 must adapt complete-copy access to a live uploader lock **only when the
|
||||
operation actually owns that coordination lock**. The current helper copies
|
||||
readable locks and fails closed on unreadable/live exclusively owned files;
|
||||
it does not delete locks or broadly drop engineering data.
|
||||
- Native idle guards and later coordination locks remain necessary. Final
|
||||
equality and filesystem rename are not one cross-process atomic transaction
|
||||
against arbitrary noncooperating external writers.
|
||||
- Nonprimary byte hashes are intentionally absent. Their copy integrity uses
|
||||
complete membership and size/mtime checks, as specified; same-size,
|
||||
timestamp-preserving nonprimary corruption is outside the semantic guarantee.
|
||||
- All snapshots must be stable while copied, including runtime files. This
|
||||
deliberately differs from post-snapshot semantic checks, which tolerate
|
||||
runtime changes. Original and partial recovery evidence is retained on failure.
|
||||
@@ -0,0 +1,122 @@
|
||||
# 既存地址记录下的明确 ICDB 维护入口
|
||||
|
||||
2026-11-03 的现场报告显示,点击“非 READY ICDB 检查与修复”后,IP101GR 在
|
||||
0.172 秒内返回 BLOCKED,没有启动官方 Repair。原先维护按钮和普通校验使用
|
||||
相同请求;普通校验对任何 sAddress.adr 的阻止条件也挡住了明确维护入口。
|
||||
随后保留的库协调检查点使重新读取与维护都无法继续。
|
||||
|
||||
本次为用户明确确认的维护增加独立入口。普通校验遇到地址记录仍停止,不依据
|
||||
文件日期、TCP 不通或本机无 PCB 进程判断地址失效,不删除、移动或隔离地址。
|
||||
没有地址阻止时,维护继续沿用原有校验及本轮失联后的自动修复流程。
|
||||
|
||||
存在地址记录时,明确维护需要唯一可确认的工程 PRJ/database 映射。共享符号库
|
||||
地址、所选工程内多个地址、外部引用、歧义目标、不完整工程均会阻止执行。
|
||||
其他独立 CBB 的 Work 数据库地址不纳入当前修复目标,原文件保持不变。工具检查相关
|
||||
原生程序和保留工作进程,并同时独占读取库中的原生数据库文件;记录目标工程
|
||||
引用指纹和地址字节哈希,检查期间及完整备份后重新核对。完整工程备份保留
|
||||
原地址文件,再由官方 iCDB Project Backup 打开工程。只有其实际 Output 明确
|
||||
报告 `Project is not in use. Full iCDB Project Backup's functionality is available.`,
|
||||
且没有占用或未知窗口时才请求 Repair。
|
||||
|
||||
库旁已有协调检查点时,明确维护可以接续有效的同库记录,条件是原监督进程
|
||||
已退出,或当前进程确实持有已闲置的保留锁。相关所有者和目标独占访问检查
|
||||
必须先全部通过,再原样归档旧检查点并建立本次检查点;库 sidecar 和全局 mutex
|
||||
期间始终持有。未知、损坏、其他库的记录或仍存活的外部监督进程不会被接管。
|
||||
普通释放检查的地址要求没有放宽,上传锁文件不删除。
|
||||
|
||||
重启后有有效同库检查点时,界面仅按工程目录显示 UNKNOWN 状态,明确标注
|
||||
“状态未确认,不代表损坏”。此视图不调用原生状态读取,只允许明确维护或严格
|
||||
释放检查;普通校验、上传/更新/移除及备份恢复均禁用。安全完成维护后再重新
|
||||
读取权威状态,保留当前搜索条件。
|
||||
|
||||
Repair、原生退出、地址消失和最终校验仍是不同的判据。只有完整原生修复证据、
|
||||
所有者与地址释放及同一工程后验 PASS/GREEN 全部成立才计为修复通过。缺健康
|
||||
备份、恢复旧版本、占用、超时或不完整证据不会提升为成功,也不会盲目重试。
|
||||
|
||||
协调端在保留旧地址字节的用户工程副本上观察到:官方工具报告数据库曾在服务器
|
||||
运行时被复制、工程当前未使用,随后官方 Repair 自行清除副本地址并返回成功。
|
||||
这证明了明确维护入口的必要性;原始用户库没有由本次开发或测试修改。实际按钮、
|
||||
冻结包及最终全套回归的实际验收结果见下。
|
||||
|
||||
## 修复后的本地读写访问提示
|
||||
|
||||
实际副本验证发现,原理图 iCDB Repair 成功并清除地址后,PCB 仍可能显示上次
|
||||
异常退出后的读写访问确认。这与选择恢复旧数据库不同。明确维护确认现在说明:
|
||||
仅在本地固定磁盘、严格确认修复后,工具可对本次启动的这一完整提示确认一次。
|
||||
|
||||
该授权不能由普通 Verify 或通用对话框规则开启。维护代码先验证完整原生修复
|
||||
证据,生成绑定原库、PRJ、PCB 的内部凭据。实际 PCB 启动前,重新确认地址缺失、
|
||||
无其他原生所有者,并同时独占读取 LMC、相关 icdb.dat 和选中 LayoutDB.lyt,
|
||||
在本次私有桌面生成短时有效的启动证据。出现提示时再核对当前 PCB 与启动器的
|
||||
实际 PID、父子关系、安装路径和完整设计参数,以及其他所有者缺失。
|
||||
|
||||
只接受原始完整英文提示正文(仅忽略空白差异)、精确窗口类型/标题和唯一可用
|
||||
Yes6/No7 按钮。专用代理在自己的私有桌面再次读取实际窗口和控件;先消耗授权,
|
||||
再发送一次按钮消息。没有证据、提示变更、重复提示、额外弹窗或身份不符均停止,
|
||||
不使用鼠标、前台输入或通用 Yes 回退。后续文档身份、保存关闭和 READY 判据不变。
|
||||
|
||||
路径必须经 GetDriveType 确认为 LOCAL_FIXED,且没有重解析点祖先。UNC、网络
|
||||
映射盘、可移动盘和链接路径不自动确认。该检查不宣称具备跨主机分布式排他能力;
|
||||
数据库只读句柄在交给官方 PCB 启动前释放,任意非协作外部写入者之间仍不存在
|
||||
跨进程原子事务保证。普通校验及其他数据库恢复选择继续保持硬性阻断。
|
||||
|
||||
## PCB 恢复版本待用户决定
|
||||
|
||||
后续实际副本已完成 iCDB Repair 和一次本地读写确认,但 PCB 又要求在“最后
|
||||
用户保存数据库”和“自动保存数据库”之间选择恢复版本。本次两项显示的日期
|
||||
均为 `2026/9/24 23:06`;同日期不代表内容相同,工具没有自动选择任何版本。
|
||||
|
||||
这类结果单独标识为 `PCB_VERSION_CHOICE_REQUIRED`,展示候选日期,并在
|
||||
`pcb-version-choice.json` 保存完整窗口和候选状态。维护摘要显示“ICDB 已修复 /
|
||||
PCB 版本待选”,原生状态仍为 REPAIRED,但整项保持未完成、需人工决定,不能
|
||||
计为 PASS/GREEN。工具也不会因为显示了某个默认选中项就认可该版本。
|
||||
|
||||
## 最终验证(2026-11-03)
|
||||
|
||||
程序源码提交 `d76475a`:全量 `python -m pytest -q` **969 passed,1 条已有
|
||||
pywinauto STA 模式警告,107.69 秒**;编译、diff 检查和代码复审通过。
|
||||
由不可变 `git archive d76475a` 构建的 EXE 通过 GUI 冒烟。
|
||||
|
||||
在第二份完整隔离库上,通过打包 EXE 的实际“非 READY ICDB 检查与修复”按钮
|
||||
确认并运行 IP101GR:有效旧阻止记录接续、旧地址完整备份、官方 Repair 成功并
|
||||
正常释放、一次受约束的读写确认均实际执行。之后准确停在原生 PCB 版本选择,
|
||||
显示 `version_choice_required=1`、`repair_unconfirmed=0`、`repaired=0`。
|
||||
这是维护入口和结果分类通过验收,不代表未经用户选版本就达到 READY。
|
||||
|
||||
原始证据:
|
||||
|
||||
- 用户最初 0.172 秒失败:`diagnostics/issue2-user-maintenance-20261103/user-reports/`。
|
||||
- 冻结 EXE 实际按钮:`diagnostics/issue2-user-maintenance-20261103/actual-button-frozen-d76475a/outcome.json`。
|
||||
- 原生版本选项:上述目录的 `data/evidence/verify-8fa461b6d6fe/pcb-version-choice.json`。
|
||||
- 全量测试:`build/issue2-maintenance-final-tests-d76475a.log`。
|
||||
|
||||
### 用户明确选择最后手动保存版本后的副本验证
|
||||
|
||||
用户选择“用最后手动保存版本继续验证”,授权范围仅为隔离副本。诊断续跑使用
|
||||
真实校验器、原生工作进程、对话框代理及权威状态读取;只为这次用户决定提供
|
||||
版本动作:先点击 6213,重新观察其已选中且 6206 未选中,再确认 OK 1。
|
||||
选择前保留完整工程副本;没有改变程序的默认版本选择规则。
|
||||
|
||||
工程成功打开并核对身份,但在原长路径下两次 Project Integration 均产生本轮
|
||||
JobPrefsDB.jpf / local Cell Library 加载错误。原文件、临时目录及备份中的 JPF/CEL
|
||||
可读且哈希一致,日志前缀与时间证明是本轮错误,不能断言二进制数据已损坏。
|
||||
|
||||
随后保持同一工程数据,通过临时本地 `T:` 短路径进行对照,完成原生 Integration、
|
||||
保存关闭、进程释放及权威状态查询,结果为 **PASS / GREEN / READY
|
||||
(IsVerifiedReuseBlock, raw=1),safe_to_continue=true**。所有原生进程退出后已移除
|
||||
该临时盘符。此结果说明短路径试验可通过,尚不能证明确切路径长度限制或永久
|
||||
解决原长路径下的 JobPrefs/Cell Library 兼容问题;产品没有自动增加短路径映射。
|
||||
|
||||
这是**用户指定历史版本后的恢复与验证**,不是无人值守或无损自动修复验收。
|
||||
验证后的完整库副本保留在 `diagnostics/issue2-user-maintenance-20261103/frozen-library/`,
|
||||
原用户库没有被替换。结果和选择证据分别位于:
|
||||
|
||||
- `user-authorized-last-saved-r2/user-selection-events.jsonl`(实际 6213 → 复读 → OK 1)。
|
||||
- `user-authorized-last-saved-short-path/result.json`(最终 PASS/GREEN)。
|
||||
- `short-path-trial.json`(临时盘符及正常退出后清理记录)。
|
||||
- `source-unchanged-after-user-choice.json`(全部试验后原库 21,013 个主要文件清单仍一致,原地址字节哈希未变)。
|
||||
|
||||
以上相对路径均位于 `diagnostics/issue2-user-maintenance-20261103/`。
|
||||
现场原工单其他工程、网络共享读写确认和 Windows 10 仍不能由此验收代替。
|
||||
|
||||
交付候选包为 `dist/issue2-maintenance-20261103-d76475a.zip`。不合并发布、不自动关闭工单。
|
||||
@@ -0,0 +1,46 @@
|
||||
# 工单 #2:用户实测失败后的修订记录
|
||||
|
||||
分支 `codex/temp-issue-2-icdb-recovery`。本轮修订不能视为现场验收通过;未合并、发布或关闭工单。
|
||||
|
||||
## 用户失败的实际原因
|
||||
|
||||
用户运行 `b26e2f2` 冻结包。真实日志位于程序旁的 `data` 目录。中心库存在有效的未释放会话检查点,应用进入文件系统恢复视图,因此管理按钮被禁用;旧界面没有清楚显示原因,禁用外观也像可用按钮。该次没有启动增删改操作。
|
||||
|
||||
ICDB 批次的首项 `1GPHY_8212` 在预检查报 `MAINTENANCE_TARGET_UNCONFIRMED`,原生 Repair 没有执行。旧检查硬性要求 `PCB/pcb.prj`,但该工程的 PCB 明确反向引用主 `1GPHY_8212.prj`。主 PRJ 指向 `database`;存在的 `PCB/template.prj` 不能当作活动工程猜测使用。后续八项被跳过。
|
||||
|
||||
## 修订
|
||||
|
||||
- 只有 PCB 唯一、精确反向引用主 PRJ 时,允许缺少辅助 `pcb.prj`。预检查、Repair 后重新打开、管理来源身份及库引用核对使用一致规则。`template.prj` 保持原样并参与资产哈希。
|
||||
- 显示库会话阻止横幅、管理禁用原因、灰色禁用按钮及首项具体失败阶段。
|
||||
- 集成校验跳过原生明确禁止调用、且已同步的动作;仍要求四项最终全部同步。必需动作被禁止或原生拒绝时继续判失败,不伪造通过。
|
||||
- 识别原生 EDIF 中数字开头的精确标识符,例如 `&1GPHY_8212`;不放松设计内容比较。
|
||||
- 私有桌面上的原生库编辑器若提示其他已确认缺少 PCB 的条目,只确认准确匹配的已知通知。当前目标、未知弹窗或身份不符的窗口不自动确认。
|
||||
- 原生新增共享明确截止时间;父进程超时发出取消信号。阻塞调用返回后,以及所有日志和证据 I/O 完成、提交 OK 之前,重新检查监督进程、取消状态及期限,防止超时后迟到写入。
|
||||
|
||||
## 隔离原生证据及限制
|
||||
|
||||
证据根目录为 `diagnostics/issue2-user-feedback-20261103/`。
|
||||
|
||||
完整现场库副本保留原生地址和所有工程文件,共 38,954 个文件。原用户库始终不参与写入,完整恢复新增结束后 `source-final-recheck.json` 再次确认 25,214 个主要文件与试验前完全一致。
|
||||
|
||||
`d36b6bc` 冻结程序的实际维护按钮已在该副本完成完整备份、官方 Repair、数据库地址释放及同一 PCB 重新打开。随后原生要求选择历史 PCB 数据,应用返回 `PCB_VERSION_CHOICE_REQUIRED`,没有显示修复完成。
|
||||
|
||||
用户选择最后手动保存版本(2026/9/24 15:15)后,在确切所属的隔离会话中继续。SynchCES 和 LoadCES 成功,但原生 BackAnnotate 仍报已验证工程不允许执行。未保存、未达到 READY,失败 PCB 已正常关闭。这段人工续接不算无人值守自动修复通过。
|
||||
|
||||
空隔离库中的重新导入及工程身份核对通过,但自动校验因目标缺少 PartsDB 分区失败,不能算完整校验通过。完整依赖库中的首次同名替换完成原生移除后,新增被其他条目缺少 PCB 的提示阻塞而超时;该部分失败的检查点及完整旧库备份保留在 `diagnostics/full-update-events/`,没有自动重放。
|
||||
|
||||
完整隔离库中 IP101GR 的旧数据库地址通过官方 Repair 释放,证据为 `dependency-ip101gr-native-only/result.json`。这只是依赖数据库的原生修复诊断,没有重新打开或 READY 验收。
|
||||
|
||||
修订后对缺失的 `1GPHY_8212` 显式执行恢复新增,启用自动校验;独立证据目录为 `diagnostics/full-recovery-events/`。结果为 `UPLOADED_VERIFIED`,`safe_to_continue=true`。已知的其他缺 PCB 条目提示被自动准确确认;新增后独立重读库、三种原生逻辑导出及主要资产比较通过。随后自动执行 ForwardAnnotate、SynchCES、LoadCES、BackAnnotate,四项最终均同步,保存、关闭和进程退出确认完成,权威 `IsVerifiedReuseBlock` 返回 `raw=1 / READY`。自动校验链路耗时 126.422 秒(不含完整备份和新增身份检查)。
|
||||
|
||||
最终结果为 `full-recovery-add-result.json`,完整检查点为 `diagnostics/full-recovery-events/management-03a9dbc537f84e0faaea2ad5a2a732c2/checkpoint.json`。此结果证明修订后**重新导入加校验**的恢复路径有效,不能替代直接 ICDB Repair 后仍被原生 BackAnnotate 拒绝的失败结论,也不把用户选择历史数据后的工程称为无损修复。
|
||||
|
||||
## 尚未满足的门槛
|
||||
|
||||
服务器会话失联经实际按钮触发、自动 Repair、重新打开、保存关闭及权威 READY 的完整链路仍需通过。历史数据选择及重新导入均可能改变恢复版本,不能宣称无损恢复。Windows 10 尚未验证;当前实机为 Windows 11 / Mentor EE7.9.5。
|
||||
|
||||
## 自动化验证
|
||||
|
||||
修订代码全量 `python -X utf8 -m pytest -q`:**1095 passed,171.09 秒**。保留一条已有 pywinauto STA COM 线程模式警告。`compileall`、`git diff --check` 通过。取消发生在日志证据 I/O 中的回归先复现错误提交,再验证修复;相关集中测试 108 项通过。独立审查已复核全部代码修订,最后一项取消时序 P2 已解决,没有剩余实质问题。
|
||||
|
||||
候选包按提交归档构建。最终冻结按钮冒烟结果及构建、压缩包校验记录分别保存在证据目录的 `final-frozen-buttons/result.json`、`build-result.json`、`package-result.json`;按钮冒烟只证明界面响应,不等于现场 ICDB 自动修复验收。
|
||||
@@ -0,0 +1,46 @@
|
||||
# 无地址 ICDB 维护及 PCB 版本选择
|
||||
|
||||
沿用 `codex/temp-issue-2-icdb-recovery` 临时分支。依据实际错误日志与公开资料修正入口,用户明确授权在需要时弹窗选择版本。应用自动备份仍取消,操作前保留手动备份提醒;未修改原用户库。
|
||||
|
||||
## 本次行为
|
||||
|
||||
- 明确发起 ICDB 维护时,不再因为没有 `sAddress.adr` 或协调检查点而跳过原生检查。
|
||||
- 无地址时,所选 PCB 必须唯一反向引用主 PRJ,工程内数据库映射必须唯一。多数据库、共享地址、路径身份不符、原生进程/脚本占用及无法独占读取仍停止。
|
||||
- 原生 Repair 成功并确认释放后,沿同一任务重新打开。若原生要求选择历史 PCB 版本,主应用显示实际候选时间和“最后手动保存 / 自动保存 / 取消”。不默认选择任一历史版本。
|
||||
- 用户选择后,私有桌面代理重新核对窗口、进程、候选时间及单选状态,再确认恢复。选择过期、窗口变化或执行失败不重试确认。等待期间应用保持响应;取消停止当前项并保留原生现场。
|
||||
- 最终仍要求集成校验、保存关闭、进程退出及权威 READY。使用了历史 PCB 版本时,即便校验通过,也记录 `RESTORED_REVIEW_REQUIRED`(已恢复,版本待核对),不标记为无损 Repair。
|
||||
- 未提供交互入口的调用保留待选择结果,不自动选版本;普通 Verify 不获得修复后授权。
|
||||
|
||||
## 过程证据
|
||||
|
||||
无地址隔离工程 IP101GR 经实际应用维护按钮完成原生 Repair,地址为空且进程退出。之后严格的修复后授权通过读写确认,继续到 PCB 历史版本选择。证据为 `diagnostics/noaddr-ui/evidence/maintenance-c05e9c4b06b2/result.json`。
|
||||
|
||||
用户此前已选择最后手动保存版本(2026/9/24 23:06)。首次诊断续接沿用该选择,完成校验、保存关闭,`IsVerifiedReuseBlock` 返回 READY/raw=1;记录在 `diagnostics/icdb-addressless-20261103/authorized-last-manual/result.json`。该次还通过诊断操作确认了保存弹窗,不能记为完整自动链路通过,因此继续实现上述应用内选择流程。
|
||||
|
||||
后续应用内选择试验两次在原生修复前被其他脚本占用阻止。进一步日志显示来自另一工具的并行 `run_bridge.vbs` 测试;没有强制结束或忽略该进程。失败记录保留在 `source-choice-button/`、`source-choice-button-retry/`。
|
||||
|
||||
## 验证边界
|
||||
|
||||
集中回归覆盖无地址选目标、地址变化、共享/多个数据库、修复后授权、选择/取消、版本日期改变、重复确认、原生动作失败、错 PID/桌面、真实单选状态复读和历史恢复归类。独立代码审查无剩余实质问题。
|
||||
|
||||
最终全量测试、冻结构建及实际按钮结果统一记录在 `diagnostics/icdb-addressless-20261103/`。本文件不将历史版本恢复视为无损修复,也不将模拟测试或人工续接替代最终冻结链路结果。
|
||||
|
||||
## 最终冻结包结果
|
||||
|
||||
程序源码提交 `de952a6`。全量 **1135 passed,228.63 秒**,一条已有 pywinauto STA COM 线程模式警告;编译、diff 检查及独立审查通过。候选程序从该提交的不可变归档构建。
|
||||
|
||||
最终试验使用原有完整隔离副本。先由官方 Repair 做独立准备,释放旧地址且不打开 PCB;这只用于构造此前真实遇到的无地址状态,不作为验收。启动最终冻结程序前确认:**地址为空、协调阻止检查点不存在**。
|
||||
|
||||
随后通过应用真实维护按钮执行,没有替换原生适配器或直接调用分阶段校验:
|
||||
|
||||
1. 原生检查确认未占用,执行 Repair,记录本轮原生日志并确认退出/释放。
|
||||
2. 同一工程重新打开,应用弹窗显示手动保存和自动保存日期均为 `2026/9/24 23:06`。
|
||||
3. 在应用弹窗选择用户此前已批准的最后手动保存版本。私有桌面代理完成单选复读及原生确认。
|
||||
4. 原有监督器自动处理保存 Reusable Block cell 提示,完成校验、保存、关闭及进程退出,无诊断脚本手动点击原生窗口。
|
||||
5. 权威 `IsVerifiedReuseBlock` 返回 `READY / raw=1`。最终 `PASS / GREEN / safe_to_continue=true`,恢复结果为 `RESTORED_REVIEW_REQUIRED`。
|
||||
|
||||
证据:`frozen-choice-button-retry/result.json`、`version-choice.png`,以及
|
||||
`diagnostics/choice-frozen-ui-retry/evidence/verify-7b0cd3fb8608/result.json`。
|
||||
之前被其他任务脚本阻止的各次试验均保留,没有计入成功。用户授权关闭并行测试时,该测试已经自行退出,因此没有终止 Mentor 进程或外来测试进程。
|
||||
|
||||
该结果证明本机 Windows 11 / EE7.9.5 上 IP101GR 的无地址维护、应用内用户选择和后续完整链路可执行;恢复采用历史手动保存版本,不证明无损保留了该版本之后的修改。未据此合并发布或关闭工单。
|
||||
@@ -0,0 +1,53 @@
|
||||
# 自动备份检查与调整
|
||||
|
||||
按用户 2026-11-03 最新要求:取消应用操作前自动备份,改为弹窗提示手动备份。本要求覆盖早期计划中的“必须完整备份后执行”。仍在 `codex/temp-issue-2-icdb-recovery` 临时分支,未合并或发布。
|
||||
|
||||
## 检查结果与调整范围
|
||||
|
||||
| 操作 | 检查到的旧行为 | 当前调整 |
|
||||
| --- | --- | --- |
|
||||
| 新增 CBB | 每项复制整个中心库,即使没有旧同名工程 | 取消,记录只读内容基线 |
|
||||
| 同名替换 | 每项复制整个中心库,再移除并导入 | 取消,保留逐项阶段及失败记录;失败时使用手动备份恢复 |
|
||||
| 移除 | 每项复制整个中心库 | 取消,原生移除后重新读库确认缺失 |
|
||||
| 普通校验 | 本地工程辅助备份,网络路径跳过 | 统一取消,记录 `manual_backup_policy` |
|
||||
| ICDB 修复 | 应用复制完整工程,原生工具另外备份 | 取消应用复制,保留独占访问、原生自身备份及成功证据要求 |
|
||||
| 从备份恢复 | 整库回退备份,再从中复制验证库;额外保留来源副本 | 去掉回退备份和重复来源副本,直接生成一份隔离验证库 |
|
||||
| 读取、搜索、筛选 | 无自动备份 | 保持只读 |
|
||||
|
||||
## 仍需生成的数据
|
||||
|
||||
- 新增/替换的来源暂存及原生内容导出副本:防止原生工具直接改写用户提供的源工程。
|
||||
- 恢复的隔离验证库:用于在安装前完成实际校验,会占用磁盘并花费复制时间,不能等同于未经修改的整库备份。
|
||||
- 恢复安装时保留旧 Work:仅同卷目录改名,不复制数据,用于安装失败时还原目录交换。
|
||||
- 工程库引用修正前的单个 PRJ 原文、日志、清单及检查点:属于轻量变更证据,不是工程或中心库备份。
|
||||
- Mentor 原生 Repair 自身生成的备份:属于原生修复流程,应用没有绕过。
|
||||
|
||||
独立研究探针中显式创建的实验备份及现存历史备份未删除。桌面生产路径不再触发上述旧的自动工程/整库备份辅助函数。
|
||||
|
||||
## 用户交互和约束
|
||||
|
||||
管理操作沿用原确认窗口,增加“应用不会自动备份,请先手动备份中心库及相关工程”。普通校验、维护、恢复同样在启动前提示;每批一次,取消不启动后台任务。应用不检查也不声称用户已经创建了手动备份。
|
||||
|
||||
取消备份不会取消串行任务、库锁、数据库独占检查、目标变更检查、来源身份核对、重新读库验证或未完成任务检查点。替换仍是移除后重新导入,非原子操作;部分失败必须使用手动备份及检查点恢复,不自动重放。
|
||||
|
||||
直接 ICDB Repair 的现场完整验收缺口仍保留,本次备份策略调整不代表该故障已解决。
|
||||
|
||||
## 隔离原生验证
|
||||
|
||||
在既有独立实验库 `diagnostics/reimport-8212/native-add/fixture/mentor_lib.lmc` 通过正式管理引擎实测:
|
||||
|
||||
- 原生移除 `1GPHY_8212` 后复读确认缺失,结果 `REMOVED`,安全释放,耗时 39.391 秒。
|
||||
- 随后原生重新导入同一独立来源,复读名称/分区、原生逻辑导出及主要资产身份确认通过,结果 `UPLOADED`,安全释放,耗时 101.359 秒。
|
||||
- 两项操作均没有生成 `library-before` 整库备份,来源主要文件清单未变。测试未启用自动校验,不将上传成功解释为 READY。
|
||||
|
||||
证据:`diagnostics/manual-backup-20261103/native-cycle-result.json`、`native-cycle-accepted.json` 和 `diagnostics/mb-events/`。上述耗时包含原生启动、复读和内容检查,不能当作与旧版同环境对照的提速比例。
|
||||
|
||||
开始实测前发现上一版应用在完整隔离库 IP101GR 上保留了“继续以读写方式打开”提示。仅向已核对进程命令和私有桌面的该提示发送“否”,两个 PCB 进程正常退出;没有强杀、保存或删除原生地址。原失败证据与取消记录保留在 `previous-test-cancel.json`。随后通过正式释放检查解除小实验库旧阻止记录,未绕过库锁。
|
||||
|
||||
## 代码验证
|
||||
|
||||
最终全量 Python 回归:**1111 passed,192.49 秒**,一条已有 pywinauto STA COM 线程模式警告。集中回归 297 项通过;占用检查修订后相关 151 项通过。编译及 diff 检查通过,独立复审无剩余实质问题。
|
||||
|
||||
审查发现取消整库复制时一并丢失了全库数据库独占检查,已改为不复制数据的 `build_exclusive_library_manifest`:记录基线和写入前检查均同时持有所有 `.lmc` / `icdb.dat` 的独占读取句柄。回归覆盖主库、共享库、其他 CBB 数据库仍被共享读取句柄占用的情况,确认未进入原生写入。
|
||||
|
||||
候选包从提交归档构建。最终冻结程序手动备份提示及取消测试记录位于 `diagnostics/manual-backup-20261103/frozen-prompts/result.json`,构建和交付信息保存在同一证据目录。
|
||||
@@ -0,0 +1,77 @@
|
||||
# 原生 CBB 增删改查接入与候选包验证
|
||||
|
||||
程序源码提交:`b26e2f2f6232c22a94ee1269bd4449fe0fe06623`。
|
||||
分支:`codex/temp-issue-2-icdb-recovery`。本地候选包,未合并、未发布、未关闭工单。
|
||||
|
||||
## 已接入的操作
|
||||
|
||||
| 操作 | 原生入口与验收条件 |
|
||||
| --- | --- |
|
||||
| 读取 | `LibraryManager.Application.OpenLibrary`、`Partitions(7)`;核对库身份、分区和条目,正常关闭会话。 |
|
||||
| 新增 CBB | `OnReusableBlocksEditor` → Logical-Physical → New;私有桌面 UIA 和有时限的控件消息提交完整 PRJ,确认成功提示后关闭重开库,再核对工程内容。重名拒绝覆盖。 |
|
||||
| 用工程替换已选 CBB | 完整工程及中心库备份 → 原生移除 → 原生重新导入 → 重新读库和内容核对。失败保留恢复证据并停止后续写操作。 |
|
||||
| 移除已选 | 安装脚本确认的 `CleanWGLib.exe <lmc> F4 <list>`,输入为 `REUSE_BLOCK`;先完整备份,要求明确 Removed 输出,再重新读库确认不存在。 |
|
||||
|
||||
“用工程替换已选 CBB…(原生重新导入)”与已有“从备份恢复 CBB…”是不同操作。前者更新中心库注册条目,采用移除后重新导入,**不是原子替换**;后者沿用备份 Work 的副本验证与安装恢复流程。
|
||||
|
||||
新增和替换默认继续自动校验,允许批次开始前取消。结果分别显示上传失败、上传成功但校验失败、上传并校验通过;取消自动校验时明确显示“已上传 / 未自动校验”。
|
||||
|
||||
## 支持范围与保护
|
||||
|
||||
- 已验证本机 Mentor EE7.9.5、DxDesigner、Logical-Physical、ASCII CBB 名称。原生核心组件和三种内容导出程序均核对固定 SHA-256;接口或版本不符时禁用并显示原因。
|
||||
- 所有写操作使用串行任务、共享互斥和上传工具兼容的库锁;暂存来源、完整备份、目标身份、事务随机标识、监督进程及实际独占句柄必须相互匹配。
|
||||
- 不直接修改 LMC 二进制,不依赖独立上传工具安装目录,不退回前台鼠标。遇到中心库升级或流程选择提示拒绝自动迁移。
|
||||
- 原生导入会改写 ICDB 存储字节。内容身份采用官方 ASCII、CSV 和 EDIF 原理图导出,加上 Layout、约束及其他主要资产的 SHA-256。只规范化已实测的报告时间和路径字段;未知工程文件继续参与比较。
|
||||
- 原生复制可能留下不正确的 PCB 库相对引用。仅在本任务导入、会话释放及库锁持有得到确认后校正已导入副本,再复读目录与内容。原始来源不改写。
|
||||
- 导出副本所有权随库检查点持久保存;超时、重启、地址记录仍存在或进程、独占访问无法确认时,不能解除库锁或接续维护。
|
||||
- 完整来源和预计目标路径达到 260 个 UTF-16 单元时,在原生写入前拒绝;同名替换在移除旧条目前检查。保留所有文件,提示缩短操作数据或目标库路径,不宣称已实现原生长路径支持。
|
||||
- 本轮已确认的原生复制失败即时记录。只正常确认本任务进程的已验证错误对话框;未知提示不自动点击,会话释放不明确时保留阻止状态。
|
||||
|
||||
## 实际验证
|
||||
|
||||
环境:Windows 11,版本 `10.0.26200`;Mentor EE7.9.5。
|
||||
|
||||
### 原生完整管理引擎
|
||||
|
||||
真实新建隔离库完成:新增 A、拒绝重复名称、替换为 B、备份后移除、将独立备份工程重新导入。各项会话均安全释放。B 的 Layout 哈希与 A 不同,并与来源 B 一致。原始来源主要文件清单未变。
|
||||
|
||||
证据:`diagnostics/issue2-native-crud-20261103/engine-e2e/cycle-result.json`。
|
||||
|
||||
### 最终冻结程序公开界面
|
||||
|
||||
从应用真实按钮、来源文件选择器和确认清单执行,没有替换原生适配器或绕过能力检查。
|
||||
|
||||
| 试验 | 结果 |
|
||||
| --- | --- |
|
||||
| 275 字符暂存路径 | `UPLOAD_FAILED`,明确 `NATIVE_PATH_TOO_LONG`,`safe_to_continue=true`;未启动内容导出或原生 Add。 |
|
||||
| 正常路径新增 A | `UPLOADED`,重新读库与工程内容核对通过。 |
|
||||
| 同名替换为 B | `UPLOADED`,实际 Layout 匹配 B 且不同于 A。 |
|
||||
| 原生移除 | `REMOVED`,重新读库确认不存在。 |
|
||||
| 最终退出与来源检查 | 原生进程已退出;两份来源的 153/147 个主要文件哈希及 541/506 个文件的大小、修改时间保持一致。 |
|
||||
|
||||
证据位于 `diagnostics/issue2-native-crud-20261103/`:
|
||||
|
||||
- `frozen-public-ui-path-block/result.json`:写入前长路径拒绝。
|
||||
- `frozen-public-ui/result.json`:最终冻结程序完整按钮流程及截图。
|
||||
- `final-source-baselines.json`、`final-acceptance.json`:来源和会话释放证据。
|
||||
- `build-result.json`、`validation.json`、`package-result.json`:源码、测试、构建和包校验记录。
|
||||
|
||||
本轮 CRUD 原生及冻结界面试验均在批次开始前取消自动校验,**上传成功不等于 READY**。这些结果不能代替上传后完整 Verify/Save/Close 或现场 ICDB 失联修复验收。
|
||||
|
||||
### 实测发现并修正的长路径问题
|
||||
|
||||
初版冻结程序在 264 字符暂存文件路径下弹出“系统找不到指定的路径”,日志记录 `Cannot copy iCDB base of Reusable Block project`,旧逻辑只检查成功提示,直到超时才返回。该失败未计入通过。
|
||||
|
||||
对同一文件,旧式 32 位 Win32 CopyFile 复现错误码 3;保持同一冻结程序、测试库、完整来源和空描述,仅缩短暂存路径后,原生新增和内容核对通过。最终修订增加完整路径预检和本轮失败识别,并在新冻结包实测提前拒绝。没有删减长路径中的日志或其他文件来绕过问题。
|
||||
|
||||
保留原始失败、正常关闭及库锁重新核验记录:`frozen-public-ui-longpath-failed/`、`longpath-failure-release/`、`longpath-failure-catalog/`、`path-copy-probe/`、`frozen-public-ui-shortpath-control/`。
|
||||
|
||||
## 自动化验证与交付
|
||||
|
||||
- 全量 `python -m pytest -q`:**1071 passed**,90.98 秒,1 条已有 pywinauto COM 线程模式警告。
|
||||
- `python -m compileall -q src tests`、`git diff --check`:通过。
|
||||
- 独立整体代码审查及长路径修订复审:无未解决的实质问题。
|
||||
- 从提交归档构建冻结程序,启动与退出冒烟测试通过;上述公开界面验收使用同一构建。
|
||||
- 候选包:`dist/issue2-native-crud-20261103-b26e2f2.zip`,旁附 SHA-256;包内含使用说明及验证摘要。
|
||||
|
||||
尚未完成 Windows 10 实机验证,也未将本轮 CRUD 试验视作现场服务器会话失联修复通过。旧版库迁移、其他 Mentor 版本、非 Logical-Physical 分区及原生长路径支持不在已验证范围。原用户库不参与本轮写入试验。
|
||||
@@ -0,0 +1,24 @@
|
||||
# ICDB 失败后的副本恢复入口
|
||||
|
||||
原生修复失败、缺少有效备份,或 Repair 后完整校验失败时,结果窗口提供“选择副本恢复…”;主窗口保留“选择工程副本恢复失败项…”,允许关闭结果窗口后继续。单纯占用、未知诊断、仅检查或成功结果不提示替换。
|
||||
|
||||
入口固定使用本次失败任务的库、名称和分区,不使用用户后来勾选的其他条目。切换中心库使旧入口失效。选择的是库外完整工程的 PRJ 文件,相关 PCB、数据库和依赖资料仍由现有来源检查验证。
|
||||
|
||||
点击入口只打开来源选择窗口。用户明确确认手动备份、目标库、目标条目及副本后,才在后台检查释放,并复用现有原生移除/导入流程;不自动备份整个库,不自动删除目录代替原生操作。自动校验默认开启。
|
||||
|
||||
释放检查继续要求原生所有者退出、数据库地址记录处理完毕及独占可读。WMI 查询通过最多 10 秒的只读助手执行,超时不当作空闲;同时检查脚本与校验/修复工作进程。检查不通过显示具体原因、保留阻止记录和恢复入口。未完成的管理写入仍不自动重放。
|
||||
|
||||
原维护失败记录保持原样。副本恢复建立独立 `reimport-recovery/*/recovery.json`,关联原证据、来源、释放检查和管理结果。上传成功但校验失败继续显示失败;上传并取得 READY 后显示“副本恢复校验通过,版本待核对”,不改称原 ICDB 无损修复成功。
|
||||
|
||||
按用户要求精简界面:默认只展示目标、副本选择、备份确认和操作结果。开发流程说明已移除,诊断细节和证据路径放入默认收起的日志。恢复执行前仍明确说明先移除原条目再导入副本。
|
||||
|
||||
## 验收边界
|
||||
|
||||
- 核心流程专项测试 57 项通过;随后新增的两项主窗口取消/退出复核回归均先复现失败再通过。
|
||||
- 完整回归记录为 **1,194 passed / 1 failed**(1,013.66 秒)。该运行启动后用户要求精简 UI,已收集的测试仍断言旧文案“尚未修复成功”,运行时加载的界面已使用“修复未完成”,因此失败。未把该次结果标成全量通过。
|
||||
- 最终界面与更新后的测试重新验证 **77 passed**(43.00 秒),包含该失败用例及新增的日志默认收起检查。其余产品逻辑未在此期间修改。
|
||||
- 编译、差异检查、独立审查通过。最终冻结构建及启动/正常退出、占用辅助进程冒烟通过,EXE 内 5 个关键模块与当前源码一致。记录在 `diagnostics/copy-reimport-20261104/`。
|
||||
|
||||
本次验证覆盖 Qt 真实事件循环中的按钮、取消、来源确认、后台等待及故障分支,原生写入边界使用替身,不把这些测试当作 Mentor 修复验收。
|
||||
|
||||
既有隔离副本仍有 `IP101GR/Work/database/cdbsvr/sAddress.adr`,因此完整库释放条件目前不满足。该情况不能通过忽略地址或强制清除检查点解决,需要先处理对应工程。此前 `1GPHY_8212` 的原始 Repair 后 BackAnnotate 失败结论保持不变,工单未关闭。
|
||||
@@ -0,0 +1,29 @@
|
||||
# ICDB 维护审查修正(候选)
|
||||
|
||||
替代 `8180a8a` 的诊断实现。该旧候选曾把完整校验当作诊断,且存在缺失证据后直接进入 Repair 的分支,不应继续用于原库。
|
||||
|
||||
## 行为
|
||||
|
||||
- READY 始终不进入维护或默认备份恢复队列,即使被勾选。混合选择只处理可见的、可用的非 READY 项;全部 READY 时没有可执行目标,不回退到处理 READY。
|
||||
- 先取得上传工具兼容的库锁,验证检查点、工程身份、进程和数据库独占访问,再启动诊断。
|
||||
- 独立的 `diagnostic_only` 模式只打开并确认目标,随后通过原生 `Close(False)` 关闭。不执行 Project Integration、保存、原生 LM Verify 菜单、工程库路径改写或 READY 校验。Mentor 启动本身仍可能生成运行日志/地址记录,因此不宣称整个原生过程绝对只读。
|
||||
- 诊断拒绝配置中指向其他中心库的引用,包含缩进/制表符格式。不会为了检查而改写引用。
|
||||
- 原生关闭助手最多调用一次。关闭返回后最多观察 30 秒的进程/地址释放;超时保留现场并停止。
|
||||
- Repair 只接受本次独立证据目录中的结构化 `ICDB_REPAIR_REQUIRED` 记录,要求工程级范围、会话身份和精确匹配的数据库路径。修复前再次确认目标及释放状态。
|
||||
- 删除通过 Python 函数名、模块名判断可信度的逻辑,以及吞掉断言/pytest 失败后直接修复的分支。缺少证据、通用数据库安全错误、其他工程或历史轮次证据均不能授权 Repair。
|
||||
- 诊断通过在报告中单列“启动检查通过、未修复”,不冒充修复完成或 READY。只有修复后完整校验取得权威 GREEN/READY 才算修复验证通过;历史恢复仍需核对版本。
|
||||
|
||||
## 验证范围
|
||||
|
||||
- 最终从 `ef652f3` 导出的固定源码运行完整回归:`python -X utf8 -m pytest -q --tb=short`,**1,151 passed,375.48 秒**;仅既有 pywinauto STA 警告。
|
||||
- 此前的专项覆盖包括库锁、证据缺失/其他工程/历史轮次、无集成保存、关闭失败、路径格式、READY 选择范围和延迟退出。最终源码副本与构建输入哈希已核对。
|
||||
- `compileall` 与 `git diff --check` 通过。
|
||||
- 独立审查发现并修正重复关闭和路径格式遗漏;冻结构建和启动结果另存于 `diagnostics/icdb-review-20261104/`。
|
||||
- 冻结启动/退出检查返回 0;EXE 内 5 个变更模块与固定源码编译结果一致;ZIP CRC 校验通过。
|
||||
- 最终候选:`dist/issue2-icdb-reviewed-ef652f3.zip`,50,871,172 字节;SHA-256:`f4565f1696caf620522d621bd8555817a6d7d5d6ed4193cf87f2b53758a5d8c7`。构建和测试证据对应代码提交 `ef652f3ada0b9b8422e49f2ebc5b18305204d8ab`。
|
||||
|
||||
## 保留的限制
|
||||
|
||||
本轮不在原库执行原生操作,未重新完成现场失联故障的端到端验收。仅有 `sAddress.adr`、历史版本选择提示或一般数据库错误不足以认定 ICDB 损坏;这些情况会停止并保留证据,不自动 Repair。若原生启动后会话未释放,也不会继续修复或处理下一项。
|
||||
|
||||
本候选不推送、不合并发布、不关闭工单。测试中的模拟边界用于验证队列和安全条件,不代替现场 Mentor 验收。
|
||||
@@ -0,0 +1,52 @@
|
||||
# 原生占用检查候选:完整修复验收失败
|
||||
|
||||
本记录更新此前 `2026-11-04-icdb-review-fixes.md` 的维护入口说明。工单 #2 保持未解决;本候选不合并、不发布正式版、不关闭工单。
|
||||
|
||||
## 本轮改动
|
||||
|
||||
- 维护入口先调用原生 iCDB Project Backup 的工程加载/占用检查,不先打开 PCB。旧 `sAddress.adr` 只是待核实证据,不再单凭它阻断检查,也不删除或改写该文件。
|
||||
- 仅本轮 Output 明确绑定目标工程、目标数据库,确认未占用且要求 Repair,原生检查正常退出,并再次通过工程身份和占用检查,才调用一次 Repair。其他工程、共享库、未知错误或未释放会话均阻止后续操作。
|
||||
- WMI 占用查询在独立只读辅助进程执行,最多 10 秒;超时是未知,不是空闲。文件扫描在后台运行并支持取消。原生准备阶段预算 60 秒,另加原生操作超时及 5 秒监督余量;取消后再次核对,避免迟到启动。
|
||||
- 停止请求传入维护流程,原生写入不强杀;释放未确认时停止后续批次。仅检查结果使用 `CHECKED`,不计入修复成功。READY 即使已勾选也不进入维护。
|
||||
- 精确的 verified/once-verified Reusable Block BackAnnotate 拒绝归类为 `CBB_REIMPORT_REQUIRED`,不再被后续释放告警掩盖。该分类不会执行重导入,也不改变 `safe_to_continue`;原生错误及释放错误都保留在报告中。
|
||||
- 历史版本选择继续通过应用弹窗;只有完整校验及权威 READY 通过才允许成功。历史恢复仍标记版本待核对。
|
||||
|
||||
## 隔离环境实测
|
||||
|
||||
证据根目录:`diagnostics/native-occupancy-20261104/`(含本机路径和原生日志,不纳入 Git)。测试通过实际应用维护按钮和版本选择弹窗完成,没有以手工分阶段调用替代验收。
|
||||
|
||||
一致副本包含 38,954 个文件、1,220,129,120 字节。复制期间源文件集合/大小/修改时间一致,253 个主要文件 SHA-256 核对通过;追加目标 PRJ/PCB 后,最终再次核对原库的 255 个已记录文件,全部未变化。原库未执行写操作。
|
||||
|
||||
最终尝试 `source-ui-fourth`,目标 `1GPHY_8212`:
|
||||
|
||||
1. 原生检查明确返回未占用,并指出当前数据库不一致、要求 Repair。
|
||||
2. 原生 Repair 创建自身备份,完成数据库检查、整理和关闭,返回 `Project should now be fixed.`,并确认退出释放。
|
||||
3. 应用弹窗选择用户已授权的最后手动保存版本(2026/9/24 15:15),重新打开同一工程。
|
||||
4. SynchCES、LoadCES 通过;BackAnnotation 为 Required,实际调用被 Mentor 拒绝:`Back Annotation is not allowed on verified (or once verified) Reusable Blocks.`
|
||||
5. 未完成保存与 READY 校验。最终 **FAIL / UNKNOWN / REPAIR_VALIDATION_FAILED**,`validation_passed=false`、`safe_to_continue=false`。原生 Repair 完成不等于整体修复成功。
|
||||
6. 失败关闭助手记录 Close/Quit 成功,但最终释放检查仍看到 PID 21968,因此保留检查点并停止批次。后续只读复查该原生进程已消失;这不追溯修改原失败结果。测试应用关闭结果对话框后正常退出。
|
||||
|
||||
实测界面响应记录:614 次 WM_NULL 检查,200 毫秒超时 0 次,最大约 78 毫秒。这只证明本次运行的界面响应,不保证任意网络故障下所有系统调用可立即取消。
|
||||
|
||||
关键证据:
|
||||
|
||||
- `source-ui-fourth/acceptance.json`:`accepted=false`。
|
||||
- `source-ui-fourth/evidence/maintenance-43479c21aa59/result.json`:完整维护结果。
|
||||
- `source-ui-fourth/evidence/maintenance-43479c21aa59/native-repair/repair-result.json`:原生 Repair 证据。
|
||||
- `source-ui-fourth/evidence/verify-99a675e0399c/`:重新打开、集成拒绝、正常关闭及释放未确认记录。
|
||||
- `source-ui-fourth/ui-responsiveness.json`、`version-choice.png`、`finished.png`。
|
||||
- `source-final-check.json`:原库 255 个哈希均保持不变。
|
||||
|
||||
## 代码与冻结候选验证
|
||||
|
||||
- `python -X utf8 -m pytest -q --tb=short`:**1,176 passed**,302.56 秒;1 条既有 pywinauto STA 警告。
|
||||
- `compileall`、`git diff --check`、独立只读代码审查通过。
|
||||
- PyInstaller 构建通过;冻结程序创建主窗口及正常退出通过,新 `--owner-probe` 在冻结程序中返回有效结果。
|
||||
- EXE 内 11 个变更模块与当前源码编译结果一致。验证脚本及结果在证据根目录的 `check_candidate.py`、`frozen-result.json`。
|
||||
- 本地候选目录:`dist/issue2-native-occupancy-candidate/`。冻结包完整故障修复链路未执行,不能称为已验收的修复包。
|
||||
|
||||
## 尚未解决
|
||||
|
||||
已验证或曾验证的 CBB 注册状态限制仍阻止 BackAnnotate。不能跳过 Required 操作、强行设置 READY 或把移除/重导入偷偷加入 ICDB Repair。此前隔离试验的独立重导入路径见 `2026-11-03-field-feedback.md`,其行为涉及库条目更新,不能据此宣称本次无损修复通过。
|
||||
|
||||
本轮没有完成 Windows 10/11 双系统验收;冻结包的完整现场故障链路仍需验证。程序测试和启动冒烟均不能代替上述失败的实际验收。
|
||||
@@ -0,0 +1,45 @@
|
||||
# 三页界面与原生检查、退出修正
|
||||
|
||||
界面按“检验 / ICDB 维护 / 中心库管理”横向切换,共用中心库、清单、搜索和选择状态。默认收起运行日志,长状态信息限制高度,避免纵向堆叠操作区或报错撑长窗口。1000×620 布局预览保存在本轮诊断目录中。
|
||||
|
||||
## 本轮现场日志定位
|
||||
|
||||
用户运行的是 `29959e2` 冻结包。2026-11-04 14:21(北京时间)的维护在原生检查启动后报 `(2, 'EnumWindows', '系统找不到指定的文件。')`,并没有调用 Repair。随后手动释放检查发现 `1GPHY_8212`、`IP101GR` 的地址记录仍存在;它们不能直接当作已释放或直接删除。第二次在准备检查时取消,助手没有及时结束文件扫描。
|
||||
|
||||
## 修正
|
||||
|
||||
- 在实际空私有桌面复现了 Win32 旧错误码问题:先 `SetLastError(2)` 再枚举空桌面,pywin32 会报与现场相同的错误。现在枚举前清零旧错误;真实枚举异常继续上报,不把未知错误当作空闲。
|
||||
- 将取消信号传入修复助手的文件扫描。文件标记最多每 100 毫秒读取一次,取消后锁存;原生启动、Repair 命令和确认前仍立即读取取消信号。冻结实测曾因逐文件读取取消标记而在启动前超时,节流后已推进至实际原生检查和 Repair。
|
||||
- 手动备份模式下,助手只在启动前执行一次完整目标保护,移除原先自动备份取消后留下的重复检查。同一保护内复用初始完整扫描作地址和文件选择,取得全部独占读句柄后再做第二次完整扫描;地址变化或原生文件集合增删均停止。没有复用跨操作的旧快照。
|
||||
- 发出唯一正常关闭请求前仍严格确认任务进程、工程、私有桌面、空闲窗口和地址状态。关闭后只等待进程、启动器及地址释放,不再因退出途中 WMI 暂时缺少命令行而提前报身份未确认,也不再次关闭窗口。未实际退出仍保留未释放状态。
|
||||
|
||||
## 已有验证记录
|
||||
|
||||
本轮证据目录为 `diagnostics/tabs-release-20261104/`,含本机路径,不提交原始数据。
|
||||
|
||||
- 初轮完整回归 1,200 项通过,2 项旧测试替身未接收取消参数;同步接口后维护模块 48 项通过。
|
||||
- 扫描优化后的维护、原生修复等相关测试 225 项通过;随后退出等待等 91 项通过。包含实际私有桌面的 Win32 回归,而不只是窗口模拟。
|
||||
- 冻结程序取消试验 `frozen-cancel-local`:预检查中取消约 0.61 秒返回,未启动原生 Repair,应用正常退出。
|
||||
- 源码实际入口 `source-optimized`:原生确认未占用并要求修复,Repair 成功,按用户授权恢复最后手动保存版本;最终因 verified/once-verified CBB 禁止 BackAnnotate 失败。PCB 正常关闭,没有附加 PCB 释放未确认错误。
|
||||
- 冻结实际入口 `frozen-polling`:原生检查及 Repair 已完成,取消标记只读取 214 次、耗时 0.313 秒。随后 PCB 因数据库服务器启动晚于客户端截止时间而加载失败。服务器日志显示它后来实际启动并自行关闭,不据此宣称完整修复通过。
|
||||
- 同一次失败退出中,先记录了 `startup_close_requested`,随后 WMI 缺少进程信息导致 `STARTUP_PROCESS_UNCONFIRMED`,下一秒却已确认进程退出;该具体时序已转为回归测试。
|
||||
|
||||
最终完整回归:**1,207 passed**,588.26 秒,仅既有 pywinauto STA 警告;记录在 `pytest-final.log` / `pytest-final-result.json`。最终冻结构建、启动退出冒烟和 6 个关键模块的源码一致性检查通过。独立审查未发现剩余必要缺陷。
|
||||
|
||||
最终冻结实际入口为 `frozen-local-final`,使用 `C:\Temp\CbbTabsRelease20261104\library` 的独立副本:原生 `NOT_IN_USE` 且明确要求修复 → Repair 完成并释放 → 重新打开同一 PCB → 用户已授权的最后手动保存版本(2026/9/24 15:15)→ SynchCES / LoadCES → BackAnnotate 被原生拒绝。最终 **FAIL / UNKNOWN / REPAIR_VALIDATION_FAILED**,未取得 READY;退出记录确认进程结束,没有附加 `PCB_RELEASE_UNCONFIRMED`。应用正常退出返回 0。此前服务器迟启动的失败记录保留,不能从一次对照断定其全部成因。
|
||||
|
||||
原库 255 个已记录主要文件哈希复核全部未变,见 `source-final-check.json`。
|
||||
|
||||
最终包的 `frozen-cancel-final` 再次验证取消:约 1.16 秒返回,检查助手报告 `CANCELLED`,批次保持 `BLOCKED`,未启动 Repair,应用正常退出。取消只证明操作已停止,不计作修复成功。
|
||||
|
||||
## 验收限制
|
||||
|
||||
原库未执行本轮自动化写入。第一套 F 盘测试副本出现目录枚举属性与直接读取属性不一致,被链接检查阻止,未绕过检查。测试随后迁移到独立本机目录;`C:\Users` 目录会被 Mentor 转成共享路径,因此最终试验选择独立的 `C:\Temp` 路径,并保留前序失败记录。
|
||||
|
||||
完整 ICDB 修复仍必须取得权威 READY;原生 Repair 成功、能够取消、正常关闭或界面测试通过都不能替代该验收。未合并发布,工单保持未解决。
|
||||
|
||||
## 结果展示收尾
|
||||
|
||||
实际冻结运行截图还暴露了结果弹窗包含长路径和 COM 异常、错误列挤压 CBB 名称的问题。结果正文改为简短计数、用户可理解的失败原因和副本恢复入口;原始异常、统计明细及日志路径保留在可展开详情和日志中。名称与结果列共同分配可用宽度,长内容不再把表格撑出窗口。历史备份待核对和待选 PCB 版本仍直接提示。
|
||||
|
||||
该收尾只调整展示,不改变占用检查、关闭、Repair、校验或恢复行为。以已保存的真实失败结果回放检查布局,未额外写入原生库。相关界面、筛选和副本恢复回归 84 项通过;记录为 `pytest-presentation.log` / `pytest-presentation-result.json`。原先完整回归 1,207 项及冻结原生流程的失败结论仍分别保留,不能把展示回放当作新增原生验收。
|
||||
@@ -0,0 +1,127 @@
|
||||
{
|
||||
"candidate": "r10",
|
||||
"candidate_base_commit": "1acfbd637452e8f64d96981044194661dfb4ec1b",
|
||||
"python_full_suite": {
|
||||
"name": "pytest",
|
||||
"errors": "0",
|
||||
"failures": "0",
|
||||
"skipped": "0",
|
||||
"tests": "1574",
|
||||
"time": "207.493",
|
||||
"timestamp": "2026-11-05T21:09:55.032807+08:00",
|
||||
"hostname": "Abs"
|
||||
},
|
||||
"frozen_modules_and_scripts_compared": 37,
|
||||
"native_check_statuses": [
|
||||
"FAIL / ICDB_REPAIR_REQUIRED / released",
|
||||
"CHECKED / released"
|
||||
],
|
||||
"native_check_seconds": [
|
||||
68.563,
|
||||
26.812
|
||||
],
|
||||
"foreign_same_desktop_modals_untouched": true,
|
||||
"source_primary_files_unchanged": true,
|
||||
"gui_native_queue_order": [
|
||||
"check-start",
|
||||
"check-end",
|
||||
"status-start",
|
||||
"status-end"
|
||||
],
|
||||
"gui_cached_filter_available": true,
|
||||
"gui_max_timer_gap_seconds": 0.079,
|
||||
"automatic_icdb_repair_acceptance": false,
|
||||
"field_server_session_loss_acceptance": false,
|
||||
"tested_environment": "Windows 11 / Mentor EE7.9.5",
|
||||
"candidate_code_sha256": {
|
||||
"src\\cbb_refresh_verify\\application.py": "babeefe4ddc2fb78b4af3a0413f60cb351eeca57f6f2862e2bc1b8a94de59f32",
|
||||
"src\\cbb_refresh_verify\\backup_recovery.py": "ea7bb90151e825efb6163e43ed344b62407565005f0a0459c423ba2205539373",
|
||||
"src\\cbb_refresh_verify\\batch_status.py": "918c80dd4f75146baa6b7616ce415ac89ee28f6c1f46b2bfda77bacc998b5b62",
|
||||
"src\\cbb_refresh_verify\\close_failed_block.vbs": "e5f0d9678e07a239e96e634b90cdc761de52fc136311fae31484fa38d6fd9781",
|
||||
"src\\cbb_refresh_verify\\com_runtime.py": "f0f3802d16c791a8bf9dfef44a94917072bfbe8fb3a927d76be8ef0341c7ed35",
|
||||
"src\\cbb_refresh_verify\\content_check.py": "8239c17b6e2452917ed573a7deb3e4c8583eaef91bf3630eff5f424d2e398aa9",
|
||||
"src\\cbb_refresh_verify\\defaults.py": "19aaec03822468b18099f358a5aac3433346ff81345b58a896545bf508840e3d",
|
||||
"src\\cbb_refresh_verify\\desktop_worker.py": "3b79dcab16b67b68550957c09c9de1ba08d85109356274c8cff4d0ae02dec3fb",
|
||||
"src\\cbb_refresh_verify\\diagnostic_open.py": "d6c49ffe5a9969d95edbbc896d47a7e100f248380a287f99ba7bb8b92dbb3072",
|
||||
"src\\cbb_refresh_verify\\dialog_agent.py": "6a9b9802912afc4dd670ee9b28845d97bd64fe55fd577815ef729850fcff78db",
|
||||
"src\\cbb_refresh_verify\\dialog_models.py": "f68cee01d927b48364276d3c1f79e63ce8af231878db0b907d292780cfbafb56",
|
||||
"src\\cbb_refresh_verify\\dialog_probe.py": "d61f0c955c961980c9635940eefb9c7947c1fe90b4b6fd844720df41ddb0aa0e",
|
||||
"src\\cbb_refresh_verify\\dialog_rules.py": "3189b476f7ff4678b59212ed7b4081164e038a7cf7662cd895f9019cb3c1edc5",
|
||||
"src\\cbb_refresh_verify\\dialog_supervisor.py": "15c415c2d2e916f0b64ba04416164ff3b50996d70b22d3b4ac2226b5547ac247",
|
||||
"src\\cbb_refresh_verify\\failed_session.py": "7e6f7fa5ebcf2d49f00c5efc5f5d26412704b68e9122e476ac1f672009a98c09",
|
||||
"src\\cbb_refresh_verify\\icdb_maintenance.py": "6ab1d469b09e92641ff60a4b6acd4cc13d40cc200a6fae880e864181526994c4",
|
||||
"src\\cbb_refresh_verify\\icdb_ownership.py": "7bf2342c1efa34a2ebcbf27964a40a490220f7146fbb6ef957b8d8dd1e511f03",
|
||||
"src\\cbb_refresh_verify\\icdb_recovery.py": "358c0e9a004f1e0b2127513286e1dffd94b0180a8b7314aa9655462f570b6360",
|
||||
"src\\cbb_refresh_verify\\integration.py": "86669ad73ae1d2d724d406c3644bb0c297236a4ffdc4b66117930ec660613e88",
|
||||
"src\\cbb_refresh_verify\\library_lock.py": "315b3cba411713aea870b0a773b3cb986be73b85b88732d8cd82862f22f650db",
|
||||
"src\\cbb_refresh_verify\\library_manager_verify.py": "71e16a8581ad44b646be78b480f9812d596a6d162b3eec03d078bf4ea4503195",
|
||||
"src\\cbb_refresh_verify\\library_reader.py": "47d58d1518ba7e69c22b41db2d34c0a61e2cc1362cf28414f0dae43d4a011753",
|
||||
"src\\cbb_refresh_verify\\maintenance_entry.py": "3b93c25f69d7a961facd8004e20e155a84cc18f06d57b741a9055786ed058990",
|
||||
"src\\cbb_refresh_verify\\management.py": "64e6fc1382092f1d2154052ec456b9c511934d3f2b231a163be28dca27eb3873",
|
||||
"src\\cbb_refresh_verify\\management_transaction.py": "32c53caaead05d5db3a31d3e30721e65434e5837095dc0a7812f825603aa37a0",
|
||||
"src\\cbb_refresh_verify\\mentor_adapter.py": "26a73074ef162d240c80747e371f357c8ec87b00cdbbd3509acc4ac58e68e955",
|
||||
"src\\cbb_refresh_verify\\mentor_paths.py": "ba48c0003b3eacc88906497b2e43b299ca4536a9f7dae44bbacf6a6ec694c116",
|
||||
"src\\cbb_refresh_verify\\models.py": "9e8209a8b006df923f1d07ccab64bbcfe5d674c4fc5f5426bfbc9b11da4ee105",
|
||||
"src\\cbb_refresh_verify\\native_add_failures.py": "192202732423dc624c5548c75e80bb20973e5087c21d4798c9637f25b6de7e94",
|
||||
"src\\cbb_refresh_verify\\native_backup.py": "7276fa3d9298e85550151cf0c7191d84bd08a18a72df5d854a3c38f1a88b001d",
|
||||
"src\\cbb_refresh_verify\\native_engineering_identity.py": "a241bc3be7dc5a922ce728f1febd3684e79e6e45935589c80a4b1a5933e05df5",
|
||||
"src\\cbb_refresh_verify\\native_export_guard.py": "5120c13e4ef1255d4c61316eb40005c4039c23e41edca4437bd0ef28b543a959",
|
||||
"src\\cbb_refresh_verify\\native_management.py": "bdb42f0bbbc964e56cfe08f66804a03dfc73157eb98911531c9d4c8f940c7595",
|
||||
"src\\cbb_refresh_verify\\native_occupancy.py": "7d686079d12217382adace6361cd343d977b91075e3b157cf410ca92d07ffc49",
|
||||
"src\\cbb_refresh_verify\\native_repair.py": "65d3e5b28b1f375402b002f56527dafbcc79e21cea66822e3bc26332d59e76d7",
|
||||
"src\\cbb_refresh_verify\\native_repair_ui.py": "3eb2af181befea94af8b3b3131edff09589f340bcba777abbe3b67fd31b80393",
|
||||
"src\\cbb_refresh_verify\\network_path.py": "6b5b159502d42a46bf4ee26d5698fd2c6498b359088e2138eae46e9065b13c6f",
|
||||
"src\\cbb_refresh_verify\\operation_queue.py": "57ad9da8aeedd9cd75a8c5b5fda44044bcb457670a4a323e9e8bb247198074ab",
|
||||
"src\\cbb_refresh_verify\\owner_probe.py": "8dcfd60246cb2979db34d02e0a2d605c334b6f7e2666f22daa2f50c0408bc903",
|
||||
"src\\cbb_refresh_verify\\pcb_bridge.py": "745ef117e984021e8a3d9087a2783c1efe19bed97edcfbcfae7703a291cc6eaa",
|
||||
"src\\cbb_refresh_verify\\pcb_restore_prompt.py": "5342612ad666e3faf5a9a4ce4710e9af458d357c44037135f2837dad436d5cf7",
|
||||
"src\\cbb_refresh_verify\\post_repair_consent.py": "3b1eaff1db58fd311a9dbc5fdcd850911b04cc5afd4e747f70a62b721b8fafa4",
|
||||
"src\\cbb_refresh_verify\\post_verify_diagnostics.py": "2442de485bc0d6a34c4b2d9b10bc5f323ea38f9ff66674119a50f5c6043bac63",
|
||||
"src\\cbb_refresh_verify\\reimport_recovery.py": "66b2ba8f8c2ec9ae8c386d6b1aa74a1fbb6bfb509c4df0a262f8d7a0ca48469e",
|
||||
"src\\cbb_refresh_verify\\residual_sessions.py": "5fa8a0f87d6aa4c7e0dec4ab8eb1d649d20fdbea35016fbd65fefefd42607eef",
|
||||
"src\\cbb_refresh_verify\\runtime_logging.py": "44ac25430a89c5ffc9e48e88c227e88052f4c815365e8556f67918f3edaba39e",
|
||||
"src\\cbb_refresh_verify\\runtime_timing.py": "c4ed4057b5000e0b86ccc7dd1fe2004d6e0dae29f397fec77b01ad41a81c6367",
|
||||
"src\\cbb_refresh_verify\\save_verified_block.vbs": "2ede0a1297e44533cd6333b775cdd70c86b5f2aaaaa18ccd6df158379ef1fd31",
|
||||
"src\\cbb_refresh_verify\\scoped_manifest.py": "54cf4288e7850e220b394ae971ea98785eba631f80784a3f9354209e649f6498",
|
||||
"src\\cbb_refresh_verify\\status_bridge.py": "05d627d02934a14f5de409472c291d37565a95b836f9c130111aae80612e9196",
|
||||
"src\\cbb_refresh_verify\\verify_diagnostics.py": "041b77d7d49e4c86338ed5e5741d0d27a2c42bc358f4da54b3efe64af847e9b8",
|
||||
"src\\cbb_refresh_verify\\verify_probe.py": "3ed743df49d195c74f5045985ab23491d103ee2c42c07b558c1e037176402ed2",
|
||||
"src\\cbb_refresh_verify\\verify_runner.py": "bb5bae2616e3440a6adc083a2a6941176205f574fde077cf89a6121077833fed",
|
||||
"src\\cbb_refresh_verify\\__init__.py": "be4027b9b6c4659a7f7d499a14f75ec84c410bd9a706d9ffd9f97d44a52b3806",
|
||||
"src\\cbb_refresh_verify\\__main__.py": "dc4be034a0e43d4b659a9300137c29a6a6b7a32b7eaef02b6dff9a88c41305c0",
|
||||
"src\\cbb_refresh_verify\\assets\\dialog_rules.v1.json": "3911080fc799a819662e225a7ad73e883abd8dcc9936cc30ec1b2d6d51a03c6e",
|
||||
"src\\cbb_refresh_verify\\ui\\backup_notice.py": "1a3fa5ac18a267907faf95f36d61b9f08bcbb939eef4d480dd06af1391a81599",
|
||||
"src\\cbb_refresh_verify\\ui\\backup_recovery_dialog.py": "621ea2efea85367b0c9bb9790040860a1ac001f40f8834289cb67c96ea0648d1",
|
||||
"src\\cbb_refresh_verify\\ui\\icdb_check_task.py": "03e6416ee3d2fa11ecedb624a558516eeb56e634f1f22e41e57e10db6a13d656",
|
||||
"src\\cbb_refresh_verify\\ui\\main_window.py": "4526f59b7f26374ff119d45453b278780a51ef7632eb1611c4e06a205cd30795",
|
||||
"src\\cbb_refresh_verify\\ui\\management_dialog.py": "27d920284e508f19fae71b04a3b3d81a251559d52c4cc8d691c41186686572b7",
|
||||
"src\\cbb_refresh_verify\\ui\\pcb_restore_dialog.py": "b7228d828df235ac51502dc68760d28c4896af02c780e9806e11c32dba7f62da",
|
||||
"src\\cbb_refresh_verify\\ui\\residual_release_dialog.py": "515aaa236ad6a0bee9e5383c6c9d093baeb8bc7dc98f1b978b1197ce672c6764",
|
||||
"src\\cbb_refresh_verify\\ui\\workers.py": "4cc9360a4820ded27a7d5ef709fc9f04b1d4804cb1e7a614f6c357ed547da888",
|
||||
"src\\cbb_refresh_verify\\ui\\__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
},
|
||||
"scope_note": "Candidate icons are local workspace assets and are excluded from this change. Native evidence files and engineering copies remain local.",
|
||||
"pr_integration": {
|
||||
"base_commit": "a56fd17b60d9f67997d7f48c862f3367d4502f84",
|
||||
"python_full_suite": {
|
||||
"name": "pytest",
|
||||
"errors": "0",
|
||||
"failures": "0",
|
||||
"skipped": "0",
|
||||
"tests": "1582",
|
||||
"time": "194.662",
|
||||
"timestamp": "2026-11-05T21:54:33.463053+08:00",
|
||||
"hostname": "Abs"
|
||||
},
|
||||
"compile_check": true,
|
||||
"diff_check": true,
|
||||
"candidate_code_differences": [
|
||||
"src\\cbb_refresh_verify\\mentor_adapter.py"
|
||||
],
|
||||
"difference_scope": "Merge main: defer private desktop allocation into protected cleanup in the two legacy status readers; retain PCB diagnostic/integration behavior.",
|
||||
"both_cleanup_regression_suites_preserved": true,
|
||||
"candidate_rebuilt_after_main_integration": false,
|
||||
"automatic_icdb_repair_acceptance": false,
|
||||
"field_server_session_loss_acceptance": false
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
# PR #10 comment 309
|
||||
|
||||
Release proof now records the requested CBB, effective BLOCK/LIBRARY proof scope, identities/statuses of archived checkpoints and retained owners, and `reconciled_foreign_blockers`. For example, a BlockA operation which safely reconciles BlockB's historical checkpoint explicitly lists BlockB and the full-library proof. `data_recovery_confirmed` remains false. No extra gate, automatic backup or native action was added.
|
||||
|
||||
Three regressions first failed on missing evidence fields. After the fix, 94 backend/lease/release regressions passed; compileall and git diff --check passed. The tests use real temporary file/lease handles with the process-query boundary replaced; no production library was opened. Full regression is run again at the integrated chain tip. Real Mentor/shared-network acceptance and a rebuilt package remain outstanding.
|
||||
|
||||
Review: https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/10#issuecomment-309
|
||||
@@ -1,38 +0,0 @@
|
||||
# PR11 review 345 follow-up
|
||||
|
||||
Repeated CBB verification and ICDB check runs replace the previous result dialog
|
||||
for the same operation. Closing a result retires its Qt widgets and action
|
||||
references, while the check task keeps its requests, results, invalidated targets,
|
||||
and recovery context. A result for the other operation stays available.
|
||||
|
||||
During application shutdown, the title and status show that background work and
|
||||
path release are pending. After approximately 120 seconds a second notice says
|
||||
the application is still waiting. This is a notice interval, not a deadline;
|
||||
shutdown still waits for existing workers and never forces native tools to stop.
|
||||
|
||||
The batch CLI accepts an optional positive `--limit`:
|
||||
|
||||
```powershell
|
||||
python -m cbb_refresh_verify --batch-lmc 'Z:\library\library.lmc' --limit 2
|
||||
```
|
||||
|
||||
The limit selects the first requested names in their existing order. With no
|
||||
`--block`, the existing non-READY selection supplies those names; repeated
|
||||
`--block` options retain their explicit order. Omitting `--limit` retains the
|
||||
existing all-requested behavior. `batch_selection` logs selected, total, and
|
||||
remaining counts. On batch exceptions or unconfirmed native release,
|
||||
`batch_drive_retained` identifies the drive, remote share, display library and
|
||||
Mentor path, and directs the operator to the confirmed-release entry. It never
|
||||
disconnects a mapping while a native writer may still be active.
|
||||
|
||||
Management change counts explicitly cover the compared engineering files only.
|
||||
|
||||
Removed from the standalone PR11 head: all five `if False` blocks for the later
|
||||
release flow, and `_reload_after_maintenance` assignments and its unused reload
|
||||
branch. The hidden release control and existing method signatures remain for
|
||||
the later PR12 implementation. When integrating forward, preserve PR12's live
|
||||
release/resume behavior and retire its dialog-owned action references as well.
|
||||
Preserve PR13's asynchronous close and lease guards when adding the wait notice.
|
||||
|
||||
Validation uses the isolated offscreen review wrapper with fake native boundaries;
|
||||
it does not open Mentor, kill native processes, invoke Repair, or back up a library.
|
||||
@@ -1,13 +0,0 @@
|
||||
# 独立审查 1:只读进程探测与原生任务准入队列
|
||||
|
||||
基于 main `a56fd17`,不叠加 PR #3 的历史提交。
|
||||
|
||||
**行为变化:** 增加有界、版本化、只读 owner-probe helper 和可取消的 FIFO 原生任务队列。应用仅新增隐藏的只读 helper 分派;现有 UI、验证和原生写操作保持原来的入口。
|
||||
|
||||
**失败安全:** 查询超时或协议/身份异常返回未确认;暂停或取消的队列票据不会运行其动作,也不阻止后面的可执行任务。不启动或终止 Mentor 进程。
|
||||
|
||||
**回滚方式:** 尚未合入下游时撤销本提交即可;下游接入后须按依赖从上层向下回退。
|
||||
|
||||
完整回归:491 passed,1 条既有 pywinauto STA 提示。编译和 diff 检查通过。
|
||||
|
||||
与原评论建议的差别:`management_transaction` 直接导入管理模型和库锁;`scoped_manifest` 的协调记录与独占快照依赖库锁协议。这两者在后端审查中一起交付,避免构造导入不完整的“纯工具”基线。
|
||||
@@ -1,20 +0,0 @@
|
||||
# Native backend review unit
|
||||
|
||||
Base: codex/review-infrastructure. This unit integrates ICDB open diagnostics, scoped content manifests, native CBB transactions and the library-release protocol; it does not expose the new UI or residual termination action. Verification and ICDB checks remain separate, READY items are excluded from maintenance, and a released single-item failure can continue independent targets.
|
||||
|
||||
Failure safety: no automatic Repair/version choice, no server termination, no direct LMC edits or native lock-file deletion. Native writes are serialized, uncertain ownership retains evidence and mappings, and unfinished writes are shown without replay.
|
||||
|
||||
Dependency rationale: library release imports native engineering identity and retained management workers; engineering identity imports management source models and scoped manifests. Separating these into nominally independent utilities would leave runtime imports unresolved. This PR therefore keeps the backend dependency closure together; UI and user-confirmed termination remain separate later PRs.
|
||||
|
||||
Rollback: before dependents are merged, revert this commit. After merging dependents, revert in reverse order or use the previous candidate package after closing the current app. Code rollback does not undo a native transaction; use a consistent manual backup or explicitly selected native history on an isolated copy.
|
||||
|
||||
Validation: full Python suite 1,376 passed (one existing pywinauto COM-threading warning); compileall and git diff --check passed. Native field recovery, Windows 10 and cross-machine shared-library acceptance remain pending.
|
||||
|
||||
Review comment 344 follow-up (2026-11-09):
|
||||
|
||||
- Production status scans continue to query fresh bridge results. The low-level session now also defaults to fresh scans; explicit checkpoint reuse is documented as a controlled read-only option with no production resume promise.
|
||||
- `library-changes.json` declares `rule_version`, the selected `scope`, excluded directory categories and suffixes, positional runtime rules, runtime filenames/prefixes, and recognized coordination checkpoints. Names, suffixes, prefixes and native database locations come from the same constants used by semantic classification. These are differences in participating engineering files; excluded content is not proven unchanged, and unrelated CBB content is not checked.
|
||||
- Removed the tests-only `pcb_bridge.execution_outcome` helper. Production release safety continues to come from observed release state and remaining clients.
|
||||
- Unlocked primary snapshots hash the copy stream, then independently hash the final source and destination. Source reads decrease from three to two. Rejected the suggestion to remove/threshold the final source hash: size and mtime cannot detect same-size, same-timestamp source edits. Locked LMC/icdb streams and owned lock snapshots retain their existing behavior; no source-rehash skip flag is added.
|
||||
|
||||
Validation for this follow-up: 287 targeted cases passed through the isolated mutex/PYTHONPATH wrapper (`test_batch_status`, `test_batch_status_faults`, `test_review_backend_followup`, `test_scoped_manifest`, `test_pcb_bridge`, `test_management_retry_blockers`, `test_backup_recovery`, `test_library_lock`, `test_management`). AST parsing, `git diff --check`, and original newline-style checks passed. No real Mentor, COM automation, shared library or process control was exercised; no full-suite run was requested.
|
||||
@@ -1,9 +0,0 @@
|
||||
# Application integration review unit
|
||||
|
||||
Base: codex/review-native-backend. Behavior: verification, ICDB batch checking and CBB management have separate tabs; background checks yield between items, keep browsing responsive and let other native tasks queue. READY targets are excluded at execution, status refresh is scoped, and manual version/copy decisions remain explicit.
|
||||
|
||||
Failure safety: a released item failure can continue independent targets; uncertain native ownership retains evidence and mappings. There is no residual-session release backend in this review stage: its button and result actions are hidden, and its callback is inert. The next PR restores the complete release entry together with its tested backend, rather than exposing a button with a missing import. No automatic Repair or native version selection is added.
|
||||
|
||||
Rollback: revert this UI commit before its dependent release PR; after dependents, revert in reverse order or close the current program and use the prior candidate. This does not roll back library writes.
|
||||
|
||||
Validation: 1,545 passed (one existing pywinauto COM-threading warning), compileall and diff checks passed. Release-specific tests are introduced in the dependent PR, never discarded from the final tree. Windows 10, real shared-library concurrency and field ICDB recovery remain pending.
|
||||
@@ -1,9 +0,0 @@
|
||||
# 评论 275:占用复核与变更报告
|
||||
|
||||
校验和管理共用历史释放记录复核:旧 JSON/内存租约触发实际进程、地址、独占文件和导出副本证明,不直接视为真实占用,不结束进程或执行 Repair。确认释放后归档旧记录并继续;失败且本项尚未启动时保留原记录,结果不会把本项标成未释放。校验结果兼容新增 release_proof,管理首次原生调用前保存释放经过;进程释放不等于历史数据已恢复。
|
||||
|
||||
写后仅对原先的目标 Work/Cert、中心库配置和共享依赖范围生成 SHA-256 差分,报告新增、删除、修改路径,并保存写后清单。范围沿用原有 ManifestScope.library,不增加整库备份或其他 CBB 内容哈希,不声称已证明所有其他 CBB 未被波及。已释放的部分失败也保留差分;仍有原生所有者时不为报告读取数据库。报告失败单独标为 UNCONFIRMED 并返回原因,不伪造未完成事务、不制造永久占用。
|
||||
|
||||
PASS 不再重复计入 unconfirmed。未改变实际原生写操作、人工备份政策或服务器保护,也没有恢复自动修复。
|
||||
|
||||
回归覆盖历史记录无占用/真实地址占用、首次原生调用前留证、目标及共享依赖差分、失败后差分、报告保存失败后可继续。完整回归和限制以最终验证记录及 PR 描述为准;真实 Mentor、Win10、跨机器共享库尚未因此取得新验收结论。
|
||||
@@ -1,7 +0,0 @@
|
||||
# 评论 275/283:结果口径接入
|
||||
|
||||
管理进度显示历史占用复核;结果分别呈现已确认的原生动作、变更清单完整性和历史会话释放事实。单项 RECOVERY_REQUIRED 但 safe_to_continue=True 时,不再声称整个队列停止;记录失败不伪装成原生上传/移除失败。
|
||||
|
||||
独立操作回归更新为实际历史记录归档流程:先证明当前占用已释放、保留归档字节,再进行普通验证;不自动 Repair,失败后不遗留新的占用锁。
|
||||
|
||||
本阶段相关 UI/独立操作/后端回归 29 passed。后端完整回归与最终集成回归另见验证记录。没有执行真实 Mentor 写操作;回退按依赖逆序,不代表恢复原生事务。
|
||||
@@ -1,7 +1,5 @@
|
||||
# CBB Batch Status Bridge Implementation Plan
|
||||
|
||||
Current behavior (2026-11-09): production status scans always query the bridge fresh and overwrite checkpoint evidence. `BatchStatusSession.scan` defaults to `resume=False`; `resume=True` remains an explicit low-level option for controlled read-only scans, not an exposed production resume feature. Its lightweight fingerprint cannot detect every native payload/database write, so saved READY/PENDING rows must not authorize production actions.
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Read 180 to 3000 CBB Verify states through one resilient x86 Mentor bridge session with checkpoint recovery and authoritative `READY/PENDING` results.
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
# Issue #2 implementation plan
|
||||
|
||||
Approved by user on 2026-11-02. Continue branch codex/temp-issue-2-icdb-recovery,
|
||||
baseline ec78dd7 (491 tests). Do not merge, publish or close the issue. Preserve
|
||||
untracked review.diff. Python 3.12, PySide6, Mentor EE7.9.5, private desktop by
|
||||
default. No force termination of native database owners, deleting locks,
|
||||
guessing native write interfaces, or editing LMC binary contents.
|
||||
|
||||
Each task uses regression tests, focused validation and a separate commit.
|
||||
Real field lost-session reproduction and Windows 10 validation must be reported
|
||||
as unverified when unavailable; header corruption is not a substitute.
|
||||
|
||||
## Task 1: ICDB failure lifecycle and repair outcomes
|
||||
|
||||
Extend the existing owned-empty-PCB close path to wait for its launcher as well.
|
||||
Cover COM connected without a document, delayed dialogs/addresses/process exit.
|
||||
Native Repair must report missing healthy backup, native repair failure, database
|
||||
busy, unknown dialogs and timeout/unreleased distinctly using this run's native
|
||||
logs and Output. Safely close an idle, conclusively failed native repair tool;
|
||||
never act on unrecognized prompts or active native operations.
|
||||
Preserve original error, original evidence and all repair evidence. Record release
|
||||
state. Repair success in summaries means original native repair succeeded AND
|
||||
same-project reopening, verification and authoritative GREEN succeeded. Historical
|
||||
backup restoration remains RESTORED_REVIEW_REQUIRED. A conclusively failed repair
|
||||
may continue independent CBB items only if all relevant processes and addresses
|
||||
are released and scope is project-local; shared-library/unknown ownership stops.
|
||||
Add sanitized replay of issue2 lost-session/open-failure events with asserted target,
|
||||
stage and invocation order; one automatic repair maximum, no repeated PCB loop.
|
||||
Maintain VerifyRequest/VerifyResult compatibility. Files primarily failed_session,
|
||||
pcb_bridge, mentor_adapter, native_repair[_ui], verify_runner, icdb_maintenance and
|
||||
their tests. Update release evidence. No native live operations without coordinator
|
||||
agreement (only one native operation at a time). Coordinator builds candidate and
|
||||
runs frozen tests after review. Field fault sample is not in the attachment (logs
|
||||
only); do not claim field recovery.
|
||||
|
||||
## Task 2: Search, filtering, selection and non-READY maintenance
|
||||
|
||||
Implement local name/partition keyword search and filters: all, READY, non-READY,
|
||||
PENDING, unknown/read errors, missing project. Non-READY includes unconfirmed states
|
||||
without calling them corrupt. Show visible/READY/error counts; no Mentor rereads on
|
||||
filtering. Management selection permits READY; verify/maintenance/default backup
|
||||
recovery exclude READY. Operations target current visible checked rows; hiding a row
|
||||
clears its checkbox. Provide select visible/clear selection. Maintenance entry,
|
||||
confirmation, progress and report agree on non-READY target set. Existing verify-all
|
||||
means visible eligible rows, maintenance defaults visible eligible rows with checked
|
||||
subset if any. Refresh affected authoritative statuses after operations, retain search
|
||||
and filter. No premature integration of CRUD; expose selected records for Task4.
|
||||
Maintain CbbRecord compatibility and explicit status separate from action result.
|
||||
Tests include mixed READY/PENDING/errors/missing, filtering after state transitions,
|
||||
selection scope and 381/3000 row responsiveness. Files UI main_window, small focused
|
||||
filter helper if useful, backup dialog and maintenance report + tests. Avoid unrelated
|
||||
UI overhaul. Commit and report focused tests plus full suite once.
|
||||
|
||||
## Task 3: Scoped primary-file hashes and verified backups
|
||||
|
||||
Copy and retain complete backup trees. Restrict SHA256 and semantic before/after
|
||||
comparison to primary project/design/database/constraint files and required library
|
||||
dependencies: PRJ/PCB/DXP, icdb.dat, Layout, schematic/logic/symbol assets, CES/config,
|
||||
target LMC and shared database dependencies. Explicitly exclude runtime logs/temp/
|
||||
locks/address records, historical backups, PDF/generated output from content hashes;
|
||||
address files still participate in idle checks. Treat unclassified engineering data
|
||||
conservatively as primary rather than accidentally excluding it. For central-library
|
||||
manifest, only target CBB Work/Cert plus active library configuration/shared library
|
||||
dependency trees; do not hash unrelated CBB projects.
|
||||
During copy validate tree membership and file size/mtime before/after; primary files
|
||||
also source/destination SHA256, including locked database stream bytes. Logs changing
|
||||
after successful snapshot must not invalidate subsequent semantic comparison, while
|
||||
primary changes/additions/deletions must block install. Manifest is versioned and
|
||||
contains relative paths, size, hash and scope; progress gives hashed files/bytes/stage.
|
||||
Keep existing validate-copy -> target conflict check -> retain Work -> install ->
|
||||
reopen verification. Preserve old backups and evidence on failure. Add tests for logs
|
||||
only, all primary categories, changed/deleted sources, target concurrency, copied byte
|
||||
corruption and preserved recovery copies. Files backup_recovery and new focused
|
||||
manifest helper + tests. Reuse helper in management Task4 without changing old public
|
||||
Verify contracts. Document explicit rules/compatibility, commit after tests.
|
||||
|
||||
## Task 4: Native CBB management and delivery
|
||||
|
||||
Integrate add, same-name update, remove in current application. Input complete PRJ/PCB
|
||||
projects, no Packager/PDF/part replacement/rename/partition move. Add conflicts never
|
||||
overwrite. Update matches existing name/partition and backs up complete old project
|
||||
and library recovery snapshot. Remove backs up then uses verified Mentor native
|
||||
operation; reread confirms absence. Never fake removal by deleting directories.
|
||||
Add/update reread identity, default auto-verify optional per batch, distinguish upload
|
||||
failed, uploaded-but-verification-failed, uploaded-and-verified. Preserve source files.
|
||||
Use isolated native adapter: capability detection by installed version/interface plus
|
||||
isolated validation. Prefer proven COM/command; verified private desktop controls only
|
||||
fallback, never foreground input. Unsupported operations disabled with exact reason.
|
||||
Use cbb-upload-795 as research only, no external runtime dependency. Native API research
|
||||
comes from coordinator. No fabricated operation parameters. Snapshot/readback result
|
||||
must correspond to actual library entry and source engineering identity.
|
||||
Requests/results contain operation, library, CBB, partition, source, auto_verify,
|
||||
stage/status, safe_to_continue and evidence path. Serialize all writes with existing
|
||||
verification mutex and a library-level lock compatible with original uploader; apply
|
||||
coordination to verify/recovery too. Stop when native release uncertain. Persist item
|
||||
checkpoints and show unfinished tasks on restart, never replay automatically.
|
||||
Provide safe preview/confirmation for destructive operations; backups outside target.
|
||||
Test isolated add/conflict/update/remove/reimport, cancellation, timeout/network errors,
|
||||
partial successes, no-op/lying native response, busy library, restart checkpoints.
|
||||
Implement capabilities conservatively: if actual native operation cannot be proven,
|
||||
its UI remains disabled with actionable explanation and validation gap is explicit.
|
||||
Full Python/compile/diff checks, candidate frozen smoke, Windows11 native scenario;
|
||||
Windows10 and real field sample explicitly unverified if inaccessible. Coordinator
|
||||
provides final review and source/frozen deliverables without merging/publishing.
|
||||
@@ -0,0 +1,12 @@
|
||||
# 无地址 ICDB 维护与 PCB 版本选择
|
||||
|
||||
用户要求按已确认的入口分析修复,并明确允许需要时弹窗让用户选择。沿用临时分支,不恢复应用自动备份,不改原库。
|
||||
|
||||
- [x] 无地址记录的明确维护也进入原生 Repair;仅允许唯一数据库与 PCB/PRJ 反向引用绑定,保留全库独占检查。新增回归先失败,集中 250 项通过,独立审查通过。
|
||||
- [x] 实际应用按钮在无地址 IP101GR 副本完成原生 Repair,随后需要 PCB 版本选择;沿用用户此前确认的手动保存版本,诊断续接已保存关闭并读取 READY。人工续接不算完整自动链路验收。
|
||||
- [x] 在主应用显示候选时间和手动保存/自动保存/取消按钮。没有 UI 选择入口的调用保持待选择,不自动选版本;每个原生窗口只问一次,等待期间继续观察会话。
|
||||
- [x] 原生动作仍由私有桌面代理执行,核对修复证明、进程、窗口和候选版本;先选择单选项并复读,再确认 OK;取消或窗口变化不确认恢复。
|
||||
- [x] 用户选择后沿原校验链路继续,原生保存提示仍由已有监督器处理。最终 READY 保持原有门槛;使用历史 PCB 版本记录“已恢复,版本待核对”,不标记无损修复。
|
||||
- [x] 测试 UI 取消、手动/自动选择、选择失效、重复弹窗、错 PID/桌面、原生失败和 READY 区分;独立审查、全量回归、冻结实际按钮验证并交付候选。1135 项通过;de952a6 冻结实际按钮达到 PASS/GREEN/READY,历史版本仍标记待核对。
|
||||
|
||||
采用独立版本选择控制器与 Qt 对话框,复用原生代理及现有进度信号;不引入前台鼠标或自动重导入。界面只要求选择已有候选版本,不替用户推断应采用哪个版本。
|
||||
@@ -0,0 +1,36 @@
|
||||
# Manual Backup Implementation Plan
|
||||
|
||||
**Goal:** 按用户最新要求取消应用操作前的自动备份,改为提示手动备份,减少整库复制和重复哈希耗时。
|
||||
|
||||
**Architecture:** 管理操作使用只读内容基线、暂存来源、原生身份核对和现有库锁。备份责任转为用户;应用不验证或声称手动备份已存在。恢复操作只创建用于隔离校验的库副本,不再额外复制完整回退库。原生 Repair 自身备份保持原生行为。
|
||||
|
||||
**Tech Stack:** Python 3.12 / PySide6 / Mentor EE7.9.5。
|
||||
|
||||
用户已明确指定取消自动备份并提示手动备份,本计划直接执行。沿用临时分支,不合并发布、不修改原用户库。保留既有 `review.diff`。
|
||||
|
||||
## 范围与检查结果
|
||||
|
||||
| 操作 | 旧行为 | 新行为 |
|
||||
| --- | --- | --- |
|
||||
| 新增、替换、移除 | 每项完整中心库备份 | 手动备份提示;只读基线、检查点及来源暂存 |
|
||||
| 普通校验 | 本地 CBB 辅助备份,网络跳过 | 所有路径统一取消应用辅助备份 |
|
||||
| ICDB Repair | 应用完整工程备份,加原生自身备份 | 取消应用复制,保留独占读取/身份检查及原生自身行为 |
|
||||
| 从备份恢复 | 整库回退备份再复制验证库;额外来源副本 | 直接复制一次隔离验证库,来源直接暂存到验证工程 |
|
||||
| 读取/搜索/筛选 | 无备份 | 保持只读 |
|
||||
|
||||
验证工程副本和来源暂存是任务输入,不能删除后直接改原始来源。恢复安装中的旧 Work 改名保留是目录交换保护,不复制数据,继续保留。历史证据与备份不清理。独立研究工具的显式备份不属于桌面自动操作。
|
||||
|
||||
## Tasks
|
||||
|
||||
- [ ] 管理:先增加不复制整库及基线变化阻止写入的回归;移除事务授权对备份目录的依赖,绑定基线清单,保留身份、监督进程、活跃库锁和检查点验证;更新对应测试。
|
||||
- [ ] 校验/Repair/恢复:先写不调用自动备份、保持独占检查及单一验证库副本的回归;改调用路径和进度说明,测试取消/占用/来源及目标变化继续阻止操作。
|
||||
- [ ] 界面:将手动备份提示加入管理、校验、维护、恢复执行确认;取消不启动任务,每批一次,不伪称备份已完成。移除自动备份承诺。
|
||||
- [ ] 验证:集中测试、全量 Python 测试、编译与 diff 检查、独立代码审查;隔离原生移除验证不创建整库备份;新冻结包验证提示和取消反馈。更新验证记录,提交并构建候选。
|
||||
|
||||
## Review Focus
|
||||
|
||||
- 没有备份目录仍能通过真实管理事务校验;错库、过期锁、来源变化、基线记录篡改仍拒绝。
|
||||
- 替换移除成功但新增失败必须保留部分失败检查点,明确使用用户手动备份恢复。
|
||||
- 删除备份调用不能同时删掉数据库独占和取消检查。
|
||||
- 恢复仍隔离验证,并保留来源/目标变更检查与失败安装回退。
|
||||
- UI 取消确认无写入;逐项自动校验不重复弹窗;没有目标时不弹无意义提示。
|
||||
@@ -0,0 +1,32 @@
|
||||
# 原生 CBB 管理接入续作
|
||||
|
||||
沿用用户已批准的工单 #2 管理范围与临时分支。此次用户要求找到并尝试接入库的增删改查原生接口。
|
||||
不直接修改 LMC 二进制,不采用前台鼠标,不强制结束持有数据库的原生进程;原用户库不参与写入试验。
|
||||
|
||||
## 已确认接口
|
||||
|
||||
- 查询:LibraryManager.Application.OpenLibrary → Partitions(7) → 名称、分区,核对库身份并正常退出。
|
||||
- 新增:OnReusableBlocksEditor → 原生 Logical-Physical 页签 → New → 源 PRJ、名称、顶层块,提交原生对话框。字段使用有时限的窗口消息复读,提交后确认成功消息,再关闭重开目录。
|
||||
- 移除:安装脚本确认的 CleanWGLib/F4/REUSE_BLOCK,必须完整备份且重新读库确认缺失。
|
||||
- 同名替换:复用经过验证的移除与新增;它不是原子更新,删除后导入失败时保留恢复检查点并停止队列。与仅替换 Work 的“从备份恢复”明确区分。
|
||||
|
||||
## 接入步骤
|
||||
|
||||
1. 共享原生新增适配层,保留私有桌面、二进制版本、同库租约、监督进程、来源暂存及完整备份的验证。生产能力未通过时只有带隔离库所有权证据的研究入口可写。
|
||||
2. 原生 ICDB 导入会重写存储。用安装版本锁定的 ASCII、CSV 和 EDIF 原理图导出建立内容指纹,并保留布局及其他工程资产的字节哈希。不能把注册成功或名称相同等同于工程内容一致。
|
||||
3. 导出仅使用新建的完整工程副本。严格确认退出、有效输出与原生完成标记;仅规范化已经实际证明会变化的报告时间/路径字段。布局、坐标、连接、属性及未知工程文件变化一律阻止接受。
|
||||
4. 新增后原生程序可能未正确重定位 PCB 配置的 CentralLibrary。仅在本任务注册成功、原生释放和租约持有时修正该已导入工程的库引用,再重新打开核对目录与内容。原始输入工程不改动。
|
||||
5. 在实际新建隔离库运行新增、同名冲突、不同版本同名替换、备份后移除、从备份重新导入;逐项保存证据,验证源文件未变。随后才提升对应生产能力。
|
||||
6. 运行相关回归、独立审查、全量测试与冻结包实际管理入口验证。缺少原生证据的能力继续禁用并准确说明原因。
|
||||
|
||||
## 已完成的内容指纹取证
|
||||
|
||||
`diagnostics/issue2-native-crud-20261103/` 保存真实导出对照:
|
||||
|
||||
- ASCII:层次与展开连接、组件、端口和属性,3,531 行;只差生成时间和数据库目录三行报告元数据。
|
||||
- CSV:14 个表格文件;只差信息表的 System_Date 字段。
|
||||
- EDIF `-schematic`:约 580 KB,包含坐标、图形、连线、旋转、文本位置及属性;只差根级 status/written/timestamp。
|
||||
- 139 个主要工程资产一致;其余变化为 ICDB 数据文件、其运行时记录及两处 PCB CentralLibrary 引用。
|
||||
|
||||
以上为已验证格式的内容身份合同,不声称任意未知版本、任意外部工具私有元数据都可无差别转换。
|
||||
导出格式、安装版本、必需文件或引用不符合时拒绝操作。
|
||||
@@ -1,25 +0,0 @@
|
||||
# Latest reviews for PR #10/#11/#12
|
||||
|
||||
Scope: user selected only the 2026-11-09 comments #309/#310/#313. Earlier deep-review backlog stays out of scope. Preserve ICDB automatic Repair OFF, serial writes, current icon and independent-library admission. No merge to main, issue closure or release.
|
||||
|
||||
## PR #10
|
||||
|
||||
- [ ] Reproduce BlockA releasing historical BlockB checkpoints and retained owners without naming BlockB in proof.
|
||||
- [ ] Record requested block, actual proof scope, checkpoint identities and foreign names in existing release proof. Preserve original checkpoint bytes and data_recovery_confirmed=False; no new blocking gate.
|
||||
- [ ] Run backend/lease regressions, compile/diff checks, commit on codex/review-native-backend.
|
||||
|
||||
## PR #11/#12
|
||||
|
||||
- [ ] Forward-merge backend into UI, then UI into residual branch; no history rewriting.
|
||||
- [ ] Test one unreadable process/thread not affecting another, without fabricated modal windows; cover preview and action-time rechecks.
|
||||
- [ ] Enumerate only target-process threads/windows, store incomplete-read metadata per PID. Keep unknown/active writers protected rather than adding a blind force override.
|
||||
- [ ] Persist window identities and at most a 4 KiB output excerpt, preserve full preview in memory, stop duplicating activity output.
|
||||
- [ ] Carry exact preview block scope into native Cancel and recheck identity/scope before clicking.
|
||||
- [ ] Run residual/UI regressions, compile/diff checks, commit on residual branch.
|
||||
|
||||
## Chain tip
|
||||
|
||||
- [ ] Merge residual fixes into PR #13, preserving ca39fb3 and icon.
|
||||
- [ ] Address #11's line-ending note once at the tip: application.py to LF; pin it and main_window.py in EditorConfig. Preserve all other file endings and the global * -text rule.
|
||||
- [ ] Independent review, integrated full suite, compile/diff checks, validation records and fast-forward pushes to existing PR branches.
|
||||
- [ ] Update PR descriptions with precise results and no new package/native acceptance. Leave #3 as historical umbrella, without merging or closing it.
|
||||
@@ -1,7 +1,5 @@
|
||||
# CBB 批量状态桥设计
|
||||
|
||||
Current behavior (2026-11-09): production status scans always query the bridge fresh and overwrite checkpoint evidence. `BatchStatusSession.scan` defaults to `resume=False`; `resume=True` remains an explicit low-level option for controlled read-only scans, not an exposed production resume feature. Its lightweight fingerprint cannot detect every native payload/database write, so saved READY/PENDING rows must not authorize production actions.
|
||||
|
||||
## 目标
|
||||
|
||||
支持对 180 到 3000 个 CBB 进行 Mentor authoritative Verify 状态读取,要求单条失败隔离、过程可恢复、结果可审计,并避免现有“一条 CBB 启动一个桥进程”的启动开销。
|
||||
|
||||
@@ -46,16 +46,6 @@ def resolve_data_root(cli_value: Path | None) -> Path:
|
||||
local = os.environ.get("LOCALAPPDATA")
|
||||
return (Path(local) / "CbbRefreshVerify" if local else Path.home() / "AppData" / "Local" / "CbbRefreshVerify").resolve()
|
||||
|
||||
def _positive_int(value):
|
||||
try:
|
||||
number = int(value)
|
||||
except ValueError:
|
||||
raise argparse.ArgumentTypeError('must be a positive integer') from None
|
||||
if number <= 0:
|
||||
raise argparse.ArgumentTypeError('must be a positive integer')
|
||||
return number
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(prog="CbbRefreshVerify")
|
||||
parser.add_argument('--verify-worker', type=Path, help=argparse.SUPPRESS)
|
||||
@@ -67,7 +57,6 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
parser.add_argument('--collect-failure-logs', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--batch-lmc', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--block', action='append', default=[], help=argparse.SUPPRESS)
|
||||
parser.add_argument('--limit', type=_positive_int, help='Maximum requested CBB names for --batch-lmc (default: all)')
|
||||
parser.add_argument('--libspec', default='', help=argparse.SUPPRESS)
|
||||
parser.add_argument('--dms-login-config', default='', help=argparse.SUPPRESS)
|
||||
parser.add_argument('--mentor-bin', default='', help=argparse.SUPPRESS)
|
||||
@@ -121,11 +110,6 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
if library.error: raise RuntimeError(library.error)
|
||||
names = [record.name for record in library.records if record.status != 'READY']
|
||||
if not names: raise RuntimeError('中心库未读取到需要校验的 CBB')
|
||||
total = len(names)
|
||||
if args.limit is not None:
|
||||
names = names[:args.limit]
|
||||
logger.info('batch_selection selected=%s total=%s remaining=%s limit=%s',
|
||||
len(names), total, total - len(names), args.limit or 'all')
|
||||
requests = [VerifyRequest(mentor_path, name, context.root/'evidence',
|
||||
libspec=args.libspec, dms_login_config=args.dms_login_config,
|
||||
mentor_bin=args.mentor_bin, logging_context=context,
|
||||
@@ -133,21 +117,13 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
mapped_remote_root=lease.remote_root,
|
||||
native_lm_verify=native_lm_verify_enabled())
|
||||
for name in names]
|
||||
def retain_mapping(reason):
|
||||
lease.retain_for_recovery()
|
||||
logger.warning(
|
||||
'batch_drive_retained drive=%s remote=%s display=%s mentor=%s reason=%s '
|
||||
'guidance=请打开此中心库的“释放残留会话…”入口,确认原生会话安全释放后再释放映射;'
|
||||
'原生写入仍可能运行时请保留映射。',
|
||||
lease.drive or '-', lease.remote_root or '-', lease.display_path,
|
||||
mentor_path, reason)
|
||||
try:
|
||||
results = run_batch(requests)
|
||||
except Exception:
|
||||
retain_mapping('batch_exception')
|
||||
lease.retain_for_recovery()
|
||||
raise
|
||||
if any(not result.safe_to_continue for result in results):
|
||||
retain_mapping('native_release_unconfirmed')
|
||||
lease.retain_for_recovery()
|
||||
report = write_batch_report(requests, results, context.root/'reports')
|
||||
logger.info('batch_report path=%s', report)
|
||||
logger.info('failure_report path=%s', failure_report_path(report))
|
||||
|
||||
@@ -107,7 +107,7 @@ def fingerprint_library(lmc: Path) -> LmcFingerprint:
|
||||
# Metadata alone is not a safe checkpoint key: on network shares and on
|
||||
# file systems with coarse timestamp resolution, two different LMC
|
||||
# contents can have the same size and mtime. Include the actual file
|
||||
# digest to invalidate changed LMC bytes; payload edits remain outside this key.
|
||||
# digest so a changed central library can never reuse an old status row.
|
||||
content_sha256 = _sha256_file(path)
|
||||
combined = hashlib.sha256()
|
||||
combined.update(str(path).casefold().encode('utf-8', errors='surrogatepass'))
|
||||
@@ -186,12 +186,7 @@ def _now() -> str:
|
||||
|
||||
|
||||
class BatchStatusSession:
|
||||
"""Supervised serial bridge session; fresh status queries by default.
|
||||
|
||||
Checkpoints record scan evidence. Explicit ``resume=True`` is a low-level
|
||||
opt-in for controlled read-only scans, not a production freshness proof:
|
||||
the lightweight fingerprint does not cover native payload/database edits.
|
||||
"""
|
||||
"""Supervised serial bridge session with checkpoint recovery."""
|
||||
|
||||
def __init__(self, bridge: StatusBridgeClient, *, timeout_seconds: float = 10.0,
|
||||
rotate_every: int = 500) -> None:
|
||||
@@ -201,7 +196,7 @@ class BatchStatusSession:
|
||||
self.restart_count = 0
|
||||
|
||||
def scan(self, names: Iterable[str], lmc_file: Path, checkpoint_path: Path,
|
||||
*, block_type: str = "RULP", resume: bool = False) -> list[BatchStatusRecord]:
|
||||
*, block_type: str = "RULP", resume: bool = True) -> list[BatchStatusRecord]:
|
||||
fingerprint = fingerprint_library(Path(lmc_file))
|
||||
if resume:
|
||||
checkpoint = BatchCheckpoint.load(checkpoint_path)
|
||||
@@ -296,8 +291,6 @@ def authoritative_status_map(names: Iterable[str], lmc_file: Path, checkpoint_pa
|
||||
timeout_seconds: float = 10.0) -> dict[str, str]:
|
||||
"""Return only bridge-backed statuses for an optional UI integration.
|
||||
|
||||
Production always queries fresh statuses, including after native writes;
|
||||
saved READY/PENDING rows are never reused here.
|
||||
A missing bridge is represented as ``UNAVAILABLE``/``UNKNOWN`` by callers;
|
||||
it is never promoted to ``READY``.
|
||||
"""
|
||||
|
||||
@@ -21,7 +21,7 @@ def maintenance_counts(results):
|
||||
'checked_without_repair': sum(r.status == 'CHECKED' for r in results),
|
||||
'issues_found': sum(r.error_category == 'ICDB_REPAIR_REQUIRED' for r in results),
|
||||
'in_use': sum(r.error_category == 'ICDB_DATABASE_IN_USE' for r in results),
|
||||
'unconfirmed': sum(r.status not in ('PASS', 'CHECKED', 'SKIPPED', 'CANCELLED')
|
||||
'unconfirmed': sum(r.status not in ('CHECKED', 'SKIPPED', 'CANCELLED')
|
||||
and r.error_category not in ('ICDB_REPAIR_REQUIRED', 'ICDB_DATABASE_IN_USE') for r in results),
|
||||
'cancelled': sum(r.status == 'CANCELLED' for r in results),
|
||||
'skipped': sum(r.status == 'SKIPPED' for r in results),
|
||||
|
||||
@@ -82,28 +82,6 @@ def has_retained_library(library):
|
||||
return bool(owner and owner['retained'])
|
||||
|
||||
|
||||
def recheck_previous_release(library, evidence_dir, *, block_name=None, required=False, progress=None):
|
||||
"""Historical records trigger fresh proof, never process termination or repair."""
|
||||
if not (required or has_blocker(library) or has_retained_library(library)):
|
||||
return None
|
||||
def notify(stage, **details):
|
||||
if progress is not None:
|
||||
try:
|
||||
progress({'stage': stage, 'block': block_name or '', **details})
|
||||
except Exception:
|
||||
import logging
|
||||
logging.getLogger(__name__).warning('Release progress observer failed', exc_info=True)
|
||||
notify('previous_release_check', detail='正在复核历史记录对应的实际占用')
|
||||
try:
|
||||
proof = release_retained_library(library, evidence_dir, block_name=block_name)
|
||||
except Exception as error:
|
||||
notify('previous_release_unconfirmed', detail=str(error))
|
||||
raise
|
||||
notify('previous_release_confirmed', release_proof=proof,
|
||||
detail='已确认会话释放并归档历史记录;这不表示历史数据已恢复')
|
||||
return proof
|
||||
|
||||
|
||||
def _persist_blocker(library, status='OWNER_RELEASE_UNCONFIRMED', *, lease_id, block_name=None):
|
||||
import win32api, win32process
|
||||
path = blocker_path(library)
|
||||
@@ -521,7 +499,7 @@ def _prove_library_released(library, block_name=None, *, allow_unknown_checkpoin
|
||||
|
||||
|
||||
def release_retained_library(library, evidence_dir, *, block_name=None):
|
||||
"""Reconcile historical leases after fresh owner/address/access proof.
|
||||
"""Explicit user-requested release, after fresh owner/address/access proof.
|
||||
|
||||
The upload sidecar is never deleted. This acknowledges process release,
|
||||
not the correctness of a partially changed library or its recovery state.
|
||||
@@ -559,16 +537,6 @@ def release_retained_library(library, evidence_dir, *, block_name=None):
|
||||
records = [checkpoint_record(path) for path, data in before.items() if data is not None]
|
||||
scoped = (block_name if block_name and all(record and record.get('block_name') == block_name
|
||||
for record in records) and (owner is None or owner.get('block_name') == block_name) else None)
|
||||
reconciled = [{'kind': 'checkpoint', 'path': str(path), 'recognized': metadata is not None,
|
||||
**{key: (metadata or {}).get(key) for key in ('block_name', 'lease_id', 'pid', 'status', 'time')}}
|
||||
for path, data in before.items() if data is not None
|
||||
for metadata in (checkpoint_record(path),)]
|
||||
if owner:
|
||||
reconciled.append({'kind': 'retained_owner', 'path': str(lease.path),
|
||||
'block_name': owner.get('block_name'), 'lease_id': owner['lease_id'],
|
||||
'status': 'OWNER_RELEASE_UNCONFIRMED'})
|
||||
foreign = sorted({item['block_name'] for item in reconciled
|
||||
if block_name and item.get('block_name') and item['block_name'] != block_name})
|
||||
proof_context = (_prove_library_released(library, allow_unknown_checkpoint=True) if unknown else
|
||||
_prove_library_released(library, block_name=scoped)
|
||||
if scoped else _prove_library_released(library))
|
||||
@@ -580,9 +548,6 @@ def release_retained_library(library, evidence_dir, *, block_name=None):
|
||||
root = evidence/('release-' + uuid4().hex)
|
||||
root.mkdir(parents=True, exist_ok=False)
|
||||
record = {'library': str(library), 'status': 'RELEASE_CONFIRMED', **proof,
|
||||
'requested_block_name': block_name, 'proof_scope': 'BLOCK' if scoped else 'LIBRARY',
|
||||
'proof_block_name': scoped, 'reconciled_checkpoints': reconciled,
|
||||
'reconciled_foreign_blockers': foreign,
|
||||
'unknown_checkpoint_archived': unknown,
|
||||
'data_recovery_confirmed': False, 'evidence_path': str(root/'release.json')}
|
||||
(root/'release.json').write_text(json.dumps(record, ensure_ascii=False, indent=2), encoding='utf-8')
|
||||
|
||||
@@ -8,7 +8,7 @@ from uuid import uuid4
|
||||
|
||||
from .library_lock import LibraryLock, LibraryBusy
|
||||
from .scoped_manifest import (ManifestScope, build_manifest, build_exclusive_library_manifest,
|
||||
comparison_rules, copy_verified, hash_file, scan_tree)
|
||||
copy_verified, hash_file, scan_tree)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -73,7 +73,6 @@ class ManagementResult:
|
||||
detail: str = ''
|
||||
evidence_path: Path | None = None
|
||||
release_proof: dict | None = None
|
||||
change_report: dict | None = None
|
||||
|
||||
|
||||
def validate_name(value):
|
||||
@@ -187,8 +186,6 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
mutex = None
|
||||
acquired = False
|
||||
release_proof = None
|
||||
original = None
|
||||
change_report = None
|
||||
def invoke(callback, *args):
|
||||
nonlocal owner_safe
|
||||
owner_safe = False
|
||||
@@ -209,33 +206,8 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
if progress:
|
||||
progress({'stage': stage, 'block': request.name, 'operation': request.operation, **details})
|
||||
def finish(status, detail='', safe=True):
|
||||
nonlocal change_report
|
||||
if mutated and original is not None and change_report is None:
|
||||
change_report = {'status': 'UNCONFIRMED', 'scope': original['scope'],
|
||||
**comparison_rules(scope),
|
||||
'unrelated_cbb_content_checked': False,
|
||||
'detail': '原生会话尚未释放,未读取写后内容'}
|
||||
if safe:
|
||||
try:
|
||||
after = build_exclusive_library_manifest(library_root, scope=scope, progress=progress)
|
||||
_write_json(root/'library-after-manifest.json', after)
|
||||
before_files, after_files = original['files'], after['files']
|
||||
change_report.update(status='RECORDED', detail='目标工程及共享依赖的内容差分',
|
||||
added=sorted(after_files.keys()-before_files.keys()),
|
||||
deleted=sorted(before_files.keys()-after_files.keys()),
|
||||
modified=sorted(path for path in before_files.keys() & after_files.keys()
|
||||
if before_files[path] != after_files[path]))
|
||||
except Exception as error:
|
||||
change_report['detail'] = f'写后内容未确认:{error}'
|
||||
try:
|
||||
_write_json(root/'library-changes.json', change_report)
|
||||
except OSError as error:
|
||||
change_report.update(status='UNCONFIRMED', evidence_error=str(error),
|
||||
detail=f'变更记录保存失败:{error}')
|
||||
if change_report['status'] != 'RECORDED':
|
||||
detail = (detail+'\n'+change_report['detail']).strip()
|
||||
result = ManagementResult(request.operation, request.library, request.name, request.partition,
|
||||
request.source, request.auto_verify, 'complete', status, safe, detail, report, release_proof, change_report)
|
||||
request.source, request.auto_verify, 'complete', status, safe, detail, report, release_proof)
|
||||
if report:
|
||||
try:
|
||||
_write_json(report, {**asdict(result), 'history': history, 'backup_policy': 'manual'})
|
||||
@@ -284,12 +256,10 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
acquired = win32event.WaitForSingleObject(mutex, 0) in (win32con.WAIT_OBJECT_0, win32con.WAIT_ABANDONED)
|
||||
if not acquired:
|
||||
return finish('BLOCKED', '已有 CBB 校验/管理/恢复任务运行;本次未启动。')
|
||||
from .library_lock import recheck_previous_release
|
||||
release_proof = recheck_previous_release(library, root/'previous-release', block_name=request.name,
|
||||
required=request.check_previous_release or bool(unfinished_target
|
||||
and unfinished_target.get('safe_to_continue') is not True), progress=progress)
|
||||
if release_proof is not None:
|
||||
checkpoint('release_check', release_proof=release_proof)
|
||||
from .library_lock import has_blocker, has_retained_library, release_retained_library
|
||||
if (has_blocker(library) or has_retained_library(library) or request.check_previous_release
|
||||
or unfinished_target and unfinished_target.get('safe_to_continue') is not True):
|
||||
release_proof = release_retained_library(library, root/'previous-release')
|
||||
if unfinished_target:
|
||||
return finish('BLOCKED', f'存在未完成/需恢复任务,禁止自动重放:{unfinished_target["evidence_path"]}')
|
||||
if hasattr(adapter, 'bind_library_mapping'):
|
||||
|
||||
@@ -160,3 +160,18 @@ def wait_for_target_document(job, app_provider, *, process_alive, emit=lambda **
|
||||
last_observation = observation
|
||||
sleep(.25)
|
||||
raise PcbBridgeError('PCB_EXITED_BEFORE_COM', 'PCB 在 COM 文档就绪前退出')
|
||||
|
||||
|
||||
def execution_outcome(*, save_complete: bool, pcb_exited: bool,
|
||||
fatal_error: str = '') -> dict[str, object]:
|
||||
if fatal_error:
|
||||
code, _, detail = str(fatal_error).partition(':')
|
||||
return {'status': 'FAIL', 'error_code': code.strip() or 'FATAL_DIALOG',
|
||||
'stderr': detail.strip() or str(fatal_error), 'safe_to_continue': True}
|
||||
if not save_complete:
|
||||
return {'status': 'FAIL', 'error_code': 'SAVE_NOT_CONFIRMED',
|
||||
'stderr': '保存/关闭未完成', 'safe_to_continue': True}
|
||||
if not pcb_exited:
|
||||
return {'status': 'FAIL', 'error_code': 'PCB_EXIT_NOT_CONFIRMED',
|
||||
'stderr': '保存后未确认 PCB 退出', 'safe_to_continue': True}
|
||||
return {'status': 'PASS', 'stdout': 'Project Integration 已同步;保存、关闭和 PCB 退出均已确认。'}
|
||||
@@ -0,0 +1,379 @@
|
||||
"""Preview and cooperatively close the exact native sessions a user confirms."""
|
||||
from contextlib import contextmanager
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import time
|
||||
from uuid import uuid4
|
||||
|
||||
from .owner_probe import query_process_snapshot
|
||||
from .native_engineering_identity import _OWNER_NAMES
|
||||
|
||||
_NAMES = {'expeditionpcb.exe', 'librarymanager.exe', 'icdbprojectbackup.exe',
|
||||
'viewdraw.exe', 'icdbnetserver.exe', 'icdbserver.exe',
|
||||
'reuseblockimporter.exe', 'cleanwglib.exe', 'cscript.exe', 'wscript.exe'} | _OWNER_NAMES
|
||||
_WORKER_NAMES = {'python.exe', 'pythonw.exe', 'cbbrefreshverify.exe'}
|
||||
_WORKER_FLAGS = ('--verify-worker', '--repair-worker', '--management-worker', '--native-backup-worker')
|
||||
|
||||
|
||||
@contextmanager
|
||||
def _process_handle(pid, *, terminate=False):
|
||||
import win32api, win32con
|
||||
handle = win32api.OpenProcess(win32con.SYNCHRONIZE | 0x1000 | (1 if terminate else 0), False, int(pid))
|
||||
try:
|
||||
yield handle
|
||||
finally:
|
||||
handle.Close()
|
||||
|
||||
|
||||
def _handle_identity(handle):
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
import win32process
|
||||
kernel = ctypes.WinDLL('kernel32', use_last_error=True)
|
||||
kernel.QueryFullProcessImageNameW.argtypes = [wintypes.HANDLE, wintypes.DWORD,
|
||||
wintypes.LPWSTR, ctypes.POINTER(wintypes.DWORD)]
|
||||
kernel.QueryFullProcessImageNameW.restype = wintypes.BOOL
|
||||
buffer = ctypes.create_unicode_buffer(32768)
|
||||
length = wintypes.DWORD(len(buffer))
|
||||
if not kernel.QueryFullProcessImageNameW(int(handle), 0, buffer, ctypes.byref(length)):
|
||||
raise ctypes.WinError(ctypes.get_last_error())
|
||||
return {'created_handle': win32process.GetProcessTimes(handle)['CreationTime'].isoformat(),
|
||||
'image': buffer.value}
|
||||
|
||||
|
||||
def _process_identity(row):
|
||||
with _process_handle(row['pid']) as handle:
|
||||
return _handle_identity(handle)
|
||||
|
||||
|
||||
def _process_windows(pids):
|
||||
if not pids: return {}
|
||||
import win32api, win32con, win32gui, win32process, win32service
|
||||
from .native_repair_ui import _native_output
|
||||
result = {pid: [] for pid in pids}
|
||||
observed = set()
|
||||
def capture(hwnd, _=None):
|
||||
pid = win32process.GetWindowThreadProcessId(hwnd)[1]
|
||||
if pid not in result or hwnd in observed or not win32gui.IsWindowVisible(hwnd):
|
||||
return
|
||||
observed.add(hwnd)
|
||||
children, documents = [], []
|
||||
def child(handle, _):
|
||||
kind = win32gui.GetClassName(handle)
|
||||
if kind == 'MDIClient' and win32gui.GetWindow(handle, win32con.GW_CHILD):
|
||||
documents.append(handle)
|
||||
if win32gui.IsWindowVisible(handle):
|
||||
children.append({'hwnd': int(handle), 'class': kind,
|
||||
'id': win32gui.GetDlgCtrlID(handle) & 0xffff,
|
||||
'text': win32gui.GetWindowText(handle), 'enabled': bool(win32gui.IsWindowEnabled(handle))})
|
||||
win32api.SetLastError(0)
|
||||
win32gui.EnumChildWindows(hwnd, child, None)
|
||||
window = {'hwnd': int(hwnd), 'title': win32gui.GetWindowText(hwnd),
|
||||
'class': win32gui.GetClassName(hwnd), 'enabled': bool(win32gui.IsWindowEnabled(hwnd)),
|
||||
'children': children, 'documents': documents, 'rect': list(win32gui.GetWindowRect(hwnd))}
|
||||
if any(c['class'].casefold().startswith('richedit') for c in children):
|
||||
window['output'] = _native_output([window])
|
||||
result[pid].append(window)
|
||||
win32api.SetLastError(0)
|
||||
def incomplete():
|
||||
for pid in result:
|
||||
result[pid].append({'hwnd': 0, 'title': '窗口状态读取不完整', 'class': 'UNCONFIRMED',
|
||||
'enabled': False, 'children': []})
|
||||
try:
|
||||
win32gui.EnumWindows(capture, None)
|
||||
except Exception:
|
||||
incomplete()
|
||||
try:
|
||||
desktops = win32service.GetProcessWindowStation().EnumDesktops()
|
||||
except Exception:
|
||||
incomplete()
|
||||
return result
|
||||
for name in desktops:
|
||||
if name != 'Default' and not name.startswith(('CbbVerify_', 'CbbRepair_', 'CbbManagement_', 'CbbStatusRead_', 'CbbFlagRead_')):
|
||||
continue
|
||||
desktop = None
|
||||
try:
|
||||
desktop = win32service.OpenDesktop(name, 0, False, win32con.DESKTOP_READOBJECTS)
|
||||
for hwnd in desktop.EnumDesktopWindows(): capture(int(hwnd))
|
||||
except Exception:
|
||||
incomplete()
|
||||
finally:
|
||||
if desktop is not None: desktop.CloseDesktop()
|
||||
return result
|
||||
|
||||
|
||||
def _project_name(row, library):
|
||||
from .failed_session import _command_args
|
||||
for arg in _command_args(row['command'])[1:]:
|
||||
try:
|
||||
relative = Path(arg.split('=', 1)[-1]).relative_to(library.parent/'ReusableBlocksLP')
|
||||
if len(relative.parts) >= 2 and relative.parts[1].casefold() == 'work':
|
||||
return relative.parts[0]
|
||||
except ValueError:
|
||||
continue
|
||||
return '当前库关联会话'
|
||||
|
||||
|
||||
def close_target(name, windows):
|
||||
"""No save/restore approval and no close against an unknown modal/window."""
|
||||
main = [w for w in windows if w['class'].startswith('Afx:') and (
|
||||
name.casefold() == 'icdbprojectbackup.exe' and w['title'].startswith('iCDB Project Backup')
|
||||
or name.casefold() == 'librarymanager.exe' and w['title'].startswith('Library Manager')
|
||||
or name.casefold() == 'expeditionpcb.exe' and 'Expedition PCB' in w['title'])]
|
||||
if len(main) != 1:
|
||||
return None, '未确认空闲主窗口;有工程时请先在原生窗口保存并关闭'
|
||||
window = main[0]
|
||||
for other in windows:
|
||||
if other is window: continue
|
||||
benign = (not other['title'] and other['class'] in
|
||||
('UAC_InputIndicatorOverlayWnd', 'UAC Input Indicator'))
|
||||
benign = benign or (other['class'] == 'Internet Explorer_Hidden' and not other['title']
|
||||
and not other.get('children') and other.get('rect', [1, 1, 2, 2])[0:2] == other.get('rect', [1, 1, 2, 2])[2:4])
|
||||
if not benign: return None, '存在原生弹窗,请先处理该窗口后重新检查'
|
||||
if not window['enabled']:
|
||||
return None, '原生程序正在工作,请稍后重新检查'
|
||||
if any(c['class'].casefold() == 'msctls_progress32' for c in window['children']):
|
||||
return None, '原生操作尚未结束'
|
||||
if name.casefold() == 'icdbprojectbackup.exe':
|
||||
output = window.get('output')
|
||||
if not isinstance(output, str): return None, '原生输出尚无法确认,请重新检查'
|
||||
active = list(re.finditer(r'(?i)repairing|restoring|backing up|creating (?:a )?backup', output))
|
||||
last_load = output.rfind('Backup information loaded correctly.')
|
||||
failure = output.rfind('Repair project error [')
|
||||
if active and max(last_load, failure) < active[-1].start():
|
||||
return None, '备份、恢复或修复需要在原生窗口确认结束后再释放'
|
||||
return window, ('将正常关闭工程;未保存时等待确认' if window.get('documents') else '可正常关闭')
|
||||
|
||||
|
||||
def _save_question(windows):
|
||||
for window in windows:
|
||||
text = '\n'.join(c['text'] for c in window['children'] if c['class'] == 'Static')
|
||||
buttons = {c['id']: c for c in window['children'] if c['class'] == 'Button' and c['enabled']}
|
||||
if (window['class'] == '#32770' and 'Expedition' in window['title']
|
||||
and re.search(r'\bsave\b', text, re.I) and re.search(r'changes|modified', text, re.I)
|
||||
and set(buttons) == {6, 7, 2}):
|
||||
return {'hwnd': window['hwnd'], 'text': text, 'buttons': buttons}
|
||||
return None
|
||||
|
||||
|
||||
def inspect_residual_sessions(library, *, block_names=()):
|
||||
from .library_lock import _owner_matches_scope, blocker_path, checkpoint_record, has_retained_library
|
||||
library = Path(library).resolve()
|
||||
if library.suffix.casefold() != '.lmc' or not library.is_file():
|
||||
raise ValueError('请选择有效的中心库 .lmc 文件')
|
||||
blocks = tuple(dict.fromkeys(str(name) for name in block_names))
|
||||
if any(not name or name in ('.', '..') or any(c in name for c in '\\/:*?"<>|') for name in blocks):
|
||||
raise ValueError('残留检查的工程名称无效')
|
||||
roots = tuple(library.parent/'ReusableBlocksLP'/b/'Work' for b in blocks) + (library.parent/'SymbolLibs',)
|
||||
if not blocks: roots = (library.parent,)
|
||||
candidates = []
|
||||
for row in query_process_snapshot():
|
||||
if row['pid'] == os.getpid(): continue
|
||||
native = row['name'].casefold() in _NAMES
|
||||
worker = (row['name'].casefold() in _WORKER_NAMES
|
||||
and any(flag in row['command'].casefold() for flag in _WORKER_FLAGS))
|
||||
if not (native or worker): continue
|
||||
scope = _owner_matches_scope(row, library, roots)
|
||||
if scope is not False:
|
||||
candidates.append({**row, 'scope_confirmed': scope is True})
|
||||
windows = _process_windows({r['pid'] for r in candidates})
|
||||
sessions = []
|
||||
for row in candidates:
|
||||
item = dict(row)
|
||||
try:
|
||||
item.update(_process_identity(row))
|
||||
target, detail = close_target(row['name'], windows.get(row['pid'], [])) if row['scope_confirmed'] else (
|
||||
None, '归属未确认,请在原生窗口确认工程并关闭后重新检查')
|
||||
item.update(can_close=target is not None, detail=detail)
|
||||
except Exception as error:
|
||||
item.update(can_close=False, detail=f'进程已变化或暂时无法确认:{error}')
|
||||
item['project'] = _project_name(row, library) if row['scope_confirmed'] else '归属未确认'
|
||||
item['prompt'] = _save_question(windows.get(row['pid'], [])) if row['scope_confirmed'] else None
|
||||
sessions.append(item)
|
||||
previous = []
|
||||
marker = blocker_path(library)
|
||||
for path in (marker, marker.with_suffix('.pending')):
|
||||
if path.exists():
|
||||
record = checkpoint_record(path)
|
||||
previous.append({'path': str(path), 'recognized': record is not None,
|
||||
'status': record.get('status', 'UNRECOGNIZED') if record else 'UNRECOGNIZED',
|
||||
'time': record.get('time', '') if record else '',
|
||||
'pid': record.get('pid') if record else None})
|
||||
if has_retained_library(library):
|
||||
previous.append({'path': str(library), 'status': 'RETAINED_IN_MEMORY', 'time': '',
|
||||
'pid': os.getpid(), 'kind': 'in_memory'})
|
||||
return {'library': str(library), 'block_names': list(blocks), 'sessions': sessions,
|
||||
'previous_records': previous}
|
||||
|
||||
|
||||
def _request_close(row, *, stop=None):
|
||||
import win32con, win32event, win32gui, win32process
|
||||
with _process_handle(row['pid']) as handle:
|
||||
if win32event.WaitForSingleObject(handle, 0) == win32con.WAIT_OBJECT_0:
|
||||
return {'release_status': 'RELEASED', 'detail': '已退出'}
|
||||
identity = _handle_identity(handle)
|
||||
if identity != {key: row.get(key) for key in ('created_handle', 'image')}:
|
||||
return {'release_status': 'IDENTITY_CHANGED', 'detail': '进程身份已变化,未关闭'}
|
||||
windows = _process_windows({row['pid']}).get(row['pid'], [])
|
||||
if row['name'].casefold() == 'expeditionpcb.exe':
|
||||
from .failed_session import _startup_snapshot, _cancel_target
|
||||
for window in windows:
|
||||
if window['class'] != '#32770': continue
|
||||
target = _cancel_target(_startup_snapshot(window['hwnd'], row['pid']))
|
||||
if target:
|
||||
win32gui.PostMessage(target[1].handle, win32con.BM_CLICK, 0, 0)
|
||||
deadline = time.monotonic()+3
|
||||
while time.monotonic() < deadline:
|
||||
if win32event.WaitForSingleObject(handle, 100) == win32con.WAIT_OBJECT_0:
|
||||
return {'release_status': 'RELEASED', 'detail': '已取消启动并退出'}
|
||||
if stop is not None and stop.is_set():
|
||||
return {'release_status': 'CANCELLED', 'detail': '已停止释放'}
|
||||
windows = _process_windows({row['pid']}).get(row['pid'], [])
|
||||
if close_target(row['name'], windows)[0] is not None: break
|
||||
break
|
||||
target, detail = close_target(row['name'], windows)
|
||||
if target is None: return {'release_status': 'WAITING', 'detail': detail}
|
||||
if stop is not None and stop.is_set():
|
||||
return {'release_status': 'CANCELLED', 'detail': '已停止释放'}
|
||||
if win32process.GetWindowThreadProcessId(target['hwnd'])[1] != row['pid']:
|
||||
return {'release_status': 'IDENTITY_CHANGED', 'detail': '窗口归属已变化,未关闭'}
|
||||
win32gui.PostMessage(target['hwnd'], win32con.WM_CLOSE, 0, 0)
|
||||
deadline = time.monotonic()+3
|
||||
while time.monotonic() < deadline:
|
||||
if win32event.WaitForSingleObject(handle, 100) == win32con.WAIT_OBJECT_0:
|
||||
return {'release_status': 'RELEASED', 'detail': '已正常退出'}
|
||||
if stop is not None and stop.is_set(): break
|
||||
return {'release_status': 'WAITING', 'detail': '已请求正常关闭;请处理原生窗口,完成后重新检查'}
|
||||
|
||||
|
||||
def _force_close(row, *, stop=None):
|
||||
"""Separate UI consent permits ending only this exact, scoped process handle."""
|
||||
import win32api, win32con, win32event
|
||||
if stop is not None and stop.is_set():
|
||||
return {'release_status': 'CANCELLED', 'detail': '已停止释放'}
|
||||
with _process_handle(row['pid'], terminate=True) as handle:
|
||||
if win32event.WaitForSingleObject(handle, 0) == win32con.WAIT_OBJECT_0:
|
||||
return {'release_status': 'RELEASED', 'detail': '已退出'}
|
||||
if _handle_identity(handle) != {k: row.get(k) for k in ('created_handle', 'image')}:
|
||||
return {'release_status': 'IDENTITY_CHANGED', 'detail': '进程身份已变化,未结束'}
|
||||
win32api.TerminateProcess(handle, 1)
|
||||
exited = win32event.WaitForSingleObject(handle, 3000) == win32con.WAIT_OBJECT_0
|
||||
return {'release_status': 'RELEASED' if exited else 'WAITING',
|
||||
'detail': '已强制结束,工程需重新检查' if exited else '已请求结束,等待退出'}
|
||||
|
||||
|
||||
def _finish_library_release(library, evidence):
|
||||
from .library_lock import release_retained_library
|
||||
return release_retained_library(library, evidence)
|
||||
|
||||
|
||||
def _release_residual_sessions(plan, evidence_dir, *, stop=None, force=False):
|
||||
library = Path(plan['library']).resolve()
|
||||
root = Path(evidence_dir).resolve()/('sessions-'+uuid4().hex[:12])
|
||||
if root.is_relative_to(library.parent) or library.parent.is_relative_to(root):
|
||||
raise ValueError('释放记录需位于中心库之外')
|
||||
root.mkdir(parents=True)
|
||||
result = {'status': 'PARTIAL', 'library': str(library), 'sessions': [], 'force': force,
|
||||
'evidence_path': str(root/'result.json'), 'previous_records': plan.get('previous_records', [])}
|
||||
fresh = {r['pid']: r for r in query_process_snapshot()}
|
||||
# Close native children first, so their supervisors can finish and drop leases.
|
||||
ordered = sorted(plan['sessions'], key=lambda r: r['name'].casefold() in _WORKER_NAMES)
|
||||
for original in ordered:
|
||||
current = fresh.get(original['pid'])
|
||||
outcome = {'release_status': 'RELEASED', 'detail': '已退出'}
|
||||
if stop is not None and stop.is_set():
|
||||
outcome = {'release_status': 'CANCELLED', 'detail': '已停止释放'}
|
||||
elif current is not None:
|
||||
from .library_lock import _owner_matches_scope
|
||||
scoped = _owner_matches_scope(current, library, (library.parent,)) is True
|
||||
if original.get('scope_confirmed') is not True or not scoped or original['pid'] == os.getpid():
|
||||
outcome = {'release_status': 'WAITING', 'detail': '未在确认名单中证明属于当前库,未关闭;请重新检查'}
|
||||
elif any(current.get(key) != original.get(key) for key in ('created', 'executable', 'command', 'name')):
|
||||
outcome = {'release_status': 'IDENTITY_CHANGED', 'detail': '确认后进程身份已变化,未关闭'}
|
||||
else:
|
||||
try: outcome = (_force_close if force else _request_close)(original, stop=stop)
|
||||
except Exception as error:
|
||||
outcome = {'release_status': 'WAITING', 'detail': str(error)}
|
||||
result['sessions'].append({**original, **outcome})
|
||||
by_pid = {r['pid']: r for r in result['sessions']}
|
||||
result['sessions'] = [by_pid[r['pid']] for r in plan['sessions']]
|
||||
# Launchers may exit only after the GUI child processed its close request.
|
||||
after = {r['pid']: r for r in query_process_snapshot()}
|
||||
remaining_windows = _process_windows({r['pid'] for r in result['sessions']
|
||||
if r['release_status'] == 'WAITING' and r['pid'] in after})
|
||||
for row in result['sessions']:
|
||||
if row['release_status'] == 'WAITING' and row['pid'] not in after:
|
||||
row.update(release_status='RELEASED', detail='已退出')
|
||||
elif row['release_status'] == 'WAITING':
|
||||
row['prompt'] = _save_question(remaining_windows.get(row['pid'], []))
|
||||
if all(row['release_status'] == 'RELEASED' for row in result['sessions']) and not (stop and stop.is_set()):
|
||||
try:
|
||||
result['proof'] = _finish_library_release(library, root/'library-proof')
|
||||
proof = result['proof']
|
||||
if (proof.get('status') != 'RELEASE_CONFIRMED'
|
||||
or Path(proof.get('library', '')).resolve() != library):
|
||||
raise ValueError('释放证明与当前库不一致')
|
||||
result['status'] = 'RELEASE_CONFIRMED'
|
||||
except Exception as error:
|
||||
result['detail'] = str(error)
|
||||
try:
|
||||
(root/'result.json').write_text(json.dumps(result, ensure_ascii=False, indent=2), 'utf-8')
|
||||
except OSError as error:
|
||||
result['evidence_error'] = str(error)
|
||||
return result
|
||||
|
||||
|
||||
def release_residual_sessions(plan, evidence_dir, *, stop=None, force=False):
|
||||
import win32con, win32event
|
||||
mutex = win32event.CreateMutex(None, False, r'Local\CbbRefreshVerify795')
|
||||
acquired = False
|
||||
try:
|
||||
deadline = time.monotonic()+15
|
||||
while time.monotonic() < deadline and not (stop and stop.is_set()):
|
||||
acquired = win32event.WaitForSingleObject(mutex, 0) in (win32con.WAIT_OBJECT_0, win32con.WAIT_ABANDONED)
|
||||
if acquired: break
|
||||
time.sleep(.2)
|
||||
if not acquired:
|
||||
return {'status': 'PARTIAL', 'library': plan['library'], 'sessions': [
|
||||
{**r, 'release_status': 'WAITING', 'detail': '其它批次尚在执行;请停止该批次后重试'}
|
||||
for r in plan['sessions']], 'detail': '未取得执行通道,未关闭任何进程。'}
|
||||
return _release_residual_sessions(plan, evidence_dir, stop=stop, force=force)
|
||||
finally:
|
||||
if acquired: win32event.ReleaseMutex(mutex)
|
||||
mutex.Close()
|
||||
|
||||
|
||||
def answer_save_question(row, choice):
|
||||
"""Only the exact displayed save question receives an explicit user answer."""
|
||||
import win32con, win32event, win32gui
|
||||
if choice not in (6, 7, 2): raise ValueError('无效的保存选择')
|
||||
mutex = win32event.CreateMutex(None, False, r'Local\CbbRefreshVerify795')
|
||||
acquired = win32event.WaitForSingleObject(mutex, 0) in (win32con.WAIT_OBJECT_0, win32con.WAIT_ABANDONED)
|
||||
if not acquired:
|
||||
mutex.Close()
|
||||
raise ValueError('其它批次正在执行,请稍后处理保存提示')
|
||||
try:
|
||||
_answer_save_question(row, choice)
|
||||
finally:
|
||||
win32event.ReleaseMutex(mutex)
|
||||
mutex.Close()
|
||||
|
||||
|
||||
def _answer_save_question(row, choice):
|
||||
import win32con, win32gui
|
||||
fresh = next((r for r in query_process_snapshot() if r['pid'] == row['pid']), None)
|
||||
if fresh is None or any(fresh.get(k) != row.get(k) for k in ('created', 'command', 'executable')):
|
||||
raise ValueError('进程已变化,请重新检查')
|
||||
with _process_handle(row['pid']) as handle:
|
||||
if _handle_identity(handle) != {k: row.get(k) for k in ('created_handle', 'image')}:
|
||||
raise ValueError('进程已变化,请重新检查')
|
||||
prompt = _save_question(_process_windows({row['pid']}).get(row['pid'], []))
|
||||
if not prompt or prompt != row.get('prompt'):
|
||||
raise ValueError('原生提示已变化,请重新检查')
|
||||
button = prompt['buttons'][choice]
|
||||
import win32process
|
||||
if win32process.GetWindowThreadProcessId(button['hwnd'])[1] != row['pid']:
|
||||
raise ValueError('保存按钮归属已变化')
|
||||
win32gui.PostMessage(button['hwnd'], win32con.BM_CLICK, 0, 0)
|
||||
@@ -15,15 +15,6 @@ import stat
|
||||
|
||||
|
||||
MANIFEST_VERSION = 1
|
||||
MANIFEST_RULE_VERSION = 1
|
||||
_ROOT_RUNTIME_PREFIX = 'work.before-restore-'
|
||||
_ROOT_RUNTIME_PATH = ('projectbackup', 'backups')
|
||||
_NATIVE_RUNTIME_DIRECTORIES = ('log', 'dbcheck', 'dbrestore')
|
||||
_NATIVE_SERVER_DIRECTORY = 'cdbsvr'
|
||||
_PROJECT_PCB_DIRECTORY = 'pcb'
|
||||
_PROJECT_DATABASE_PREFIXES = (('database',), (_PROJECT_PCB_DIRECTORY, 'database'))
|
||||
_NONPRIMARY_FILENAMES = ('saddress.adr',)
|
||||
_NONPRIMARY_FILENAME_PREFIXES = ('~$',)
|
||||
_NONPRIMARY_DIRECTORIES = frozenset({
|
||||
'log', 'logs', 'temp', 'tmp', '__pycache__', 'backup', 'backups',
|
||||
'output', 'outputs', 'report', 'reports', 'gerber', 'gerbers', 'odb++',
|
||||
@@ -38,21 +29,22 @@ def _root_runtime(directories):
|
||||
"""Known runtime/history children of a library or project workspace root."""
|
||||
return bool(directories and (
|
||||
directories[0] in _NONPRIMARY_DIRECTORIES
|
||||
or directories[0].startswith(_ROOT_RUNTIME_PREFIX)
|
||||
or directories[:len(_ROOT_RUNTIME_PATH)] == _ROOT_RUNTIME_PATH))
|
||||
or directories[0].startswith('work.before-restore-')
|
||||
or directories[:2] == ('projectbackup', 'backups')))
|
||||
|
||||
|
||||
def _native_runtime(directories, database_prefix):
|
||||
runtime_prefix = database_prefix + (_NATIVE_SERVER_DIRECTORY,)
|
||||
runtime_prefix = database_prefix + ('cdbsvr',)
|
||||
return (directories[:len(runtime_prefix)] == runtime_prefix
|
||||
and len(directories) > len(runtime_prefix)
|
||||
and directories[len(runtime_prefix)] in _NATIVE_RUNTIME_DIRECTORIES)
|
||||
and directories[len(runtime_prefix)] in ('log', 'dbcheck', 'dbrestore'))
|
||||
|
||||
|
||||
def _project_runtime(directories):
|
||||
return (_root_runtime(directories)
|
||||
or (directories[:1] == (_PROJECT_PCB_DIRECTORY,) and _root_runtime(directories[1:]))
|
||||
or any(_native_runtime(directories, prefix) for prefix in _PROJECT_DATABASE_PREFIXES))
|
||||
or (directories[:1] == ('pcb',) and _root_runtime(directories[1:]))
|
||||
or _native_runtime(directories, ('database',))
|
||||
or _native_runtime(directories, ('pcb', 'database')))
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -93,8 +85,7 @@ class ManifestScope:
|
||||
"""
|
||||
directories = parts if directory else parts[:-1]
|
||||
if not directory and (Path(parts[-1]).suffix in _NONPRIMARY_SUFFIXES
|
||||
or parts[-1] in _NONPRIMARY_FILENAMES
|
||||
or parts[-1].startswith(_NONPRIMARY_FILENAME_PREFIXES)):
|
||||
or parts[-1] == 'saddress.adr' or parts[-1].startswith('~$')):
|
||||
return True
|
||||
if self.kind == 'project':
|
||||
return _project_runtime(directories)
|
||||
@@ -132,36 +123,6 @@ class ManifestScope:
|
||||
return 'shared_dependency'
|
||||
|
||||
|
||||
def comparison_rules(scope):
|
||||
"""Describe semantic exclusions using the classifier's rule constants."""
|
||||
project_positions = ['project root or its PCB child']
|
||||
project_native = ' or '.join('/'.join(prefix + (_NATIVE_SERVER_DIRECTORY,))
|
||||
for prefix in _PROJECT_DATABASE_PREFIXES)
|
||||
native_positions = [project_native + ' under project root']
|
||||
if scope.kind == 'library':
|
||||
project_positions = ['library root', 'selected CBB Work/Cert root or its PCB child']
|
||||
native_positions = [
|
||||
project_native + ' under selected CBB Work/Cert',
|
||||
'SymbolLibs/<partition>/' + _NATIVE_SERVER_DIRECTORY,
|
||||
'<shared dependency>/' + _NATIVE_SERVER_DIRECTORY,
|
||||
]
|
||||
return {
|
||||
'rule_version': MANIFEST_RULE_VERSION,
|
||||
'excluded_categories': sorted(_NONPRIMARY_DIRECTORIES),
|
||||
'excluded_suffixes': sorted(_NONPRIMARY_SUFFIXES),
|
||||
'runtime_exclusions': {
|
||||
'directory_name_positions': project_positions,
|
||||
'directory_prefixes': [_ROOT_RUNTIME_PREFIX],
|
||||
'relative_directories': ['/'.join(_ROOT_RUNTIME_PATH)],
|
||||
'native_directory_names': sorted(_NATIVE_RUNTIME_DIRECTORIES),
|
||||
'native_directory_positions': native_positions,
|
||||
'file_names': list(_NONPRIMARY_FILENAMES),
|
||||
'file_name_prefixes': list(_NONPRIMARY_FILENAME_PREFIXES),
|
||||
'coordination_checkpoints': 'recognized CBB coordination checkpoints',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def hash_file(path):
|
||||
digest = hashlib.sha256()
|
||||
with Path(path).open('rb') as stream:
|
||||
@@ -310,10 +271,7 @@ def copy_verified(source, destination, *, scope=None, progress=None, hash_functi
|
||||
|
||||
Native icdb.dat/LMC files are held with exclusive read handles for the copy.
|
||||
Their expected SHA256 comes from the source read stream, independently of
|
||||
hashing destination bytes. Unlocked primary files are also hashed while
|
||||
streaming the copy, then rehashed at source to detect even same-size/mtime
|
||||
edits. Every primary destination is independently hashed. Failures retain
|
||||
the partial destination evidence.
|
||||
hashing destination bytes. Failures retain the partial destination evidence.
|
||||
Progress receives one dict with stage, hashed_files/bytes and copied_files.
|
||||
"""
|
||||
import win32con
|
||||
@@ -371,15 +329,9 @@ def copy_verified(source, destination, *, scope=None, progress=None, hash_functi
|
||||
shutil.copystat(path, copied)
|
||||
if stream_hash is not None:
|
||||
digest = stream_hash.hexdigest()
|
||||
elif label is not None:
|
||||
stream_hash = hashlib.sha256()
|
||||
with path.open('rb') as incoming, copied.open('wb') as outgoing:
|
||||
for data in iter(lambda: incoming.read(1024 * 1024), b''):
|
||||
stream_hash.update(data)
|
||||
outgoing.write(data)
|
||||
shutil.copystat(path, copied)
|
||||
digest = stream_hash.hexdigest()
|
||||
else:
|
||||
if label is not None:
|
||||
digest = hash_function(path)
|
||||
shutil.copy2(path, copied)
|
||||
before, after = entries[path], path.stat()
|
||||
if (before.st_size, before.st_mtime_ns) != (after.st_size, after.st_mtime_ns):
|
||||
|
||||
+1584
-1575
File diff suppressed because it is too large.
Load diff
@@ -14,7 +14,7 @@ from ..management import run_management_batch, validate_name
|
||||
RESULT_LABELS = {
|
||||
'REMOVED': '已移除', 'UPLOADED': '已上传 / 未自动校验',
|
||||
'UPLOADED_VERIFIED': '已上传且校验通过', 'UPLOADED_VERIFY_FAILED': '已上传但校验未通过',
|
||||
'UPLOAD_FAILED': '上传失败', 'RECOVERY_REQUIRED': '需要人工恢复',
|
||||
'UPLOAD_FAILED': '上传失败', 'RECOVERY_REQUIRED': '需要人工恢复 / 队列已停止',
|
||||
'BLOCKED': '操作被阻止', 'UNSUPPORTED': '当前环境不支持',
|
||||
}
|
||||
STAGE_LABELS = {
|
||||
@@ -25,9 +25,6 @@ STAGE_LABELS = {
|
||||
'verify': '正在校验上传结果', 'verified': '校验已返回', 'copy': '正在准备来源副本',
|
||||
'hash': '正在校验主要文件',
|
||||
'release_check': '正在检查工程是否被占用',
|
||||
'previous_release_check': '正在复核历史占用',
|
||||
'previous_release_confirmed': '历史会话已确认释放',
|
||||
'previous_release_unconfirmed': '占用复核未通过',
|
||||
}
|
||||
|
||||
|
||||
@@ -206,18 +203,6 @@ class ManagementDialog(QDialog):
|
||||
for result in results:
|
||||
summary = f'{result.name}:{RESULT_LABELS.get(result.status, result.status)}'
|
||||
text = f'{summary} — {result.detail}'
|
||||
changes = getattr(result, 'change_report', None)
|
||||
if changes:
|
||||
if changes.get('status') == 'RECORDED':
|
||||
text += (f'\n已比对的工程文件:新增 {len(changes["added"])}、删除 {len(changes["deleted"])}、'
|
||||
f'修改 {len(changes["modified"])};范围仅限报告列出的工程文件。')
|
||||
else:
|
||||
summary += ',变更清单待核对'
|
||||
text += '\n'+changes.get('detail', '变更清单未确认')
|
||||
if getattr(result, 'release_proof', None):
|
||||
text += '\n历史会话已释放;历史工程数据的恢复状态需另行核对。'
|
||||
if not result.safe_to_continue:
|
||||
summary += ',原生会话释放待确认'
|
||||
if self.recovery_from and result.status == 'UPLOADED_VERIFIED':
|
||||
summary += ',版本待核对。'
|
||||
elif result.status not in ('UPLOADED', 'UPLOADED_VERIFIED', 'REMOVED'):
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
"""User-confirmed, asynchronous native-session release."""
|
||||
from pathlib import Path
|
||||
from threading import Event
|
||||
|
||||
from PySide6.QtCore import QThreadPool, Signal
|
||||
from PySide6.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton,
|
||||
QTableWidget, QTableWidgetItem, QHeaderView, QMessageBox)
|
||||
|
||||
from .workers import ServiceWorker
|
||||
|
||||
|
||||
class ResidualReleaseDialog(QDialog):
|
||||
released = Signal(object)
|
||||
before_release = Signal()
|
||||
|
||||
def __init__(self, library, evidence_dir, parent=None):
|
||||
super().__init__(parent)
|
||||
self.library, self.evidence_dir = Path(library), Path(evidence_dir)
|
||||
self.plan = None
|
||||
self.native_queue = None
|
||||
self.busy = False
|
||||
self.stop = Event()
|
||||
self._refresh_after = False
|
||||
self.pool = QThreadPool(self)
|
||||
self.setWindowTitle('释放残留会话')
|
||||
self.setModal(True)
|
||||
self.resize(760, 350)
|
||||
layout = QVBoxLayout(self)
|
||||
self.message = QLabel('正在检查当前库关联的会话…')
|
||||
self.message.setWordWrap(True)
|
||||
layout.addWidget(self.message)
|
||||
self.table = QTableWidget(0, 4)
|
||||
self.table.setHorizontalHeaderLabels(['工程', '程序', 'PID', '状态'])
|
||||
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
|
||||
self.table.horizontalHeader().setSectionResizeMode(3, QHeaderView.Stretch)
|
||||
self.table.setEditTriggers(QTableWidget.NoEditTriggers)
|
||||
layout.addWidget(self.table)
|
||||
buttons = QHBoxLayout()
|
||||
self.refresh_button = QPushButton('重新检查')
|
||||
self.confirm_button = QPushButton('确认释放')
|
||||
self.prompt_button = QPushButton('处理保存提示…')
|
||||
self.force_button = QPushButton('强制结束所列会话…')
|
||||
self.force_button.setEnabled(False)
|
||||
self.prompt_button.setEnabled(False)
|
||||
self.close_button = QPushButton('关闭')
|
||||
for button in (self.refresh_button, self.confirm_button, self.prompt_button, self.force_button, self.close_button): buttons.addWidget(button)
|
||||
layout.addLayout(buttons)
|
||||
self.refresh_button.clicked.connect(self.refresh)
|
||||
self.confirm_button.clicked.connect(self.confirm_release)
|
||||
self.close_button.clicked.connect(self.close)
|
||||
self.prompt_button.clicked.connect(self.answer_prompt)
|
||||
self.force_button.clicked.connect(self.force_release)
|
||||
self.table.itemSelectionChanged.connect(self._update_prompt)
|
||||
self.refresh()
|
||||
|
||||
def _start(self, action, completed):
|
||||
self.busy = True
|
||||
self.confirm_button.setEnabled(False)
|
||||
self.refresh_button.setEnabled(False)
|
||||
self.prompt_button.setEnabled(False)
|
||||
self.force_button.setEnabled(False)
|
||||
self.close_button.setText('停止释放')
|
||||
self.worker = ServiceWorker(action)
|
||||
self.worker.signals.succeeded.connect(completed)
|
||||
self.worker.signals.failed.connect(lambda error: self.message.setText(str(error)))
|
||||
self.worker.signals.finished.connect(self._finished)
|
||||
self.pool.start(self.worker)
|
||||
|
||||
def _finished(self):
|
||||
self.busy = False
|
||||
self.refresh_button.setEnabled(True)
|
||||
self.confirm_button.setEnabled(self.plan is not None)
|
||||
self.force_button.setEnabled(bool(self.plan and any(
|
||||
r.get('scope_confirmed', True) for r in self.plan['sessions'])))
|
||||
self.close_button.setText('关闭')
|
||||
self._update_prompt()
|
||||
if self._refresh_after:
|
||||
self._refresh_after = False
|
||||
self.refresh()
|
||||
|
||||
def _rows(self, sessions):
|
||||
self.table.setRowCount(len(sessions))
|
||||
for index, session in enumerate(sessions):
|
||||
for column, value in enumerate((session.get('project', ''), session['name'],
|
||||
session['pid'], session.get('detail', ''))):
|
||||
self.table.setItem(index, column, QTableWidgetItem(str(value)))
|
||||
if sessions: self.table.setCurrentCell(0, 0)
|
||||
|
||||
def _update_prompt(self):
|
||||
row = self.table.currentRow()
|
||||
rows = self.plan['sessions'] if self.plan else []
|
||||
self.prompt_button.setEnabled(not self.busy and 0 <= row < len(rows) and bool(rows[row].get('prompt')))
|
||||
|
||||
def answer_prompt(self):
|
||||
if self.busy or not self.plan: return
|
||||
row = self.table.currentRow()
|
||||
if row < 0: return
|
||||
session = self.plan['sessions'][row]
|
||||
prompt = session.get('prompt')
|
||||
if not prompt: return
|
||||
choice = QMessageBox.question(self, '关闭工程前保存', prompt['text']+
|
||||
'\n\n是:保存后关闭;否:放弃未保存更改;取消:保留会话。',
|
||||
QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel, QMessageBox.Cancel)
|
||||
code = {QMessageBox.Yes: 6, QMessageBox.No: 7, QMessageBox.Cancel: 2}[choice]
|
||||
from cbb_refresh_verify.residual_sessions import answer_save_question
|
||||
self._start(lambda: answer_save_question(session, code),
|
||||
lambda _: setattr(self, '_refresh_after', True))
|
||||
|
||||
def refresh(self):
|
||||
if self.busy: return
|
||||
from cbb_refresh_verify.library_lock import inspect_residual_sessions
|
||||
self.plan = None
|
||||
self.message.setText('正在检查当前库关联的会话…')
|
||||
def ready(plan):
|
||||
self.library = Path(plan['library'])
|
||||
self.plan = plan
|
||||
self._rows(plan['sessions'])
|
||||
text = ('确认后逐项正常关闭下列会话;有未保存更改时,可选择保存或保留。'
|
||||
if plan['sessions'] else '未发现活跃会话。')
|
||||
records = plan.get('previous_records', [])
|
||||
if records:
|
||||
dates = ', '.join(sorted({r['time'][:10] for r in records if r.get('time')}))
|
||||
text += f'\n有 {len(records)} 条历史操作记录'+(f'({dates})' if dates else '')+',确认后将复核并清理。'
|
||||
elif not plan['sessions']:
|
||||
text += '确认后将复查库占用状态。'
|
||||
self.message.setText(text)
|
||||
def inspect():
|
||||
from cbb_refresh_verify.network_path import select_library_file
|
||||
library = self.library if self.library.suffix.casefold() == '.lmc' else select_library_file(self.library)
|
||||
return inspect_residual_sessions(library)
|
||||
self._start(inspect, ready)
|
||||
|
||||
def force_release(self):
|
||||
if self.busy or not self.plan or not self.plan['sessions']: return
|
||||
targets = [r for r in self.plan['sessions'] if r.get('scope_confirmed', True)]
|
||||
if not targets: return
|
||||
names = '\n'.join(f'{r.get("project", "")} — {r["name"]} (PID {r["pid"]})' for r in targets)
|
||||
answer = QMessageBox.warning(self, '强制结束会话',
|
||||
'将强制结束以下进程,未保存的更改会丢失,正在写入的工程可能需要恢复。\n\n'+names+
|
||||
'\n\n仍要结束这些进程吗?', QMessageBox.Yes | QMessageBox.Cancel, QMessageBox.Cancel)
|
||||
if answer == QMessageBox.Yes: self.confirm_release(force=True)
|
||||
|
||||
def confirm_release(self, checked=False, *, force=False):
|
||||
if self.busy or self.plan is None: return
|
||||
from cbb_refresh_verify.library_lock import release_residual_sessions
|
||||
self.stop.clear()
|
||||
plan = self.plan
|
||||
self.before_release.emit()
|
||||
self.message.setText('正在逐项释放,请稍候…')
|
||||
def done(result):
|
||||
self.plan = {**plan, 'sessions': result['sessions']}
|
||||
self._rows(result['sessions'])
|
||||
count = sum(row['release_status'] == 'RELEASED' for row in result['sessions'])
|
||||
if result['status'] == 'RELEASE_CONFIRMED':
|
||||
self.plan = None
|
||||
self.message.setText(f'已释放 {count} 个会话,旧占用记录已解除。')
|
||||
self.released.emit(result['proof'])
|
||||
else:
|
||||
self.message.setText(f'已释放 {count} 个会话,其余会话或库状态仍待确认。'
|
||||
+ ('\n'+result['detail'] if result.get('detail') else '请处理原生窗口后重新检查。'))
|
||||
def execute():
|
||||
action = lambda: release_residual_sessions(plan, self.evidence_dir, stop=self.stop, force=force)
|
||||
return self.native_queue.run(action, stop=self.stop) if self.native_queue is not None else action()
|
||||
self._start(execute, done)
|
||||
|
||||
def closeEvent(self, event):
|
||||
if self.busy:
|
||||
self.stop.set()
|
||||
self.message.setText('正在停止释放,等待本次操作返回…')
|
||||
event.ignore()
|
||||
else:
|
||||
super().closeEvent(event)
|
||||
|
||||
def reject(self):
|
||||
if self.busy:
|
||||
self.stop.set()
|
||||
else:
|
||||
super().reject()
|
||||
@@ -102,7 +102,6 @@ class VerifyResult:
|
||||
timings_seconds: dict[str, float] = field(default_factory=dict)
|
||||
incomplete_timing_phases: tuple[str, ...] = ()
|
||||
recovery_attempts: tuple[dict, ...] = ()
|
||||
release_proof: dict | None = None
|
||||
|
||||
|
||||
def resolve_importer(mentor_bin: str | None = None) -> Path:
|
||||
@@ -551,7 +550,6 @@ def run_verify(request, *, progress=None, flag_reader=None, process_runner=None,
|
||||
mutex = win32event.CreateMutex(None, False, r'Local\CbbRefreshVerify795')
|
||||
acquired = False
|
||||
library_lock = None
|
||||
previous_release = None
|
||||
release_confirmed = True
|
||||
remaining_clients = ()
|
||||
def clients_released():
|
||||
@@ -568,18 +566,16 @@ def run_verify(request, *, progress=None, flag_reader=None, process_runner=None,
|
||||
if request.maintenance:
|
||||
from .maintenance_entry import run_icdb_check
|
||||
return run_icdb_check(request, progress=progress, stop=stop)
|
||||
from .library_lock import LibraryLock, LibraryBusy, recheck_previous_release
|
||||
from .library_lock import LibraryLock, LibraryBusy
|
||||
import pywintypes
|
||||
if Path(request.lmc_file).is_file():
|
||||
try:
|
||||
previous_release = recheck_previous_release(request.lmc_file,
|
||||
Path(request.evidence_dir)/'previous-release', block_name=request.block_name, progress=progress)
|
||||
library_lock = LibraryLock(request.lmc_file, checkpoint=False,
|
||||
safe_to_release=clients_released)
|
||||
library_lock.__enter__()
|
||||
except LibraryBusy as error:
|
||||
return VerifyResult('FAIL', stderr=str(error), error_category='LIBRARY_IN_USE')
|
||||
except (OSError, ValueError, RuntimeError, pywintypes.error) as error:
|
||||
except (OSError, pywintypes.error) as error:
|
||||
return VerifyResult('FAIL', stderr=str(error), error_category='LIBRARY_ACCESS_FAILED')
|
||||
release_confirmed = False
|
||||
result = _run_verify_serialized(
|
||||
@@ -678,10 +674,6 @@ def run_verify(request, *, progress=None, flag_reader=None, process_runner=None,
|
||||
if type(pid) is int and pid > 0)
|
||||
except (OSError, ValueError, KeyError):
|
||||
pass
|
||||
if previous_release is not None:
|
||||
result = replace(result, release_proof=previous_release)
|
||||
if result.evidence_path:
|
||||
_write_optional_evidence(result.evidence_path, {'block_name': request.block_name, **asdict(result)})
|
||||
return result
|
||||
finally:
|
||||
try:
|
||||
|
||||
@@ -60,6 +60,18 @@ def test_unconfirmed_open_is_amber_and_does_not_claim_icdb_damage(qtbot, tmp_pat
|
||||
assert cell.background().color().name() == '#fff8e1'
|
||||
|
||||
|
||||
def test_completed_old_library_result_does_not_release_new_library(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
from pathlib import Path
|
||||
window = load_window(qtbot, tmp_path, monkeypatch, verifier=lambda _: VerifyResult('FAIL', safe_to_continue=False))
|
||||
window._run(['Beta'], maintenance=True)
|
||||
qtbot.waitUntil(lambda: not window._icdb_active())
|
||||
summary = window.icdb_summary
|
||||
window.lmc_edit.setText('other.lmc')
|
||||
next(button for button in summary.buttons() if '释放' in button.text()).click()
|
||||
assert getattr(window, 'release_dialog', None) is None
|
||||
assert '切' in window.status_label.text()
|
||||
|
||||
|
||||
def test_later_management_invalidates_old_recovery_offer(qtbot, tmp_path, monkeypatch):
|
||||
|
||||
@@ -84,30 +84,11 @@ def test_scan_reuses_checkpoint_and_queries_only_missing(tmp_path):
|
||||
encoding="utf-8",
|
||||
)
|
||||
bridge = FakeBridge()
|
||||
records = BatchStatusSession(bridge).scan(["A", "B"], lmc, checkpoint, resume=True)
|
||||
records = BatchStatusSession(bridge).scan(["A", "B"], lmc, checkpoint)
|
||||
assert bridge.requests == ["B"]
|
||||
assert {record.block_name for record in records} == {"A", "B"}
|
||||
|
||||
|
||||
def test_default_scan_refreshes_cached_ready_after_payload_change(tmp_path):
|
||||
lmc = tmp_path/'library.lmc'; lmc.write_bytes(b'library')
|
||||
checkpoint = tmp_path/'scan.jsonl'
|
||||
BatchStatusSession(FakeBridge()).scan(['A'], lmc, checkpoint)
|
||||
# The lightweight fingerprint cannot prove payload status is unchanged.
|
||||
fingerprint = fingerprint_library(lmc)
|
||||
(tmp_path/'payload.pcb').write_bytes(b'native edit without LMC change')
|
||||
assert fingerprint_library(lmc) == fingerprint
|
||||
class PendingBridge(FakeBridge):
|
||||
def query(self, *args, **kwargs):
|
||||
self.requests.append(args[1])
|
||||
return BridgeResult('PENDING', 'fake')
|
||||
bridge = PendingBridge()
|
||||
records = BatchStatusSession(bridge).scan(['A'], lmc, checkpoint)
|
||||
assert [record.status for record in records] == ['PENDING']
|
||||
assert bridge.requests == ['A']
|
||||
assert len(checkpoint.read_text('utf-8').splitlines()) == 1
|
||||
|
||||
|
||||
def test_timeout_isolated_and_later_item_continues(tmp_path):
|
||||
lmc = tmp_path / "mentor_lib.lmc"
|
||||
lmc.write_bytes(b"library")
|
||||
@@ -199,7 +180,7 @@ def test_retry_rechecks_failed_scan_without_library_changes(tmp_path):
|
||||
first = BatchStatusSession(FakeBridge(timeout_name='A')).scan(['A', 'B'], lmc, checkpoint)
|
||||
assert first[0].status == 'TIMEOUT'
|
||||
bridge = FakeBridge()
|
||||
second = BatchStatusSession(bridge).scan(['A', 'B'], lmc, checkpoint, resume=True)
|
||||
second = BatchStatusSession(bridge).scan(['A', 'B'], lmc, checkpoint)
|
||||
assert bridge.requests == ['A']
|
||||
assert second[0].status == 'READY'
|
||||
|
||||
|
||||
@@ -82,5 +82,5 @@ def test_fingerprint_change_does_not_reuse_checkpoint(tmp_path):
|
||||
from cbb_refresh_verify.status_bridge import BridgeResult
|
||||
return BridgeResult("PENDING", "fake")
|
||||
bridge = Bridge()
|
||||
BatchStatusSession(bridge).scan(["A"], lmc, checkpoint, resume=True)
|
||||
BatchStatusSession(bridge).scan(["A"], lmc, checkpoint)
|
||||
assert bridge.requests == ["A"]
|
||||
@@ -6,7 +6,7 @@ from test_maintenance_entry import case
|
||||
|
||||
def test_verify_defaults_to_no_repair_and_does_not_retain_a_failure_lock(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import verify_runner as runner, library_lock as locks, native_repair
|
||||
library = tmp_path / 'library/library.lmc'; library.parent.mkdir(); library.touch()
|
||||
library = tmp_path / 'library.lmc'; library.touch()
|
||||
req = runner.VerifyRequest(library, 'CBB', tmp_path / 'evidence')
|
||||
assert req.auto_repair is False
|
||||
marker = locks.blocker_path(library)
|
||||
@@ -16,17 +16,11 @@ def test_verify_defaults_to_no_repair_and_does_not_retain_a_failure_lock(tmp_pat
|
||||
error_category='ICDB_REPAIR_REQUIRED', safe_to_continue=True)
|
||||
monkeypatch.setattr(runner, '_run_verify_serialized', lambda *a, **k: (calls.append('verify') or result))
|
||||
monkeypatch.setattr(native_repair, 'attempt_recovery', lambda *a, **k: pytest.fail('verify requested Repair'))
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
|
||||
monkeypatch.setattr('cbb_refresh_verify.native_engineering_identity._process_snapshot', lambda: [])
|
||||
first = runner.run_verify(req)
|
||||
assert first.status == result.status and first.error_category == result.error_category
|
||||
assert first.release_proof['status'] == 'RELEASE_CONFIRMED'
|
||||
assert runner.run_verify(req) is result
|
||||
assert runner.run_verify(req) is result
|
||||
assert calls == ['verify', 'verify']
|
||||
assert not marker.exists()
|
||||
archive = Path(first.release_proof['evidence_path']).with_name('blocker-before-0.json')
|
||||
assert archive.read_text() == 'historical diagnostic record'
|
||||
assert locks._key(library.parent / '.library.cbb-upload.lock') not in locks._owners
|
||||
assert marker.read_text() == 'historical diagnostic record'
|
||||
assert locks._key(tmp_path / '.library.cbb-upload.lock') not in locks._owners
|
||||
|
||||
|
||||
def test_catalog_checkpoint_does_not_disable_ordinary_verify(qtbot, tmp_path, monkeypatch):
|
||||
|
||||
@@ -23,6 +23,46 @@ def test_only_confirmed_maintenance_sets_explicit_flag(qtbot, tmp_path, monkeypa
|
||||
assert len(calls) == 2 and calls[-1].maintenance is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize('marker_kind', ['valid', 'foreign', 'malformed'])
|
||||
def test_old_checkpoint_does_not_force_maintenance_or_disable_verify(qtbot, tmp_path, monkeypatch, marker_kind):
|
||||
from cbb_refresh_verify.library_lock import LibraryLock, blocker_path, _owners, _guard
|
||||
from cbb_refresh_verify.ui.main_window import MainWindow
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
from cbb_refresh_verify.models import LibraryReadResult, CbbRecord
|
||||
import cbb_refresh_verify.ui.main_window as ui
|
||||
library = tmp_path/'library/mentor.lmc'; library.parent.mkdir(); library.touch()
|
||||
(library.parent/'ReusableBlocksLP/IP101GR').mkdir(parents=True)
|
||||
with LibraryLock(library, safe_to_release=lambda: False) as lock: pass
|
||||
with _guard:
|
||||
owner = _owners.pop(lock.key, None)
|
||||
if owner: owner['handle'].Close()
|
||||
marker = blocker_path(library)
|
||||
if marker_kind == 'malformed': marker.write_text('{}')
|
||||
if marker_kind == 'foreign':
|
||||
record = json.loads(marker.read_text()); record['library'] = str(tmp_path/'foreign/mentor.lmc')
|
||||
marker.write_text(json.dumps(record))
|
||||
monkeypatch.setattr(ui, 'preflight_skip_reason', lambda *a: None)
|
||||
calls = []
|
||||
window = MainWindow(reader=lambda *a: LibraryReadResult((CbbRecord('IP101GR', 'Reusable Blocks', status='PENDING'),)),
|
||||
verifier=lambda req: (calls.append(req) or VerifyResult('BLOCKED', safe_to_continue=False)),
|
||||
status_refresher=lambda *a: {'IP101GR': 'PENDING'}, data_root=tmp_path/'data')
|
||||
qtbot.addWidget(window)
|
||||
window.lmc_edit.setText(str(library)); window.load_library()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert window.release_library_button.isEnabled()
|
||||
assert window.visible_records()[0].name == 'IP101GR'
|
||||
assert window.visible_records()[0].status == 'PENDING'
|
||||
assert not window._maintenance_recovery_view
|
||||
window.select_visible_button.click()
|
||||
assert window.icdb_repair_button.isEnabled()
|
||||
assert window.batch_button.isEnabled() and window.selected_batch_button.isEnabled()
|
||||
monkeypatch.setattr(QMessageBox, 'question', lambda *a, **k: QMessageBox.Yes)
|
||||
window.verify_selected(); qtbot.waitUntil(lambda: not window.busy)
|
||||
assert len(calls) == 1 and calls[0].maintenance is False
|
||||
assert window.selected_batch_button.isEnabled()
|
||||
window.repair_icdb_all(); qtbot.waitUntil(lambda: not window._icdb_active())
|
||||
assert len(calls) == 2 and calls[1].maintenance is True
|
||||
assert marker.exists()
|
||||
|
||||
|
||||
def test_maintenance_summary_exposes_first_failure_reason(qtbot, tmp_path):
|
||||
|
||||
@@ -72,6 +72,20 @@ def test_busy_execution_channel_does_not_create_unreleased_management_owner(setu
|
||||
assert result.evidence_path.is_file()
|
||||
|
||||
|
||||
def test_management_rechecks_retained_verify_lease_without_checkpoint(setup, monkeypatch, isolated_mutex):
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
from cbb_refresh_verify.residual_sessions import inspect_residual_sessions
|
||||
request, adapter, _ = setup
|
||||
with locks.LibraryLock(request.library, checkpoint=False, safe_to_release=lambda: False):
|
||||
pass
|
||||
assert not locks.blocker_path(request.library).exists()
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
|
||||
monkeypatch.setattr('cbb_refresh_verify.residual_sessions.query_process_snapshot', lambda: [])
|
||||
preview = inspect_residual_sessions(request.library)
|
||||
assert preview['sessions'] == [] and any(r.get('kind') == 'in_memory' for r in preview['previous_records'])
|
||||
result = execute(request, adapter)
|
||||
assert result.status == 'REMOVED' and result.release_proof['status'] == 'RELEASE_CONFIRMED'
|
||||
assert not locks.has_retained_library(request.library)
|
||||
|
||||
|
||||
def test_management_worker_prelaunch_failure_is_safe(tmp_path, monkeypatch):
|
||||
@@ -269,7 +283,7 @@ def test_status_cache_does_not_reuse_a_different_block_type(tmp_path):
|
||||
return BridgeResult('READY', 'test')
|
||||
session = BatchStatusSession(Bridge())
|
||||
session.scan(['Block'], library, tmp_path/'scan.jsonl', block_type='RULP')
|
||||
session.scan(['Block'], library, tmp_path/'scan.jsonl', block_type='Other', resume=True)
|
||||
session.scan(['Block'], library, tmp_path/'scan.jsonl', block_type='Other')
|
||||
assert calls == ['RULP', 'Other']
|
||||
|
||||
|
||||
|
||||
@@ -111,3 +111,31 @@ def test_previous_unsafe_result_allows_retry_and_requires_matching_release_proof
|
||||
window.management_dialog.reject()
|
||||
|
||||
|
||||
def test_historical_record_does_not_prevent_catalog_load_and_offers_checked_release(qtbot, tmp_path, monkeypatch):
|
||||
import pytest
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
from cbb_refresh_verify.ui.main_window import MainWindow
|
||||
library = tmp_path/'library/lib.lmc'; library.parent.mkdir(); library.touch()
|
||||
locks.blocker_path(library).write_text('{}', encoding='utf-8')
|
||||
reads = []
|
||||
window = MainWindow(reader=lambda path: (reads.append(path) or LibraryReadResult(())), data_root=tmp_path/'data')
|
||||
qtbot.addWidget(window)
|
||||
window.lmc_edit.setText(str(library)); window.load_library()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert window.loaded_path == str(library) and reads
|
||||
assert window.release_library_button.isEnabled()
|
||||
assert locks.blocker_path(library).read_text() == '{}'
|
||||
calls = []
|
||||
monkeypatch.setattr(locks, 'inspect_residual_sessions', lambda *a:
|
||||
{'library': str(library), 'sessions': []})
|
||||
monkeypatch.setattr(locks, 'release_residual_sessions', lambda *a, **kw:
|
||||
(calls.append(a) or {'status': 'RELEASE_CONFIRMED', 'sessions': [], 'proof':
|
||||
{'status': 'RELEASE_CONFIRMED', 'library': str(library), 'evidence_path': 'proof.json'}}))
|
||||
window.release_library_button.click()
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
assert not calls
|
||||
window.release_dialog.confirm_button.click()
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
window.release_dialog.close()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert len(calls) == 1 and 'proof.json' in window.output.toPlainText()
|
||||
@@ -1,42 +0,0 @@
|
||||
from threading import Event, Thread
|
||||
|
||||
from cbb_refresh_verify.operation_queue import NativeQueue, QueueCancelled
|
||||
|
||||
|
||||
def test_paused_ticket_yields_to_a_ready_native_task():
|
||||
queue=NativeQueue()
|
||||
ready, waiting, complete=Event(),Event(),Event()
|
||||
order=[]
|
||||
thread=Thread(target=lambda:queue.run(lambda:(order.append('resumed'),complete.set()),
|
||||
ready=ready.is_set,waiting=waiting.set))
|
||||
thread.start()
|
||||
try:
|
||||
assert waiting.wait(2)
|
||||
queue.run(lambda:order.append('ready'))
|
||||
assert order==['ready']
|
||||
ready.set();queue.wake()
|
||||
assert complete.wait(2)
|
||||
assert order==['ready','resumed']
|
||||
finally:
|
||||
ready.set();queue.wake();thread.join(2)
|
||||
assert not thread.is_alive()
|
||||
|
||||
|
||||
def test_cancelled_paused_ticket_does_not_hold_later_work():
|
||||
queue=NativeQueue()
|
||||
waiting,stop=Event(),Event()
|
||||
outcome=[]
|
||||
def wait():
|
||||
try:
|
||||
queue.run(lambda:outcome.append('unexpected'),ready=lambda:False,
|
||||
waiting=waiting.set,stop=stop)
|
||||
except QueueCancelled:outcome.append('cancelled')
|
||||
thread=Thread(target=wait);thread.start()
|
||||
try:
|
||||
assert waiting.wait(2)
|
||||
stop.set();queue.wake();thread.join(2)
|
||||
assert not thread.is_alive()
|
||||
queue.run(lambda:outcome.append('next'))
|
||||
assert outcome==['cancelled','next']
|
||||
finally:
|
||||
stop.set();queue.wake();thread.join(2)
|
||||
@@ -2,6 +2,7 @@ import pytest
|
||||
|
||||
from cbb_refresh_verify.pcb_bridge import (
|
||||
PcbBridgeError,
|
||||
execution_outcome,
|
||||
require_document_identity,
|
||||
wait_for_target_document,
|
||||
)
|
||||
@@ -73,6 +74,23 @@ def test_bridge_stops_if_pcb_exits_before_com_is_ready(tmp_path):
|
||||
assert raised.value.error_code == 'PCB_EXITED_BEFORE_COM'
|
||||
|
||||
|
||||
def test_fatal_dialog_overrides_successful_save_markers():
|
||||
result = execution_outcome(
|
||||
save_complete=True,
|
||||
pcb_exited=True,
|
||||
fatal_error='SAVE_REUSABLE_BLOCK_FAILED: Error saving the Reusable Block',
|
||||
)
|
||||
|
||||
assert result['status'] == 'FAIL'
|
||||
assert result['error_code'] == 'SAVE_REUSABLE_BLOCK_FAILED'
|
||||
|
||||
|
||||
def test_success_requires_save_and_pcb_exit():
|
||||
assert execution_outcome(save_complete=True, pcb_exited=True)['status'] == 'PASS'
|
||||
assert execution_outcome(save_complete=False, pcb_exited=True)['status'] == 'FAIL'
|
||||
assert execution_outcome(save_complete=True, pcb_exited=False)['status'] == 'FAIL'
|
||||
|
||||
|
||||
def test_connected_com_without_document_remains_startup_and_checks_native_failure(tmp_path):
|
||||
errors = iter(('', 'ICDB_REPAIR_REQUIRED: original lost session'))
|
||||
events = []
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
from pathlib import Path
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
|
||||
def test_preview_lists_residuals_and_does_not_close_before_confirmation(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
plan = {'library': str(tmp_path/'lib.lmc'), 'sessions': [
|
||||
{'project': 'A', 'name': 'iCDBProjectBackup.exe', 'pid': 10, 'detail': '可正常关闭'}]}
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda *_: plan)
|
||||
calls = []
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', lambda *a, **k: calls.append(a))
|
||||
dialog = ResidualReleaseDialog(tmp_path/'lib.lmc', tmp_path/'evidence')
|
||||
qtbot.addWidget(dialog); dialog.show()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert dialog.table.item(0, 0).text() == 'A'
|
||||
assert dialog.table.item(0, 2).text() == '10'
|
||||
assert not calls
|
||||
dialog.close()
|
||||
assert not calls
|
||||
|
||||
|
||||
def test_empty_process_list_explains_historical_records_without_claiming_activity(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda *_: {
|
||||
'library': str(tmp_path/'lib.lmc'), 'sessions': [], 'previous_records': [
|
||||
{'path': 'old-record.json', 'time': '2026-11-04T09:43:50+00:00', 'pid': 57076}]})
|
||||
dialog = ResidualReleaseDialog(tmp_path/'lib.lmc', tmp_path/'evidence')
|
||||
qtbot.addWidget(dialog)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert '未发现活跃会话' in dialog.message.text()
|
||||
assert '历史操作记录' in dialog.message.text() and '2026-11-04' in dialog.message.text()
|
||||
assert dialog.confirm_button.isEnabled() and not dialog.force_button.isEnabled()
|
||||
dialog.close()
|
||||
|
||||
|
||||
def test_confirm_releases_full_plan_and_only_emits_actual_library_proof(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
plan = {'library': str(tmp_path/'lib.lmc'), 'sessions': [
|
||||
{'project': name, 'name': 'iCDBProjectBackup.exe', 'pid': pid, 'detail': '可正常关闭'}
|
||||
for name, pid in [('A', 10), ('B', 20)]]}
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda *_: plan)
|
||||
proof = {'status': 'RELEASE_CONFIRMED', 'library': plan['library'], 'evidence_path': 'proof.json'}
|
||||
calls = []
|
||||
def release(actual, *a, **kw):
|
||||
calls.append(actual)
|
||||
return {'status': 'RELEASE_CONFIRMED', 'proof': proof, 'sessions': [
|
||||
{**row, 'release_status': 'RELEASED', 'detail': '已正常退出'} for row in actual['sessions']]}
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', release)
|
||||
dialog = ResidualReleaseDialog(tmp_path/'lib.lmc', tmp_path/'evidence')
|
||||
qtbot.addWidget(dialog); dialog.show()
|
||||
released = []
|
||||
dialog.released.connect(released.append)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
qtbot.mouseClick(dialog.confirm_button, Qt.LeftButton)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert calls == [plan] and released == [proof]
|
||||
assert '已释放 2' in dialog.message.text()
|
||||
assert not dialog.confirm_button.isEnabled()
|
||||
|
||||
|
||||
def test_main_window_opens_confirmation_list_and_returns_to_idle_when_closed(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify import library_lock
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda library, **kw:
|
||||
{'library': str(library), 'sessions': []})
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.check_library_release()
|
||||
dialog = getattr(window, 'release_dialog', None)
|
||||
assert dialog is not None, 'Release entry must preview sessions before cleanup'
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert window.busy and dialog.confirm_button.isEnabled()
|
||||
dialog.close()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
|
||||
|
||||
def test_force_close_is_explicit_and_cancel_does_not_release(qtbot, tmp_path, monkeypatch):
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
plan = {'library': str(tmp_path/'lib.lmc'), 'sessions': [
|
||||
{'project': 'A', 'name': 'ExpeditionPCB.exe', 'pid': 10, 'detail': '窗口无响应'}]}
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda *_: plan)
|
||||
calls = []
|
||||
def release(actual, *a, **kw):
|
||||
calls.append(kw['force'])
|
||||
return {'status': 'PARTIAL', 'sessions': [{**plan['sessions'][0], 'release_status': 'WAITING'}]}
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', release)
|
||||
dialog = ResidualReleaseDialog(tmp_path/'lib.lmc', tmp_path/'evidence')
|
||||
qtbot.addWidget(dialog)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
monkeypatch.setattr(QMessageBox, 'warning', lambda *a: QMessageBox.Cancel)
|
||||
dialog.force_button.click()
|
||||
assert not calls
|
||||
monkeypatch.setattr(QMessageBox, 'warning', lambda *a: QMessageBox.Yes)
|
||||
dialog.force_button.click()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert calls == [True]
|
||||
|
||||
|
||||
def test_released_batch_can_resume_only_its_unexecuted_items(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
window = load_window(qtbot, tmp_path, monkeypatch,
|
||||
verifier=lambda _: VerifyResult('FAIL', stderr='release unconfirmed', safe_to_continue=False))
|
||||
window._run(['Beta', 'Gamma'])
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
action = getattr(window, '_resume_batch_action', None)
|
||||
assert action is not None and not action.isEnabled()
|
||||
library = Path(window.mentor_lmc_path or window.loaded_path)
|
||||
from cbb_refresh_verify import library_lock
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda *_:
|
||||
{'library': str(library), 'sessions': []})
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', lambda *a, **kw:
|
||||
{'status': 'RELEASE_CONFIRMED', 'sessions': [], 'proof': {'status': 'RELEASE_CONFIRMED',
|
||||
'library': str(library), 'evidence_path': str(tmp_path/'proof.json')}})
|
||||
window._residual_release_action.click()
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
window.release_dialog.confirm_button.click()
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
window.release_dialog.close()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert window.summary.isVisible()
|
||||
assert action.isEnabled()
|
||||
calls = []
|
||||
monkeypatch.setattr(window, '_run', lambda names, **kw: calls.append((names, kw)))
|
||||
action.click()
|
||||
assert calls == [(['Gamma'], {'maintenance': False})]
|
||||
@@ -0,0 +1,229 @@
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def api():
|
||||
from cbb_refresh_verify import library_lock
|
||||
inspect = getattr(library_lock, 'inspect_residual_sessions', None)
|
||||
release = getattr(library_lock, 'release_residual_sessions', None)
|
||||
assert callable(inspect) and callable(release), 'Missing confirmed residual-session release workflow'
|
||||
return inspect, release
|
||||
|
||||
|
||||
def row(pid, project, *, name='iCDBProjectBackup.exe'):
|
||||
return {'pid': pid, 'name': name, 'parent': 1, 'created': f'created-{pid}',
|
||||
'executable': 'C:/Mentor/'+name, 'command': f'{name} -p "{project}"'}
|
||||
|
||||
|
||||
def test_preview_limits_to_selected_projects_and_keeps_process_identity(tmp_path, monkeypatch):
|
||||
inspect, _ = api()
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
a = library.parent/'ReusableBlocksLP/A/Work/A.prj'
|
||||
b = library.parent/'ReusableBlocksLP/B/Work/B.prj'
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [row(10, a), row(20, b)])
|
||||
monkeypatch.setattr(sessions, '_process_identity', lambda r: {'created_handle': r['created'], 'image': r['executable']})
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda pids: {p: [] for p in pids})
|
||||
result = inspect(library, block_names=('A',))
|
||||
assert [r['pid'] for r in result['sessions']] == [10]
|
||||
assert result['sessions'][0]['created'] == 'created-10'
|
||||
|
||||
|
||||
def test_unknown_scope_is_visible_but_never_closed_even_with_force(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
process = row(10, ''); process['command'] = 'LibraryManager.exe'
|
||||
process['name'] = 'LibraryManager.exe'
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [process])
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {})
|
||||
monkeypatch.setattr(sessions, '_process_identity', lambda r: {'created_handle': 'old', 'image': r['executable']})
|
||||
plan = sessions.inspect_residual_sessions(library)
|
||||
assert plan['sessions'] and plan['sessions'][0]['scope_confirmed'] is False
|
||||
monkeypatch.setattr(sessions, '_request_close', lambda *a, **kw: pytest.fail('closed unknown scope'))
|
||||
monkeypatch.setattr(sessions, '_force_close', lambda *a, **kw: pytest.fail('ended unknown scope'))
|
||||
for force in (False, True):
|
||||
result = sessions.release_residual_sessions(plan, tmp_path.parent/'release-evidence'/tmp_path.name, force=force)
|
||||
assert result['status'] == 'PARTIAL'
|
||||
# A request file becoming readable must not expand the user's consent list.
|
||||
monkeypatch.setattr('cbb_refresh_verify.library_lock._owner_matches_scope', lambda *a: True)
|
||||
result = sessions.release_residual_sessions(plan, tmp_path.parent/'release-evidence'/tmp_path.name, force=True)
|
||||
assert result['status'] == 'PARTIAL'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('name,title,children,expected', [
|
||||
('iCDBProjectBackup.exe', 'iCDB Project Backup - test', [], True),
|
||||
('ExpeditionPCB.exe', 'Expedition PCB - Reusable Block', [], True),
|
||||
('ExpeditionPCB.exe', 'Design.pcb - Expedition PCB', [], True),
|
||||
('iCDBProjectBackup.exe', 'iCDB Project Backup - test', [{'class': 'msctls_progress32', 'text': ''}], False),
|
||||
])
|
||||
def test_only_idle_supported_native_windows_are_offered_for_close(name, title, children, expected):
|
||||
api()
|
||||
from cbb_refresh_verify.residual_sessions import close_target
|
||||
windows = [{'hwnd': 100, 'class': 'Afx:main', 'title': title, 'enabled': True,
|
||||
'children': children, 'documents': [], 'output': 'Backup information loaded correctly.'}]
|
||||
target, reason = close_target(name, windows)
|
||||
assert bool(target) is expected
|
||||
if not expected: assert reason
|
||||
|
||||
|
||||
def test_confirmation_rechecks_pid_reuse_and_never_posts_to_replacement(tmp_path, monkeypatch):
|
||||
inspect, release = api()
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
process = row(10, tmp_path/'ReusableBlocksLP/A/Work/A.prj')
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [process.copy()])
|
||||
monkeypatch.setattr(sessions, '_process_identity', lambda r: {'created_handle': 'old', 'image': r['executable']})
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {10: []})
|
||||
plan = inspect(library)
|
||||
process['created'] = 'replacement'
|
||||
monkeypatch.setattr(sessions, '_request_close', lambda *_: pytest.fail('closed replacement PID'))
|
||||
monkeypatch.setattr(sessions, '_finish_library_release', lambda *_: {'status': 'RELEASE_CONFIRMED'})
|
||||
result = release(plan, tmp_path.parent/'release-evidence'/tmp_path.name)
|
||||
assert result['sessions'][0]['release_status'] == 'IDENTITY_CHANGED'
|
||||
assert result['status'] == 'PARTIAL'
|
||||
|
||||
|
||||
def test_close_requests_cover_whole_preview_and_failures_remain_per_item(tmp_path, monkeypatch):
|
||||
inspect, release = api()
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
rows = [row(p, tmp_path/f'ReusableBlocksLP/{p}/Work/{p}.prj') for p in (10, 20)]
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: rows)
|
||||
monkeypatch.setattr(sessions, '_process_identity', lambda r: {'created_handle': r['created'], 'image': r['executable']})
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {})
|
||||
calls = []
|
||||
monkeypatch.setattr(sessions, '_request_close', lambda r, *_, **kw: calls.append(r['pid']) or
|
||||
{'release_status': 'RELEASED' if r['pid'] == 10 else 'WAITING', 'detail': 'native window pending'})
|
||||
monkeypatch.setattr(sessions, '_finish_library_release', lambda *_: pytest.fail('partial release cleared library marker'))
|
||||
result = release(inspect(library), tmp_path.parent/'release-evidence'/tmp_path.name)
|
||||
assert calls == [10, 20]
|
||||
assert result['status'] == 'PARTIAL'
|
||||
assert [r['release_status'] for r in result['sessions']] == ['RELEASED', 'WAITING']
|
||||
|
||||
|
||||
def test_no_remaining_processes_rechecks_and_clears_old_metadata(tmp_path, monkeypatch):
|
||||
inspect, release = api()
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [])
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {})
|
||||
proof = {'status': 'RELEASE_CONFIRMED', 'library': str(library), 'evidence_path': 'proof.json'}
|
||||
monkeypatch.setattr(sessions, '_finish_library_release', lambda *_: proof)
|
||||
result = release(inspect(library), tmp_path.parent/'release-evidence'/tmp_path.name)
|
||||
assert result['status'] == 'RELEASE_CONFIRMED' and result['proof'] == proof
|
||||
|
||||
|
||||
def test_empty_session_scan_still_exposes_historical_operation_record(tmp_path, monkeypatch):
|
||||
import json
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
from cbb_refresh_verify.library_lock import blocker_path
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
marker = blocker_path(library)
|
||||
marker.write_text(json.dumps({'protocol': 'cbb-refresh-verify-library-lease', 'version': 1,
|
||||
'library': str(library), 'lease_id': 'a'*32, 'pid': 57076,
|
||||
'status': 'OWNER_RELEASE_UNCONFIRMED', 'time': '2026-11-04T09:43:50+00:00'}))
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [])
|
||||
result = sessions.inspect_residual_sessions(library)
|
||||
assert result['sessions'] == []
|
||||
assert result['previous_records'][0]['path'] == str(marker)
|
||||
assert result['previous_records'][0]['time'].startswith('2026-11-04')
|
||||
assert marker.exists()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('output', [None, 'Repairing project\nRepair backup created successfully.',
|
||||
'Repairing project\nBackup information loaded correctly.\nRestoring project'])
|
||||
def test_backup_intermediate_success_does_not_allow_cooperative_close(output):
|
||||
from cbb_refresh_verify.residual_sessions import close_target
|
||||
window = {'hwnd': 10, 'class': 'Afx:main', 'title': 'iCDB Project Backup - test',
|
||||
'children': [], 'enabled': True, 'output': output}
|
||||
assert close_target('iCDBProjectBackup.exe', [window])[0] is None
|
||||
|
||||
|
||||
def test_force_requires_separate_explicit_argument_and_rechecks_identity(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
process = row(10, tmp_path/'ReusableBlocksLP/A/Work/A.prj')
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [process.copy()])
|
||||
monkeypatch.setattr(sessions, '_process_identity', lambda r: {'created_handle': 'old', 'image': r['executable']})
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {})
|
||||
monkeypatch.setattr(sessions, '_request_close', lambda *a, **k: {'release_status': 'WAITING', 'detail': 'hung'})
|
||||
forced = []
|
||||
monkeypatch.setattr(sessions, '_force_close', lambda r, **kw: forced.append(r['pid']) or
|
||||
{'release_status': 'WAITING', 'detail': 'exiting'})
|
||||
plan = sessions.inspect_residual_sessions(library)
|
||||
evidence = tmp_path.parent/'release-evidence'/tmp_path.name
|
||||
sessions.release_residual_sessions(plan, evidence)
|
||||
assert not forced
|
||||
sessions.release_residual_sessions(plan, evidence, force=True)
|
||||
assert forced == [10]
|
||||
process['created'] = 'reused'
|
||||
sessions.release_residual_sessions(plan, evidence, force=True)
|
||||
assert forced == [10]
|
||||
|
||||
|
||||
def test_current_process_handle_identity_uses_real_windows_api():
|
||||
import os
|
||||
from cbb_refresh_verify.residual_sessions import _process_identity
|
||||
identity = _process_identity({'pid': os.getpid()})
|
||||
assert identity['created_handle'] and Path(identity['image']).is_file()
|
||||
|
||||
|
||||
def test_force_checks_exact_handle_before_ending_owned_test_helper():
|
||||
import subprocess
|
||||
import sys
|
||||
from cbb_refresh_verify.residual_sessions import _process_identity, _force_close
|
||||
child = subprocess.Popen([sys.executable, '-c', 'import time; time.sleep(30)'],
|
||||
creationflags=subprocess.CREATE_NO_WINDOW)
|
||||
try:
|
||||
process = {'pid': child.pid, **_process_identity({'pid': child.pid})}
|
||||
changed = {**process, 'created_handle': 'different process'}
|
||||
assert _force_close(changed)['release_status'] == 'IDENTITY_CHANGED'
|
||||
assert child.poll() is None
|
||||
assert _force_close(process)['release_status'] == 'RELEASED'
|
||||
assert child.wait(3) == 1
|
||||
finally:
|
||||
if child.poll() is None:
|
||||
child.terminate(); child.wait(3) # This test's sleep-only helper.
|
||||
|
||||
|
||||
def test_partial_desktop_enumeration_never_offers_normal_close(monkeypatch):
|
||||
import win32gui, win32service
|
||||
from cbb_refresh_verify.residual_sessions import _process_windows, close_target
|
||||
def failed(*_): raise OSError('desktop disappeared')
|
||||
monkeypatch.setattr(win32gui, 'EnumWindows', failed)
|
||||
monkeypatch.setattr(win32service, 'GetProcessWindowStation', lambda: SimpleNamespace(EnumDesktops=lambda: []))
|
||||
windows = _process_windows({10})[10]
|
||||
assert any(w['class'] == 'UNCONFIRMED' for w in windows)
|
||||
windows.append({'hwnd': 100, 'class': 'Afx:main', 'title': 'Design - Expedition PCB',
|
||||
'children': [], 'enabled': True})
|
||||
assert close_target('ExpeditionPCB.exe', windows)[0] is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('choice', [6, 7, 2])
|
||||
def test_save_answers_require_current_exact_prompt_and_process(monkeypatch, choice):
|
||||
import win32con, win32gui, win32process
|
||||
from contextlib import nullcontext
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
process = row(10, 'C:/Lib/ReusableBlocksLP/A/Work/A.prj')
|
||||
process.update(created_handle='creation', image='pcb.exe')
|
||||
dialog = {'hwnd': 100, 'class': '#32770', 'title': 'Expedition PCB', 'children': [
|
||||
{'class': 'Static', 'text': 'Save changes to the modified design?'},
|
||||
*[{'class': 'Button', 'text': text, 'enabled': True, 'id': code, 'hwnd': code}
|
||||
for code, text in ((6, 'Yes'), (7, 'No'), (2, 'Cancel'))]]}
|
||||
windows = [dialog]
|
||||
process['prompt'] = sessions._save_question(windows)
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [process])
|
||||
monkeypatch.setattr(sessions, '_process_handle', lambda _: nullcontext(123))
|
||||
monkeypatch.setattr(sessions, '_handle_identity', lambda _: {'created_handle': 'creation', 'image': 'pcb.exe'})
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {10: windows})
|
||||
monkeypatch.setattr(win32process, 'GetWindowThreadProcessId', lambda _: (1, 10))
|
||||
clicked = []
|
||||
monkeypatch.setattr(win32gui, 'PostMessage', lambda *a: clicked.append(a))
|
||||
sessions._answer_save_question(process, choice)
|
||||
assert clicked == [(choice, win32con.BM_CLICK, 0, 0)]
|
||||
dialog['children'][0]['text'] = 'Save changes to another modified design?'
|
||||
with pytest.raises(ValueError, match='提示已变化'):
|
||||
sessions._answer_save_question(process, choice)
|
||||
assert len(clicked) == 1
|
||||
@@ -1,166 +0,0 @@
|
||||
from pathlib import Path
|
||||
from threading import Event
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
from PySide6.QtCore import QCoreApplication, QEvent
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
from shiboken6 import isValid
|
||||
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
|
||||
|
||||
def flush_deletes():
|
||||
QCoreApplication.sendPostedEvents(None, QEvent.DeferredDelete)
|
||||
|
||||
|
||||
def test_repeated_batch_results_retire_previous_dialog(qtbot, tmp_path):
|
||||
from cbb_refresh_verify.ui.main_window import MainWindow
|
||||
window = MainWindow(data_root=tmp_path)
|
||||
qtbot.addWidget(window)
|
||||
window._batch_done(([VerifyResult('FAIL')], tmp_path/'report.log'))
|
||||
previous = window.summary
|
||||
window._batch_done(([VerifyResult('PASS')], tmp_path/'report2.log'))
|
||||
flush_deletes()
|
||||
assert not isValid(previous)
|
||||
assert len(window.findChildren(QMessageBox)) == 1
|
||||
current = window.summary
|
||||
current.close()
|
||||
flush_deletes()
|
||||
assert not isValid(current)
|
||||
window._update() # No retained reference to deleted result actions.
|
||||
|
||||
|
||||
def test_repeated_icdb_results_preserve_latest_recovery_task(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from test_reimport_recovery import failed_repair
|
||||
window = load_window(qtbot, tmp_path, monkeypatch,
|
||||
verifier=lambda _: failed_repair(tmp_path/'result.json', safe=True))
|
||||
window._run(['Beta'], maintenance=True)
|
||||
qtbot.waitUntil(lambda: not window._icdb_active())
|
||||
first_task, previous = window.icdb_task, window.icdb_summary
|
||||
window._run(['Gamma'], maintenance=True)
|
||||
qtbot.waitUntil(lambda: not window._icdb_active())
|
||||
flush_deletes()
|
||||
assert not isValid(previous)
|
||||
assert not hasattr(first_task, 'summary')
|
||||
assert len(window.findChildren(QMessageBox)) == 1
|
||||
assert window.icdb_task.summary is window.icdb_summary
|
||||
action = next(b for b in window.icdb_summary.buttons() if '副本' in b.text())
|
||||
action.click()
|
||||
assert [request.name for request in window.management_dialog.requests()] == ['Gamma']
|
||||
window.management_dialog.reject()
|
||||
window._invalidate_check_targets('test.lmc', ['Beta', 'Gamma'])
|
||||
window._update()
|
||||
|
||||
|
||||
def test_batch_replacement_preserves_independent_icdb_result(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
window = load_window(qtbot, tmp_path, monkeypatch,
|
||||
verifier=lambda _: VerifyResult('CHECKED'))
|
||||
window._run(['Beta'], maintenance=True)
|
||||
qtbot.waitUntil(lambda: not window._icdb_active())
|
||||
icdb_summary = window.icdb_summary
|
||||
window._batch_done(([VerifyResult('PASS')], tmp_path/'first.log'))
|
||||
old_batch = window.summary
|
||||
window._batch_done(([VerifyResult('PASS')], tmp_path/'second.log'))
|
||||
flush_deletes()
|
||||
assert not isValid(old_batch)
|
||||
assert isValid(icdb_summary) and icdb_summary.isVisible()
|
||||
assert window.icdb_task.summary is icdb_summary
|
||||
assert len(window.findChildren(QMessageBox)) == 2
|
||||
|
||||
|
||||
def test_close_wait_notice_remains_visible_and_timer_stops_on_idle(qtbot, tmp_path):
|
||||
from cbb_refresh_verify.ui.main_window import MainWindow
|
||||
entered, release = Event(), Event()
|
||||
def close_lease():
|
||||
entered.set()
|
||||
release.wait(5)
|
||||
window = MainWindow(data_root=tmp_path)
|
||||
qtbot.addWidget(window)
|
||||
window.library_lease = SimpleNamespace(close=close_lease)
|
||||
window.show()
|
||||
try:
|
||||
window.close()
|
||||
qtbot.waitUntil(entered.is_set)
|
||||
assert window.isVisible() and '等待' in window.windowTitle()
|
||||
timer = window.close_wait_timer
|
||||
assert timer.isActive() and timer.interval() == 120_000
|
||||
timer.start(10)
|
||||
qtbot.waitUntil(lambda: '仍在等待' in window.windowTitle())
|
||||
assert '仍在等待' in window.status_label.text()
|
||||
window.close()
|
||||
assert window.isVisible()
|
||||
finally:
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda: not window.isVisible())
|
||||
assert not timer.isActive()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def batch_cli(tmp_path, monkeypatch):
|
||||
import cbb_refresh_verify.application as application
|
||||
import cbb_refresh_verify.library_reader as reader
|
||||
import cbb_refresh_verify.network_path as network
|
||||
import cbb_refresh_verify.verify_runner as runner
|
||||
from cbb_refresh_verify.models import CbbRecord, LibraryReadResult
|
||||
log, requested, retained = [], [], []
|
||||
def record(message, *args, **kwargs):
|
||||
log.append(message % args if args else message)
|
||||
logger = SimpleNamespace(info=record, warning=record, exception=record, handlers=())
|
||||
monkeypatch.setattr(application, 'configure', lambda *_: SimpleNamespace(root=tmp_path, logger=logger))
|
||||
class Lease:
|
||||
display_path = Path(r'\\server\share\library')
|
||||
mentor_path = tmp_path/'lib.lmc'
|
||||
drive, remote_root, created = 'Z:', r'\\server\share', True
|
||||
def __enter__(self): return self
|
||||
def __exit__(self, *_): pass
|
||||
def retain_for_recovery(self): retained.append(self.drive)
|
||||
monkeypatch.setattr(network.LibraryPathLease, 'acquire', lambda _: Lease())
|
||||
monkeypatch.setattr(network, 'select_library_file', lambda path: path)
|
||||
monkeypatch.setattr(reader, 'read_library_fast', lambda *a, **kw: LibraryReadResult((
|
||||
CbbRecord('Ready', 'LP', status='READY'), CbbRecord('One', 'LP'),
|
||||
CbbRecord('Two', 'LP'), CbbRecord('Three', 'LP'))))
|
||||
def run(requests):
|
||||
requested.extend(request.block_name for request in requests)
|
||||
return [VerifyResult('PASS') for _ in requests]
|
||||
monkeypatch.setattr(runner, 'run_batch', run)
|
||||
monkeypatch.setattr(runner, 'write_batch_report', lambda *a: tmp_path/'batch.log')
|
||||
return application, runner, log, requested, retained
|
||||
|
||||
|
||||
@pytest.mark.parametrize('extra, expected, counts', [
|
||||
([], ['One', 'Two', 'Three'], (3, 3, 0)),
|
||||
(['--limit', '2'], ['One', 'Two'], (2, 3, 1)),
|
||||
(['--block', 'Three', '--block', 'One', '--limit', '1'], ['Three'], (1, 2, 1)),
|
||||
])
|
||||
def test_batch_cli_limit_is_optional_and_reports_selection(batch_cli, extra, expected, counts):
|
||||
app, _, log, requested, _ = batch_cli
|
||||
assert app.main(['--batch-lmc', 'lib.lmc', *extra]) == 0
|
||||
assert requested == expected
|
||||
assert any(all(f'{key}={value}' in line for key, value in zip(
|
||||
('selected', 'total', 'remaining'), counts)) for line in log)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('value', ['0', '-1', 'no'])
|
||||
def test_batch_cli_rejects_nonpositive_limit(batch_cli, value):
|
||||
app, _, _, requested, _ = batch_cli
|
||||
with pytest.raises(SystemExit) as error:
|
||||
app.main(['--batch-lmc', 'lib.lmc', '--limit', value])
|
||||
assert error.value.code == 2 and not requested
|
||||
|
||||
|
||||
@pytest.mark.parametrize('raised', [False, True])
|
||||
def test_retained_mapping_logs_context_and_confirmed_release_guidance(batch_cli, monkeypatch, raised):
|
||||
app, runner, log, _, retained = batch_cli
|
||||
def run(_):
|
||||
if raised: raise RuntimeError('native writer status unknown')
|
||||
return [VerifyResult('FAIL', safe_to_continue=False)]
|
||||
monkeypatch.setattr(runner, 'run_batch', run)
|
||||
assert app.main(['--batch-lmc', 'lib.lmc', '--block', 'One']) == (1 if raised else 2)
|
||||
assert retained == ['Z:']
|
||||
notice = next(line for line in log if 'batch_drive_retained' in line)
|
||||
assert 'Z:' in notice and r'\\server\share' in notice
|
||||
assert '释放残留会话' in notice and '确认' in notice
|
||||
assert 'net use' not in notice.lower()
|
||||
@@ -1,151 +0,0 @@
|
||||
import json
|
||||
from dataclasses import replace
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from test_management import setup, execute
|
||||
|
||||
|
||||
def test_maintenance_totals_do_not_count_pass_as_unconfirmed():
|
||||
from cbb_refresh_verify.icdb_maintenance import maintenance_counts
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
counts = maintenance_counts([VerifyResult('PASS'), VerifyResult('CHECKED'),
|
||||
VerifyResult('FAIL'), VerifyResult('SKIPPED')])
|
||||
assert counts['passed'] == 1 and counts['unconfirmed'] == 1
|
||||
assert sum(counts[k] for k in ('passed', 'checked_without_repair', 'unconfirmed',
|
||||
'skipped', 'cancelled', 'issues_found', 'in_use')) == counts['total']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('occupied', [False, True])
|
||||
def test_verify_rechecks_history_instead_of_ignoring_or_permanently_blocking_it(tmp_path, monkeypatch, occupied):
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
import cbb_refresh_verify.verify_runner as runner
|
||||
library = tmp_path/'library/lib.lmc'; library.parent.mkdir(); library.touch()
|
||||
locks._persist_blocker(library, lease_id='a'*32, block_name='Target')
|
||||
before = locks.blocker_path(library).read_bytes()
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
|
||||
address = library.parent/'ReusableBlocksLP/Target/Work/database/cdbsvr/sAddress.adr'
|
||||
if occupied:
|
||||
address.parent.mkdir(parents=True); address.touch()
|
||||
called = []
|
||||
monkeypatch.setattr(runner, '_run_verify_serialized', lambda *a, **kw:
|
||||
called.append(1) or runner.VerifyResult('PASS', library_flag='GREEN'))
|
||||
events = []
|
||||
result = runner.run_verify(runner.VerifyRequest(library, 'Target', tmp_path/'evidence'), progress=events.append)
|
||||
if occupied:
|
||||
assert not called and result.safe_to_continue
|
||||
assert result.error_category == 'LIBRARY_IN_USE'
|
||||
assert locks.blocker_path(library).read_bytes() == before
|
||||
else:
|
||||
assert called == [1] and result.status == 'PASS'
|
||||
assert result.release_proof['data_recovery_confirmed'] is False
|
||||
assert not locks.blocker_path(library).exists()
|
||||
assert any(e['stage'] == 'previous_release_confirmed' for e in events)
|
||||
|
||||
|
||||
def test_management_preserves_release_context_before_first_native_call(setup, monkeypatch):
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
request, adapter, _ = setup
|
||||
locks._persist_blocker(request.library, lease_id='b'*32)
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
|
||||
catalog = adapter.catalog
|
||||
def inspect(library, evidence):
|
||||
checkpoint = next(request.evidence_dir.glob('*/checkpoint.json'))
|
||||
history = json.loads(checkpoint.read_text('utf-8'))['history']
|
||||
assert any(item.get('release_proof', {}).get('data_recovery_confirmed') is False for item in history)
|
||||
return catalog(library, evidence)
|
||||
monkeypatch.setattr(adapter, 'catalog', inspect)
|
||||
result = execute(request, adapter)
|
||||
assert result.status == 'REMOVED' and result.release_proof['status'] == 'RELEASE_CONFIRMED'
|
||||
|
||||
|
||||
def test_management_records_scoped_changes_without_hashing_unrelated_cbb(setup, monkeypatch):
|
||||
request, adapter, _ = setup
|
||||
root = request.library.parent
|
||||
target = root/'ReusableBlocksLP/Block/Work/Block.prj'
|
||||
deleted = root/'ReusableBlocksLP/Block/Work/obsolete.dat'; deleted.write_bytes(b'old')
|
||||
shared = root/'SymbolLibs/shared/icdb.dat'; shared.parent.mkdir(parents=True); shared.write_bytes(b'old')
|
||||
foreign = root/'ReusableBlocksLP/Other/Work/private.dat'; foreign.parent.mkdir(parents=True); foreign.write_bytes(b'other')
|
||||
original_open = Path.open
|
||||
def opened(path, *args, **kwargs):
|
||||
assert path != foreign, 'Post-write report must not add whole-library hashing'
|
||||
return original_open(path, *args, **kwargs)
|
||||
monkeypatch.setattr(Path, 'open', opened)
|
||||
remove = adapter.remove
|
||||
def mutate(req, evidence):
|
||||
target.write_bytes(target.read_bytes()+b'# updated\n')
|
||||
deleted.unlink(); (target.parent/'created.dat').write_bytes(b'new')
|
||||
shared.write_bytes(b'changed')
|
||||
return remove(req, evidence)
|
||||
monkeypatch.setattr(adapter, 'remove', mutate)
|
||||
result = execute(request, adapter)
|
||||
report = json.loads((result.evidence_path.parent/'library-changes.json').read_text('utf-8'))
|
||||
assert report['status'] == 'RECORDED' and report['unrelated_cbb_content_checked'] is False
|
||||
assert report['added'] == ['ReusableBlocksLP/Block/Work/created.dat']
|
||||
assert report['deleted'] == ['ReusableBlocksLP/Block/Work/obsolete.dat']
|
||||
assert 'SymbolLibs/shared/icdb.dat' in report['modified']
|
||||
assert 'ReusableBlocksLP/Block/Work/Block.prj' in report['modified']
|
||||
assert result.change_report == report
|
||||
assert report['rule_version'] == 1
|
||||
assert report['scope'] == {'kind': 'library', 'block_name': 'Block',
|
||||
'library_name': request.library.name}
|
||||
from cbb_refresh_verify import scoped_manifest as manifests
|
||||
assert report['excluded_categories'] == sorted(manifests._NONPRIMARY_DIRECTORIES)
|
||||
assert report['excluded_suffixes'] == sorted(manifests._NONPRIMARY_SUFFIXES)
|
||||
runtime = report['runtime_exclusions']
|
||||
assert runtime['native_directory_names'] == ['dbcheck', 'dbrestore', 'log']
|
||||
assert runtime['file_names'] == ['saddress.adr']
|
||||
assert runtime['file_name_prefixes'] == ['~$']
|
||||
assert runtime['relative_directories'] == ['projectbackup/backups']
|
||||
assert runtime['directory_prefixes'] == ['work.before-restore-']
|
||||
assert 'selected CBB Work/Cert root or its PCB child' in runtime['directory_name_positions']
|
||||
assert 'SymbolLibs/<partition>/cdbsvr' in runtime['native_directory_positions']
|
||||
|
||||
|
||||
def test_failed_mutation_still_records_changes_and_release_fact(setup):
|
||||
request, adapter, source = setup
|
||||
adapter.fail_add = True
|
||||
result = execute(replace(request, operation='update', source=source), adapter)
|
||||
assert result.status == 'RECOVERY_REQUIRED' and result.safe_to_continue
|
||||
assert result.change_report['status'] == 'RECORDED'
|
||||
|
||||
|
||||
def test_change_report_storage_failure_does_not_invent_unfinished_native_write(setup, monkeypatch):
|
||||
import cbb_refresh_verify.management as management
|
||||
request, adapter, _ = setup
|
||||
original = management._write_json
|
||||
def write(path, value):
|
||||
if path.name == 'library-changes.json': raise PermissionError('report disk full')
|
||||
return original(path, value)
|
||||
monkeypatch.setattr(management, '_write_json', write)
|
||||
result = execute(request, adapter)
|
||||
assert result.safe_to_continue and result.status == 'REMOVED'
|
||||
assert result.change_report['status'] == 'UNCONFIRMED'
|
||||
assert 'report disk full' in result.detail
|
||||
assert not management.unfinished_operations(request.evidence_dir)
|
||||
|
||||
|
||||
def test_bad_history_evidence_location_does_not_turn_prelaunch_error_into_unreleased_session(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock as locks, verify_runner as runner
|
||||
library=tmp_path/'lib.lmc';library.touch()
|
||||
locks._persist_blocker(library,lease_id='c'*32)
|
||||
monkeypatch.setattr(runner,'_run_verify_serialized',lambda *a,**kw:pytest.fail('invalid evidence launched native work'))
|
||||
result=runner.run_verify(runner.VerifyRequest(library,'Target',tmp_path/'evidence'))
|
||||
assert result.safe_to_continue and result.error_category=='LIBRARY_ACCESS_FAILED'
|
||||
assert locks.blocker_path(library).exists()
|
||||
|
||||
|
||||
def test_history_probe_timeout_does_not_stop_next_independent_library(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock as locks, verify_runner as runner
|
||||
a=tmp_path/'A/lib.lmc';a.parent.mkdir();a.touch()
|
||||
b=tmp_path/'B/lib.lmc';b.parent.mkdir();b.touch()
|
||||
locks._persist_blocker(a,lease_id='d'*32)
|
||||
def timeout(*args):raise RuntimeError('OWNER_QUERY_TIMEOUT')
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',timeout)
|
||||
calls=[]
|
||||
monkeypatch.setattr(runner,'_run_verify_serialized',lambda req,**kw:
|
||||
calls.append(req.lmc_file) or runner.VerifyResult('PASS'))
|
||||
results=runner.run_batch([runner.VerifyRequest(p,'Target',tmp_path/'evidence') for p in (a,b)])
|
||||
assert [r.status for r in results]==['FAIL','PASS']
|
||||
assert results[0].safe_to_continue and calls==[b]
|
||||
@@ -1,52 +0,0 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from cbb_refresh_verify import library_lock as locks
|
||||
|
||||
|
||||
@pytest.mark.parametrize('retained_owner', [False, True])
|
||||
def test_releasing_another_blocks_checkpoint_names_its_owner(tmp_path, monkeypatch, retained_owner):
|
||||
library = tmp_path/'library/lib.lmc'
|
||||
library.parent.mkdir(); library.touch()
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
|
||||
lease = None
|
||||
if retained_owner:
|
||||
with locks.LibraryLock(library, block_name='BlockB', safe_to_release=lambda: False) as lease:
|
||||
pass
|
||||
else:
|
||||
locks._persist_blocker(library, lease_id='b'*32, block_name='BlockB')
|
||||
before = locks.blocker_path(library).read_bytes()
|
||||
try:
|
||||
proof = locks.release_retained_library(library, tmp_path/'evidence', block_name='BlockA')
|
||||
assert proof['requested_block_name'] == 'BlockA'
|
||||
assert proof['proof_scope'] == 'LIBRARY'
|
||||
assert proof['reconciled_foreign_blockers'] == ['BlockB']
|
||||
assert proof['data_recovery_confirmed'] is False
|
||||
checkpoint = next(r for r in proof['reconciled_checkpoints'] if r['kind'] == 'checkpoint')
|
||||
assert checkpoint['block_name'] == 'BlockB' and checkpoint['status'] == 'OWNER_RELEASE_UNCONFIRMED'
|
||||
assert checkpoint['lease_id']
|
||||
proof_path = Path(proof['evidence_path'])
|
||||
assert json.loads(proof_path.read_text('utf-8'))['reconciled_foreign_blockers'] == ['BlockB']
|
||||
assert (proof_path.parent/'blocker-before-0.json').read_bytes() == before
|
||||
assert not locks.blocker_path(library).exists()
|
||||
if retained_owner:
|
||||
assert any(r['kind'] == 'retained_owner' and r['block_name'] == 'BlockB'
|
||||
for r in proof['reconciled_checkpoints'])
|
||||
finally:
|
||||
if lease:
|
||||
with locks._guard:
|
||||
owner = locks._owners.pop(lease.key, None)
|
||||
if owner:
|
||||
owner['handle'].Close()
|
||||
|
||||
|
||||
def test_matching_checkpoint_uses_block_scope_without_foreign_targets(tmp_path, monkeypatch):
|
||||
library = tmp_path/'library/lib.lmc'
|
||||
library.parent.mkdir(); library.touch()
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
|
||||
locks._persist_blocker(library, lease_id='a'*32, block_name='BlockA')
|
||||
proof = locks.release_retained_library(library, tmp_path/'evidence', block_name='BlockA')
|
||||
assert proof['proof_scope'] == 'BLOCK' and proof['proof_block_name'] == 'BlockA'
|
||||
assert proof['reconciled_foreign_blockers'] == []
|
||||
@@ -1,45 +0,0 @@
|
||||
from dataclasses import replace
|
||||
|
||||
from test_management import setup
|
||||
|
||||
|
||||
def test_released_item_failure_does_not_claim_entire_queue_stopped(qtbot, setup):
|
||||
from cbb_refresh_verify.management import ManagementResult
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
request, _, _ = setup
|
||||
dialog=ManagementDialog([request]);qtbot.addWidget(dialog)
|
||||
result=ManagementResult(request.operation,request.library,request.name,request.partition,
|
||||
None,False,'complete','RECOVERY_REQUIRED',True,'native add failed')
|
||||
dialog._result([result])
|
||||
assert '需要人工恢复' in dialog.status_label.text()
|
||||
assert '队列已停止' not in dialog.status_label.text()
|
||||
|
||||
|
||||
def test_report_failure_is_visible_without_inventing_native_failure(qtbot, setup):
|
||||
from cbb_refresh_verify.management import ManagementResult
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
request, _, _=setup
|
||||
dialog=ManagementDialog([request]);qtbot.addWidget(dialog)
|
||||
result=ManagementResult(request.operation,request.library,request.name,request.partition,
|
||||
None,False,'complete','REMOVED',True,'removed',release_proof={
|
||||
'status':'RELEASE_CONFIRMED','data_recovery_confirmed':False},
|
||||
change_report={'status':'UNCONFIRMED','detail':'report disk full'})
|
||||
dialog._result([result])
|
||||
assert '已移除' in dialog.status_label.text() and '变更清单待核对' in dialog.status_label.text()
|
||||
assert '历史会话已释放' in dialog.output.toPlainText()
|
||||
dialog._progress({'stage':'previous_release_check','block':request.name})
|
||||
assert '正在复核历史占用' in dialog.status_label.text()
|
||||
|
||||
|
||||
def test_recorded_counts_identify_compared_engineering_file_scope(qtbot, setup):
|
||||
from cbb_refresh_verify.management import ManagementResult
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
request, _, _ = setup
|
||||
dialog = ManagementDialog([request]); qtbot.addWidget(dialog)
|
||||
result = ManagementResult(request.operation, request.library, request.name, request.partition,
|
||||
None, False, 'complete', 'REMOVED', True, 'removed',
|
||||
change_report={'status': 'RECORDED', 'added': ['a'], 'deleted': [], 'modified': ['b']})
|
||||
dialog._result([result])
|
||||
text = dialog.output.toPlainText()
|
||||
assert '已比对的工程文件' in text
|
||||
assert '新增 1' in text and '删除 0' in text and '修改 1' in text
|
||||
@@ -118,42 +118,17 @@ def test_corrupted_destination_bytes_are_rejected_and_evidence_is_preserved(tmp_
|
||||
assert (destination/relative).exists()
|
||||
|
||||
|
||||
def test_unlocked_primary_copy_reads_source_twice_and_target_once(tmp_path, monkeypatch):
|
||||
from collections import Counter
|
||||
source, destination = tmp_path/'source', tmp_path/'destination'
|
||||
primary = put(source, 'A.prj', b'engineering' * 100000)
|
||||
reads = Counter()
|
||||
original_open = Path.open
|
||||
def opened(path, mode='r', *args, **kwargs):
|
||||
if mode == 'rb':
|
||||
reads[path] += 1
|
||||
return original_open(path, mode, *args, **kwargs)
|
||||
monkeypatch.setattr(Path, 'open', opened)
|
||||
hashes = Counter()
|
||||
original_hash = recovery._hash
|
||||
def hashed(path):
|
||||
hashes[path] += 1
|
||||
return original_hash(path)
|
||||
monkeypatch.setattr(recovery, '_hash', hashed)
|
||||
manifest = recovery._copy_verified(source, destination)
|
||||
assert hashes[primary] == 1 # Only the final source rehash is a separate pass.
|
||||
assert hashes[destination/'A.prj'] == 1
|
||||
assert reads[primary] == 2 # Copy/hash stream, then final source content proof.
|
||||
assert reads[destination/'A.prj'] == 1
|
||||
assert manifest['files']['A.prj']['sha256'] == hashlib.sha256(primary.read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def test_source_byte_changes_with_preserved_metadata_are_rejected(tmp_path, monkeypatch):
|
||||
source, destination = tmp_path/'source', tmp_path/'destination'
|
||||
primary = put(source, 'A.prj')
|
||||
real_copy = shutil.copystat
|
||||
real_copy = shutil.copy2
|
||||
def copy_then_change_source(src, dst, *args, **kwargs):
|
||||
result = real_copy(src, dst, *args, **kwargs)
|
||||
metadata = primary.stat()
|
||||
primary.write_bytes(b'X' * metadata.st_size)
|
||||
os.utime(primary, ns=(metadata.st_atime_ns, metadata.st_mtime_ns))
|
||||
return result
|
||||
monkeypatch.setattr(shutil, 'copystat', copy_then_change_source)
|
||||
monkeypatch.setattr(shutil, 'copy2', copy_then_change_source)
|
||||
with pytest.raises(OSError):
|
||||
recovery._copy_verified(source, destination)
|
||||
assert (destination/'A.prj').read_bytes() == b'engineering'
|
||||
@@ -165,7 +140,7 @@ def test_complete_tree_metadata_must_stay_stable_during_copy(tmp_path, monkeypat
|
||||
put(source, 'A.prj')
|
||||
runtime = put(source, 'logs/session.log')
|
||||
destination = tmp_path/'destination'
|
||||
real_copy = shutil.copystat
|
||||
real_copy = shutil.copy2
|
||||
def copy_then_mutate(src, dst, *args, **kwargs):
|
||||
result = real_copy(src, dst, *args, **kwargs)
|
||||
if Path(src).name == 'A.prj':
|
||||
@@ -176,7 +151,7 @@ def test_complete_tree_metadata_must_stay_stable_during_copy(tmp_path, monkeypat
|
||||
else:
|
||||
put(source, 'logs/added.log')
|
||||
return result
|
||||
monkeypatch.setattr(shutil, 'copystat', copy_then_mutate)
|
||||
monkeypatch.setattr(shutil, 'copy2', copy_then_mutate)
|
||||
with pytest.raises(OSError):
|
||||
recovery._copy_verified(source, destination)
|
||||
assert destination.exists()
|
||||
@@ -302,7 +277,7 @@ def test_colliding_engineering_names_cannot_bypass_primary_copy_byte_checks(tmp_
|
||||
scope = ManifestScope.library(block, 'target.lmc')
|
||||
source, destination = tmp_path/'source', tmp_path/'destination'
|
||||
put(source, relative)
|
||||
real_copy = shutil.copystat
|
||||
real_copy = shutil.copy2
|
||||
def copy_then_corrupt(src, dst, *args, **kwargs):
|
||||
result = real_copy(src, dst, *args, **kwargs)
|
||||
corrupt = Path(src) if side == 'source' else Path(dst)
|
||||
@@ -310,7 +285,7 @@ def test_colliding_engineering_names_cannot_bypass_primary_copy_byte_checks(tmp_
|
||||
corrupt.write_bytes(b'X' * metadata.st_size)
|
||||
os.utime(corrupt, ns=(metadata.st_atime_ns, metadata.st_mtime_ns))
|
||||
return result
|
||||
monkeypatch.setattr(shutil, 'copystat', copy_then_corrupt)
|
||||
monkeypatch.setattr(shutil, 'copy2', copy_then_corrupt)
|
||||
with pytest.raises(OSError):
|
||||
recovery._copy_verified(source, destination, scope=scope)
|
||||
assert (destination/relative).exists()
|
||||
|
||||
@@ -204,6 +204,34 @@ def test_batch_report_failure_preserves_ui_outcomes(qtbot, tmp_path, monkeypatch
|
||||
assert window.batch_button.isEnabled()
|
||||
|
||||
|
||||
def test_release_check_clears_only_its_own_management_library(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.management import Capability
|
||||
adapter = SimpleNamespace(capabilities=lambda: {op: Capability(True, 'available')
|
||||
for op in ('add', 'update', 'remove')})
|
||||
window = load_window(qtbot, tmp_path, monkeypatch, management_adapter=adapter)
|
||||
window.path_lease_factory = lambda path: SimpleNamespace(mentor_path=path, close=lambda: None,
|
||||
retain_for_recovery=lambda: None)
|
||||
library_a, library_b = tmp_path/'a.lmc', tmp_path/'b.lmc'
|
||||
for library in (library_a, library_b):
|
||||
window._management_unsafe = True
|
||||
window._management_unsafe_library = library
|
||||
window._update()
|
||||
monkeypatch.setattr('cbb_refresh_verify.library_lock.release_retained_library',
|
||||
lambda *_: {'status': 'RELEASE_CONFIRMED', 'library': str(library_a),
|
||||
'evidence_path': str(tmp_path/'release.json')})
|
||||
window.lmc_edit.setText(str(library_a))
|
||||
window.load_library()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
window._complete_library_release(library_a, {'status': 'RELEASE_CONFIRMED',
|
||||
'library': str(library_a), 'evidence_path': str(tmp_path/'release.json')})
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert not window._management_block_reason('add')
|
||||
window.lmc_edit.setText(str(library_b))
|
||||
window.load_library()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert window._management_library_unsafe(library_b)
|
||||
assert not window._management_block_reason('add')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('alias', ['absolute', 'mapped'])
|
||||
@@ -231,6 +259,39 @@ def test_native_backup_session_matches_library_alias_without_network_resolution(
|
||||
window._native_backup_session = None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('proof_kind', ['valid', 'foreign', 'invalid', 'lease_error'])
|
||||
def test_release_check_restores_current_mapping_only_after_matching_proof(qtbot, tmp_path, monkeypatch, proof_kind):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify import network_path
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
library = Path('test.lmc').absolute()
|
||||
current = network_path.LibraryPathLease(library, library)
|
||||
current.retain_for_recovery()
|
||||
window.library_lease = current
|
||||
window.mentor_lmc_path = library
|
||||
window._management_unsafe = True
|
||||
window._management_unsafe_library = library
|
||||
session = SimpleNamespace(library=library, path_lease=current, process=SimpleNamespace(poll=lambda: 0))
|
||||
window._native_backup_session = session
|
||||
proof = {'status': 'UNCONFIRMED' if proof_kind == 'invalid' else 'RELEASE_CONFIRMED',
|
||||
'library': str(tmp_path/'foreign.lmc') if proof_kind == 'foreign' else str(library),
|
||||
'evidence_path': str(tmp_path/'release.json')}
|
||||
monkeypatch.setattr('cbb_refresh_verify.library_lock.release_retained_library', lambda *_: proof)
|
||||
if proof_kind == 'lease_error':
|
||||
def failed_release(*_a, **_k):
|
||||
raise network_path.NetworkPathError('mapping release failed')
|
||||
monkeypatch.setattr(network_path, 'release_retained_path_leases', failed_release)
|
||||
try:
|
||||
window._complete_library_release(library, proof)
|
||||
qtbot.waitUntil(lambda: window._mapping_busy == 0)
|
||||
qtbot.waitUntil(lambda: window._lease_pending == 0)
|
||||
assert current._retained_for_recovery is (proof_kind != 'valid')
|
||||
assert not current._closed
|
||||
assert window._management_unsafe is (proof_kind != 'valid')
|
||||
assert (window._native_backup_session is session) is (proof_kind != 'valid')
|
||||
finally:
|
||||
window._native_backup_session = None
|
||||
network_path._retained_path_leases.pop(id(current), None)
|
||||
|
||||
|
||||
def test_opening_evidence_failure_does_not_retain_library(qtbot, tmp_path, monkeypatch):
|
||||
|
||||
@@ -78,6 +78,28 @@ def test_management_dialog_finish_waits_for_mapping_cleanup_without_freezing_fil
|
||||
qtbot.waitUntil(lambda: window.pool.activeThreadCount() == 0)
|
||||
|
||||
|
||||
def test_release_dialog_finish_cannot_clear_busy_before_mapping_cleanup(qtbot, tmp_path, monkeypatch):
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
library = Path(window.mentor_lmc_path)
|
||||
entered, release = Event(), Event()
|
||||
main_thread = get_ident()
|
||||
def restore(*args, **kwargs):
|
||||
assert get_ident() != main_thread, 'mapping release blocked the Qt thread'
|
||||
entered.set()
|
||||
assert release.wait(3)
|
||||
monkeypatch.setattr('cbb_refresh_verify.network_path.release_retained_path_leases', restore)
|
||||
window.busy = True
|
||||
try:
|
||||
window._complete_library_release(library, {'status': 'RELEASE_CONFIRMED',
|
||||
'library': str(library), 'evidence_path': 'proof.json'})
|
||||
window._release_dialog_finished(0)
|
||||
qtbot.waitUntil(entered.is_set)
|
||||
assert window.busy and window.search_edit.isEnabled()
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
finally:
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda: window.pool.activeThreadCount() == 0)
|
||||
|
||||
|
||||
def test_window_close_waits_asynchronously_for_retain_and_all_pool_work(qtbot, tmp_path, monkeypatch):
|
||||
@@ -131,3 +153,14 @@ def test_duplicate_dialog_finish_schedules_only_one_catalog_reload(qtbot, tmp_pa
|
||||
qtbot.waitUntil(lambda: window.pool.activeThreadCount() == 0)
|
||||
|
||||
|
||||
def test_window_close_tolerates_fake_and_deleted_dialog_pools(qtbot, tmp_path, monkeypatch):
|
||||
from PySide6.QtCore import QThreadPool
|
||||
from shiboken6 import delete
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
deleted_pool = QThreadPool()
|
||||
delete(deleted_pool)
|
||||
window.release_dialog = SimpleNamespace()
|
||||
window.management_dialog = SimpleNamespace(pool=deleted_pool)
|
||||
window.show()
|
||||
window.close()
|
||||
qtbot.waitUntil(lambda: not window.isVisible())
|
||||
Reference in new issue
Block a user