Compare commits
32
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec9f8a3e40 | ||
|
|
fa5590468d | ||
|
|
fee4a67ff1 | ||
|
|
1572e2d8ca | ||
|
|
cbc5723849 | ||
|
|
b2ddd76a04 | ||
|
|
39af2112e3 | ||
|
|
229df4b0ef | ||
|
|
9eea9a4c20 | ||
|
|
466f400514 | ||
|
|
42d0cebc54 | ||
|
|
b86e4e315a | ||
|
|
42e8719026 | ||
|
|
fdd07224aa | ||
|
|
a045683c8a | ||
|
|
74a45eb5cf | ||
|
|
a7df105616 | ||
|
|
78ff118f82 | ||
|
|
d0a5ce5d17 | ||
|
|
363a279157 | ||
|
|
306aa5c544 | ||
|
|
0fca6abb4e | ||
|
|
342a7266c7 | ||
|
|
e8a1714d95 | ||
|
|
60101b7195 | ||
|
|
14c9a74bbf | ||
|
|
42898d33d2 | ||
|
|
b1c36e3ca6 | ||
|
|
651b539d0e | ||
|
|
35daa77118 | ||
|
|
e73f9c6edc | ||
|
|
b7baa24b5e |
No files matched your search
@@ -1,3 +1,6 @@
|
||||
# Keep the verified Windows source and binary assets byte-for-byte.
|
||||
# Do not normalize the r4 baseline's line endings during add/checkout.
|
||||
* -text
|
||||
# Normalize only these two reviewed Python files at the chain tip.
|
||||
src/cbb_refresh_verify/application.py text eol=lf
|
||||
src/cbb_refresh_verify/ui/main_window.py text eol=lf
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
当前临时分支的备份策略(2026-11-03):应用不再自动备份中心库或 CBB 工程。新增、替换、移除、校验、ICDB 维护和恢复在执行前提示手动备份;请自行保留可用副本。导入暂存、恢复用隔离验证库和轻量操作证据仍会生成,Mentor 原生 Repair 自身的备份行为保持不变。详见[自动备份检查与调整](docs/releases/2026-11-03-manual-backup.md)。此条优先于下方历史版本的备份说明。
|
||||
|
||||
当前开发版本:**[0.2.4b2 生命周期候选](docs/releases/2026-11-06-runtime-lifecycle-candidate.md)(待评审、待现场验收)**。ICDB 批量检查在后台逐项运行,普通校验、管理和恢复可排队;READY 工程在实际执行前再次排除。检查不自动 Repair、Restore 或选择历史版本,也不代表中心库 READY。
|
||||
当前开发版本:**[0.2.4b2 生命周期候选](docs/releases/2026-11-06-runtime-lifecycle-candidate.md)(开发候选,待现场验收)**。ICDB 批量检查在后台逐项运行,普通校验、管理和恢复可排队;READY 工程在实际执行前再次排除。检查不自动 Repair、Restore 或选择历史版本,也不代表中心库 READY。
|
||||
|
||||
停止、超时或应用失联只停止后续原生动作,不结束正在 Save/Close 的调用进程。普通停止等待 5 秒,可能正在写入时最多等待 120 秒后交给后台观察;这不是强制结束时限。保存结果、关闭结果和资源释放分别记录。相关库等待释放,独立库可以排队继续;界面、筛选和日志保持可用。重启只核对未完成会话,不重放管理写操作。legacy 状态读取只观察已打开且匹配库的 LM,不启动 LM 或回答弹窗;无法读取保持 UNKNOWN。
|
||||
|
||||
@@ -10,13 +10,24 @@
|
||||
|
||||
自动流程不强杀原生会话;释放入口默认正常关闭。另有单独确认的“强制结束客户端”操作,仅限属于当前 Windows 用户和会话、归属及进程身份已确认的 PCB、Library Manager、DxDesigner/viewdraw、iCDB Project Backup 客户端。**ICDB 数据库服务器、后台导入器和归属未知的进程不允许强制结束**,即使命令指向当前库也不例外。客户端中其他已打开工程可能一并退出、未保存更改可能丢失;必须先记录确认名单,结束后重新证明库已释放,不能宣称数据库已修复。详见 [操作规程](SOP.md) 与 [版本说明](docs/releases/v0.2.4-beta.1.md)。下方日期记录为历史行为,以本说明为准。
|
||||
|
||||
本目录是独立的 CBB 中心库上传后校验工具,不属于 Part Replacement,也不负责 CBB 工程复制或中心库上传。
|
||||
本目录是独立的 CBB 检验、ICDB 维护和中心库管理工具,不属于 Part Replacement;管理入口接收已整理好的完整 PRJ/PCB 工程。
|
||||
|
||||
导入不运行 ASCII、CSV 或 EDIF 导出。新增/替换确认原生注册、目录复读、工程关联、顶层块及 Layout;顶层块允许保持来源名,或由原生导入改为本次 CBB 注册名,映射会单独记录。其余工程文件差异保留清单供核对,不以原生改写 PRJ 或运行历史判定导入失败。原生重写 ICDB 后不比较其原始字节,也不宣称已证明原理图语义等价。上传后自动校验可独立勾选,只有完整原生 Verify 和权威 READY 才显示校验通过。无效来源或已释放的单项失败逐项报告,不影响后续独立条目。
|
||||
|
||||
针对 `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。需要修复或回退时由用户在原生版本与备份界面选择,操作前请手动备份;共享符号库故障不得通过修复无关的 CBB 工程替代。
|
||||
|
||||
## 当前验证范围与已知限制
|
||||
|
||||
Windows 11 / Mentor EE7.9.5 隔离库已完成原生更新、备份恢复、校验到 READY 和释放验证,记录见 [2026-11-12 验证](docs/releases/2026-11-12-scoped-release-validation.md)。历史候选包仅证明对应提交,后续代码合并不等同于现场验收或正式发布。
|
||||
|
||||
- A/B 输入的独立 EDIF 导出曾返回 `0xC0000005`,根因尚未定位;该导出已从普通导入流程移出,不能据此判定导入失败或 ICDB 损坏。
|
||||
- Windows 10、跨机器共享库和现场服务器会话失联的一致故障副本尚未验收。跨机器释放依赖 SMB 共享模式语义,目前没有跨机器实测证明。
|
||||
- 自动 ICDB Repair 保持关闭。共享库原生服务器若无法删除自身地址文件,或早停后仍有原生弹窗,需要继续核对;不以进程列表为空或端口不可达代替释放证明。
|
||||
- 验收文档中的本机路径、原始日志、截图、测试 XML 和冻结包不随 Git 分发;仓库保留说明及摘要,原始材料须在验收机器查看或另行归档。
|
||||
|
||||
## 功能边界
|
||||
|
||||
| 工具 | 处理对象 | 核心动作 | 结果 |
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
新增拒绝同名冲突;更新先原生移除再导入,失败可能需要人工备份恢复;移除后重新读取目录确认。版本回退由操作员在原生界面选择,核对工程内容后单独校验。
|
||||
|
||||
新增和替换不调用 ASCII/CSV/EDIF 导出器;原生成功回执、重新读库、目标工程关联、顶层块及 Layout 确认后记录上传完成,不等同于 READY 或原理图语义等价。顶层块允许来源名或本次 CBB 注册名,保留原生命名变换记录;其他名称仍拒绝。其余文件差异单独保留清单并提示核对,不因 PRJ 规范化或历史记录差异阻止后续条目。可在批次开始前取消“上传后自动校验”。来源旧库路径可在暂存副本中改为所选目标库,来源原件不改;无效来源按行报告,已释放的失败不阻止后续条目。
|
||||
|
||||
## 历史记录、操作结果与报告
|
||||
|
||||
校验和管理遇到历史释放记录时,先复核实际进程、地址、独占文件及导出副本。确认释放后归档记录再继续,不以历史 JSON 本身判定真实占用;同目标未完成写入仍需核对,不自动重放。释放证明在管理首次原生调用前写入检查点,并在结果中保留。
|
||||
@@ -38,6 +40,12 @@
|
||||
|
||||
程序回退须先关闭当前客户端,再运行此前候选包;它不恢复丢失更改或被中断的原生事务。工程恢复另行在隔离副本验证,保留前后证据并重新校验。Windows 10、共享库跨机器并发和现场服务器失联恢复仍待验收,fake 测试和文件头损坏试验不代替现场验收。
|
||||
|
||||
## 已知限制与证据位置
|
||||
|
||||
A/B 输入的独立 EDIF 导出曾返回 `0xC0000005`,尚未定位;普通导入已不依赖该导出,导入是否完成以本次原生操作与复读证据判定。Windows 10、跨机器共享库和现场失联故障副本仍待验收;跨机释放依赖 SMB 共享模式语义,目前没有跨机实测。自动 ICDB Repair 保持关闭,共享数据库地址残留或晚到弹窗按现场状态继续核对。
|
||||
|
||||
代码合并不表示现场验收完成。文档中的本机路径、日志、截图、测试 XML 和候选包未入库;仓库仅保留验证摘要,原始材料需在验收机器查看或另行归档。
|
||||
|
||||
## 历史上传校验检查表
|
||||
|
||||
## 1. 输入与证据
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"date": "2026-11-09",
|
||||
"scope": "New full reviews #344/#345/#348 and runtime re-review #326",
|
||||
"branch_heads_before_validation_commit": {
|
||||
"codex/review-native-backend": "e8a1714d956e733648dacda1bfdce387e07e4cba",
|
||||
"codex/review-ui-integration": "0fca6abb4e1b54bd06e6986782ccf45383306e43",
|
||||
"codex/review-residual-release": "a7df105616a8f5cfab61b85e0c5d93aa74ded415",
|
||||
"codex/runtime-lifecycle-safety": "a045683c8a6d6918ec701e2944d0e20c25296b65"
|
||||
},
|
||||
"environment": {
|
||||
"python": "3.12.10",
|
||||
"windows": "10.0.26200"
|
||||
},
|
||||
"full_suite": {
|
||||
"tests": 1775,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"duration_seconds": 273.089,
|
||||
"xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\2026-11-09-full-review-final-1775.xml",
|
||||
"xml_sha256": "a993473b7784748f671a3d38a0e80f1aa7dfaf714b23d6378ed26d0481c1b904",
|
||||
"warnings": [
|
||||
"Existing pywinauto STA COM threading warning"
|
||||
]
|
||||
},
|
||||
"focused_runs": [
|
||||
{
|
||||
"scope": "Backend",
|
||||
"passed": 287
|
||||
},
|
||||
{
|
||||
"scope": "UI standalone",
|
||||
"passed": 65
|
||||
},
|
||||
{
|
||||
"scope": "Residual standalone forward integration",
|
||||
"passed": 41
|
||||
},
|
||||
{
|
||||
"scope": "Final runtime/UI integration before last merge",
|
||||
"passed": 211
|
||||
},
|
||||
{
|
||||
"scope": "Terminal-publication fix lifecycle/management group",
|
||||
"passed": 159
|
||||
}
|
||||
],
|
||||
"compileall": "passed",
|
||||
"diff_check": "passed",
|
||||
"independent_review": "No remaining important introduced findings after fixing two queue timing findings",
|
||||
"tested_files_sha256": {
|
||||
"src/cbb_refresh_verify/application.py": "62b9b013563a216d020c8366cccb8f949b02afa72dc63c26940804441cc23057",
|
||||
"src/cbb_refresh_verify/batch_status.py": "55a4007cf54491ca8e045a5bf86aa4353ac8437cca5a76cd79304962e3d3fa0a",
|
||||
"src/cbb_refresh_verify/desktop_worker.py": "27d751816552d215dd8ee9cd67941d824f7b4493120ead7c3f87e5eba5ec4a92",
|
||||
"src/cbb_refresh_verify/library_lock.py": "636e0b1c84061796424da6289361c059fecacad31802df2edc3f3455ec8c40d8",
|
||||
"src/cbb_refresh_verify/management.py": "29ecb101dacf2bb23b8b8931c01078956dd6c641444e82a69a62e811c7261fc5",
|
||||
"src/cbb_refresh_verify/native_management.py": "7598a18da12dd527e9403a956b1ade76b253f89a9ee4790f0802244b54616844",
|
||||
"src/cbb_refresh_verify/operation_queue.py": "a6932d8bc68ac436091f6d362557c66d274ec52d0f295a22f014a3396845c79f",
|
||||
"src/cbb_refresh_verify/pcb_bridge.py": "2f6c2b09642100468814500569dbfc6695fc2a46b9a3b8333daa8e1530cdeef5",
|
||||
"src/cbb_refresh_verify/scoped_manifest.py": "26ba8303e2de294374443513d667570abed2f0f2563a2e969a9cb35e74d65c00",
|
||||
"src/cbb_refresh_verify/session_record.py": "fbf31fb38894f75d725b269229c7d928be54136b491cc5339f7a4b018d7b7f5e",
|
||||
"src/cbb_refresh_verify/ui/icdb_check_task.py": "cc108974e843f31e59e90acd18ad2d810e6bcd67d7cf303b2b772501d95b6d8e",
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "a05d9d838be4b9e9f6e2b612c25186e77f23899bffc59b67f50fea597eab47c9",
|
||||
"src/cbb_refresh_verify/ui/management_dialog.py": "f3fc740197fc109ae3ddd8ead556a8847d5e00ec9a97d5cc2e166d656fb861ef",
|
||||
"src/cbb_refresh_verify/ui/residual_release_dialog.py": "82382af142379c540721dbfa7ba5a5d766130d89807e1f34ad032a0ad1411f5c",
|
||||
"tests/test_batch_status.py": "c1f9af0c7c6f3171b3726fb53346f480b13b8d9cd88111a9c12e2fae2392bbff",
|
||||
"tests/test_batch_status_faults.py": "314e890c9aee439c8a75b4dfd605685240c74f6212da975fd50526bd70b4a0ff",
|
||||
"tests/test_management_retry_blockers.py": "124dbef291dbe331ba0c3e7de1665c910ea43e37b1563429b387f0f2233953ee",
|
||||
"tests/test_management_supervision.py": "2dcadd6551a94c52e5d4e74285959f10144a89c48af87e508abaea945652d1f6",
|
||||
"tests/test_pcb_bridge.py": "527fb63147a203a2e9419da989aff600d3e461580989e39e8ede3a8cc57b901a",
|
||||
"tests/test_residual_release_dialog.py": "10b23d009703d542e5ce8ecb35a4833e0135bb8852b4116e49eedc7010397a1e",
|
||||
"tests/test_review326_dispatch_and_receipts.py": "ce4d529246da1c4d53c3dec70ef49542165064404301dec3e32851df62492ecf",
|
||||
"tests/test_review326_queue_guidance.py": "c2c97aceddd9713618afdd5f2a7be4764b56a1b62fc672282fb8c218b4969c74",
|
||||
"tests/test_review345_ui_cli.py": "795e7e4f9bda8874c6a65a08863cab19f4adb3412287276ee2960588f0fd2fa8",
|
||||
"tests/test_review348_release_comparison.py": "ceccdb3d6f7bc6cb65562c059f13aa2bc5d89d98c6f64b0f11d9b943ebbde165",
|
||||
"tests/test_review_backend_followup.py": "c10704fae250c9e204c995843a2baab0a2562e51984ae4d429aa438ba1c88113",
|
||||
"tests/test_review_management_ui_followup.py": "746602a84c3ba9cb041c5dd354b39d344355b71a3666b27a47eb9aee231e171c",
|
||||
"tests/test_scoped_manifest.py": "d22749cd240ab365f91ebb9d0469dc3336150338a84a77c1aeb6fbc20ccd439f"
|
||||
},
|
||||
"icon_sha256": {
|
||||
"ico": "62d4472ebaa94f9b39aebae06459685d3322041d0e1a7ada9f368cfd816ba1d6",
|
||||
"png": "840f657fd7c622d9afd78625a64ed8ad04c90a895dd3c9fd37eebae543cdebe8",
|
||||
"svg": "cbba5b3f339cbeb5eb43012709237359442ef67c69fc5b6679a8ee4c0a1b7328"
|
||||
},
|
||||
"design_choices": [
|
||||
"Production status always fresh; low-level checkpoint reuse explicit",
|
||||
"Final source and target hashes retained; copy hashed in stream",
|
||||
"Optional CLI limit; default all requested targets",
|
||||
"Release mapping cleanup serialized before waiting task admission",
|
||||
"New native calls vetoed on supervisor loss; accepted pending calls may record continuation identity"
|
||||
],
|
||||
"candidate_rebuilt": false,
|
||||
"automatic_icdb_repair": false,
|
||||
"merged": false,
|
||||
"issue_closed": false,
|
||||
"not_verified": [
|
||||
"Real Mentor/native database writes during loss/cancel",
|
||||
"Frozen execution of this revision",
|
||||
"Windows 10",
|
||||
"Shared network/cross-machine release"
|
||||
],
|
||||
"first_full_run": {
|
||||
"tests": 1774,
|
||||
"failures": 1,
|
||||
"xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\2026-11-09-full-review-first-failure-1774.xml",
|
||||
"xml_sha256": "9d7275b0a4122db12b8367e4367759f3051ce29a56645da5098776d8b9ca2bc8",
|
||||
"reason": "FINISHED permitted watchdog orphan exit before result publication; receipt now precedes terminal phase"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
# Full-review follow-up: comments 344 / 345 / 348 / 326
|
||||
|
||||
This revision follows the new November 9 full reviews. The old November 6 deep-review backlog remains outside the user's previously selected scope.
|
||||
|
||||
## Backend: #10 / 344
|
||||
|
||||
- Status scans default to fresh queries. The low-level explicit checkpoint reuse API remains for compatibility with controlled read-only scans; production status queries continue to use `resume=False`. Its lightweight fingerprint is not described as proof that payload databases are unchanged.
|
||||
- Change reports include rule version, compared scope, excluded directory categories/suffixes and positional runtime rules from the classifier constants. Unrelated CBB content is still explicitly outside comparison. Counts in the management result refer to compared engineering files.
|
||||
- Removed the tests-only `pcb_bridge.execution_outcome` helper with optimistic release defaults; active production release checks remain authoritative.
|
||||
- SHA-256 is computed during streaming of unlocked primary files instead of a separate preliminary source pass. The final source SHA-256 and target SHA-256 remain. This reduces three source reads to two without dropping same-size/same-mtime mutation detection. The review's suggested removal of final source hashing was not adopted because it would weaken the requested source-change check.
|
||||
|
||||
Backend commit `e8a1714`; 287 focused regressions passed. Details and exact command are in `docs/reviews/2026-11-05-native-backend.md`.
|
||||
|
||||
## UI/CLI: #11 / 345
|
||||
|
||||
- Replaced repeated same-purpose result windows with lifecycle-managed dialogs. Task recovery associations survive independent result windows; deleted dialogs/actions are forgotten. Forward integration keeps #12's enabled release/resume paths and recreates a resume action if its old summary was closed.
|
||||
- Closing waits visibly, including a persistent still-waiting notice after 120 seconds. It does not promise a kill deadline or interrupt a write. The final idle check includes the independent lifecycle pool.
|
||||
- Optional positive CLI `--limit` bounds requested names in order. Omission retains the existing all-target behavior rather than silently dropping work. Logs distinguish selected/total/remaining and explain retained mappings after exceptions or unsafe results, pointing to confirmed release instead of an unconditional network-drive deletion.
|
||||
- Removed `if False` branches/dead reload field in the standalone UI PR; forward integration retains the later enabled release behavior. File line-ending rules from the prior tip remain.
|
||||
|
||||
UI commit `342a726`; 65 targeted UI/CLI tests passed on its branch. Integration keeps PR13 stop propagation; CLI test doubles were updated to accept and assert that stop input.
|
||||
|
||||
## Residual release: #12 / 348
|
||||
|
||||
The unreadable-window poisoning and oversized repeated-output findings target the old `5eb4b2d` tree and are already fixed in `651b539`. This revision additionally displays confirmation scope and actual execution result as separate columns, and counts allowed-but-unreleased rows with their reasons. Preview consent never overrides a fresh activity/identity refusal. Residual commit `14c9a74`; 35 targeted tests passed.
|
||||
|
||||
## Runtime and queue: #13 / 326
|
||||
|
||||
- Native management launch/open/create/close/quit/Add submission/Remove launch and editor entry use `dispatch_native`. It records the pending phase before callback entry, synchronous return records POSTCALL, callback failure records UNCONFIRMED, and asynchronous submission requires its existing explicit result acknowledgment. Save/failure-close helpers retain their atomic registration/start gate.
|
||||
- Identity recording for an already-started Remove uses explicit continuation semantics: it must match the operation's current pending phase, cannot authorize a new call, and may continue tracking/waiting after supervisor loss. A real boundary regression demonstrates that loss immediately after Popen cannot abandon its wait. `required=False` controls journal errors, not permission to dispatch after supervisor loss.
|
||||
- Pre-proof snapshots freeze alias generation, block and operation ID. Full-library proofs and operation receipts list `reconciled_blocks` and exact retained sessions; a replaced operation is not acknowledged.
|
||||
- Cached queue reasons name the retained CBB and expose a release entry in verification, ICDB and management waiting states. NativeQueue emits an updated notice only when the cached wait reason changes, so a task transitioning from running to retained cannot leave a hidden dead-end action. Queue predicates do no filesystem/native I/O.
|
||||
- The queued release's mapping finalizer runs inside the serialized release action before it admits the waiting native ticket. The completion signal skips later destructive mapping cleanup. This prevents an old proof from clearing a new task's mapping retention. Both normal confirmation and native Cancel use this finalizer. Closing the residual panel does not mark the still-queued parent action finished.
|
||||
|
||||
## Validation and limits
|
||||
|
||||
The final focused integration run passed 211 tests. New tests were first observed failing for missing dispatch/receipt facts, dispatch veto after accepted Remove, missing queue explanations, changed wait reasons, stale mapping cleanup and dialog lifecycle boundaries. Independent review's two queue timing findings were corrected and re-reviewed with no remaining important introduced finding.
|
||||
|
||||
The first full run exposed one terminal-publication race (1,773 passed, one failed): management wrote FINISHED before its result receipt, allowing the orphan watchdog to exit between them. The result is now flushed before FINISHED. The regression accepts either the normal failure exit or orphan exit only after checking the saved result and the absence of a subsequent native action. A new test first reproduced the missing receipt at the FINISHED transition; 159 focused lifecycle/management tests then passed. The failed full XML is preserved separately, and the full suite is rerun on the corrected tree.
|
||||
|
||||
This does not require a final result before every orphan exit: PRECALL/POSTCALL may deliberately exit during an idle non-COM wait after supervisor loss, as requested by review 319. Such an exit is neither operation success nor resource-release proof. A missing final result is returned as `success=False, safe_to_continue=False` by the launcher, with the last call facts retained in the session journal for explicit reconciliation. FINISHED specifically is now published only after its final receipt; requiring a final receipt before all POSTCALL orphan exits would leave the original idle-orphan problem unresolved.
|
||||
|
||||
Full-suite counts, source hashes and immutable XML copies are in the accompanying validation JSON. Compilation/diff checks and icon equality are checked on the integrated tree. No frozen package was rebuilt; the old iconfix package does not contain this revision. No real Mentor Save/Close/Add/Remove or shared/network/cross-machine acceptance was performed. ICDB automatic Repair remains off. No merge to main, formal release, issue closure, native address/lock deletion, foreground mouse control, or native process termination is authorized by this validation.
|
||||
@@ -0,0 +1,85 @@
|
||||
{
|
||||
"date": "2026-11-09",
|
||||
"scope": "Latest comments #309/#310/#313 only; older deep-review backlog excluded by user",
|
||||
"integration_head_before_validation_commit": "b1c36e3ca6d6680d0b656a725a1db871d5ffabbd",
|
||||
"branch_heads": {
|
||||
"codex/review-native-backend": "b7baa24b5ed87256fb846236b08c75ff02887e9c",
|
||||
"codex/review-ui-integration": "e73f9c6edcb36a18fdd8a17b565cc1fb7c97f26b",
|
||||
"codex/review-residual-release": "651b539d0ef491b3fd410031b9f981d71272aac9",
|
||||
"codex/runtime-lifecycle-safety": "b1c36e3ca6d6680d0b656a725a1db871d5ffabbd"
|
||||
},
|
||||
"environment": {
|
||||
"python": "3.12.10",
|
||||
"windows": "10.0.26200"
|
||||
},
|
||||
"full_suite": {
|
||||
"tests": 1742,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"duration_seconds": 293.056,
|
||||
"xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\2026-11-09-latest-stack-full-1742.xml",
|
||||
"source_xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\cbb-refresh-verify-795-review-stack-fixes-full.xml",
|
||||
"xml_sha256": "e00376d01fa26dd8e62d065d700f8cc200000665a6958536d109336119f8a0c0"
|
||||
},
|
||||
"focused_suites": {
|
||||
"cbb-refresh-verify-795-backend-fixes": {
|
||||
"tests": 94,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"duration_seconds": 41.802,
|
||||
"xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\2026-11-09-cbb-refresh-verify-795-backend-fixes-latest-focused-94.xml",
|
||||
"source_xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\cbb-refresh-verify-795-backend-fixes-fixes-focused.xml",
|
||||
"xml_sha256": "d8580bcc766c7ad6d3ce1d9de7d44b496afaaa8c3489cf01245f1d8a7d15500c"
|
||||
},
|
||||
"cbb-refresh-verify-795-ui-fixes": {
|
||||
"tests": 43,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"duration_seconds": 5.554,
|
||||
"xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\2026-11-09-cbb-refresh-verify-795-ui-fixes-latest-focused-43.xml",
|
||||
"source_xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\cbb-refresh-verify-795-ui-fixes-fixes-focused.xml",
|
||||
"xml_sha256": "0ed470d756f0b387ca9fbf4f4891bd60abfc3faf535e67c06d6640557d627753"
|
||||
},
|
||||
"cbb-refresh-verify-795-review-stack": {
|
||||
"tests": 136,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"duration_seconds": 16.117,
|
||||
"xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\2026-11-09-cbb-refresh-verify-795-review-stack-latest-focused-136.xml",
|
||||
"source_xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\cbb-refresh-verify-795-review-stack-fixes-focused.xml",
|
||||
"xml_sha256": "2087bfa02a0251deee535acda7454c0967b1f11aa5c7125296efc78c141fec59"
|
||||
}
|
||||
},
|
||||
"compileall": "passed",
|
||||
"diff_check": "passed",
|
||||
"independent_review": "No important introduced findings before or after integration",
|
||||
"controlled_private_desktop_fixture": "passed",
|
||||
"tested_files_sha256": {
|
||||
".gitattributes": "a68c9f317ed6e4131c72269b98403c7a3f9c08d5d03e710425301bd50273e791",
|
||||
"src/cbb_refresh_verify/application.py": "b76ff891d77f0a7dba8feeb1f5ae5745ee83dee2fa46c585c187dbf9bb1c39d2",
|
||||
"src/cbb_refresh_verify/library_lock.py": "8b3286d36ad686f65ec7e30eded9c4d0f8a629ca214b39812dfba496292da976",
|
||||
"src/cbb_refresh_verify/residual_sessions.py": "b5d38a06cb2902c3612edb75b1ef83596524f02b6cf7890f6541f210d3e380ce",
|
||||
"tests/test_residual_sessions.py": "f34c77a11d2a2b08c5670a9809474afd84b212016a27b104249e5fddb4675f1f",
|
||||
"tests/test_review313_residual_isolation.py": "4052ca51c35787a8df9b63e79febd38b666da98c09976fffb34f4361381d8b4d",
|
||||
"tests/test_review_foreign_release_evidence.py": "cbf2af02418f6bd3ec720a7a7658cf97f06d1a6e12009fdff2a99f465711591e"
|
||||
},
|
||||
"icon_sha256": {
|
||||
"ico": "62d4472ebaa94f9b39aebae06459685d3322041d0e1a7ada9f368cfd816ba1d6",
|
||||
"png": "840f657fd7c622d9afd78625a64ed8ad04c90a895dd3c9fd37eebae543cdebe8",
|
||||
"svg": "cbba5b3f339cbeb5eb43012709237359442ef67c69fc5b6679a8ee4c0a1b7328"
|
||||
},
|
||||
"automatic_icdb_repair": false,
|
||||
"candidate_rebuilt": false,
|
||||
"not_verified": [
|
||||
"Real Mentor operations",
|
||||
"Frozen execution of this revision",
|
||||
"Windows 10",
|
||||
"Shared/network/cross-machine release"
|
||||
],
|
||||
"merged": false,
|
||||
"issue_closed": false
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
# Latest PR review follow-up: 2026-11-09
|
||||
|
||||
The user selected the November 9 latest re-review comments, excluding the older November 6 deep-review backlog.
|
||||
|
||||
| PR/comment | Result | Source/validation |
|
||||
| --- | --- | --- |
|
||||
| #10 / #309 | Proof names foreign CBB checkpoints and distinguishes requested block from effective BLOCK/LIBRARY scope. | `b7baa24`; 94 backend/lease regressions passed. See `2026-11-09-pr10-review309.md`. |
|
||||
| #11 / #310 | No new blocking finding; backend synchronized in `e73f9c6`. Existing pause semantics retained. | 43 UI/background/queue regressions passed on the UI branch. |
|
||||
| #12 / #313 | Incomplete window reads isolated by PID; bounded repeated evidence; native Cancel retains preview scope. | `651b539`; 116 relevant regressions passed, including a real controlled private desktop/window. See `2026-11-09-pr12-review313.md`. |
|
||||
| #13 integration | Both sides of the residual preview conflict retained: runtime write protection and per-PID read/scope metadata. | Integration merge `b1c36e3`; 136 focused integrated regressions passed. Full result and file hashes in the accompanying JSON. |
|
||||
|
||||
## Line endings
|
||||
|
||||
At the chain tip only, `application.py` is normalized from CRLF to LF. Replacing its LF bytes with CRLF reproduces its prior bytes exactly, and `git diff --ignore-space-at-eol` is empty for this file. `main_window.py` already uses LF. Two specific `.gitattributes` rules pin these files to LF; the global `* -text` rule and every other source file's line-ending policy remain unchanged. No repository-wide normalization or EditorConfig layer is added.
|
||||
|
||||
## Independent review
|
||||
|
||||
The reviewer found no important introduced P1/P2 in the backend/residual changes. Its focused check passed 45 tests with the private-desktop fixture excluded; the coordinator separately ran that actual fixture successfully. A second inspection of the integration confirmed that PR13's active-write, retained-session acknowledgment and durable release records coexist with the new evidence and window-read boundaries. No tests or native operations ran during that integration inspection.
|
||||
|
||||
## Reproduction
|
||||
|
||||
Use the existing `diagnostics/run_review_fixes.py` wrapper from the original workspace against each linked worktree; it isolates the test mutex and sets the intended source path/Qt offscreen. The final full run, compileall and git diff --check results are in `2026-11-09-latest-pr-stack-validation.json`, including evidence hashes and source/test file hashes.
|
||||
|
||||
Current ICO/PNG/SVG hashes match the previously corrected blue check/circular-arrow assets. No candidate executable or ZIP was rebuilt: the previous iconfix package does not contain these fixes. These are source/PR validations, not real Mentor/Windows 10/shared-network/cross-machine acceptance. ICDB automatic Repair remains OFF. PR #3 remains a historical umbrella already covered by #10–#13. The PRs stay Draft; no merge to main, formal release or issue closure is performed.
|
||||
@@ -0,0 +1,7 @@
|
||||
# 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
|
||||
@@ -0,0 +1,38 @@
|
||||
# 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.
|
||||
@@ -0,0 +1,21 @@
|
||||
# PR #12 comment 313
|
||||
|
||||
## Behavior
|
||||
|
||||
Window inspection takes a Windows thread snapshot for the requested processes, finds the desktops assigned to those threads, and opens only those desktops. Failures are recorded per affected PID outside the real window list. Unrelated inaccessible desktops no longer disable healthy rows. Preview, cooperative close, forced close, native Cancel and save-prompt responses all use the same per-PID incomplete-read fact during their fresh action-time observation.
|
||||
|
||||
Unknown or active native writes still prohibit forced termination. The review's suggested blanket force override for unreadable windows is not implemented: exact identity and private-desktop ownership do not establish that Save/Repair has returned. A failed read names that session and can be retried, while other sessions remain actionable.
|
||||
|
||||
Disk evidence retains window identity and a UTF-8 output excerpt of at most 4,096 bytes, original output length and SHA-256. It omits child-control trees and duplicated native-activity output. The complete preview remains in memory for the existing details action.
|
||||
|
||||
Native Cancel carries the preview's `block_names` and checks the same Work + SymbolLibs scope before the exact-process/control checks. It no longer silently widens a scoped preview to the full library.
|
||||
|
||||
## Verification
|
||||
|
||||
The initial five regressions failed against the old implementation. After the fix, 116 residual/backend/UI/background-queue regressions passed; compileall and git diff --check passed. This includes a real controlled Windows window on a private CbbManagement desktop, read from another process, with clean fixture exit and no Mentor/native database actions.
|
||||
|
||||
The real fixture caught a platform limitation missed by API doubles: EnumThreadWindows silently omits windows on another desktop. The final implementation maps threads to desktop names and uses OpenDesktop/EnumDesktopWindows for only those mapped desktops. GetThreadDesktop's borrowed handle is never closed; owned OpenDesktop handles and the thread snapshot are closed.
|
||||
|
||||
Independent review and the full integrated-chain run are recorded at the final PR #13 tip. Older deep-review comments #297-#300 remain outside this explicitly selected scope. No candidate was rebuilt; real Mentor, Windows 10 and shared/network release scenarios remain unverified.
|
||||
|
||||
Review: https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/12#issuecomment-313
|
||||
@@ -0,0 +1,7 @@
|
||||
# PR #12 comment 348 follow-up
|
||||
|
||||
The review's process-isolation and oversized-output findings target the earlier `5eb4b2d` tree; both are addressed by `651b539` and remain covered by the real private-desktop and bounded-evidence regressions.
|
||||
|
||||
The remaining consent/result presentation gap is fixed here. The residual table retains its original six columns and adds confirmation scope and actual result. A row that was allowed at confirmation but rejected after a fresh activity/identity check now shows both facts beside its reason. The result message also counts confirmation-allowed rows and how many remain unreleased; it does not reinterpret preview consent as successful execution or bypass an active-write guard.
|
||||
|
||||
The new regression failed before the change. The release-dialog, residual follow-up and private-desktop regression group passed 35 tests. No production/native database action was performed. Integrated full validation is recorded at the PR #13 tip; no candidate build, merge or field acceptance is implied.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,76 @@
|
||||
# 2026-11-11:逐按钮模拟操作验证
|
||||
|
||||
基线:42e87190263453c8e3a7001d5768741b3b3a2c38。
|
||||
|
||||
全量 Python 测试 **1,835 passed**,只有既有的 STA COM 模式警告;Windows 私有桌面的界面组 **276 passed** 并正常退出。记录了 **281 次点击信号**、**78 种控件标识**和 **28 张代表性截图**。新增测试包含真实 Qt 文件选择和确认按钮、连点、停止、取消、窗口关闭和动态结果入口。
|
||||
|
||||
## 逐按钮模拟操作结果
|
||||
|
||||
Windows 原生 Qt 控件,独立私有桌面。48 个应用按钮/复选项全部触发点击信号,另验证 3 个菜单页签;276 项界面相关测试通过。
|
||||
|
||||
文件选择和确认框使用真实 Qt 对话框及其按钮;原生读写、恢复、保存、取消、强制结束均使用隔离替身。通过表示界面连接、参数、状态及错误处理通过,不表示真实 Mentor 操作通过。
|
||||
|
||||
| 控件 | 按钮 | 结果 | 验证点 |
|
||||
| --- | --- | --- | --- |
|
||||
| BackupRecoveryDialog.browse_button | 选择… | 通过 | 真实备份工程选择框打开/取消 |
|
||||
| BackupRecoveryDialog.restore_button | 恢复并校验 | 通过 | 无效来源拒绝;确认/拒绝;显示受控恢复结果 |
|
||||
| BackupRecoveryDialog.close_button | 关闭 | 通过 | 空闲关闭恢复窗口 |
|
||||
| BackupRecoveryDialog.cancel_queue_button | 取消排队 | 通过 | 取消等待票据,不调用恢复后端 |
|
||||
| MainWindow.native_lm_verify_check | 使用 Library Manager 原生 Verify(Win10 兼容测试) | 通过 | 勾选状态切换,原生 Verify 选项保持独立 |
|
||||
| MainWindow.advanced_toggle | 高级设置 | 通过 | 展开和收起高级设置 |
|
||||
| MainWindow.select_visible_button | 选择可见项 | 通过 | 只勾选可见条目 |
|
||||
| MainWindow.clear_selection_button | 清空选择 | 通过 | 清空勾选 |
|
||||
| MainWindow.load_button | 读取 CBB | 通过 | 读取当前库并更新清单 |
|
||||
| MainWindow.browse_button | 选择 | 通过 | 真实选择框打开/取消;取消不触发读取 |
|
||||
| MainWindow.selected_batch_button | 批量校验已选 | 通过 | 真实确认/拒绝;仅执行可见非 READY 已选项 |
|
||||
| MainWindow.batch_button | 校验可见非 READY | 通过 | 真实确认/拒绝;只执行可见非 READY 项 |
|
||||
| MainWindow.icdb_repair_button | ICDB 批量检查 | 通过 | 开始独立 ICDB 检查,不启用自动 Repair |
|
||||
| MainWindow.backup_restore_button | 从备份恢复 CBB… | 通过 | 为当前非 READY 目标打开备份恢复窗口 |
|
||||
| MainWindow.reimport_button | 选择工程副本恢复失败项… | 通过 | 副本恢复仍绑定失败 CBB |
|
||||
| MainWindow.stop_button | 当前项完成后停止 | 通过 | 设置停止标志,后续目标不再执行 |
|
||||
| MainWindow.logs_button | 打开日志目录 | 通过 | 打开正确目录;目录及系统打开失败时显示错误 |
|
||||
| MainWindow.recovery_button | 打开异常证据 | 通过 | 打开正确证据路径;系统打开失败时显示错误 |
|
||||
| MainWindow.native_backup_button | 版本历史与备份… | 通过 | 只启动一次;收到关闭回执后恢复可用 |
|
||||
| MainWindow.icdb_stop_button | 停止检查 | 通过 | 停止当前后台检查,不再打开后续项 |
|
||||
| MainWindow.add_button | 新增 CBB… | 通过 | 打开新增操作窗口 |
|
||||
| MainWindow.update_button | 用工程替换已选 CBB… | 通过 | 打开所选目标的更新窗口 |
|
||||
| MainWindow.remove_button | 移除已选… | 通过 | 打开所选目标的移除窗口 |
|
||||
| MainWindow.release_library_button | 释放残留会话… | 通过 | 打开当前库的释放预览 |
|
||||
| MainWindow.queue_release_button | 查看残留会话… | 通过 | 打开等待库的释放预览,关闭面板不误解锁任务 |
|
||||
| MainWindow.runtime_log_toggle | 查看运行日志 | 通过 | 显示/隐藏运行输出 |
|
||||
| ManagementDialog.sources_button | 选择来源工程… | 通过 | 真实工程选择框打开/取消并更新来源行 |
|
||||
| ManagementDialog.auto_verify | 本批次上传后自动校验 | 通过 | 切换本批次自动校验选项 |
|
||||
| ManagementDialog.release_wait_button | 查看残留会话… | 通过 | 传出等待释放的目标库 |
|
||||
| ManagementDialog.logs_button | 查看日志 | 通过 | 显示/隐藏管理日志 |
|
||||
| ManagementDialog.execute_button | 预览并确认执行… | 通过 | 真实确认/拒绝,重复点击不重复执行 |
|
||||
| ManagementDialog.stop_button | 当前项结束后停止 | 通过 | 设置管理任务停止标志 |
|
||||
| ManagementDialog.close_button | 关闭 | 通过 | 空闲关闭,执行中禁用点击不打断任务 |
|
||||
| PcbRestoreDialog.manual_button | 最后手动保存 | 通过 | 只选择最后手动保存版本,关闭不覆盖已有选择 |
|
||||
| PcbRestoreDialog.auto_button | 自动保存 | 通过 | 只选择自动保存版本,关闭不覆盖已有选择 |
|
||||
| PcbRestoreDialog.cancel_button | 取消 | 通过 | 取消选择,不默认回退版本 |
|
||||
| ResidualReleaseDialog.refresh_button | 重新检查 | 通过 | 重新扫描预览,不执行释放 |
|
||||
| ResidualReleaseDialog.confirm_button | 确认释放 | 通过 | 传递当前确认范围,显示实际释放结果 |
|
||||
| ResidualReleaseDialog.prompt_button | 处理保存提示… | 通过 | 真实是/否/取消,传递对应保存选择 |
|
||||
| ResidualReleaseDialog.details_button | 查看原生提示… | 通过 | 显示原生提示全文和详细信息 |
|
||||
| ResidualReleaseDialog.cancel_native_button | 请求原生取消… | 通过 | 真实确认/拒绝后发送受控取消请求 |
|
||||
| ResidualReleaseDialog.force_button | 强制结束客户端… | 通过 | 真实确认/取消后传递强制标志;未调用实际强杀 |
|
||||
| ResidualReleaseDialog.close_button | 关闭 | 通过 | 空闲关闭;执行中请求停止并等待当前项返回 |
|
||||
| Result.batch_release | 查看残留并释放… | 通过 | 从批量失败结果打开当前库释放入口 |
|
||||
| Result.batch_resume | 继续未执行项 | 通过 | 释放确认后只执行此前未执行的目标 |
|
||||
| Result.batch_copy | 选择副本恢复… | 通过 | 兼容维护结果中的副本恢复仍绑定失败工程 |
|
||||
| Result.icdb_release | 查看残留并释放… | 通过 | 从 ICDB 结果打开对应库释放入口 |
|
||||
| Result.icdb_copy | 选择副本恢复… | 通过 | 从 ICDB 结果打开对应失败工程的副本恢复 |
|
||||
|
||||
每项对应的测试编号、点击次数、完整事件记录及代表性截图见同目录 button-matrix.json / windows-all.json。
|
||||
|
||||
本轮额外修复:打开日志目录时,目录创建失败或系统拒绝打开不再向 Qt 事件循环抛出未处理异常,改用现有错误提示。
|
||||
|
||||
未验证:真实 Mentor 写库、ICDB 修复、Windows 10、跨机器共享库。
|
||||
|
||||
## 验证边界与构建记录
|
||||
|
||||
实际原生写库、历史回退、保存、原生取消及强制结束均使用隔离替身。未触碰现场工程或中心库,未证明 ICDB 原生修复成功;Windows 10 和跨机器共享库仍未验收。
|
||||
|
||||
首次候选构建因 C 盘空间不足在收集文件阶段失败,未计为通过。本轮未完成构建已迁至 F 盘继续,原候选和测试证据保留。最终构建及冻结验证结果见相邻验证 JSON。
|
||||
|
||||
逐按钮的测试编号与点击次数、界面 XML、截图路径和文件哈希保存在相邻验证 JSON 及其引用的本机证据中。截图只提供代表性界面,逐项结论以测试断言和点击记录为依据。
|
||||
@@ -0,0 +1,210 @@
|
||||
{
|
||||
"date": "2026-11-11",
|
||||
"baseline": "fdd07224aac99bee8d1f29e8e82d6a2c49964c87",
|
||||
"review_comment": "https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-381",
|
||||
"full_suite": {
|
||||
"tests": 1789,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 341.04
|
||||
},
|
||||
"focused_final": {
|
||||
"tests": 57,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 10.935
|
||||
},
|
||||
"windows_native_direct_runs": [
|
||||
{
|
||||
"tests": 21,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 14.625
|
||||
},
|
||||
{
|
||||
"tests": 21,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 11.765
|
||||
}
|
||||
],
|
||||
"windows_platform": {
|
||||
"platform": "windows",
|
||||
"desktop": "CbbUiReview381_ea1f0bcdc2",
|
||||
"exit_status": 0,
|
||||
"total": 21,
|
||||
"failures": 0,
|
||||
"mentor_calls": false
|
||||
},
|
||||
"inconclusive_windows_controller_run": {
|
||||
"controller_exit_code": 1,
|
||||
"assertion_total": 21,
|
||||
"assertion_failures": 0,
|
||||
"counted_as_pass": false,
|
||||
"controller_cause_confirmed": false,
|
||||
"followup": "Direct pytest launch and stack diagnostics; two direct runs exited 0."
|
||||
},
|
||||
"negative_control": {
|
||||
"expected_failure": true,
|
||||
"result": {
|
||||
"tests": 1,
|
||||
"failures": 1,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 3.75
|
||||
},
|
||||
"method": "Only baseline _queued_action restored in test memory; no source mutation."
|
||||
},
|
||||
"compileall_passed": true,
|
||||
"diff_check_passed": true,
|
||||
"tested_production_sha256": "a18d36f893f6e23b8e52b3d7e0b8cfba9ebfa08abb44acb54219cc092b318942",
|
||||
"full_run_file_hashes": {
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "a18d36f893f6e23b8e52b3d7e0b8cfba9ebfa08abb44acb54219cc092b318942",
|
||||
"tests/test_review381_queue_release.py": "56661d607b55d1284fad69105d4457ab6816696a998188d6986ed67765b326e0",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.ico": "62d4472ebaa94f9b39aebae06459685d3322041d0e1a7ada9f368cfd816ba1d6",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.png": "840f657fd7c622d9afd78625a64ed8ad04c90a895dd3c9fd37eebae543cdebe8",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.svg": "cbba5b3f339cbeb5eb43012709237359442ef67c69fc5b6679a8ee4c0a1b7328"
|
||||
},
|
||||
"final_file_hashes": {
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "a18d36f893f6e23b8e52b3d7e0b8cfba9ebfa08abb44acb54219cc092b318942",
|
||||
"tests/test_review381_queue_release.py": "e568a2701337be068af91a03ff3451d82c705109a7b62c3c11663a42bcf552b5",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.ico": "62d4472ebaa94f9b39aebae06459685d3322041d0e1a7ada9f368cfd816ba1d6",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.png": "840f657fd7c622d9afd78625a64ed8ad04c90a895dd3c9fd37eebae543cdebe8",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.svg": "cbba5b3f339cbeb5eb43012709237359442ef67c69fc5b6679a8ee4c0a1b7328"
|
||||
},
|
||||
"test_refinement_after_full": "Only one test gained an admission barrier; production unchanged; focused and Windows rerun.",
|
||||
"candidate_rebuilt": true,
|
||||
"candidate_executable": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-candidate\\dist\\CbbRefreshVerify-Background\\CbbRefreshVerify.exe",
|
||||
"bundle": {
|
||||
"module_count": 62,
|
||||
"source_and_frozen_code_equal": true,
|
||||
"source_sha256_checked": true,
|
||||
"packaged_assets_equal": true,
|
||||
"exe_icon_images_equal": true,
|
||||
"executable_sha256": "71812c1fdfa6522fad4468f4ca4c7d8f77aa9c6880b70f0d8b7ad58a31d55ec2"
|
||||
},
|
||||
"frozen_smoke": {
|
||||
"gui": {
|
||||
"status": "passed",
|
||||
"exit_code": 0
|
||||
},
|
||||
"verify-worker": {
|
||||
"exit_code": 1,
|
||||
"status": "passed",
|
||||
"evidence": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-candidate\\smoke-319c4ff4\\verify-worker"
|
||||
},
|
||||
"management-worker": {
|
||||
"exit_code": 2,
|
||||
"status": "passed",
|
||||
"evidence": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-candidate\\smoke-319c4ff4\\management-worker"
|
||||
},
|
||||
"owner-probe": {
|
||||
"exit_code": 0,
|
||||
"status": "passed",
|
||||
"evidence": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-candidate\\smoke-319c4ff4\\owner-probe"
|
||||
},
|
||||
"dialog-agent": {
|
||||
"status": "passed",
|
||||
"exit_code": 0,
|
||||
"scope": "empty PID set, observe only"
|
||||
},
|
||||
"module_origins": {
|
||||
"status": "passed",
|
||||
"module_count": 62,
|
||||
"source_root": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795-review-stack\\src"
|
||||
},
|
||||
"version": "0.2.4b2"
|
||||
},
|
||||
"independent_review": {
|
||||
"scope": "review381 and directly related stale/cross-task release UI",
|
||||
"reviewer": "review381_final",
|
||||
"reviewed_files": [
|
||||
"src/cbb_refresh_verify/ui/main_window.py",
|
||||
"tests/test_review381_queue_release.py"
|
||||
],
|
||||
"finding": "foreground completion erased independent background wait",
|
||||
"followup": "fixed; both completion orders reproduced failing then passing",
|
||||
"final_review": "no additional findings",
|
||||
"review_native_calls": false
|
||||
},
|
||||
"native_mentor_operations_verified": false,
|
||||
"icdb_repair_accepted": false,
|
||||
"field_library_modified": false,
|
||||
"windows10_verified": false,
|
||||
"shared_library_verified": false,
|
||||
"merged": false,
|
||||
"artifacts": {
|
||||
"review381-baseline.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-baseline.xml",
|
||||
"sha256": "f224548b02b5841f7d3148375eea50f6505c83af912b66a7d67c5d572bc287b3"
|
||||
},
|
||||
"review381-red-controlled.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-red-controlled.xml",
|
||||
"sha256": "15c620cb4ec251501d83fd7ebc4ee654df8b0e4b7aa8f8ccb2d7af30ec162c5f"
|
||||
},
|
||||
"review381-interleaved-red.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-interleaved-red.xml",
|
||||
"sha256": "fea4342c4bdab3b03e70f70585e66281188ac80ae7613e4bf7db9fcd616ce1f5"
|
||||
},
|
||||
"review381-completion-red.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-completion-red.xml",
|
||||
"sha256": "6dab11fbba7878db81885f5d11fadc5c80728a9dab3cab8edd0883cb7015d3e2"
|
||||
},
|
||||
"review381-full.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-full.xml",
|
||||
"sha256": "9f73a2dddae8831c2bad4ae1fb2f2f509b1981508a512fffb208dce1a858860f"
|
||||
},
|
||||
"review381-focused-barrier.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-focused-barrier.xml",
|
||||
"sha256": "ec7fd3dc3ce869b97ed3f22e7e9528f60dc8512a89e451eae434fe665bae838a"
|
||||
},
|
||||
"review381-admission-negative-control.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-admission-negative-control.xml",
|
||||
"sha256": "ecb66304ee5cc1be9c19c4ba33c57a7bd86e65b156a959fa5665cba2274679e9"
|
||||
},
|
||||
"review381-windows-direct-first.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-windows-direct-first.xml",
|
||||
"sha256": "3ba672a9190a5ec715ae99db01c0faca1b3bfcfe9d25a25ba46309af7f5c1880"
|
||||
},
|
||||
"review381-windows-direct-first-platform.json": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-windows-direct-first-platform.json",
|
||||
"sha256": "a255f39b48fe69656c553b6a4feff6f905beb1e18ba2de9724454f15d3d8ea56"
|
||||
},
|
||||
"review381-windows.xml": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-windows.xml",
|
||||
"sha256": "a2d53895c5afaf0907a670d544cd98db6c786bbf75f2e520ac0355d3c4a88ff2"
|
||||
},
|
||||
"review381-windows-platform.json": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-windows-platform.json",
|
||||
"sha256": "e06d76c1c2c297f6d4e11f76a903666a1bdf47cdc81a26a295c2040ef9381bbb"
|
||||
},
|
||||
"review381-independent-review.json": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-independent-review.json",
|
||||
"sha256": "155c0b1c4ae3ecb5b94b1a2d321e47b96a4885f18cc369f36c82408b20959981"
|
||||
},
|
||||
"review381-candidate/source-sha256.json": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-candidate\\source-sha256.json",
|
||||
"sha256": "6028d5cb3f6eeec68ae938fb73223d5343de7c8671ba3b77d9a1d1e6faa37608"
|
||||
},
|
||||
"review381-candidate/bundle-verification.json": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-candidate\\bundle-verification.json",
|
||||
"sha256": "08117158e59192c7ee7f0538968b24d5e4cb8e9f8f230636bd009aa39ffbc4b5"
|
||||
},
|
||||
"review381-candidate/smoke-319c4ff4/result.json": {
|
||||
"path": "C:\\Users\\ABS_Windows\\.codex\\visualizations\\2026\\11\\02\\01a19b86-b23f-7fe0-9407-45a4303e10e3\\review381-candidate\\smoke-319c4ff4\\result.json",
|
||||
"sha256": "3cefd58746044c0f48455aba9796b0a30687ee5a30084fa1948449e5094c1a10"
|
||||
}
|
||||
},
|
||||
"committed_file_hashes": {
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "a18d36f893f6e23b8e52b3d7e0b8cfba9ebfa08abb44acb54219cc092b318942",
|
||||
"tests/test_review381_queue_release.py": "e0d62424cbf70ec9573db78ede0a4c6534775399194eed4c6b28ba8d468307be",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.ico": "62d4472ebaa94f9b39aebae06459685d3322041d0e1a7ada9f368cfd816ba1d6",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.png": "840f657fd7c622d9afd78625a64ed8ad04c90a895dd3c9fd37eebae543cdebe8",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.svg": "cbba5b3f339cbeb5eb43012709237359442ef67c69fc5b6679a8ee4c0a1b7328"
|
||||
},
|
||||
"post_validation_whitespace_cleanup": "Trimmed one trailing blank line in test file; compiled test code equal; staged diff check rerun."
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
# PR #13 评论 381:等待入口与交错操作验证
|
||||
|
||||
对应审查:<https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-381>。基线为 `fdd07224aac99bee8d1f29e8e82d6a2c49964c87`。
|
||||
|
||||
## 修复行为
|
||||
|
||||
校验获得原生执行机会后,立即刷新执行状态和残留入口。入口显示及点击均复核现有的内存保留状态,已释放的库不会因旧消息或延迟点击重新打开释放面板。窗口进入关闭流程后,不接受新的释放面板请求。
|
||||
|
||||
等待消息在覆盖当前目标前,同样检查消息所指库现在是否仍被保留。另一个库的普通排队消息、已过期的保留消息或 ICDB 开始事件,不会抹掉仍有效的等待入口。
|
||||
|
||||
独立复查补充发现:前台任务结束会清除另一个库正在等待的后台 ICDB 入口。现在前台结束时保留该后台任务的有效入口;后台取消或结束时,移除属于它的过期入口,同时保留同库前台仍需要的入口。路径比较使用已知别名,不查询磁盘、网络或 WMI。
|
||||
|
||||
没有新增库锁、占用扫描、轮询线程或强制结束逻辑。原生执行仍串行;未确认释放时的同库保护和自动 Repair 关闭状态不变。本次不调整整批调度。
|
||||
|
||||
## 实际执行的验证
|
||||
|
||||
| 验证 | 结果 |
|
||||
| --- | --- |
|
||||
| 既有队列入口基线 | 7 通过 |
|
||||
| 原问题及交错操作,修复前 | 7 失败、2 通过;随后扩展的交错用例另有 3 项预期失败 |
|
||||
| 前台结束/后台取消两种顺序,修复前 | 2 项均失败 |
|
||||
| 全量 Python 测试 | 1,789 通过、0 失败、0 跳过;既有 STA COM 模式警告 1 项 |
|
||||
| 加强并发屏障后的相关回归 | 57 通过 |
|
||||
| Windows 原生 Qt 控件,独立私有桌面 | 21 项通过;直接启动的最终验证记录另存 JSON/XML |
|
||||
| 负向对照 | 仅在测试进程内恢复旧的队列接纳方法,新用例稳定失败;不修改源文件 |
|
||||
| 编译及差异检查 | `compileall` 和 `git diff --check` 通过 |
|
||||
| 新冻结候选包 | 5 项冒烟通过;62 个包内模块与源码一致;包内图标及 EXE 图标资源一致 |
|
||||
|
||||
全量测试后仅加强了一个测试的时序屏障,业务源码没有再变化;加强后的测试文件已重新执行相关回归和 Windows 控件验证。全量时与最终测试文件的哈希分别保留。
|
||||
|
||||
新增的 14 项用例覆盖:执行尚未结束时隐藏旧入口;五次延迟点击;过期等待消息;独立库事件交错;反复打开、关闭和重开面板;重复点校验后停止再点释放;前后台任务先后结束;关闭过程中送达的点击。控件点击使用真实 PySide6 控件与事件循环;库数据和原生扫描采用隔离替身,不操作现场库。
|
||||
|
||||
一次较长启动链的 Windows 验证中,21 项断言均通过,但外层控制器返回 1,未计为完整通过。随后缩短验证启动链,直接启动 pytest,并加入超时堆栈记录;直接运行的正常退出结果单独保留。不能据此把那次控制器异常认定为已复现的业务故障,也不隐去该次未完成验证。具体记录见相邻验证 JSON。
|
||||
|
||||
## 候选包与边界
|
||||
|
||||
新包位置记录于 `2026-11-11-pr13-review381-validation.json`,构建和验证产物保存在本机 Codex visualizations 目录。EXE SHA-256:
|
||||
|
||||
`71812c1fdfa6522fad4468f4ca4c7d8f77aa9c6880b70f0d8b7ad58a31d55ec2`
|
||||
|
||||
冻结冒烟包括 GUI 创建及正常退出、启动前取消的 Verify worker、桌面不匹配时拒绝操作的管理 worker、空所有者查询,以及私有桌面上空 PID 范围的弹窗观察。后四项是受控边界验证,不代表真实原生操作成功。
|
||||
|
||||
本轮未执行真实 Mentor Save/Close/Add/Remove 或 ICDB 修复,未写入现场中心库;也未验证 Windows 10、跨机器共享库或现场故障一致副本。不能将本次界面和生命周期验证作为 ICDB 自动修复成功的依据。不合并发布、不关闭现场工单。
|
||||
@@ -0,0 +1,235 @@
|
||||
# 当前程序流程、阻塞点与错误节点
|
||||
|
||||
> 证据路径说明:本文的本机绝对路径、日志名、截图、测试 XML 和冻结包指向验收机器上的原始材料,未纳入 Git;仓库仅保留说明和验证摘要。
|
||||
|
||||
> 这是修改前 `42d0ceb` 的流程快照。后续修复及真实复测见 [占用范围验证](2026-11-12-scoped-release-validation.md)。
|
||||
|
||||
依据提交 `42d0cebc54191681b53dcecb120f53236c1963bb` 的代码及 2026-11-12 冻结程序原生验收记录。本文件只分析当前行为,没有实施下面建议的调整,也没有新增原生验收。
|
||||
|
||||
后续只读核查已用外部软件自身日志确认 E01 的两个未知阻塞进程来自 DxPartReplace 测试,创建时间、父进程和私有桌面交叉匹配;外部工程引用原库,本次 CBB 验收使用隔离库。详见 [进程来源核查](2026-11-12-process-origin-audit.md)。这进一步确认了并行软件触发本程序范围判定漏洞,不能将其解释成本程序自身客户端未退出。
|
||||
|
||||
红色 E 节点表示真实验收已经发生、仍未解决的问题;橙色 B 节点表示代码中确实存在的等待、拒绝或失败分支,但不表示每个条件都已复现;绿色 F 表示本轮修复并复测通过的位置。各入口在 UI 中独立,底层原生调用仍共享串行通道。
|
||||
|
||||
## 一、最需要处理的阻塞链
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[单个 CBB 失败或被停止] --> B[PCB 或助手未确认退出]
|
||||
B --> C[safe_to_continue 为 false]
|
||||
C --> D[B02 同库后续项被跳过]
|
||||
C --> E[B01 后续任务等待库可用]
|
||||
E --> F[用户打开释放窗口]
|
||||
F --> G[正常关闭本工具 PCB]
|
||||
G --> H[E01 其他任务的未知会话也被纳入必须退出的集合]
|
||||
H --> I[整库释放仍为 PARTIAL]
|
||||
I --> E
|
||||
classDef error fill:#fee2e2,stroke:#dc2626,color:#7f1d1d
|
||||
classDef risk fill:#fff3cd,stroke:#d97706,color:#78350f
|
||||
class H,I error
|
||||
class D,E risk
|
||||
```
|
||||
|
||||
这条链中的核心缺陷是:**当前项是否失败、当前项是否留下占用、整个库能否继续、其他工具是否正在运行,没有彻底分开。** 某项失败但 `safe_to_continue=true` 时,当前代码会继续处理下一项,真实多来源新增已验证这一点;`false` 则会阻止同库后续项,不能称为“所有失败都不会影响整批”。
|
||||
|
||||
## 二、阻塞与失败清单
|
||||
|
||||
| 标记 | 发生位置与触发条件 | 当前后果、影响范围 | 证据与处理方向 |
|
||||
| --- | --- | --- | --- |
|
||||
| **E01 已复现、未修复** | 释放集合包含 scope_confirmed=false 的其他任务进程;释放函数要求全部观察项 RELEASED;底层证明也把没有目标路径的进程作为可能占用 | 本工具 PCB 已退出,整库仍 PARTIAL;保留状态无法清除,同库后续任务继续等或被跳过 | R7 的 PCB 21856/21248 均退出;其他任务 viewdraw 29832 为 WAITING。必须区分观察项与本库目标,并用目标资源证明决定能否继续,不能直接结束其他任务 |
|
||||
| **E02 已复现、未走通** | PCB 启动出现原生“确认无其他用户,以读写权限继续”提示 | 当前打开判为 DATABASE_SAFETY_STOP;普通校验未 READY,ICDB 检查无法确认,备份副本不安装。关闭成功时本项失败仍可安全继续 | 该正文不直接证明 ICDB 损坏。代码有受限的修复后授权分支,但不是普通打开时通用的用户确认入口 |
|
||||
| **E03 已复现、未修复** | A/B 来源工程的原生 EDIF 导出器退出 0xC0000005 | 本项上传失败;退出及资源释放证明成功后下一项继续,不能跳过身份比对报告成功 | 相同批次 C 能新增成功。需进一步定位原生导出与输入兼容性 |
|
||||
| **B01 可长期排队** | NativeQueue 没有排队总超时;等待 active=false 且本库 library_available=true | UI 线程保持运行,但普通校验、管理、刷新等任务可能一直显示等待;可取消排队。活动任务未返回时,即使不同库也不能使用同一个原生通道 | 属于后台任务等待,不等于界面卡死;不同库且条件满足的票据可以越过暂不可用票据。需要展示等待对象、阶段及下一步,而不是单一“忙” |
|
||||
| **B02 失败传播到同库** | run_batch、run_management_batch、IcdbCheckTask 遇 safe_to_continue=false;未知异常也可能保守置 false | 同库后续项 SKIPPED;其他库不因这个集合被跳过;CANCELLED/QUEUE_STOP 或用户停止会停止余下队列 | 现有规则确实仍会让单项占用影响本库整批。后续需分辨仅此工程占用与共享库占用,不能盲目把 false 改 true |
|
||||
| **B03 执行互斥与协调锁** | Windows 会话级 Local/CbbRefreshVerify795 被占用;库协调锁被持有;历史 blocked/pending 记录存在或身份不符 | 直接拒绝本次操作,或先复核旧记录;未确认时保留本库协调锁/记录 | 多个应用实例、独立上传工具、崩溃遗留均可能触发。历史记录本身不是仍在写库的证明 |
|
||||
| **B04 地址、数据库、在途调用** | 存在 sAddress.adr;数据库/LMC/Layout 独占读失败;仍有本库原生写入或导出副本所有者 | 当前操作或释放证明失败;真实在途写入应继续保护。陈旧地址和不完整日志也可能导致无法确认 | 当前主要哈希排除地址文件,但占用判断仍会使用它们;不能用“哈希忽略了”推断“占用也已忽略” |
|
||||
| **B05 原生调用未返回** | Add/Remove/COM 调用或原生进程超过监督时限 | 有些监督入口返回超时并保留真实 worker;真实写入继续观测;CleanWGLib 超时后仍等待其自然退出,不能把超时当释放 | 可能同时占着执行通道、库锁或保留状态。需要区分取消未开始项、请求原生取消、仍在写入、可以关闭的客户端 |
|
||||
| **B06 原生版本窗口仍打开** | iCDB Project Backup 原生窗口尚未关闭,或关闭结果未确认 | 同库校验/恢复受到限制;同库 ICDB 后台检查会暂停,关闭并确认后恢复;不是自动修复失败 | 这是实际原生编辑会话的互斥。不能通过关闭应用或删除记录假装窗口已关闭 |
|
||||
| **B07 格式、能力与来源校验** | 缺失/越界引用、不支持的版本或接口、目标分区不唯一、来源同名不匹配、未完成变更记录仍需恢复 | 本项拒绝;新增遇同名冲突明确失败;未完成写操作不会在重启后自动重放 | 这些多数属于输入/恢复边界;要给出具体原因和可纠正入口,不能混成 ICDB 问题 |
|
||||
| **B08 来源/目标内容变化** | 暂存复制前后文件集合或主要哈希变化;基线后中心库更新;恢复前来源或目标变化 | 停止当前写入或恢复。更新已 Remove 但尚未 Add 成功时可能 RECOVERY_REQUIRED | 应保留阶段、原 Work 或人工备份路径;不能把部分成功视为整体成功 |
|
||||
| **B09 权威状态与工程身份** | 保存/关闭失败;注册内容不符;中心库复读失败;校验后不是 GREEN/READY | 当前项不通过;是否影响后续取决于释放事实。上传成功可为 UPLOADED,但不等于 UPLOADED_VERIFIED | 不能仅以 PCB 窗口打开、COM 返回或文件目录存在判成功 |
|
||||
| **B10 IO、路径与证据存储** | 网络盘不可见、路径映射失败、证据目录不可写、检查点变化、空间不足 | 读取/当前任务失败;关键写前检查点保存失败时不开始写入;某些辅助诊断写入失败只记录警告 | 网络/磁盘与原生数据库错误要分开报告;恢复需先复制验证库,因此有实际容量和耗时 |
|
||||
| **B11 程序关闭等待** | 关闭时检查仍活动、当前任务仍忙、线程池或路径租约操作仍未结束 | 首次关闭可能只请求停止;进入关闭流程后等线程池/租约结束,代码没有统一关闭总超时 | R7 正常退出通过,不代表 COM 永久不返回场景也能退出;需要单独验收这一条件 |
|
||||
| **F01 已修复复测** | 原生私有桌面 GetThreadDesktop 拒绝访问;重新 OpenDesktop 后 HWND 不可读 | 之前误报窗口归属变化,无法正常释放 | 已改为有界桌面枚举、映射窗口后再核对 PID,真实 PCB 正常取消退出通过 |
|
||||
| **F02 已修复复测** | 状态刷新期间结果窗口的释放按钮仍可点击,函数因 busy 直接返回 | 之前按钮点击无窗口 | 已跟随 busy/排队目标更新,R7 先禁用后可用,点击能打开释放窗口;不等于 E01 已解决 |
|
||||
|
||||
另有 **P2 结果展示错误**:释放数量包含自然退出且未允许操作的观察项,因此出现“已释放 4 个,确认允许 2 个”。这是统计问题,不是解除占用的证明。
|
||||
|
||||
## 三、完整业务流程总图
|
||||
|
||||
下图按实际任务边界展开:所有菜单可以独立提交请求;排队串行的是 Mentor 原生操作。为保持图可读,把共享的 PCB 子流程和释放子流程放在后两张展开图中,节点 V、R 在各图中指向同一过程。
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
START[启动桌面应用] --> INIT[配置日志、加载原生能力、异步发现未完成任务]
|
||||
INIT --> LIB[选择中心库并建立路径映射 B10]
|
||||
LIB --> READ[读取 CBB、工程文件及权威状态 B07 B09]
|
||||
READ --> LIST[搜索、筛选、可见项勾选]
|
||||
LIST --> OP{选择独立操作入口}
|
||||
|
||||
OP --> VERIFY[检验:只取可见非 READY 项]
|
||||
OP --> CHECK[ICDB 批量检查:只取可见非 READY 项]
|
||||
OP --> HISTORY[版本历史与备份:单个非 READY 项]
|
||||
OP --> RECOVER[从完整工程备份恢复:非 READY 项]
|
||||
OP --> MANAGE[中心库管理:READY 可更新或移除]
|
||||
OP --> R[释放残留:进入释放子流程]
|
||||
|
||||
VERIFY --> CONFIRM[显示目标与确认;写操作提示人工备份]
|
||||
CHECK --> CONFIRM
|
||||
HISTORY --> ADMIT
|
||||
RECOVER --> CONFIRM
|
||||
MANAGE --> CONFIRM
|
||||
CONFIRM --> ADMIT[原生队列准入 B01:可取消;按目标库保留状态判断]
|
||||
ADMIT --> DISPATCH{任务类型}
|
||||
DISPATCH -->|普通校验| V[共享 PCB 打开、弹窗、校验、关闭子流程 E02]
|
||||
DISPATCH -->|检查| CITEM[每项重新判断 READY 和内容是否更新]
|
||||
CITEM -->|应跳过| RESULT
|
||||
CITEM -->|应检查| CV[调用 V;仅诊断打开,不保存校验、不 Repair]
|
||||
CV --> CLASSIFY{本次错误正文含 ICDB 特征吗}
|
||||
CLASSIFY -->|正常打开并关闭| CLEAN[CHECKED;不等于 READY]
|
||||
CLASSIFY -->|含有特征| ICERR[报告 ICDB 问题;不执行自动修复]
|
||||
CLASSIFY -->|其他弹窗或无法打开| UNCERTAIN[无法确认;保留原错误 E02]
|
||||
CLEAN --> RESULT
|
||||
ICERR --> RESULT
|
||||
UNCERTAIN --> RESULT
|
||||
|
||||
DISPATCH -->|版本管理| HOPEN[绑定工程后打开原生备份窗口 B06]
|
||||
HOPEN --> HUSER[用户查看、创建备份或选择版本回退]
|
||||
HUSER --> HCLOSE[等待窗口正常关闭、释放结果及状态复读 B06 B09]
|
||||
HCLOSE --> RESULT
|
||||
|
||||
DISPATCH -->|备份恢复| BVALID[来源身份、路径、文件、空间检查 B07 B10]
|
||||
BVALID --> BCOPY[复制隔离验证库与备份工程 B08]
|
||||
BCOPY --> BV[调用 V:在副本校验 E02]
|
||||
BV --> BOK{PASS、GREEN 且安全释放}
|
||||
BOK -->|否| BUNCHANGED[恢复失败;目标不安装]
|
||||
BOK -->|是| BCOMPARE[复核来源和目标未变化 B08]
|
||||
BCOMPARE --> INSTALL[旧 Work 改名保留,再安装副本 B08 B10]
|
||||
INSTALL --> TV[调用 V:重新打开实际目标 B09]
|
||||
TV --> RESULT
|
||||
BUNCHANGED --> RESULT
|
||||
|
||||
DISPATCH -->|管理| MPRE[原生能力、来源、历史任务、库锁检查 B03 B07]
|
||||
MPRE --> MCAT[原生目录复读并核对名称和分区 B09]
|
||||
MCAT --> MBASE[记录内容基线;来源工程复制暂存 B08]
|
||||
MBASE --> MOP{新增、更新或移除}
|
||||
MOP -->|新增或更新| EXPORT[原生 ASCII、CSV、EDIF 身份导出 E03]
|
||||
EXPORT --> MWRITE[新增 Add;更新 Remove 后 Add B05 B08]
|
||||
MOP -->|移除| REMOVE[原生 Remove B05]
|
||||
MWRITE --> MREAD[目录复读、内容身份及释放核对 B09]
|
||||
REMOVE --> MREAD
|
||||
MREAD --> AUTO{新增或更新启用自动校验吗}
|
||||
AUTO -->|是| MV[调用 V 进行校验;上传成功与校验成功分别记录]
|
||||
AUTO -->|否或移除| RESULT
|
||||
MV --> RESULT
|
||||
|
||||
V --> RESULT[逐项记录结果、阶段、证据与释放事实]
|
||||
RESULT --> SAFE{safe_to_continue}
|
||||
SAFE -->|true| NEXT[继续下一项;ICDB 检查在每项之间让出原生队列]
|
||||
SAFE -->|false| RETAIN[B02 保留本库会话状态;同库余项跳过]
|
||||
RETAIN --> R
|
||||
NEXT --> MORE{还有任务且未停止吗}
|
||||
MORE -->|是| ADMIT
|
||||
MORE -->|否| REFRESH[刷新受影响条目的权威状态 B09;生成报告 B10]
|
||||
REFRESH --> LIST
|
||||
R -->|证明成功| RESUME[清理本库保留状态;必要时用户继续未执行项]
|
||||
R -->|未确认 E01| RETAIN
|
||||
RESUME --> LIST
|
||||
LIST -->|关闭应用| EXIT[停止当前任务并等待线程池、租约结束 B11]
|
||||
EXIT --> END[程序退出]
|
||||
|
||||
classDef error fill:#fee2e2,stroke:#dc2626,color:#7f1d1d
|
||||
classDef risk fill:#fff3cd,stroke:#d97706,color:#78350f
|
||||
classDef good fill:#dcfce7,stroke:#16a34a,color:#14532d
|
||||
class V,CV,UNCERTAIN,BV,EXPORT,R error
|
||||
class LIB,READ,ADMIT,HOPEN,HCLOSE,BVALID,BCOPY,BCOMPARE,INSTALL,TV,MPRE,MCAT,MBASE,MWRITE,REMOVE,MREAD,RETAIN,REFRESH,EXIT risk
|
||||
class CLEAN,RESUME good
|
||||
```
|
||||
|
||||
图中的“回到队列”是下一次任务准入的概览:当前普通校验和管理批次在批次外围占用队列;ICDB 检查每完成一个 CBB 才释放并重新排队,不能理解为三种批次都已经逐项让出通道。读取/状态刷新也会使用原生队列,纯内存搜索与筛选不启动 Mentor。
|
||||
|
||||
## 四、共享 PCB 任务展开图 V
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
V[开始:普通校验、检查或恢复副本校验] --> GATE[取得会话互斥、复核历史释放、取得库锁 B03 B04]
|
||||
GATE --> PRE[检查 PRJ、PCB、依赖和证据目录 B07 B10]
|
||||
PRE --> CONTENT{普通校验且配置了额外内容检查吗}
|
||||
CONTENT -->|是| EXTRA[Importer 内容检查;失败结束本项]
|
||||
CONTENT -->|否| LAUNCH
|
||||
EXTRA -->|通过| LAUNCH[创建私有桌面与监督 worker;启动 PCB B05]
|
||||
EXTRA -->|失败| FAILURE
|
||||
LAUNCH --> OPEN{原生打开结果}
|
||||
OPEN -->|读写确认提示| PERMISSION[E02 普通入口缺少通用授权交互;当前安全停止]
|
||||
OPEN -->|可识别版本选择| VERSION[用户选最后手动保存、自动保存或取消;适用入口才提供]
|
||||
OPEN -->|其他错误或未知弹窗| FAILURE[本项失败,记录实际文本或超时 B05]
|
||||
OPEN -->|打开完成| MODE{仅诊断打开吗}
|
||||
VERSION -->|可继续| OPEN
|
||||
VERSION -->|取消| FAILURE
|
||||
MODE -->|是| DIAG[证明目标已打开;请求关闭,不执行保存校验]
|
||||
MODE -->|否| VERIFY[实际原生校验、保存、关闭 B05 B09]
|
||||
VERIFY --> READY[中心库权威复读:必须 GREEN/READY B09]
|
||||
PERMISSION --> CLOSE
|
||||
FAILURE --> CLOSE
|
||||
DIAG --> CLOSE[正常关闭、取消已知启动弹窗、释放 COM 和自动化助手]
|
||||
READY --> CLOSE
|
||||
CLOSE --> OWNERS[确认 worker、PCB、启动器和目标资源已释放 B04;桌面访问 F01 已修复]
|
||||
OWNERS -->|成功| OUT[返回本项业务结果,safe_to_continue=true]
|
||||
OWNERS -->|失败或无法确认| RETAIN[保留证据与会话,safe_to_continue=false,触发 B02]
|
||||
classDef error fill:#fee2e2,stroke:#dc2626,color:#7f1d1d
|
||||
classDef risk fill:#fff3cd,stroke:#d97706,color:#78350f
|
||||
class PERMISSION error
|
||||
class GATE,PRE,LAUNCH,FAILURE,VERIFY,READY,OWNERS,RETAIN risk
|
||||
```
|
||||
|
||||
普通校验和检查都不默认启动自动 Repair。仓库中仍保留修复与修复后授权代码,但当前桌面批量检查路径明确关闭自动修复,不能把存在函数等同于产品入口已接通。
|
||||
|
||||
## 五、释放任务展开图 R
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
R[主窗口或结果窗口点击释放] --> UI[校验当前目标与按钮可用状态 F02 已修复]
|
||||
UI --> SCAN[异步枚举进程、线程桌面、窗口、历史会话]
|
||||
SCAN --> GROUP{能证明属于本库吗}
|
||||
GROUP -->|是| TARGET[可确认的目标客户端]
|
||||
GROUP -->|否| OBSERVE[归属未知,只允许观察]
|
||||
TARGET --> CONSENT[用户确认正常关闭;可查看原生提示]
|
||||
CONSENT --> ACTION[重新核对 PID、创建时间、映像、窗口后正常关闭 F01 已修复]
|
||||
ACTION --> PROMPT{还有原生提示吗}
|
||||
PROMPT -->|保存提示| SAVE[用户保存、放弃或保留;真实分支尚未完整验收]
|
||||
PROMPT -->|支持取消的活动窗口| CANCEL[确认后请求原生 Cancel;不当成取消已完成]
|
||||
PROMPT -->|无| EXITCHECK
|
||||
SAVE --> EXITCHECK[观察真实进程是否退出]
|
||||
CANCEL --> EXITCHECK
|
||||
EXITCHECK --> ALL{当前代码:所有观察项都 RELEASED 吗}
|
||||
OBSERVE --> ALL
|
||||
ALL -->|否| ERROR[E01 未归属本库的其他任务也会让整体 PARTIAL]
|
||||
ALL -->|是| PROOF[持有证明句柄检查本库、共享库、地址、导出副本和在途调用 B04]
|
||||
PROOF --> UNKNOWN[E01 底层仍可能把路径未知进程当候选占用]
|
||||
UNKNOWN -->|不能证明| ERROR
|
||||
UNKNOWN -->|证明成功| RECORD[归档匹配的历史记录,清理对应保留状态及映射]
|
||||
RECORD --> RELEASED[RELEASE_CONFIRMED;允许重新尝试]
|
||||
ERROR --> WAIT[B01 队列仍等或 B02 本库余项已跳过;显示残留原因]
|
||||
WAIT -->|用户重新检查| SCAN
|
||||
classDef error fill:#fee2e2,stroke:#dc2626,color:#7f1d1d
|
||||
classDef risk fill:#fff3cd,stroke:#d97706,color:#78350f
|
||||
classDef fixed fill:#dcfce7,stroke:#16a34a,color:#14532d
|
||||
class ALL,ERROR,UNKNOWN error
|
||||
class PROOF,WAIT,SAVE,CANCEL risk
|
||||
class UI,ACTION,RELEASED fixed
|
||||
```
|
||||
|
||||
强制结束是另一个需要确认的分支:只针对已确认归属、符合条件的客户端,不能结束数据库服务器或归属未知进程;本轮真实操作只验收了打开确认后取消,没有执行强制终止。它不会消除 E01,不能作为释放判断错误的替代方案。
|
||||
|
||||
## 六、代码位置与四层协调机制
|
||||
|
||||
| 机制 | 位置 | 控制范围 |
|
||||
| --- | --- | --- |
|
||||
| 原生队列 | `operation_queue.py:18`、`ui/main_window.py:844`、`ui/management_dialog.py:174` | 应用内一次执行一个原生任务;按库保留状态允许其他可运行票据越过等待项 |
|
||||
| Windows 会话互斥 | `verify_runner.py:547`、`management.py:172`、`backup_recovery.py:145` | 同一 Windows 会话中的本工具原生调用;不是每工程独立互斥 |
|
||||
| 库协调锁与历史阻止记录 | `library_lock.py:129`、`:443`、`:523` | 按中心库控制写入与释放;历史记录需复核,不能直接删除当成功 |
|
||||
| 运行时保留状态 | `session_record.py:25`、`:236`、`:354`、`:443` | 原生队列准入、助手与客户端身份观测;日志阶段不等于真实进程状态 |
|
||||
| 导出副本所有权 | `native_export_guard.py:10`、`native_engineering_identity.py:288` | 防止原生导出器仍持有分析副本时释放相关操作 |
|
||||
|
||||
关键传播代码:`verify_runner.py:1294`、`management.py:430`、`ui/icdb_check_task.py:55`。E01 的双重判定:`residual_sessions.py` 中 `_release_residual_sessions` 的全部行 RELEASED 条件,以及 `library_lock.py:443` 的 `_prove_library_released`。E02:`dialog_rules.py:222`、`verify_runner.py:895`。E03:`native_engineering_identity.py:288`。退出等待:`ui/main_window.py:1709`。
|
||||
|
||||
建议处理顺序:**E01 的本库释放判定 → B02 的工程/共享库影响范围 → E02 的明确用户确认路径 → B01/B05/B11 的等待及停止结果 → E03 输入兼容性与剩余条件按钮原生验收**。这些是后续工作建议,未在本次流程整理中实施。
|
||||
@@ -0,0 +1,73 @@
|
||||
# 误判复核与优化顺序
|
||||
|
||||
> 证据路径说明:本文的本机绝对路径、日志名、截图、测试 XML 和冻结包指向验收机器上的原始材料,未纳入 Git;仓库仅保留说明和验证摘要。
|
||||
|
||||
> 这是当天早期的复核与建议;后续实施结果见 [占用范围验证](2026-11-12-scoped-release-validation.md),不将早期未通过项追记为成功。
|
||||
|
||||
依据 `42d0ceb` 的六处修复记录、真实冻结程序验收,以及 13:44–13:46 的外部进程归属交叉核对。本轮只做分类和优化建议,没有修改业务代码。统计单位是已知问题根因,不能据此估算整个程序的缺陷率。
|
||||
|
||||
## 已修复的六处问题
|
||||
|
||||
| 问题 | 复核分类 | 依据 |
|
||||
| --- | --- | --- |
|
||||
| 导出器退出期间 OpenProcess 返回 5,立即认为释放失败 | 误判/过早得出失败结论 | 原生退出竞争;需要继续观察新快照与目标文件,而不是只看一次权限错误。已修复并有真实导入/更新复测 |
|
||||
| 无工程参数的外部 viewdraw 阻止备份入口 | 跨工程占用误判 | 未证明目标被占用;恢复入口已改为结合路径、地址与目标文件实际探测 |
|
||||
| 历史 sAddress_.adr 不一致导致报告工程内容不同 | 内容校验范围误判 | 地址元数据不等于工程内容;完整复制保留,但主要内容哈希排除 |
|
||||
| 旧工程没有辅助 PCB/pcb.prj 被报告备份不完整 | 工程格式误判 | PCB 唯一关联主 PRJ 的旧格式本身可用;已复用同一身份检查并真实进入副本校验 |
|
||||
| 私有桌面窗口不可读,不能正常取消 PCB | 真实 Windows 接入缺陷 | 正常进程查询权限不等于可读外部桌面 HWND;已修复并真实关闭客户端 |
|
||||
| 释放按钮可点击但 busy 导致处理函数直接返回 | 真实 UI 状态缺陷 | R6 原包实际点击无窗口,R7 新包先禁用再可用,实际打开窗口 |
|
||||
|
||||
六处中四类属于误判/过严判断,两类属于真实功能缺陷。这里“误判”仍然是程序需要修复的缺陷,不表示可以撤销失败记录或补记验收成功。
|
||||
|
||||
## 当前剩余五类问题
|
||||
|
||||
| 类别 | 判定 | 是否仍需修改 |
|
||||
| --- | --- | --- |
|
||||
| 外部未知会话导致整库释放 PARTIAL | **已确认占用范围误判,1 个根因至少影响两道释放门禁** | 是,最高优先级;操作集合全退出判断与底层资源证明必须一起修正 |
|
||||
| 显示释放 4 个,但确认允许操作只有 2 个 | **统计归因错误** | 是;区分本次请求关闭、实际退出、原已退出、外部只读观察,不混成主动释放数量 |
|
||||
| PCB 读写确认挡住校验与备份恢复 | **原生提示真实发生,普通流程缺少相应确认路径;当前停止不等于检测错** | 是;明确用户授权、目标身份和实际占用核查;不能当 ICDB 损坏,也不能直接自动同意 |
|
||||
| A/B 的原生 EDIF 导出崩溃 | **真实导出失败,输入/原生兼容性根因未定** | 是;保留错误码、输入及导出证据,独立复现,不绕过内容身份校验 |
|
||||
| 条件按钮、现场失联副本、Win10 等未完成 | **验收缺口,不能记为已发生漏洞或误判** | 补真实覆盖;测试后再决定需要何种修改 |
|
||||
|
||||
此前“本程序遗留会话导致释放不了”的描述需细化:本程序在停止启动过程中确实留下过两个 PCB 客户端,属于真实清理问题;正常关闭后,继续挡住整库确认的是外部软件。不能用后半段的误判抹去前半段实际残留,也不能把两者当成同一种“锁”。
|
||||
|
||||
## 优化顺序与验收条件
|
||||
|
||||
### P1:统一占用归属和资源范围
|
||||
|
||||
当前备份入口与整库释放入口使用不同的判断强度;一处已经按目标资源探测,另一处仍能因未知进程直接停止。应复用统一的“来源、目标范围、活动阶段、资源证据”判断,避免每个入口再次发明一套锁规则。
|
||||
|
||||
- 来源记录:创建时保存 PID、创建时间、映像、任务号、私有桌面、目标工程/库和父子关系;重启后按身份核对,不能仅凭 PID。
|
||||
- 范围判定:区分同工程、同库共享依赖、明确其他库、未知。由谁拉起与是否占用本库分别保存。
|
||||
- 观察项不自动变成阻止项。明确属于其他库的进程不要求退出;未知项展示不确定原因,继续取本库在途调用、目标文件/数据库、地址、必要原生读取等证据。证据不足不能猜测安全。
|
||||
- 不能只把 `scope is not False` 改成 `scope is True`,也不能只改“所有行退出”条件;否则可能放过真实打开同库的外部会话,或仍被底层第二道门禁挡住。
|
||||
- 目标文件独占打开只是证据之一,不单独保证原生接口、共享依赖和检查期间的状态均安全。后续写入前还需重新核对。
|
||||
|
||||
验收至少包括:其他软件开其他库且持续运行时,本库能正常完成操作;其他软件确实持有本库数据库时,本库拒绝相关写入;外部进程来源不明但目标文件无占用时,不能单凭进程名永久阻止;PID 被复用时不得操作新进程。
|
||||
|
||||
### P1:把单项失败与批次停止分开
|
||||
|
||||
现有一个 `safe_to_continue` 同时承载多种情况:当前项失败、当前工程占用、共享库写入未结束、释放证据不足。因此某个工程的问题容易扩大为整库不可用。
|
||||
|
||||
逐项保留业务结果,再明确能否继续及影响范围:仅当前工程、整个共享库、原生执行通道、用户主动停止。安全释放的失败项继续下一项;仅当前工程问题是否可绕过,需要以共享资源证据决定;共享写入未返回则继续保护。不要全局放开 false 或直接删历史记录。
|
||||
|
||||
验收要使用同一批次“坏工程 → 好工程”以及“共享库真实占用 → 后续写入不得开始”两个方向。现有真实多来源新增已通过前一方向的一种安全失败场景,不代表所有占用场景都通过。
|
||||
|
||||
### P1/P2:接通原生读写提示与非阻塞操作
|
||||
|
||||
普通校验、检查、恢复副本按操作目的决定是否允许读写授权,不复用只适用于修复后的隐式授权。识别精确提示后展示目标和选项,用户可继续、跳过、取消;等待用户决定时保持 UI 可用,并明确后续任务是否仍需等当前原生会话。检查流程不能因用户点击而悄悄变成自动修复。
|
||||
|
||||
队列、原生执行和关闭分别展示等待对象与阶段。取消排队立即生效;已进入原生写入时说明是否正在等待返回或支持原生取消。普通校验/管理当前在批次外层持有队列,评估能否在完整单项事务结束后让出通道,不在 Remove→Add 中间插入另一写任务。
|
||||
|
||||
### P2:结果和性能
|
||||
|
||||
- UI 使用“检测结果、操作结果、释放状态”分别表达,避免将“待用户确认”写成工程损坏,或将“上传成功”写成 READY。
|
||||
- 修正释放数字归因,报告观察项不增加本次主动释放数量。
|
||||
- 来源、版本、依赖等便宜的输入检查先做;只复查本次受影响工程和实际依赖。避免每个按钮都全局扫描并读取无关窗口。
|
||||
- 原生 EDIF 单独诊断;保存失败输入和退出码,让独立 CBB 继续,不能降低身份校验来消除报错。
|
||||
|
||||
### P2:真实并行与异常操作回归
|
||||
|
||||
保留其他软件测试作为并行验收条件,覆盖:外部独立工程持续打开、外部共享同库、检查中排队再取消、停止后立即释放、刷新时连续点击、版本窗口开关、断网、源文件变化、主程序关闭与重启后的 PID 复用。分别核查目标变更、真实进程退出、权威状态和剩余任务,而不是只看按钮恢复可用或 Python 测试通过。
|
||||
|
||||
当前最有价值的改动是修 E01 的作用范围与证据链,而不是继续增加更多全局拒绝条件。最终验收仍要求实际完整校验与恢复到 READY;本次分类没有补齐这一缺口。
|
||||
@@ -0,0 +1,337 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"created": "2026-11-12T11:32:48",
|
||||
"overall_acceptance": "NOT_PASSED",
|
||||
"automatic_icdb_repair": false,
|
||||
"merged": false,
|
||||
"issue_closed": false,
|
||||
"environment": {
|
||||
"windows": [
|
||||
"11",
|
||||
"10.0.26200",
|
||||
"SP0",
|
||||
"Multiprocessor Free"
|
||||
],
|
||||
"python": "3.12.10",
|
||||
"mentor": "EE7.9.5"
|
||||
},
|
||||
"baseline_commit": "b86e4e315a2ac7d8a3d05587389d0237b6576881",
|
||||
"candidate": {
|
||||
"executable": "F:\\CbbAccept-20261112\\candidate-release4\\dist\\CbbRefreshVerify-Background\\CbbRefreshVerify.exe",
|
||||
"module_count": 62,
|
||||
"source_and_frozen_code_equal": true,
|
||||
"source_sha256_checked": true,
|
||||
"packaged_assets_equal": true,
|
||||
"exe_icon_images_equal": true,
|
||||
"executable_sha256": "2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d"
|
||||
},
|
||||
"tests": {
|
||||
"name": "pytest",
|
||||
"errors": "0",
|
||||
"failures": "0",
|
||||
"skipped": "0",
|
||||
"tests": "1851",
|
||||
"time": "382.059",
|
||||
"timestamp": "2026-11-12T11:20:58.800467+08:00",
|
||||
"hostname": "Abs"
|
||||
},
|
||||
"compileall_passed": true,
|
||||
"git_diff_check_passed": true,
|
||||
"original_integrity": {
|
||||
"time": "2026-11-12T11:29:23",
|
||||
"results": [
|
||||
{
|
||||
"scope": "A",
|
||||
"source": "F:\\Sync Tool Skyworth\\Work Maps\\Skyworth_CBB_Lib\\CBB\\1GPHY_RTL8211F",
|
||||
"checked": 187,
|
||||
"changes": []
|
||||
},
|
||||
{
|
||||
"scope": "B",
|
||||
"source": "F:\\Sync Tool Skyworth\\Work Maps\\Skyworth_CBB_Lib\\CBB\\1GPHY_RTL8211F_A",
|
||||
"checked": 185,
|
||||
"changes": []
|
||||
},
|
||||
{
|
||||
"scope": "field-library-originals",
|
||||
"source": "F:\\Sync Tool Skyworth\\Work Maps\\Skyworth_CBB_Lib\\Mentor_lib_EE7.9",
|
||||
"checked": 26887,
|
||||
"changes": []
|
||||
}
|
||||
],
|
||||
"originals_unchanged": true
|
||||
},
|
||||
"native_crud": {
|
||||
"same_name_update": {
|
||||
"operation": "update",
|
||||
"name": "1GPHY_8212",
|
||||
"stage": "complete",
|
||||
"status": "UPLOADED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "上传已确认;本批次未启用自动校验。"
|
||||
},
|
||||
"remove": {
|
||||
"operation": "remove",
|
||||
"name": "1GPHY_8212",
|
||||
"stage": "complete",
|
||||
"status": "REMOVED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "已由原生操作移除,重新读取目录确认不存在;应用未创建备份。"
|
||||
},
|
||||
"batch_first_safe_failure": {
|
||||
"operation": "add",
|
||||
"name": "1GPHY_RTL8211F",
|
||||
"stage": "complete",
|
||||
"status": "UPLOAD_FAILED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "Native identity exporter failed or reported an error."
|
||||
},
|
||||
"batch_next_added": {
|
||||
"operation": "add",
|
||||
"name": "1GPHY_8212",
|
||||
"stage": "complete",
|
||||
"status": "UPLOADED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "上传已确认;本批次未启用自动校验。"
|
||||
}
|
||||
},
|
||||
"final_ui_observations": [
|
||||
{
|
||||
"time": "2026-11-12T11:26:17",
|
||||
"event": "legacy-backup-recovery-result",
|
||||
"bundle_sha256": "2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d",
|
||||
"text": [
|
||||
"目标 CBB",
|
||||
"备份工程",
|
||||
"恢复未通过:备份校验未通过,目标未更改。\nDATABASE_RECOVERY_REQUIRED: 是(&Y) | 否(&N) | If an XDS or ExpeditionPCB is running on this design, it's likely that\nyour file system and/or network system was too slow to determine\nwhich product the design is open in within the 15 second timeout\nperiod.\n\nOtherwise, the design may not have been closed properly due to\nthe XDS or ExpeditionPCB crashing in the last session.\n\nBefore continuing, please confirm that no other users have the\ndesign open.\n\nContinue to open the design with read/write access permission?\n记录:F:\\CbbAccept-20261112\\final-data\\evidence\\backup-restore-90b843115d07\\recovery-result.json"
|
||||
],
|
||||
"target_primary_unchanged": true
|
||||
},
|
||||
{
|
||||
"time": "2026-11-12T11:27:59",
|
||||
"event": "final-backup-queue-cancelled",
|
||||
"bundle_sha256": "2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d",
|
||||
"text": [
|
||||
"目标 CBB",
|
||||
"备份工程",
|
||||
"恢复未通过:已取消排队,未启动原生操作。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"time": "2026-11-12T11:28:27",
|
||||
"event": "summary-release-initial-state",
|
||||
"bundle_sha256": "2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d",
|
||||
"enabled": false,
|
||||
"text": [
|
||||
"ICDB 检查结束:未发现异常 0,发现问题 0,占用 0,无法确认 0,取消 1,未执行 0",
|
||||
"中心库",
|
||||
"可见 1 / 1 · READY 0 · 异常/待确认 1",
|
||||
"ICDB 检查结束:未发现异常 0,发现问题 0,占用 0,无法确认 0,取消 1,未执行 0",
|
||||
"正在执行当前任务…"
|
||||
]
|
||||
},
|
||||
{
|
||||
"time": "2026-11-12T11:28:28",
|
||||
"event": "summary-release-opened",
|
||||
"bundle_sha256": "2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d",
|
||||
"text": [
|
||||
"正在检查当前库关联的会话…",
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
"time": "2026-11-12T11:28:34",
|
||||
"event": "force-warning-cancel",
|
||||
"bundle_sha256": "2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d",
|
||||
"text": [
|
||||
"仅强制结束以下客户端。客户端中其他已打开工程也会退出;未保存的更改会丢失,正在写入的工程可能需要恢复。\n数据库服务器和归属未知的进程不会被强制结束。\n\n1GPHY_8212 — ExpeditionPCB.exe (PID 21856)\n1GPHY_8212 — ExpeditionPCB.exe (PID 21248)\n\n仍要结束这些进程吗?"
|
||||
]
|
||||
},
|
||||
{
|
||||
"time": "2026-11-12T11:28:59",
|
||||
"event": "r7-normal-exit",
|
||||
"bundle_sha256": "2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d",
|
||||
"exit_code": 0
|
||||
}
|
||||
],
|
||||
"backup_recovery": {
|
||||
"installed": false,
|
||||
"status": "FAIL",
|
||||
"detail": "备份校验未通过,目标未更改。\nDATABASE_RECOVERY_REQUIRED: 是(&Y) | 否(&N) | If an XDS or ExpeditionPCB is running on this design, it's likely that\nyour file system and/or network system was too slow to determine\nwhich product the design is open in within the 15 second timeout\nperiod.\n\nOtherwise, the design may not have been closed properly due to\nthe XDS or ExpeditionPCB crashing in the last session.\n\nBefore continuing, please confirm that no other users have the\ndesign open.\n\nContinue to open the design with read/write access permission?",
|
||||
"target_primary_unchanged": true
|
||||
},
|
||||
"residual": {
|
||||
"library": "F:\\CbbAccept-20261112\\library\\native-add\\fixture\\mentor_lib.lmc",
|
||||
"status": "PARTIAL",
|
||||
"confirmed_scope": [
|
||||
{
|
||||
"name": "ExpeditionPCB.exe",
|
||||
"pid": 21856,
|
||||
"release_status": "RELEASED",
|
||||
"consent_allowed": true
|
||||
},
|
||||
{
|
||||
"name": "ExpeditionPCB.exe",
|
||||
"pid": 21248,
|
||||
"release_status": "RELEASED",
|
||||
"consent_allowed": true
|
||||
}
|
||||
],
|
||||
"final_target_clients": 0,
|
||||
"observed_unconfirmed": [
|
||||
{
|
||||
"name": "viewdraw.exe",
|
||||
"pid": 29832,
|
||||
"scope_confirmed": false
|
||||
},
|
||||
{
|
||||
"name": "cscript.exe",
|
||||
"pid": 8652,
|
||||
"scope_confirmed": false
|
||||
}
|
||||
],
|
||||
"foreign_task_processes_terminated": false,
|
||||
"lock_or_address_files_deleted": false
|
||||
},
|
||||
"remaining": [
|
||||
{
|
||||
"priority": "P1",
|
||||
"problem": "Unconfirmed processes from another task still prevent whole-library release proof"
|
||||
},
|
||||
{
|
||||
"priority": "P2",
|
||||
"problem": "Release count includes unconsented observation rows that exited independently"
|
||||
},
|
||||
{
|
||||
"problem": "Native PCB read/write permission prompt prevents successful verify/READY and backup installation"
|
||||
},
|
||||
{
|
||||
"problem": "Native EDIF exporter crashes for isolated A/B inputs, exit 0xC0000005"
|
||||
},
|
||||
{
|
||||
"problem": "Some conditional native buttons, field lost-session recovery, Windows 10 remain unaccepted"
|
||||
}
|
||||
],
|
||||
"evidence": [
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\candidate-release4\\bundle-verification.json",
|
||||
"bytes": 261,
|
||||
"sha256": "8dbefef3d8cbd65f3531a1919b11a8bea1b494f01fe63a65ac277e05b572b7de"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\candidate-release4\\source-sha256.json",
|
||||
"bytes": 8168,
|
||||
"sha256": "35d9904b515297ab033e3290ae69785fa827e7f3440d1a670e665016c18b28f8"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\full-suite-delivery.xml",
|
||||
"bytes": 265893,
|
||||
"sha256": "cb3298e2aa72c5f4899e1b4dc21c88b35b58af6343de5f3d148e6a5acfcba7de"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\desktop-map-red.xml",
|
||||
"bytes": 11144,
|
||||
"sha256": "e209aa9aadefec21013ffaa1364c42cf210b3bfb738fb7cc817bd9f39f1aaa5f"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\desktop-map-green.xml",
|
||||
"bytes": 4929,
|
||||
"sha256": "1a5b5814bc21d3f739573700f4c93da3b241161124f80ed44d2ee0bcf5f01c39"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\legacy-backup-red.xml",
|
||||
"bytes": 7828,
|
||||
"sha256": "6c05be80efcd1430de99a905b9a32aaa29079aedb7cef606a673896bebf200dc"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\legacy-backup-green.xml",
|
||||
"bytes": 13877,
|
||||
"sha256": "2a0fc3ddb5b743f2cb2db00a81dc1bc025f76a75a5c6099f667e3461a555d49b"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\summary-release-red.xml",
|
||||
"bytes": 3116,
|
||||
"sha256": "3dcec893e4d3dca47d8d48bd8e83752f8a3860da09195c40429d1841bf6b9a6b"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\summary-release-green.xml",
|
||||
"bytes": 10321,
|
||||
"sha256": "f8beefdea1b616d6459f4e12becdbdac633b4650f487332627d5e54c85518ce6"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\originals-rechecked.json",
|
||||
"bytes": 632,
|
||||
"sha256": "693155ed50d18af7d9ae1bda41a696d25687b486541fc0e9df9956e7dbfe7653"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\final-native-inspection.json",
|
||||
"bytes": 22288,
|
||||
"sha256": "038a635a8bd3e5d5de5eb4ad73125b12bbd1416d53a8f27ebe014e2a6bb84536"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\r7-accept.log",
|
||||
"bytes": 25203,
|
||||
"sha256": "ceca1412c2df483f4290e7131c587af5de16d30874f23a588f53d32db432f9e7"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\final-data\\management\\management-741e463dc75d4f35acd992ad42200fbf\\checkpoint.json",
|
||||
"bytes": 3547,
|
||||
"sha256": "7fe68525e01d8e35bacb2bc84cdc4fa1469bb599f40bd6a77dcad7a6725bce24"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\final-data\\management\\management-d83e404f22864885ab57943783897ebe\\checkpoint.json",
|
||||
"bytes": 11411,
|
||||
"sha256": "6928ef7a8d9664da7ee209afeb280c61fd081f5d207ef8686ebf09ad57d8140a"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\final-data\\management\\management-a900d2b62a544623b499ce55d099dfd2\\checkpoint.json",
|
||||
"bytes": 1140,
|
||||
"sha256": "dc0725ff0db339f81be5af021925396cba50f303cfea5c0aa2370a8deff18486"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\final-data\\management\\management-c8a18e3bb8bc4aa19f7dbc982b3602d2\\checkpoint.json",
|
||||
"bytes": 11652,
|
||||
"sha256": "d09ad8d7b88e7ba607ddb34cac523ef8074f5d3f43fe2f033c35125629bc251c"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\final-data\\evidence\\backup-restore-90b843115d07\\recovery-result.json",
|
||||
"bytes": 3901,
|
||||
"sha256": "df44ea3f2d01ace1189c2c5f93af8c67abc6c196cf2ba8e99318d222a582c58a"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\final-data\\release-checks\\sessions-346da47efa8d\\result.json",
|
||||
"bytes": 8947,
|
||||
"sha256": "743fc764021ac8fc22d6f799f4f9663d704d0fd6c41aafd14409666e85747900"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\step-restore_execute.py.log",
|
||||
"bytes": 4134,
|
||||
"sha256": "a6da200bd6a3895d60ae85eac419b440696a5b9b5503856990782ed04f1f9795"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\r5-batch-add-result.png",
|
||||
"bytes": 75306,
|
||||
"sha256": "a812edf98f2a96ce4c1f5cd218c9ec0b045e94538af11dbd65c35db799e03e2d"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\r5-release-result-1.png",
|
||||
"bytes": 44151,
|
||||
"sha256": "a916a2080504201902c5d873fc3d7913e47804b7c5e1aa410a8ef8f778e759b5"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\r7-summary-release-initial-state.png",
|
||||
"bytes": 11891,
|
||||
"sha256": "d13236159a38adf8030d84a66f59db4269cba471f305e835918cf1e4f86b7397"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\r7-summary-release-opened.png",
|
||||
"bytes": 87863,
|
||||
"sha256": "a77e0169e7dce2f25f5f3343afa73af75418837987bb7561c24dca18485e3627"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbAccept-20261112\\r7-final-release-result.png",
|
||||
"bytes": 88350,
|
||||
"sha256": "1b504c4b0c42c18cdbc73bc58b5aa716cde43cb0330106b07fc7cb5e40c7a514"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
# 2026-11-12 冻结程序与 Mentor 原生验收
|
||||
|
||||
> 证据路径说明:本文的本机绝对路径、日志名、截图、测试 XML 和冻结包指向验收机器上的原始材料,未纳入 Git;仓库仅保留说明和验证摘要。
|
||||
|
||||
**结论:未通过整体验收,不合并发布、不关闭工单。**
|
||||
|
||||
本轮实际运行冻结 EXE、Mentor EE7.9.5、原生 COM/命令和私有桌面窗口;点击使用真实 UIA/Win32 控件,没有替换业务服务、伪造原生结果或抢占前台鼠标。此前 48 按钮 Qt 模拟结果不计为本次原生验收。
|
||||
|
||||
最终候选包:`F:\CbbAccept-20261112\candidate-release4\dist\CbbRefreshVerify-Background\CbbRefreshVerify.exe`。
|
||||
SHA-256:`2ad132e434a8e1de0b61f271aa87215749b0f3174ea0682eb578bc31271e8a4d`。
|
||||
冻结档案中的 62 个模块逐一与源代码编译结果相符;打包资产及 EXE 图标与当前源图标相符。
|
||||
原始记录、截图、失败尝试和各轮候选包保存在 `F:\CbbAccept-20261112`,便于核对本报告中的具体测试轮次。
|
||||
|
||||
## 隔离范围与原件核对
|
||||
|
||||
- 原生创建独立空库 `library\native-add\fixture\mentor_lib.lmc`,随后实际新增、更新和移除测试 CBB。
|
||||
- 另复制现场库的共享依赖及四个工程到 `field-lib`:26,887 个文件,815,607,385 字节。该库实际读取到四个 READY 项。
|
||||
- 独立来源 A/B 的库引用原指向不可用的 S 盘,仅对隔离副本改为测试库;原工程未改。
|
||||
- 验收结束重新核对原件:A 的 187 个主要文件、B 的 185 个主要文件、复制现场库所对应的 26,887 个原文件,大小及 SHA-256 均未改变。见 `originals-rechecked.json`。
|
||||
- 完整旧 Work 已人工保留到 `manual-old-work`;应用管理操作继续采用手动备份提示,没有新增自动整库备份。
|
||||
- 原生进程只使用正常关闭/取消。强制结束的确认窗口实际打开后选择了取消;没有强制结束其他工具的进程,也没有删除地址或锁文件。
|
||||
|
||||
## 实际发现并修改的六处问题
|
||||
|
||||
| 问题 | 修改 | 实际复测及边界 |
|
||||
| --- | --- | --- |
|
||||
| 导出器退出期间 OpenProcess 返回 5,立即被当成释放失败 | 5/87 均继续观测;只有新快照无目标、已取得句柄退出且数据库探测通过才放行 | R3 同名更新、R5 新增及同批失败续跑;真实活动进程和数据库占用仍拒绝放行 |
|
||||
| 另一个工程无 PRJ 参数的 viewdraw 阻止备份入口 | 备份空闲检查结合目标路径、地址及实际独占读探测,不再单凭未知命令阻止 | R7 中其他 DxDesigner 仍运行,备份进入隔离库及原生校验;这不等于下面的整库释放问题已解决 |
|
||||
| 原生导入不保留历史 `sAddress_.adr`,被误报内容不一致 | 将其与 `sAddress.adr` 一起排除在主要内容哈希之外,规则版本升为 2,完整复制仍保留 | R3 更新 `UPLOADED`,原理图 ASCII/CSV/EDIF、布局与注册内容一致;R5 再新增成功 |
|
||||
| 外部私有桌面的 GetThreadDesktop 返回拒绝访问,重新 OpenDesktop 后 HWND 还不可读 | 对失败 PID 枚举当前窗口站的桌面;打开桌面后先枚举窗口,再核对 PID 并发送关闭/取消 | R5 原先残留的 PCB 启动器/客户端两个真实进程正常退出,获得 RELEASE_CONFIRMED;R6/R7 同类客户端也退出 |
|
||||
| 恢复入口强制要求旧格式工程没有的辅助 `PCB/pcb.prj` | 复用既有工程身份检查;PCB 必须唯一关联所选主 PRJ,数据库与布局仍必需 | R5 原包拒绝;R7 新包进入隔离复制和真实 PCB 校验。原生读写确认仍导致校验失败,目标主要文件未改,未安装备份 |
|
||||
| ICDB 结果窗口在前台任务忙时仍允许点击释放,处理函数却直接返回 | 结果按钮跟随执行状态;目标库因保留会话而排队时使用排队释放入口 | R6 实际点击无窗口;R7 同样操作时按钮先禁用,随后恢复,点击成功打开释放窗口。排队入口另有回归覆盖 |
|
||||
|
||||
## 实际按钮与流程结果
|
||||
|
||||
| 入口/动作 | 观察结果 | 验收判断 |
|
||||
| --- | --- | --- |
|
||||
| 选择库、读取、三个菜单、搜索/筛选、选择可见项/清空选择 | 空库、一个 PENDING、四个 READY 的真实数据可读取和操作;READY 不进入维护入口 | 已覆盖这些真实数据场景;381/3,000 项响应测试仍仅是此前模拟 |
|
||||
| 高级设置及原生 Verify 开关 | 展开、收起、切换和还原成功 | 仅验证控件;Win10 原生 Verify 运行未验收 |
|
||||
| 查看运行日志、打开日志目录 | 实际点击可用 | 已覆盖 |
|
||||
| 已选校验、可见非 READY 校验 | 前者实际运行;后者确认后取消,没有执行写入 | 已选校验未通过,不能报告 READY |
|
||||
| 检查中提交普通校验 | UI 可用、确认成功、显示排队;检查结束后实际启动普通 PCB 校验 | 排队行为通过;校验本身失败 |
|
||||
| ICDB 批量检查(取消确认/完整执行/停止/再次使用) | 完整检查约 38 秒;读写确认不含 ICDB 错误,归类为无法确认;停止后可重新使用,可能留下客户端供确认释放 | 未执行自动 Repair;不能视为现场修复通过 |
|
||||
| 版本历史与备份 | 从应用打开真实原生窗口,读取五个备份;创建 User 备份,再从原生 Restore 对话框恢复所选备份 | 原生输出 `Backup restored successfully.`;关闭后 CLOSED、safe=true,应用按钮恢复。证据为 R3 原生工具操作 |
|
||||
| 从备份恢复(无效来源、取消确认、重复点击) | 无效输入拒绝;取消不启动;执行后按钮禁用,重复点击未重复启动 | 已覆盖 |
|
||||
| 恢复排队、取消排队 | R6/R7 在检查期间提交,显示排队;取消后明确未启动原生操作 | 已覆盖 |
|
||||
| 旧格式备份完整恢复 | R7 通过格式/复制检查,在隔离库打开 PCB 时被读写确认拦下 | **未完成恢复**;installed=false、目标主要文件不变,保留证据 |
|
||||
| 用工程替换已选 CBB | R3 实际 Remove → 原生缺项复读 → Add → 内容比对 → 目录复读 | UPLOADED、safe=true;关闭自动校验,不等于 READY |
|
||||
| 移除 | R5 原生 CleanWGLib 返回成功;独立目录读取为空,应用读取 0 项 | REMOVED、safe=true |
|
||||
| 多来源新增 | 同批 A 的 EDIF 导出失败、safe=true;随后 C 实际新增成功;独立复读只有 C | 未因首项安全失败而停止整批 |
|
||||
| 重复名称新增 | 实际拒绝;独立复读的条目、工程身份不变 | 已覆盖 |
|
||||
| 管理执行确认取消、再次确认、连续点击执行 | 取消后可重新确认;运行时禁用执行,重复点击不创建第二项 | 新增、更新、移除均有真实操作记录 |
|
||||
| 查看原生提示、重新检查、确认释放、关闭 | 窗口和提示可读;本工具两个 PCB 进程正常退出 | R5 完整释放通过;R6/R7 仍被下面的跨任务观察项阻止整库确认 |
|
||||
| 强制结束客户端 | 确认名单只列两个本库 PCB,点击取消后继续正常释放 | 仅确认/取消路径通过,实际强制终止未执行 |
|
||||
| 主程序退出 | R3/R4/R5/R6/R7 正常退出,末次退出码 0 | 不将退出应用造成的内存释放算作整库释放功能通过 |
|
||||
|
||||
**仍未实际触发的条件按钮**:处理 PCB 未保存更改的保存/放弃选择、活动原生备份的“请求原生取消”、管理批次“当前项结束后停止”、实际强制终止、ICDB 特征错误后的工程副本重导入、成功安装备份后的再次打开并 READY。它们的 Qt/回归测试不能替代原生验收;不宣称每一个按钮的所有原生分支都已通过。
|
||||
|
||||
## 未解决的验收卡点
|
||||
|
||||
1. **P1:未确认归属的其他任务仍能阻止整库释放。** R7 `sessions-346da47efa8d/result.json` 中,确认允许的 PCB PID 21856/21248 均 RELEASED,但另一个私有桌面上的 viewdraw PID 29832 为 scope_confirmed=false、consent_allowed=false、WAITING,整体仍 PARTIAL。末次检查还观察到其他工具的 cscript;没有本库确认所属的客户端残留。原因在于 `residual_sessions._release_residual_sessions` 要求全部观察项 RELEASED,随后 `library_lock._prove_library_released` 也把无法确定路径的进程当成候选占用。不能要求关闭其他任务来通过本库验收。后续需要将观察项与可操作目标分开,并用本库数据库/地址/独占句柄及在途调用证明决定能否继续;同时覆盖真实持有本库数据库时仍必须拒绝的场景。本轮未修改此判定。
|
||||
2. **P2:释放数量混入自然退出的观察项。** R7 显示“已释放 4 个会话,确认允许 2 项”;另两个未允许项在操作期间自行退出,不能让用户误以为工具主动关闭了四项。
|
||||
3. **原生 PCB 读写确认尚未走通。** `DATABASE_RECOVERY_REQUIRED` / `DATABASE_SAFETY_STOP` 的正文要求确认没有其他用户后以读写权限继续,未直接提供 ICDB 损坏证据。检查、普通校验和备份副本校验均未获得 READY;不能自动同意写入后宣称通过。
|
||||
4. **输入兼容性:A/B 的原生 EDIF 导出崩溃。** 退出码 3221225477(0xC0000005),本机 WER 指向 MSVCR90.dll;相同环境下 C 的三种导出均成功。A/B 继续报告上传失败,不跳过身份校验伪造成功。
|
||||
5. 现场服务器会话失联的一致故障副本完整入口、Windows 10、自动修复仍未验收。ICDB 自动 Repair 保持关闭。
|
||||
|
||||
## 复核依据
|
||||
|
||||
- 最终源代码:1,851 项 Python 测试通过,1 条 pywinauto COM 警告;`full-suite-delivery.xml`。编译检查及 `git diff --check` 通过。
|
||||
- 回归保留修复前失败与修复后通过记录:`export-race-*`、`pathless-red.xml`、`address-manifest-*`、`desktop-map-*`、`legacy-backup-*`、`summary-release-*`。
|
||||
- R3 同名更新:`final-data/management/management-741e463dc75d4f35acd992ad42200fbf/checkpoint.json`。
|
||||
- R5 移除:`management-d83e404f22864885ab57943783897ebe`;同批失败:`management-a900d2b62a544623b499ce55d099dfd2`;同批继续新增:`management-c8a18e3bb8bc4aa19f7dbc982b3602d2`。
|
||||
- R7 恢复:`final-data/evidence/backup-restore-90b843115d07/recovery-result.json`。R7 释放按钮状态、原生提示、取消强制结束、最终释放及退出见 `r7-accept.log` 和对应截图。
|
||||
- 机器可读索引和指定证据摘要哈希见同目录 `2026-11-12-native-acceptance-validation.json`。大体积原始工程和运行时控制记录保留在本机,不纳入提交。
|
||||
@@ -0,0 +1,41 @@
|
||||
# 阻塞进程来源核查
|
||||
|
||||
> 证据路径说明:本文的本机绝对路径、日志名、截图、测试 XML 和冻结包指向验收机器上的原始材料,未纳入 Git;仓库仅保留说明和验证摘要。
|
||||
|
||||
> 本文保留当时的只读归属结论;后续代码修改及试验见 [占用范围验证](2026-11-12-scoped-release-validation.md)。
|
||||
|
||||
2026-11-12 13:44–13:46 进行了只读核查。结论:此前阻止整库释放的两个未知会话来自 `dxdesigner-part-replacement` 测试,不是本 CBB 程序拉起;其他软件并行测试暴露了本程序的归属和释放判定漏洞。本次没有修改业务代码或关闭进程。
|
||||
|
||||
| 历史进程 | 归属证据 | 结论 |
|
||||
| --- | --- | --- |
|
||||
| viewdraw.exe,PID 29832,父进程 5940 | 外部工具 lifecycle.jsonl 记录 worker_started PID 5940;其 private-desktop.json 记录 cad_pid 29832、创建时间 2026-11-12 03:17:21.099 UTC、桌面 dx-f2b2947f8ab144e19760e4599fda3249,均与 CBB 残留快照一致;窗口工程位于外部工具 outputs 目录 | 外部工具创建的 DxDesigner |
|
||||
| cscript.exe,PID 8652,父进程 5940 | 命令行运行外部工具 QuickPartReplace.vbs;对应任务 project-checkpoint.json 的工程和 cad_pid 29832 与窗口匹配 | 同一外部测试批次的脚本 |
|
||||
| ExpeditionPCB.exe,PID 21856 / 21248 | 命令行明确为 CBB 隔离库 1GPHY_8212 的 PCB;父子链 30552 → 21856 → 21248;CBB 验收释放记录确认两项均 RELEASED | 本程序的客户端,已正常退出 |
|
||||
|
||||
外部工程 CentralLibrary 指向 `F:/Sync Tool Skyworth/Work Maps/Skyworth_CBB_Lib/Mentor_lib_EE7.9/mentor_lib.lmc`。CBB 验收目标为 `F:/CbbAccept-20261112/library/native-add/fixture/mentor_lib.lmc`,二者不同。
|
||||
|
||||
13:44 的实时快照中,历史 PID 29832、8652 均已不存在,没有把新进程当成旧残留。当前另有真实父子链:DxPartReplace.exe 29436 → DxPartReplace.exe 16540 → cscript.exe 21364;父进程创建时间均早于子进程,映像和脚本均位于外部工具目录。此快照仅代表当时状态,PID 不能作为长期身份。
|
||||
|
||||
13:46 对本次隔离库的 LMC、icdb.dat、LayoutDB.lyt 共 12 个实际文件同时执行 GENERIC_READ、共享模式 0、OPEN_EXISTING 的只读独占打开,全部成功并关闭句柄;库内未发现 sAddress.adr。这证明当时这些目标文件没有阻止独占读的占用,不能倒推 11:28 的全部句柄状态。
|
||||
|
||||
## 逻辑漏洞所在
|
||||
|
||||
1. `library_lock._owner_matches_scope` 主要读取命令行中的 PRJ/PCB/LMC/数据库引用。裸 viewdraw.exe 和外部 QuickPartReplace.vbs 命令没有这些路径,均返回 None(UNKNOWN)。它没有在这里利用父进程批次记录、私有桌面或窗口工程身份进一步归属。
|
||||
2. `residual_sessions.inspect_residual_sessions` 的 `scope is not False` 将这两项 UNKNOWN 加入当前库残留观察列表;`scope_confirmed=false` 正确阻止关闭它们。
|
||||
3. `_release_residual_sessions` 又要求列表中全部行均为 RELEASED。这使“不能确认归属、不能操作的观察项”成为“当前库必须退出的对象”,结果一直 PARTIAL。
|
||||
4. 即使绕过上一层,`library_lock._prove_library_released` 仍将范围为 UNKNOWN 的候选进程加入 owners,可能在目标文件独占打开之前直接拒绝证明。
|
||||
|
||||
以历史真实命令行回放当前归属函数,两项均得到 UNKNOWN,和真实残留列表一致。不是用户并行测试不合规,而是程序把“未知来源”升级成了“目标库占用”。
|
||||
|
||||
修复需要分别保存**进程来源**和**资源范围**:本程序创建的进程未必仍占目标;其他软件创建的进程也可能实际打开同一个库。因此不能只按进程名、父 PID 或软件目录粗暴排除外部进程,最终应结合创建时间绑定的身份、实际工程/库引用、本库在途调用、目标资源与地址探测决定是否阻止。外部归属只读展示,不自动结束;真实共享目标占用仍需保护。
|
||||
|
||||
## 证据
|
||||
|
||||
- 本机完整核查:`F:\CbbAccept-20261112\process-origin-audit.json`。
|
||||
- 身份交叉核对、外部证据 SHA-256、分类回放及只读资源探测:`F:\CbbAccept-20261112\process-origin-confirmed.json`。
|
||||
- 外部工具自身记录根目录:`F:\Sync Tool Skyworth\Work Maps\dxdesigner-part-replacement\outputs\frozen-random-final-20261112-r4`。
|
||||
- 父 worker 记录:`data/batch-resources/28182d59cb9d4e0087fa312baf11d804/lifecycle.jsonl` 第 2 行。
|
||||
- 原生进程创建身份:该批次 `generation-1/private-desktop.json`。
|
||||
- 对应工程:`data/tasks/4f49b13e-3603-4578-b7f2-c9fe88bca864/quick-run/project-checkpoint.json`。
|
||||
|
||||
这里只完成核查和归因,没有声称跨软件阻塞已修复。
|
||||
@@ -0,0 +1,19 @@
|
||||
# PR #13 评论 391:合并前补充修复
|
||||
|
||||
> 证据路径说明:本文的本机绝对路径、日志、截图、测试 XML 和冻结包位于验收机器,未纳入 Git;仓库仅保留说明和验证摘要。
|
||||
|
||||
针对 [评论 391](https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-391),以 `466f400` 为修改前基线。用户已明确授权补齐后依次合并 #10、#11、#12、#13;代码合并不等同于现场验收或发布。
|
||||
|
||||
- 导出进程证据缺失、损坏或不是 JSON 对象时,日志及占用错误保留 `exclusion_unavailable`、具体文件或目录、PID 和原因。仍拒绝把无法核实的活跃句柄认定为已释放。
|
||||
- 批次结果在原生操作及报告完成后立即显示,权威状态刷新继续通过原生队列串行执行。刷新前不以 PASS 将清单改成 READY;等待/执行刷新有明确状态。刷新期间关闭结果窗口不重建窗口;取消排队刷新保留已完成结果,并将未复核清单状态记为 UNKNOWN。
|
||||
- 11 月 12 日验收文档统一标明本机证据未入库,README/SOP 保留 EDIF 原生崩溃、SMB/跨机、Windows 10、现场失联副本及自动 Repair 的限制。
|
||||
|
||||
验证记录位于 `F:\CbbAccept-20261112`。新增用例先复现失败,再验证修复;私有桌面 `CbbReview391NativeUi` 下实际 Windows Qt 控件和进程句柄的 6 项回归通过。覆盖正常刷新、提前关闭结果、取消排队刷新,以及缺失/坏 JSON/错误结构的诊断与保守保护。独立合并前代码复核未发现新增阻断项。
|
||||
|
||||
最终完整回归 **1,886 passed**,1 条既有 pywinauto STA 警告,记录 `review391-final.xml`。编译及 diff-check 通过。未完成的早期全量运行已停止,不计作通过;坏 JSON、缺失证据、错误结构及结果延迟的失败复现记录分别保留为 `review391-red.xml`、`review391-ui-red.xml`、`review391-shape-red.xml`。
|
||||
|
||||
新冻结包为 `candidate-review391/dist/CbbRefreshVerify-Background/CbbRefreshVerify.exe`,SHA-256 为 `eb9200c06cf8b054dbbfe678fad14c5f5a16f634526e38d2487f5960e07760ab`。64 个冻结模块逐一与当前源码编译结果一致,资源及 PE 图标一致。私有桌面启动、三个实际菜单切换及正常退出通过,详见 `review391-frozen-smoke.json`;机器摘要见 [验证 JSON](2026-11-12-review391-validation.json)。
|
||||
|
||||
本轮没有在生产库执行操作,也没有重新验收现场 ICDB 故障;此前 Mentor 隔离库完整恢复至 READY 的证据见 [占用范围验证](2026-11-12-scoped-release-validation.md),该历史包与本轮新包分别记录,不混用源码与二进制证据。
|
||||
|
||||
依赖链合并时,#10 先进入 main,再将 #11、#12、#13 逐项改为以 main 为目标并合并,保留分支。逐项核对 head SHA,最后比较 main 与被测最终 head 的文件树;不把只合进中间分支当成全部进入 main。
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"created": "2026-11-12T17:35:46.043003+08:00",
|
||||
"base_commit": "466f400514acc8531a219db8e75641be35304a3f",
|
||||
"review_comment": "https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-391",
|
||||
"full_suite": {
|
||||
"path": "F:\\CbbAccept-20261112\\review391-final.xml",
|
||||
"tests": 1886,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"windows_private_desktop_suite": {
|
||||
"path": "F:\\CbbAccept-20261112\\review391-native-ui.xml",
|
||||
"tests": 6,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"bundle": {
|
||||
"module_count": 64,
|
||||
"source_and_frozen_code_equal": true,
|
||||
"source_sha256_checked": true,
|
||||
"packaged_assets_equal": true,
|
||||
"exe_icon_images_equal": true,
|
||||
"executable_sha256": "eb9200c06cf8b054dbbfe678fad14c5f5a16f634526e38d2487f5960e07760ab"
|
||||
},
|
||||
"frozen_smoke": {
|
||||
"executable": "F:\\CbbAccept-20261112\\candidate-review391\\dist\\CbbRefreshVerify-Background\\CbbRefreshVerify.exe",
|
||||
"sha256": "eb9200c06cf8b054dbbfe678fad14c5f5a16f634526e38d2487f5960e07760ab",
|
||||
"tabs": [
|
||||
"检验",
|
||||
"ICDB 维护",
|
||||
"中心库管理"
|
||||
],
|
||||
"exit_code": 0,
|
||||
"private_desktop": "CbbReview391Frozen"
|
||||
},
|
||||
"source_sha256": {
|
||||
"src/cbb_refresh_verify/native_export_guard.py": "c3eeadd557d2f89bfce855c0736c953043ebe97bc81aa74e40bd370780a54741",
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "af65fcd8e41f35f412e8c23f525821c92b2cfb78b9d0fd4f88c515249dbd24e1",
|
||||
"tests/test_review391.py": "304d46d63af87ea4a9bca83834b77cc44c5c9addf7b0f3752431304ee612568c",
|
||||
"tests/test_batch_item_yield.py": "ed4be6d1e854b18d054a75c92171cd46b6b64411c2f74e9a3caf31fba3c7366b"
|
||||
},
|
||||
"independent_code_review": "No actionable critical, important or minor issues; read-only review, no additional tests run.",
|
||||
"merge_plan": {
|
||||
"pull_requests": [
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13
|
||||
],
|
||||
"target": "main",
|
||||
"retarget_stacked_pull_requests": true,
|
||||
"preserve_branches": true,
|
||||
"force_merge": false
|
||||
},
|
||||
"evidence_location": "Raw logs/XML/packages are local-only; repository contains this summary.",
|
||||
"native_mentor_retested": false,
|
||||
"known_limits": [
|
||||
"Field ICDB loss-of-session recovery, Windows 10 and cross-machine SMB remain unverified.",
|
||||
"Automatic ICDB Repair remains disabled; EDIF 0xC0000005 on A/B remains unresolved."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"time": "2026-11-12T16:00:50.172809+08:00",
|
||||
"bundle": {
|
||||
"module_count": 64,
|
||||
"source_and_frozen_code_equal": true,
|
||||
"source_sha256_checked": true,
|
||||
"packaged_assets_equal": true,
|
||||
"exe_icon_images_equal": true,
|
||||
"executable_sha256": "85ec649c18fefcf50d8b4caf0a66005f108713e7d5f170d1aecc82e3c5fcfe33"
|
||||
},
|
||||
"tests": {
|
||||
"passed": 1880,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"xml": "F:\\CbbAccept-20261112\\full-scoped-final10.xml"
|
||||
},
|
||||
"recovery": {
|
||||
"path": "F:\\CbbAccept-20261112\\scoped10-data\\evidence\\backup-restore-5f9b134ab83c\\recovery-result.json",
|
||||
"installed": true,
|
||||
"source_status": "PASS",
|
||||
"target_status": "PASS",
|
||||
"library_flag": "GREEN",
|
||||
"safe_to_continue": true,
|
||||
"retained_work": "F:\\CbbAccept-20261112\\field-lib-recovery\\ReusableBlocksLP\\1GPHY_8212\\Work.before-restore-5f9b134ab83c"
|
||||
},
|
||||
"release": {
|
||||
"path": "F:\\CbbAccept-20261112\\scoped10-data\\release-checks\\sessions-fc23a2a2024f\\result.json",
|
||||
"status": "RELEASE_CONFIRMED"
|
||||
},
|
||||
"original_integrity": {
|
||||
"time": "2026-11-12T16:00:19",
|
||||
"results": [
|
||||
{
|
||||
"scope": "A",
|
||||
"source": "F:\\Sync Tool Skyworth\\Work Maps\\Skyworth_CBB_Lib\\CBB\\1GPHY_RTL8211F",
|
||||
"checked": 187,
|
||||
"changes": []
|
||||
},
|
||||
{
|
||||
"scope": "B",
|
||||
"source": "F:\\Sync Tool Skyworth\\Work Maps\\Skyworth_CBB_Lib\\CBB\\1GPHY_RTL8211F_A",
|
||||
"checked": 185,
|
||||
"changes": []
|
||||
},
|
||||
{
|
||||
"scope": "field-library-originals",
|
||||
"source": "F:\\Sync Tool Skyworth\\Work Maps\\Skyworth_CBB_Lib\\Mentor_lib_EE7.9",
|
||||
"checked": 26887,
|
||||
"changes": []
|
||||
}
|
||||
],
|
||||
"originals_unchanged": true
|
||||
},
|
||||
"interaction_log": "F:\\CbbAccept-20261112\\scoped10-accept.log",
|
||||
"known_limits": [
|
||||
"Native shared-symbol server sometimes cannot remove its own address file after STOP; not bypassed.",
|
||||
"Actual field server-session-loss recovery and Windows 10 acceptance remain unverified.",
|
||||
"Automatic ICDB Repair remains disabled. No merge, release or issue closure."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
# 占用范围、单项队列及原生确认验证
|
||||
|
||||
> 证据路径说明:本文的本机绝对路径、日志名、截图、测试 XML 和冻结包指向验收机器上的原始材料,未纳入 Git;仓库仅保留说明和验证摘要。
|
||||
|
||||
本次基于 `42d0ceb`,沿用 `codex/runtime-lifecycle-safety`。当天较早的进程归属、误判分析和完整流程图是修改前快照;本记录描述后续实现及验收,不追溯改写先前失败。
|
||||
|
||||
## 修改
|
||||
|
||||
- 未确认归属的外部客户端只作观察,不要求其退出、不发送关闭,也不增加主动释放数量。释放仍检查本库在途调用、目标数据库地址和实际独占只读文件句柄;自身请求身份缺失、共享写入未返回时继续保护。
|
||||
- 旧 NATIVE_CALL/CLOSING/UNCONFIRMED 日志结合进程创建身份核实;已退出或 PID 被复用不会仅因日志阶段被认定仍在写入,读取失败保留未确认。
|
||||
- 单项失败后只对绑定任务取得新的释放证明;证明成功才允许后续项,原业务失败和原证据保留。校验和管理在完整单项事务结束后让出原生队列,不在移除与重新导入之间穿插其他任务。排队取消保留已完成项和汇总。
|
||||
- 普通校验、上传后的校验、备份副本/目标校验接通精确 PCB 读写提示和历史版本选择。用户可以继续、跳过、取消;绑定本任务 PCB 的创建身份、启动链、工程和私有桌面,临近点击重新检查。ICDB 诊断检查不借此执行 Repair 或隐式取得写入授权。
|
||||
- 实测新增修复:同名更新自动校验不再把自己当前的事务当成历史未释放事务。仅允许同线程、同 lease、同 PID、同目标及无待处理导出/检查点的嵌套调用。取消批次后不再把刷新排进已经取消的队列而丢失结果。
|
||||
- 第二轮真实试验暴露导出器进程链误判:CSV 导出器 PID 16068 创建于 14:56:19,却收录了 12:57:45 已创建的 OneDrive 服务 PID 23804。运行时追踪改为排除原有进程、绑定原生进程句柄创建时间、拒绝早于父进程的子进程及 PID 复用后的新进程链。旧记录复核也排除出生时间证明不可能属于导出任务的条目;仍需原生范围及分析副本数据库的全套释放证明,未发送退出请求给 OneDrive。
|
||||
- 失败释放复核包含在单项原生队列内部,完成后才让出通道,避免下一项开始时前一项又来争取管理互斥。新增两项回归先失败后通过,相关 46 项通过。
|
||||
- 普通读写确认比较真实控件的句柄、ID、类和正文,允许 UIA 后续增加已识别的标题栏辅助节点、重排控件及省略按钮快捷键标记;替换真实按钮仍拒绝。实际快照显示 Win32 的“是(&Y)”变成 UIA 的“是(Y)”,进程及窗口/按钮句柄均未变化;不能据此认定工程或窗口被替换。来自恢复副本真实失败的回归先失败后通过,相关 52 项通过。
|
||||
|
||||
## 冻结包和真实试验
|
||||
|
||||
当前候选程序:`F:\CbbAccept-20261112\candidate-scoped10\dist\CbbRefreshVerify-Background\CbbRefreshVerify.exe`。
|
||||
|
||||
SHA-256:`85ec649c18fefcf50d8b4caf0a66005f108713e7d5f170d1aecc82e3c5fcfe33`。64 个冻结模块逐个与当前源码编译结果一致,资源及 PE 图标一致;检查记录 `candidate-scoped10/bundle-verification.json`。较早的 scoped5 为 `4cf682130923c4534d3193a8b967ffc83d0cc519e580f6739a4861daed4f36c3`,scoped7 为 `e37b2601bb3851e9170ab8d552800547004b1a5b9882211f1180693dde76957c`,scoped9 为 `a59488dcbad72bdd7159772aabdb33b6411dea972babec33e64412a3406f810f`;各次动作日志绑定实际运行包哈希,不能混为同一版本。
|
||||
|
||||
原生写操作仅在 `F:\CbbAccept-20261112` 隔离库及工具生成的 `C:\Users\ABS_Windows\.cbb-restore` 校验副本中进行,环境为 Windows 11 build 26200、Mentor EE7.9.5 及私有桌面。操作驱动使用真实程序按钮和后台窗口消息,没有前台鼠标抢占、强杀原生客户端或手删地址文件。
|
||||
|
||||
| 试验 | 事实与证据 |
|
||||
| --- | --- |
|
||||
| 外部脚本持续存在,目标真实句柄被占用 | `scoped3-accept.log`:持有 LMC 的 Windows 独占句柄时拒绝释放,错误 32;外部脚本仍存活 |
|
||||
| 目标句柄关闭,外部脚本继续运行 | 同一日志:RELEASE_CONFIRMED,主动释放 0、授权 0;外部行为保持 OBSERVED,脚本最后自行退出 |
|
||||
| 同名更新并自动校验 | `management-38fdf8365d834a13ba7dca67111861ff/checkpoint.json`:UPLOADED_VERIFIED、safe=true;真实选择继续打开和最后手动保存版本;校验 InSynch、Save/IsSaved/Close、PCB EXITED,IsVerifiedReuseBlock=1/READY。校验约 91.6 秒 |
|
||||
| 重复更新发现地址残留 | `management-0cee6b12e93b45918caf18101c603dc5/checkpoint.json`:RECOVERY_REQUIRED;原生移除已发生,重新导入未开始,不能记为成功 |
|
||||
| 地址残留的原生证据 | 共享符号库服务器 PID 17344 日志记录 Database closed、defragmentation completed、Could not remove server address file、S: STOP;之后没有该服务器进程。`address-native-probe/result.json`:原生目录可复读,地址仍在、端点不可达;未将不可达视作无占用证明 |
|
||||
| 早期空白库试验 | 读写和手动版本选择成功,但原生 PartPkg 报缺 PartsDB 分区;不作为校验成功 |
|
||||
| 早期自动校验试验 | `management-cb85cb2b564d4778912df7accf85c109` 上传完成,校验被自身事务锁拒绝;已补回归后由上述真实完整成功试验复核 |
|
||||
| 导出器错误收录 OneDrive | `scoped6-data/management/management-498258fe1e1541e9a135ca4117cb7344/source-identity/csv-process.json`:CSV 日志已完成、分析副本无地址,但历史父 PID 关联扩大至外部进程;后来进程查询超时,本次无原生移除/新增,不计上传成功。`scoped6-active-handle-attribution.json` 为只读 Windows 句柄归属诊断;新增失败回归 `export-lineage-red.xml`、`export-history-red.xml`,修复后两组 73 项通过 |
|
||||
| 旧误判记录解除及更新重试 | scoped7 真实点击释放:RELEASE_CONFIRMED、主动关闭 0;保留旧证据。随后 `scoped7-data/management/management-d4017aaae47041b08dae6445858a7419/checkpoint.json` 完成原生更新及工程身份复读,UPLOADED、safe=true,关闭了本批次自动校验 |
|
||||
| 恢复确认窗口误判 | scoped7 的 `evidence/backup-restore-f52ee9adc188/recovery-result.json` 和 scoped9 的 `evidence/backup-restore-22512e81160b/recovery-result.json` 都在副本阶段失败,installed=false。先处理控件辅助节点后,第二次实际差分又明确了快捷键标记差异;未将两次失败记为通过 |
|
||||
| 快捷键表示差异的原生定位 | `open-identity-real-diff.json` 捕获同一 PID/创建时间、HWND、真实按钮句柄下的 Win32/UIA 差异。修正后 `identity-debug/verify-f34d9f72d4aa/result.json` 实际 PASS、GREEN/READY=1、Save COMMITTED、Close CLOSED、PCB EXITED、资源 RELEASED。这是定位与复测,不能替代完整恢复按钮验收 |
|
||||
| 立即停止后的残留 | scoped7 的 `evidence/icdb-check-73cdeda6d163/pcb-open/verify-bb3bdc393b0b/result.json`:CANCELLED、safe=false;本任务启动器 12408、PCB 344 在扫描时尚无可关闭窗口。未以队列取消成功冒充原生退出成功 |
|
||||
| 残留后的再次释放 | 后续读取发现原生 Tip of the Day;在精确绑定的私有桌面正常关闭此帮助窗口后,PCB 完成打开。scoped9 实际“确认释放”正常关闭 3 项并 RELEASE_CONFIRMED,应用正常退出。`cleanup-scoped7-stop*/startup-close.json` 保留早期未确认记录;未强杀进程、未把帮助窗口关闭本身记成数据库释放 |
|
||||
|
||||
| 最终包验收 | 事实与证据 |
|
||||
| --- | --- |
|
||||
| 最终包完整恢复按钮 | scoped10 真实执行空来源校验、取消确认、重新确认、运行期间重复点击,随后完成副本校验、目标变更检查、保留旧 Work、安装、目标再次原生校验。`scoped10-data/evidence/backup-restore-5f9b134ab83c/recovery-result.json`:installed=true,source_validation 和 result 都为 PASS、GREEN/READY=1、safe=true,Save COMMITTED、Close CLOSED、PCB/助手 EXITED、资源 RELEASED |
|
||||
| 最终状态及退出 | scoped10 原生状态刷新后可见 READY 1;READY 项检查及恢复入口禁用。最终释放为 RELEASE_CONFIRMED,主动关闭 0/允许 0,主程序正常退出 0;未修改旧失败记录 |
|
||||
| 原始文件复核 | 16:00:19 对 A/B 来源及原始中心库共 27,259 个文件重新检查大小、SHA-256,无变化;`originals-rechecked.json`。先前失败校验副本归档到 F 盘以保留证据并腾出系统盘空间,映射见 `archived-validation-copies/map.json` |
|
||||
|
||||
最终源码全量测试 **1,880 passed**(1 条既有 pywinauto STA 警告),记录 `F:\CbbAccept-20261112\full-scoped-final10.xml`;compileall、diff-check 通过。冻结代码和图标一致性、完整恢复、释放及原始文件复核的机器摘要见同目录 [验证 JSON](2026-11-12-scoped-release-validation.json)。历史版本是按此前选择偏好使用最后手动保存版本,READY 不表示已经人工核对版本内容或无数据回退。
|
||||
|
||||
## 保留限制
|
||||
|
||||
自动 ICDB Repair 继续关闭。现场服务器会话失联的一致故障副本、Windows 10、跨机共享库掉线尚未验收;不会自动合并、发布或关闭工单。共享符号数据库地址若原生工具自身无法删除,不能通过本程序删除文件或仅凭无进程放行。此前 A/B 输入 EDIF 导出崩溃与空白依赖库有关与否仍需独立复现,不绕过工程身份校验。
|
||||
|
||||
立即停止时的晚到窗口仍需要正常处理:本次 Tip of the Day 是在精确绑定的私有桌面关闭后才由应用完成会话释放,不能将此试验写成自动退出无缺口。未知/损坏检查点、尚未返回的真实共享写入继续保留未确认状态。
|
||||
@@ -0,0 +1,319 @@
|
||||
{
|
||||
"created": "2026-11-13T15:28:15.015734+08:00",
|
||||
"base_main": "cbc57238496bc84f4228aa44929208a9516dff1b",
|
||||
"branch": "codex/import-without-export-gate",
|
||||
"full_suite": {
|
||||
"tests": 1895,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"first_wrong_source_suite": {
|
||||
"tests": 1893,
|
||||
"failures": 15,
|
||||
"errors": 0,
|
||||
"skipped": 0
|
||||
},
|
||||
"first_wrong_source_reason": "Subprocesses used the editable original checkout; corrected by explicit PYTHONPATH to this worktree.",
|
||||
"frozen": {
|
||||
"module_count": 64,
|
||||
"source_and_frozen_code_equal": true,
|
||||
"source_sha256_checked": true,
|
||||
"packaged_assets_equal": true,
|
||||
"exe_icon_images_equal": true,
|
||||
"executable_sha256": "98a642d8e81f42b708934bb4dc2d023c49c2acdae5851151a430f101c74c9615"
|
||||
},
|
||||
"native": [
|
||||
{
|
||||
"name": "1GPHY_RTL8211F_A",
|
||||
"status": "UPLOADED_VERIFY_FAILED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "原生注册、工程关联、顶层块和 Layout 已确认;未核验原理图语义。其他工程文件有差异,已记录供核对。\nProject Integration error: ERROR: There are no PartsDB partitions from which to extract parts | ERROR: Unable to create local PDB | ERROR: Problem Making Local Parts DataBase",
|
||||
"checkpoint": "F:\\CbbI1113\\d3\\management\\management-9a5e12feb292441e8c5709270ffef18b\\checkpoint.json",
|
||||
"native_add_success": true,
|
||||
"registration_matches": true,
|
||||
"top_level_block_mapping": {
|
||||
"source": "1GPHY_RTL8211F",
|
||||
"registered": "1GPHY_RTL8211F_A",
|
||||
"allowed": [
|
||||
"1GPHY_RTL8211F",
|
||||
"1GPHY_RTL8211F_A"
|
||||
]
|
||||
},
|
||||
"assets_match": false,
|
||||
"asset_differences": {
|
||||
"added": [
|
||||
"PCB/1GPHY_RTL8211F_A.pcb",
|
||||
"database/cdbback/2026-11-13 15.12.50-49956.zip"
|
||||
],
|
||||
"deleted": [
|
||||
"PCB/1GPHY_RTL8211F.pcb"
|
||||
],
|
||||
"modified": [
|
||||
"1GPHY_RTL8211F_A.prj"
|
||||
]
|
||||
},
|
||||
"verification": [
|
||||
{
|
||||
"stage": "verified",
|
||||
"time": "2026-11-13T07:18:34.641758+00:00",
|
||||
"verification": {
|
||||
"status": "FAIL",
|
||||
"stderr": "Project Integration error: ERROR: There are no PartsDB partitions from which to extract parts | ERROR: Unable to create local PDB | ERROR: Problem Making Local Parts DataBase",
|
||||
"stdout": "",
|
||||
"evidence_path": "F:\\CbbI1113\\d3\\management\\management-9a5e12feb292441e8c5709270ffef18b\\verify\\verify-43d609b6535d\\result.json",
|
||||
"safe_to_continue": true,
|
||||
"library_flag": "UNKNOWN",
|
||||
"library_flag_detail": "",
|
||||
"report_path": null,
|
||||
"content_check_exit_code": null,
|
||||
"error_category": "MENTOR_PROJECT_INTEGRATION",
|
||||
"error_stage": "forward_annotation",
|
||||
"bridge_attempts": [],
|
||||
"timings_seconds": {
|
||||
"preflight": 0.031,
|
||||
"worker_setup": 6.328,
|
||||
"pcb_startup": 100.469,
|
||||
"failure_diagnostics": 1.25,
|
||||
"integration": 24.953,
|
||||
"forward_annotation": 24.812,
|
||||
"total": 133.406
|
||||
},
|
||||
"incomplete_timing_phases": [
|
||||
"integration",
|
||||
"forward_annotation"
|
||||
],
|
||||
"recovery_attempts": [],
|
||||
"release_proof": null,
|
||||
"write_outcome": {
|
||||
"save_state": "UNKNOWN",
|
||||
"close_state": "UNKNOWN",
|
||||
"helper_state": "EXITED",
|
||||
"resource_state": "RELEASED",
|
||||
"interrupted": false,
|
||||
"detail": "保存返回结果无法确认"
|
||||
},
|
||||
"session_record_path": "F:\\CbbI1113\\d3\\management\\management-9a5e12feb292441e8c5709270ffef18b\\verify\\verify-43d609b6535d\\session.json"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "1GPHY_RTL8211F",
|
||||
"status": "UPLOADED_VERIFY_FAILED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "原生注册、工程关联、顶层块和 Layout 已确认;未核验原理图语义。其他工程文件有差异,已记录供核对。\nProject Integration error: ERROR: There are no PartsDB partitions from which to extract parts | ERROR: Unable to create local PDB | ERROR: Problem Making Local Parts DataBase",
|
||||
"checkpoint": "F:\\CbbI1113\\d3\\management\\management-6be18dcb186846e78b3220b59631249e\\checkpoint.json",
|
||||
"native_add_success": true,
|
||||
"registration_matches": true,
|
||||
"top_level_block_mapping": {
|
||||
"source": "1GPHY_RTL8211F",
|
||||
"registered": "1GPHY_RTL8211F",
|
||||
"allowed": [
|
||||
"1GPHY_RTL8211F",
|
||||
"1GPHY_RTL8211F"
|
||||
]
|
||||
},
|
||||
"assets_match": false,
|
||||
"asset_differences": {
|
||||
"added": [],
|
||||
"deleted": [
|
||||
"database/cdbsvr/events/events - Abs 的冲突副本 1 - 2026-09-16 07-16-58.dat",
|
||||
"database/cdbsvr/events/events - Abs 的冲突副本 1 - 2026-09-16 07-16-58.idx"
|
||||
],
|
||||
"modified": [
|
||||
"1GPHY_RTL8211F.prj"
|
||||
]
|
||||
},
|
||||
"verification": [
|
||||
{
|
||||
"stage": "verified",
|
||||
"time": "2026-11-13T07:23:45.773452+00:00",
|
||||
"verification": {
|
||||
"status": "FAIL",
|
||||
"stderr": "Project Integration error: ERROR: There are no PartsDB partitions from which to extract parts | ERROR: Unable to create local PDB | ERROR: Problem Making Local Parts DataBase",
|
||||
"stdout": "",
|
||||
"evidence_path": "F:\\CbbI1113\\d3\\management\\management-6be18dcb186846e78b3220b59631249e\\verify\\verify-53e1561b73fa\\result.json",
|
||||
"safe_to_continue": true,
|
||||
"library_flag": "UNKNOWN",
|
||||
"library_flag_detail": "",
|
||||
"report_path": null,
|
||||
"content_check_exit_code": null,
|
||||
"error_category": "MENTOR_PROJECT_INTEGRATION",
|
||||
"error_stage": "forward_annotation",
|
||||
"bridge_attempts": [],
|
||||
"timings_seconds": {
|
||||
"preflight": 0.047,
|
||||
"worker_setup": 3.766,
|
||||
"pcb_startup": 80.469,
|
||||
"failure_diagnostics": 1.39,
|
||||
"integration": 22.359,
|
||||
"forward_annotation": 22.297,
|
||||
"total": 106.844
|
||||
},
|
||||
"incomplete_timing_phases": [
|
||||
"integration",
|
||||
"forward_annotation"
|
||||
],
|
||||
"recovery_attempts": [],
|
||||
"release_proof": null,
|
||||
"write_outcome": {
|
||||
"save_state": "UNKNOWN",
|
||||
"close_state": "UNKNOWN",
|
||||
"helper_state": "EXITED",
|
||||
"resource_state": "RELEASED",
|
||||
"interrupted": false,
|
||||
"detail": "保存返回结果无法确认"
|
||||
},
|
||||
"session_record_path": "F:\\CbbI1113\\d3\\management\\management-6be18dcb186846e78b3220b59631249e\\verify\\verify-53e1561b73fa\\session.json"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"duplicate_conflict": {
|
||||
"passed": true,
|
||||
"records": [
|
||||
{
|
||||
"operation": "add",
|
||||
"library": "F:\\CbbI1113\\library3\\native-add\\fixture\\mentor_lib.lmc",
|
||||
"name": "1GPHY_RTL8211F",
|
||||
"partition": "Logical-Physical",
|
||||
"source": "F:\\CbbI1113\\A\\1GPHY_RTL8211F.prj",
|
||||
"auto_verify": false,
|
||||
"stage": "complete",
|
||||
"status": "UPLOAD_FAILED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "同名 CBB 已存在;新增禁止覆盖,请使用明确的同名更新。",
|
||||
"evidence_path": "F:\\CbbI1113\\d4\\management\\management-f43f218e0dcb41e8bfe09d5f2f69a0a8\\checkpoint.json",
|
||||
"release_proof": null,
|
||||
"change_report": null,
|
||||
"history": [
|
||||
{
|
||||
"stage": "release_check",
|
||||
"time": "2026-11-13T07:25:51.703695+00:00"
|
||||
},
|
||||
{
|
||||
"stage": "catalog_before",
|
||||
"time": "2026-11-13T07:26:22.388154+00:00"
|
||||
}
|
||||
],
|
||||
"backup_policy": "manual"
|
||||
}
|
||||
],
|
||||
"target_and_shared_content_unchanged": true,
|
||||
"catalog": {
|
||||
"library": "F:\\CbbI1113\\library3\\native-add\\fixture\\mentor_lib.lmc",
|
||||
"flow": 1,
|
||||
"entries": [
|
||||
{
|
||||
"name": "1GPHY_RTL8211F",
|
||||
"partition": "Logical-Physical",
|
||||
"engineering_identity": {
|
||||
"top_level_block": "1GPHY_RTL8211F",
|
||||
"schematic_sha256": "ed969340d9e89875b30c7c0ab175e82a92f965743f798cca297ad8de24a55f94",
|
||||
"layout_sha256": "61c2107047afd2ce8778028bdc5527cb1e2ca14b13190625a2c9c5397077b4f8"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "1GPHY_RTL8211F_A",
|
||||
"partition": "Logical-Physical",
|
||||
"engineering_identity": {
|
||||
"top_level_block": "1GPHY_RTL8211F_A",
|
||||
"schematic_sha256": "400183e788a0980f8e08a140e1eb7f96b845c48cf486e51c90cdb33900688e41",
|
||||
"layout_sha256": "3b78437a66f3d9a510b7aed6130928629b1b15fa86a8029e1786006e900fb5d5"
|
||||
}
|
||||
}
|
||||
],
|
||||
"safe_to_continue": true
|
||||
}
|
||||
},
|
||||
"source_hashes": {
|
||||
"src/cbb_refresh_verify/application.py": "62b9b013563a216d020c8366cccb8f949b02afa72dc63c26940804441cc23057",
|
||||
"src/cbb_refresh_verify/backup_recovery.py": "f07741fdeed73871eda1d4e72803bb516cc877b5b49973e3f7aa18972228baa2",
|
||||
"src/cbb_refresh_verify/batch_status.py": "55a4007cf54491ca8e045a5bf86aa4353ac8437cca5a76cd79304962e3d3fa0a",
|
||||
"src/cbb_refresh_verify/com_runtime.py": "f0f3802d16c791a8bf9dfef44a94917072bfbe8fb3a927d76be8ef0341c7ed35",
|
||||
"src/cbb_refresh_verify/content_check.py": "8239c17b6e2452917ed573a7deb3e4c8583eaef91bf3630eff5f424d2e398aa9",
|
||||
"src/cbb_refresh_verify/defaults.py": "a1c03192f4a61ad0924b24bb635705b1ee4811d35483a02864200f95edbbebe3",
|
||||
"src/cbb_refresh_verify/desktop_worker.py": "27d751816552d215dd8ee9cd67941d824f7b4493120ead7c3f87e5eba5ec4a92",
|
||||
"src/cbb_refresh_verify/diagnostic_open.py": "d6c49ffe5a9969d95edbbc896d47a7e100f248380a287f99ba7bb8b92dbb3072",
|
||||
"src/cbb_refresh_verify/dialog_agent.py": "5acb6e5cf1350a7ca20a6fe480668435fac785835874f266881973010db6504b",
|
||||
"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": "e81d253d8b4d3e7c1000c45335a392c72b110748675c2c3324ebe524a7252e98",
|
||||
"src/cbb_refresh_verify/icdb_ownership.py": "7bf2342c1efa34a2ebcbf27964a40a490220f7146fbb6ef957b8d8dd1e511f03",
|
||||
"src/cbb_refresh_verify/icdb_recovery.py": "358c0e9a004f1e0b2127513286e1dffd94b0180a8b7314aa9655462f570b6360",
|
||||
"src/cbb_refresh_verify/integration.py": "f188856af69ba25e265988c51db7a6d4263326440d972ca78378b733b891c1ed",
|
||||
"src/cbb_refresh_verify/library_lock.py": "6836ec8ac21e788eb75326ff44cb31ad4bdfb5f381bd35cdf33e6b34c7fca89e",
|
||||
"src/cbb_refresh_verify/library_manager_verify.py": "71e16a8581ad44b646be78b480f9812d596a6d162b3eec03d078bf4ea4503195",
|
||||
"src/cbb_refresh_verify/library_reader.py": "d4007caa361edd467773e49f721e02671d5a9bcb30741769a57349850b12c438",
|
||||
"src/cbb_refresh_verify/maintenance_entry.py": "3b93c25f69d7a961facd8004e20e155a84cc18f06d57b741a9055786ed058990",
|
||||
"src/cbb_refresh_verify/management.py": "773f9405c39b3fdcea4647da84ca97e9113e03db386a45bfabd468a98ed1fb36",
|
||||
"src/cbb_refresh_verify/management_transaction.py": "32c53caaead05d5db3a31d3e30721e65434e5837095dc0a7812f825603aa37a0",
|
||||
"src/cbb_refresh_verify/mentor_adapter.py": "1fc8c98d5508120e03bf001a42dd3e0da7b165eb18c90f1aed83147d17db8638",
|
||||
"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": "e704e8f56c43629a1593d490776af328bb032208ee2f5ffd1d1be6c3114f5412",
|
||||
"src/cbb_refresh_verify/native_export_guard.py": "c3eeadd557d2f89bfce855c0736c953043ebe97bc81aa74e40bd370780a54741",
|
||||
"src/cbb_refresh_verify/native_management.py": "5eca3b40ef57ecd4a12a0d0c26afd1bb1afb448a0b7c5452bfe80591a3a74b77",
|
||||
"src/cbb_refresh_verify/native_occupancy.py": "7d686079d12217382adace6361cd343d977b91075e3b157cf410ca92d07ffc49",
|
||||
"src/cbb_refresh_verify/native_repair.py": "9f024dcb5e3a76369191033474fefd30787b6ae350c315f3cf38e92e5a1f3e98",
|
||||
"src/cbb_refresh_verify/native_repair_ui.py": "3eb2af181befea94af8b3b3131edff09589f340bcba777abbe3b67fd31b80393",
|
||||
"src/cbb_refresh_verify/network_path.py": "6b5b159502d42a46bf4ee26d5698fd2c6498b359088e2138eae46e9065b13c6f",
|
||||
"src/cbb_refresh_verify/operation_lifecycle.py": "3838c5a501711d16f578c45ebbc6f960872b0c3ba6bbda9a597f994ef746cef6",
|
||||
"src/cbb_refresh_verify/operation_queue.py": "a6932d8bc68ac436091f6d362557c66d274ec52d0f295a22f014a3396845c79f",
|
||||
"src/cbb_refresh_verify/owner_probe.py": "8dcfd60246cb2979db34d02e0a2d605c334b6f7e2666f22daa2f50c0408bc903",
|
||||
"src/cbb_refresh_verify/pcb_bridge.py": "2f6c2b09642100468814500569dbfc6695fc2a46b9a3b8333daa8e1530cdeef5",
|
||||
"src/cbb_refresh_verify/pcb_open_consent.py": "7ad9c3a183f565b8b1f7a57b7c29ee9cbc3a79fe1ac0d778459edbdcb25b5664",
|
||||
"src/cbb_refresh_verify/pcb_restore_prompt.py": "39e0b8623a838911eff61066f3e9c8ede4364dbf73efc5a8994197ec72a96488",
|
||||
"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": "4ac500b33b209611d54eb496c6c30727ba159742d625431ceea84471a5fc3442",
|
||||
"src/cbb_refresh_verify/runtime_logging.py": "44ac25430a89c5ffc9e48e88c227e88052f4c815365e8556f67918f3edaba39e",
|
||||
"src/cbb_refresh_verify/runtime_timing.py": "c4ed4057b5000e0b86ccc7dd1fe2004d6e0dae29f397fec77b01ad41a81c6367",
|
||||
"src/cbb_refresh_verify/scoped_manifest.py": "9318bf0f929d23c18466a25d83a4a9903822093c123aae10510061788c6d0ab7",
|
||||
"src/cbb_refresh_verify/session_record.py": "2bc3cff365008864584138a4ff13538bb6b2f90d981e7d008a1300f9102c6e7e",
|
||||
"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": "3027ef7fc1ef6365ff36ae0c83389d869b92ffcd96985d10275bca4dc9483e3f",
|
||||
"src/cbb_refresh_verify/__init__.py": "dd960394d88657820dba858792abf0de258e05efceb08ae2f0b39c6ad78bc469",
|
||||
"src/cbb_refresh_verify/__main__.py": "dc4be034a0e43d4b659a9300137c29a6a6b7a32b7eaef02b6dff9a88c41305c0",
|
||||
"src/cbb_refresh_verify/ui/backup_notice.py": "1a3fa5ac18a267907faf95f36d61b9f08bcbb939eef4d480dd06af1391a81599",
|
||||
"src/cbb_refresh_verify/ui/backup_recovery_dialog.py": "65081eb8d9791f8ec1316023a80edb07a91b2658b9ed27cb4cf21addb0f26026",
|
||||
"src/cbb_refresh_verify/ui/icdb_check_task.py": "ade3bf414aa29b42f4c1535c613b2cacb2735f6abc7900e6da25999390a5891d",
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "af65fcd8e41f35f412e8c23f525821c92b2cfb78b9d0fd4f88c515249dbd24e1",
|
||||
"src/cbb_refresh_verify/ui/management_dialog.py": "4ae522e8509d9153af9d41d349f1611c80f73c0913f01f33cc5a122665cf56bf",
|
||||
"src/cbb_refresh_verify/ui/pcb_open_dialog.py": "3cabdc15f1b2abaeb919a7f29f32d4b053186701fd514646d9bdd3ea32f364f6",
|
||||
"src/cbb_refresh_verify/ui/pcb_restore_dialog.py": "b7228d828df235ac51502dc68760d28c4896af02c780e9806e11c32dba7f62da",
|
||||
"src/cbb_refresh_verify/ui/residual_release_dialog.py": "1d2a26bfc7ee21b11d7edbc3074b4c525e8c9fb628bca45b08bd06fc672586c8",
|
||||
"src/cbb_refresh_verify/ui/workers.py": "4cc9360a4820ded27a7d5ef709fc9f04b1d4804cb1e7a614f6c357ed547da888",
|
||||
"src/cbb_refresh_verify/ui/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
},
|
||||
"local_evidence_sha256": {
|
||||
"F:\\CbbI1113\\full-suite.xml": "df15b248bb4eb21580800d43ce60a5ac4f4bae5a4d3c67580f45f0752472fcab",
|
||||
"F:\\CbbI1113\\full-suite-final3.xml": "d0702c2a69dab5aef57c4fa7e7f9d633058b3c03dae5970665c393c979476ab6",
|
||||
"F:\\CbbI1113\\accept.log": "39620df9b61514eed6b1c48edb19d6e1abbb71c1e4c7e7d31f0a7e1968442220",
|
||||
"F:\\CbbI1113\\accept2.log": "b3d1509d1c6d65973ba4da666103785402aef576c1fe78936c559caaaa02a62d",
|
||||
"F:\\CbbI1113\\accept2-resume.log": "6c5fb656f12c4e790ca1b3f01593283161bff7f8b253fd4e1444c53f0fb49d91",
|
||||
"F:\\CbbI1113\\accept3.log": "0a69d374c5ae3652aac7e871578a45f090220cd3d04e8701390d95abd020a8d9",
|
||||
"F:\\CbbI1113\\auto-verify-trial.json": "8729b9c6f4a48199f2e2515c59bae1891ce61b00a5572a9721dd25e003e196a0",
|
||||
"F:\\CbbI1113\\accept4.log": "81af1d0a6146b33220dd85996ab7d4b28eee820fa6d8fb30314effea249cd568",
|
||||
"F:\\CbbI1113\\duplicate-conflict-trial.json": "b7051b3e01102e51c551dde8aade9d358454a97ff91fb547702c8a4dbeb5928e",
|
||||
"F:\\CbbI1113\\native-add-wait-chain.json": "f671192272d5edcd9ed3ea736b42ea7d330c86adaadc1a5cc434b6c55fb270c1"
|
||||
},
|
||||
"independent_review": "No actionable findings; static review only; three updates reviewed.",
|
||||
"cloud_beta2_updated": false,
|
||||
"schematic_semantic_equivalence_checked": false,
|
||||
"known_limits": [
|
||||
"Automatic ICDB Repair disabled; field lost-session recovery unverified.",
|
||||
"Windows 10 and cross-machine SMB unverified.",
|
||||
"Long native Add waits observed; root cause not determined; not claimed fixed."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
# 2026-11-13:CBB 导入与附加核验解耦
|
||||
|
||||
分支:`codex/import-without-export-gate`;基线 main:`cbc57238496bc84f4228aa44929208a9516dff1b`。
|
||||
原始工程、运行日志、截图、测试 XML 和冻结包保留在本机 `F:\CbbI1113`;仓库只保存说明和验证摘要。
|
||||
|
||||
## 原因与修改
|
||||
|
||||
此前导入会在原生 Add 之前和之后强制执行 ASCII、CSV、EDIF 内容导出;能力探测也依赖这些导出器。因此 EDIF 导出崩溃能让本来尚未执行 Add 的工程显示“上传失败”,取消上传后自动校验也不能避开它。
|
||||
|
||||
- 新增、同名替换和隔离管理适配器均不再调用或要求安装这些导出器。独立导出诊断代码保留,EDIF 崩溃根因没有被宣称解决。
|
||||
- 保留完整来源暂存及复制核验、事务随机标识、检查点、库基线、精确进程和租约验证、原生成功回执以及重新读库。只在暂存副本中重定位库引用,来源旧库地址失效不会拒绝向明确选择的新库导入。
|
||||
- 上传完成必须确认目标库、名称、分区、工程关联、顶层块和 Layout。顶层块允许保持来源名或被原生导入改成本次注册名;真实映射与实际目标身份保留在证据中,不能接受第三个名称。
|
||||
- PRJ 路径规范化、默认标记、历史/其他工程文件的差异单独保存 `assets_match` 和增删改清单,并提示核对;不再以全文件相等判定上传失败。Layout 不一致、关联错误或结构缺失仍拒绝确认。
|
||||
- 不比较原生重写后的 ICDB 原始字节,也不再声称证明了原理图语义等价。`identity_proof` 保存实际复读结果,没有伪造为来源内容。
|
||||
- 上传后 Verify 保持独立可选;只有 PASS、权威 GREEN/READY 和释放确认才能记录 `UPLOADED_VERIFIED`。否则区分 `UPLOADED` 与 `UPLOADED_VERIFY_FAILED`。
|
||||
- 来源或名称错误按行进入结果,其他有效条目继续。界面仍拒绝同批重复目标,避免对同一目标提交含糊的多次变更。单项失败先复核释放,只有未释放的相关库暂停后续写入;不绕过真实数据库占用。
|
||||
|
||||
## 回归与代码复核
|
||||
|
||||
新增用例先复现:导出器缺失导致能力禁用、导入调用附加导出、单行无效来源挡住批次、旧库地址失效、原生 PRJ 改写以及原生顶层块改名误报失败。保留陌生顶层块和 Layout 差异的拒绝用例,以及上传后 Verify 失败时安全继续下一项的用例。
|
||||
|
||||
最终源码全量回归 **1,895 passed**,1 条既有 pywinauto STA COM 警告;编译检查通过。冻结包的 64 个应用模块、资产和 EXE 图标与源码一致。独立只读代码复核没有发现待修正项;该复核没有执行原生操作。
|
||||
|
||||
第一轮全量运行有 15 项失败:子进程使用了机器 editable 安装的原始工作目录,而不是本隔离工作区。该轮不计为通过;显式设置 `PYTHONPATH` 到本工作区 `src` 后,全套通过。后续测试与原生试验均固定此路径,未更改用户 Python 安装。
|
||||
|
||||
## 实机中保留的失败
|
||||
|
||||
- 第一轮冻结包在全新隔离库实际成功新增 A/B,但 PRJ 自动规范化及历史事件冲突副本缺失被旧的全资产相等规则误报为 `RECOVERY_REQUIRED`。已增加差异证据及回归;该轮不算整体验收通过。
|
||||
- 第二轮实际选择文件后移走一个测试文件、取消确认后重试并连点执行:失效行显示失败,A 随后 `UPLOADED`,B 的原生 Add 也成功。B 被后续“目标顶层块必须等于来源”检查误报为需恢复;已按本次原生命名变换修订。两项都确认释放,主程序最后正常退出 0。该轮同样不算全部通过。
|
||||
- 原生 Add 曾长时间等待。窗口、进程与等待链证据保留;没有确定底层原因,不宣称已修复耗时,也不强制结束原生写入来得到成功结果。
|
||||
|
||||
## 最新冻结包的实际批量链路
|
||||
|
||||
候选程序:`F:\CbbI1113\candidate3\dist\CbbRefreshVerify-Background\CbbRefreshVerify.exe`。
|
||||
SHA-256:`98a642d8e81f42b708934bb4dc2d023c49c2acdae5851151a430f101c74c9615`。
|
||||
|
||||
第三轮从应用真实按钮和文件选择器向全新空隔离库依次导入 B、A,开启上传后自动校验;没有替换原生适配器,没有前台鼠标接管,也没有强制结束进程或删除原生地址/锁文件。
|
||||
|
||||
| 步骤 | 实际结果 |
|
||||
| --- | --- |
|
||||
| B 的原生 Add 与复读 | 原生明确成功,库/名称/分区及工程关联确认;Layout 一致;顶层块从 `1GPHY_RTL8211F` 变为本次注册名 `1GPHY_RTL8211F_A`,映射保留,上传确认通过。 |
|
||||
| B 的上传后 Verify | `MENTOR_PROJECT_INTEGRATION / forward_annotation`,原文 `There are no PartsDB partitions from which to extract parts`。空库没有 PartsDB,不能创建本地 PDB;记录 `UPLOADED_VERIFY_FAILED`、safe=true,不记为上传失败或 READY。 |
|
||||
| B 失败后的同批 A | 实际继续执行 A 的原生 Add,注册及 Layout 复读通过;没有因为 B 的 Verify 失败停掉整批。 |
|
||||
| A 的上传后 Verify | 同样因空库缺 PartsDB 返回 `UPLOADED_VERIFY_FAILED`、safe=true。没有把失败伪造成 READY。 |
|
||||
| 独立目录读取 | 重新启动原生 Library Manager,确认两个正确名称均存在。 |
|
||||
| 来源与退出 | 两份输入主要内容清单未变;原生会话释放,应用正常退出 0;整条试验控制器退出 0。 |
|
||||
| 附加导出 | 本批未生成 ASCII/CSV/EDIF 导出进程记录;对应自动化回归也禁止普通导入调用这些导出边界。 |
|
||||
|
||||
第三轮原始证据:`accept3.log`、`auto-verify-trial.json`、`d3/management/*/checkpoint.json`、各项 `add/identity-comparison.json` 及 `verify/*/result.json`。此试验验证真实上传和“校验失败后释放并继续”的负向场景;**不是多个新增项在依赖完整的中心库中全部达到 READY 的验收**。
|
||||
|
||||
第四轮从同一最新冻结包重新打开该库,实际再次新增已有的 A:取消后重新确认、执行中连点均未重复提交;原生目录确认同名后返回 `UPLOAD_FAILED`、safe=true,检查点没有 `native_add` 阶段。目标及共享主要工程内容清单前后完全一致;独立原生目录仍只有 A/B,程序正常退出 0。证据为 `accept4.log`、`duplicate-conflict-trial.json` 和 `d4/management/*/checkpoint.json`。
|
||||
|
||||
机器可读摘要见同目录 `2026-11-13-import-decoupling-validation.json`。最初两轮发现问题的包及失败记录没有覆盖或改为成功。
|
||||
|
||||
## 范围
|
||||
|
||||
未更新云端既有 `v0.2.4-beta.2`,未合并 main 或关闭工单。自动 ICDB Repair 保持禁用。现场失联故障、Windows 10、跨机器共享库及任意工程内容的完整语义等价仍不在已验证结论中。
|
||||
@@ -0,0 +1,430 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"created": "2026-11-13T17:31:37.910526+08:00",
|
||||
"review": "https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-414",
|
||||
"base_commit": "1572e2d8cab905c28f96f562851db00ef7ea8ad6",
|
||||
"environment": {
|
||||
"windows": [
|
||||
"11",
|
||||
"10.0.26200",
|
||||
"SP0",
|
||||
"Multiprocessor Free"
|
||||
],
|
||||
"python": "3.12.10",
|
||||
"mentor": "EE7.9.5"
|
||||
},
|
||||
"commands": [
|
||||
"python -X utf8 F:/CbbReview414/run_tests.py tests --junitxml=F:/CbbReview414/full-final.xml",
|
||||
"python -X utf8 F:/CbbReview414/run_tests.py tests/test_review414_write_admission.py --junitxml=F:/CbbReview414/admission-extra.xml",
|
||||
"python -X utf8 -m compileall -q src tests",
|
||||
"git diff --check",
|
||||
"python -X utf8 F:/CbbReview414/build.py",
|
||||
"python -X utf8 F:/CbbReview414/verify_bundle.py",
|
||||
"python -X utf8 F:/CbbReview414/create_library.py",
|
||||
"python -X utf8 F:/CbbReview414/driver7.py"
|
||||
],
|
||||
"full_suite": {
|
||||
"path": "F:\\CbbReview414\\full-final.xml",
|
||||
"sha256": "075f7b76002b451a72af65d64428c0b6c65e5fa5c8776036a5fff55584a6dc54",
|
||||
"tests": 1912,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 520.549
|
||||
},
|
||||
"additional_admission_suite": {
|
||||
"path": "F:\\CbbReview414\\admission-extra.xml",
|
||||
"sha256": "6aa78606fc7aa4af1b3e2f8865752a60a518d9d25b5f88924f2b1d88280b2ac0",
|
||||
"tests": 14,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 5.299
|
||||
},
|
||||
"focused_serial_suite": {
|
||||
"path": "F:\\CbbReview414\\focused-serial-final.xml",
|
||||
"sha256": "8f68dc1ffd22d41f343299ff4382157c5fcb7ce68dc5198d2755a87dc1764337",
|
||||
"tests": 19,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 5.036
|
||||
},
|
||||
"concurrent_test_failure": {
|
||||
"result": {
|
||||
"path": "F:\\CbbReview414\\focused-final.xml",
|
||||
"sha256": "6246c57aee87142dae183aa48399ff2e3f8e8afbff0c4f6f3655d02b93b535fa",
|
||||
"tests": 19,
|
||||
"failures": 4,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 7.213
|
||||
},
|
||||
"reason": "Coordinator ran mutex-using tests during live native acceptance; four management/recovery tests were rejected by Local\\CbbRefreshVerify795. Rerun serially after native trial."
|
||||
},
|
||||
"count_note": "Full suite collected 1912 before two additional tests were appended. Additional 14-test run includes both new tests and 12 already in full suite; 1914 distinct tests passed.",
|
||||
"compileall_passed": true,
|
||||
"diff_check_passed": true,
|
||||
"bundle": {
|
||||
"module_count": 66,
|
||||
"source_and_frozen_code_equal": true,
|
||||
"source_sha256_checked": true,
|
||||
"packaged_assets_equal": true,
|
||||
"exe_icon_images_equal": true,
|
||||
"executable_sha256": "818decc5f0778a27affe3b047da526595007608e234b89c05d3e1c375e1c4cf8"
|
||||
},
|
||||
"red_reproductions": [
|
||||
{
|
||||
"path": "F:\\CbbReview414\\open-red.xml",
|
||||
"sha256": "b33502766075ece9777ceee3f6e7dde66dfb558eff08a5f860ccc0ebd63f9500"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbReview414\\queue-red.xml",
|
||||
"sha256": "a5bbad8641c7851a5fa3a4bdd15b17784c9c90c92ee4f8c8fc7e51b62ae25f40"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbReview414\\write-red.xml",
|
||||
"sha256": "4d0b0c6ebb0382955470ecb6072126b1d4f0708e6f77c49060c5be6b592220d7"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbReview414\\query-batch-red.xml",
|
||||
"sha256": "6299777fd6d3c87849b0b7069afb0d238d4f4f20f84d7cdea59b81f4a479694f"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbReview414\\export-red.xml",
|
||||
"sha256": "16724c8a015b5cb1c2d304abe6f5678716a4b4d40fd29880cb6f8a2ade451462"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbReview414\\restore-consent-red.xml",
|
||||
"sha256": "e9e2edad0c3481bea26c00c14253c9fa9b2e2bbcb3679583e52489ac3072f571"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbReview414\\default-cancel-red.xml",
|
||||
"sha256": "2e4b9b64d9a7fe8c719b08db407b78e6c866a647040761c1be36d566b86dca36"
|
||||
}
|
||||
],
|
||||
"native_trial": {
|
||||
"records": [
|
||||
{
|
||||
"operation": "add",
|
||||
"name": "1GPHY_RTL8211F_A",
|
||||
"status": "CANCELLED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "已取消本批次,未提交后续写入。",
|
||||
"evidence_path": "F:\\CbbReview414\\d7\\management\\management-00175f4d987f48da80bb7821017e7617\\checkpoint.json"
|
||||
},
|
||||
{
|
||||
"operation": "add",
|
||||
"name": "1GPHY_RTL8211F_A",
|
||||
"status": "SKIPPED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "用户跳过本项,未确认未知程序与目标库无关。",
|
||||
"evidence_path": "F:\\CbbReview414\\d7\\management\\management-26da6781691c47c7a8172b5947db7191\\checkpoint.json"
|
||||
},
|
||||
{
|
||||
"operation": "add",
|
||||
"name": "1GPHY_RTL8211F",
|
||||
"status": "UPLOADED",
|
||||
"safe_to_continue": true,
|
||||
"detail": "上传已确认;本批次未启用自动校验。\n原生注册、工程关联、顶层块和 Layout 已确认;未核验原理图语义。其他工程文件有差异,已记录供核对。",
|
||||
"evidence_path": "F:\\CbbReview414\\d7\\management\\management-2a587eeb2919405d9b570df82ff75a2a\\checkpoint.json"
|
||||
}
|
||||
],
|
||||
"choices": [
|
||||
"cancel",
|
||||
"skip",
|
||||
"continue"
|
||||
],
|
||||
"catalog": {
|
||||
"library": "F:\\CbbReview414\\library\\native-add\\fixture\\mentor_lib.lmc",
|
||||
"flow": 1,
|
||||
"safe_to_continue": true,
|
||||
"names": [
|
||||
"1GPHY_RTL8211F"
|
||||
]
|
||||
},
|
||||
"sources_unchanged": true,
|
||||
"parked_untouched_until_explicit_user_close": true,
|
||||
"user_closed_owned_empty_client_before_continue": true,
|
||||
"evidence": {
|
||||
"path": "F:\\CbbReview414\\native-trial.json",
|
||||
"sha256": "ecb21df8fd56755dd3bdc6374fa82b5623c523c396314a1c049c225fc82559df"
|
||||
}
|
||||
},
|
||||
"native_action_log": {
|
||||
"path": "F:\\CbbReview414\\actions7.jsonl",
|
||||
"sha256": "4ee465d2750b826de428693f89fe0cd9d19f67e5ad08c0fb11451184a883faf2"
|
||||
},
|
||||
"superseded_drivers": {
|
||||
"reason": "UIA traversal of disabled parent during modal prompt stalled the driver. Native windows were cancelled normally; no forced native termination.",
|
||||
"logs": [
|
||||
{
|
||||
"path": "F:\\CbbReview414\\accept4.log",
|
||||
"sha256": "f551539adec4e38072a58eff9e1a8c7589d926f2f120342a101f8476450b4b12"
|
||||
},
|
||||
{
|
||||
"path": "F:\\CbbReview414\\accept5.log",
|
||||
"sha256": "d2db6fa91df459d367900832a10c15459ba1ea8fb2a3773c29593c875597a03e"
|
||||
}
|
||||
]
|
||||
},
|
||||
"rejected_native_trial": {
|
||||
"log": {
|
||||
"path": "F:\\CbbReview414\\accept6.log",
|
||||
"sha256": "73cf87c9328d2e4104077f36ecfbdc383ef67d5d5e54674f640d88d8e5a9de16"
|
||||
},
|
||||
"statuses": [
|
||||
"CANCELLED",
|
||||
"SKIPPED",
|
||||
"UPLOAD_FAILED"
|
||||
],
|
||||
"reason": "Existing native _catalog_com refuses any preexisting LibraryManager even after write consent.",
|
||||
"no_force_termination": true,
|
||||
"foreign_client_untouched": true
|
||||
},
|
||||
"interaction_method": "Private desktop Win32 keyboard messages for modal owner decisions; UIA for idle dialogs only. Skip/Continue key routing separately verified against actual Qt dialog.",
|
||||
"history_provenance": [
|
||||
{
|
||||
"tests": 1775,
|
||||
"record_commit": "fdd07224aac99bee8d1f29e8e82d6a2c49964c87",
|
||||
"record": "2026-11-09-full-review-followup-validation.json",
|
||||
"manifest": null,
|
||||
"recorded_manifest_checked_files": 27,
|
||||
"manifest_mismatches": [],
|
||||
"exact_historical_tree_available": false,
|
||||
"collection_exit": 0,
|
||||
"collection_summary": "1775 tests collected in 12.12s"
|
||||
},
|
||||
{
|
||||
"tests": 1851,
|
||||
"record_commit": "42d0cebc54191681b53dcecb120f53236c1963bb",
|
||||
"record": "2026-11-12-native-acceptance-validation.json",
|
||||
"manifest": "F:/CbbAccept-20261112/candidate-release4/source-sha256.json",
|
||||
"recorded_manifest_checked_files": 70,
|
||||
"manifest_mismatches": [],
|
||||
"exact_historical_tree_available": false,
|
||||
"collection_exit": 0,
|
||||
"collection_summary": "1851 tests collected in 11.38s"
|
||||
},
|
||||
{
|
||||
"tests": 1880,
|
||||
"record_commit": "466f400514acc8531a219db8e75641be35304a3f",
|
||||
"record": "2026-11-12-scoped-release-validation.json",
|
||||
"manifest": "F:/CbbAccept-20261112/candidate-scoped10/source-sha256.json",
|
||||
"recorded_manifest_checked_files": 72,
|
||||
"manifest_mismatches": [],
|
||||
"exact_historical_tree_available": false,
|
||||
"collection_exit": 0,
|
||||
"collection_summary": "1880 tests collected in 13.05s"
|
||||
}
|
||||
],
|
||||
"independent_review": "Both findings fixed; final static review reported no additional actionable findings.",
|
||||
"tested_files_sha256": {
|
||||
"src/cbb_refresh_verify/application.py": "62b9b013563a216d020c8366cccb8f949b02afa72dc63c26940804441cc23057",
|
||||
"src/cbb_refresh_verify/backup_recovery.py": "08ca467304f8ce34185212a92de0ebd0b83455302fe9351d09874b180222b523",
|
||||
"src/cbb_refresh_verify/batch_status.py": "55a4007cf54491ca8e045a5bf86aa4353ac8437cca5a76cd79304962e3d3fa0a",
|
||||
"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": "a1c03192f4a61ad0924b24bb635705b1ee4811d35483a02864200f95edbbebe3",
|
||||
"src/cbb_refresh_verify/desktop_worker.py": "27d751816552d215dd8ee9cd67941d824f7b4493120ead7c3f87e5eba5ec4a92",
|
||||
"src/cbb_refresh_verify/diagnostic_open.py": "d6c49ffe5a9969d95edbbc896d47a7e100f248380a287f99ba7bb8b92dbb3072",
|
||||
"src/cbb_refresh_verify/dialog_agent.py": "5acb6e5cf1350a7ca20a6fe480668435fac785835874f266881973010db6504b",
|
||||
"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": "e81d253d8b4d3e7c1000c45335a392c72b110748675c2c3324ebe524a7252e98",
|
||||
"src/cbb_refresh_verify/icdb_ownership.py": "7bf2342c1efa34a2ebcbf27964a40a490220f7146fbb6ef957b8d8dd1e511f03",
|
||||
"src/cbb_refresh_verify/icdb_recovery.py": "358c0e9a004f1e0b2127513286e1dffd94b0180a8b7314aa9655462f570b6360",
|
||||
"src/cbb_refresh_verify/integration.py": "f188856af69ba25e265988c51db7a6d4263326440d972ca78378b733b891c1ed",
|
||||
"src/cbb_refresh_verify/library_lock.py": "6836ec8ac21e788eb75326ff44cb31ad4bdfb5f381bd35cdf33e6b34c7fca89e",
|
||||
"src/cbb_refresh_verify/library_manager_verify.py": "71e16a8581ad44b646be78b480f9812d596a6d162b3eec03d078bf4ea4503195",
|
||||
"src/cbb_refresh_verify/library_reader.py": "d4007caa361edd467773e49f721e02671d5a9bcb30741769a57349850b12c438",
|
||||
"src/cbb_refresh_verify/maintenance_entry.py": "3b93c25f69d7a961facd8004e20e155a84cc18f06d57b741a9055786ed058990",
|
||||
"src/cbb_refresh_verify/management.py": "7ead9bfffeb44201e44f73d9f039590f091e9a456982f2110dca8ec3695f8803",
|
||||
"src/cbb_refresh_verify/management_transaction.py": "32c53caaead05d5db3a31d3e30721e65434e5837095dc0a7812f825603aa37a0",
|
||||
"src/cbb_refresh_verify/mentor_adapter.py": "1fc8c98d5508120e03bf001a42dd3e0da7b165eb18c90f1aed83147d17db8638",
|
||||
"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": "e704e8f56c43629a1593d490776af328bb032208ee2f5ffd1d1be6c3114f5412",
|
||||
"src/cbb_refresh_verify/native_export_guard.py": "523cdf44db8e1665634feadba963ccf26777dc8942fb2eb604d2c30bbe92cbb6",
|
||||
"src/cbb_refresh_verify/native_management.py": "1e8a298aac8c63aef68b1e799d1f06e43de7abdc165be5086e7089a61e643e88",
|
||||
"src/cbb_refresh_verify/native_occupancy.py": "7d686079d12217382adace6361cd343d977b91075e3b157cf410ca92d07ffc49",
|
||||
"src/cbb_refresh_verify/native_repair.py": "9f024dcb5e3a76369191033474fefd30787b6ae350c315f3cf38e92e5a1f3e98",
|
||||
"src/cbb_refresh_verify/native_repair_ui.py": "3eb2af181befea94af8b3b3131edff09589f340bcba777abbe3b67fd31b80393",
|
||||
"src/cbb_refresh_verify/network_path.py": "6b5b159502d42a46bf4ee26d5698fd2c6498b359088e2138eae46e9065b13c6f",
|
||||
"src/cbb_refresh_verify/operation_lifecycle.py": "3838c5a501711d16f578c45ebbc6f960872b0c3ba6bbda9a597f994ef746cef6",
|
||||
"src/cbb_refresh_verify/operation_queue.py": "a6932d8bc68ac436091f6d362557c66d274ec52d0f295a22f014a3396845c79f",
|
||||
"src/cbb_refresh_verify/owner_probe.py": "8dcfd60246cb2979db34d02e0a2d605c334b6f7e2666f22daa2f50c0408bc903",
|
||||
"src/cbb_refresh_verify/pcb_bridge.py": "2f6c2b09642100468814500569dbfc6695fc2a46b9a3b8333daa8e1530cdeef5",
|
||||
"src/cbb_refresh_verify/pcb_open_consent.py": "2680930acc4daa314529c435337915333c05a8594ec28bc053c930054602590f",
|
||||
"src/cbb_refresh_verify/pcb_restore_prompt.py": "39e0b8623a838911eff61066f3e9c8ede4364dbf73efc5a8994197ec72a96488",
|
||||
"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": "ef148549751fa47518f5f2ca8f32ba25794ec5f22e0de545476ea33f89a3f0bf",
|
||||
"src/cbb_refresh_verify/residual_sessions.py": "4ac500b33b209611d54eb496c6c30727ba159742d625431ceea84471a5fc3442",
|
||||
"src/cbb_refresh_verify/runtime_logging.py": "44ac25430a89c5ffc9e48e88c227e88052f4c815365e8556f67918f3edaba39e",
|
||||
"src/cbb_refresh_verify/runtime_timing.py": "c4ed4057b5000e0b86ccc7dd1fe2004d6e0dae29f397fec77b01ad41a81c6367",
|
||||
"src/cbb_refresh_verify/save_verified_block.vbs": "926175562ef82bb2e732231dbc18d8a88059c7e6143c9f4e502cabfd0d170bcd",
|
||||
"src/cbb_refresh_verify/scoped_manifest.py": "9318bf0f929d23c18466a25d83a4a9903822093c123aae10510061788c6d0ab7",
|
||||
"src/cbb_refresh_verify/session_record.py": "2bc3cff365008864584138a4ff13538bb6b2f90d981e7d008a1300f9102c6e7e",
|
||||
"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": "3027ef7fc1ef6365ff36ae0c83389d869b92ffcd96985d10275bca4dc9483e3f",
|
||||
"src/cbb_refresh_verify/write_admission.py": "e38b460370596f49499fbda3033b2962dda125aa62862fd2327bf6d376d192b9",
|
||||
"src/cbb_refresh_verify/__init__.py": "dd960394d88657820dba858792abf0de258e05efceb08ae2f0b39c6ad78bc469",
|
||||
"src/cbb_refresh_verify/__main__.py": "dc4be034a0e43d4b659a9300137c29a6a6b7a32b7eaef02b6dff9a88c41305c0",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.ico": "62d4472ebaa94f9b39aebae06459685d3322041d0e1a7ada9f368cfd816ba1d6",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.png": "840f657fd7c622d9afd78625a64ed8ad04c90a895dd3c9fd37eebae543cdebe8",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.svg": "cbba5b3f339cbeb5eb43012709237359442ef67c69fc5b6679a8ee4c0a1b7328",
|
||||
"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": "ba30b79cd652b74b6e8f438d6bd5f0fc0229594ff4be2358f81c6dd3cb82e77a",
|
||||
"src/cbb_refresh_verify/ui/icdb_check_task.py": "ade3bf414aa29b42f4c1535c613b2cacb2735f6abc7900e6da25999390a5891d",
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "2c919badeeee0280e49387b88b058555a9fa6ace04835c094fccd782bf0af9c0",
|
||||
"src/cbb_refresh_verify/ui/management_dialog.py": "8e2024957be874905685167c7eab440ecee9320170c1553340025b10fa1754d6",
|
||||
"src/cbb_refresh_verify/ui/pcb_open_dialog.py": "3cabdc15f1b2abaeb919a7f29f32d4b053186701fd514646d9bdd3ea32f364f6",
|
||||
"src/cbb_refresh_verify/ui/pcb_restore_dialog.py": "b7228d828df235ac51502dc68760d28c4896af02c780e9806e11c32dba7f62da",
|
||||
"src/cbb_refresh_verify/ui/residual_release_dialog.py": "1d2a26bfc7ee21b11d7edbc3074b4c525e8c9fb628bca45b08bd06fc672586c8",
|
||||
"src/cbb_refresh_verify/ui/workers.py": "4cc9360a4820ded27a7d5ef709fc9f04b1d4804cb1e7a614f6c357ed547da888",
|
||||
"src/cbb_refresh_verify/ui/write_owner_dialog.py": "c77f4d57e683fa397a39a573171198922f6158e19a8a96ca3627af60b5a8963f",
|
||||
"src/cbb_refresh_verify/ui/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
|
||||
"tests/button_simulation.py": "3278868565853001103557d5f7ada42b11b05c03feb9032deed0327b6609de2b",
|
||||
"tests/CBBRefresh.Core.Tests.ps1": "e90774cde77189bc577ee374b50a8cc951740d2d3c36c786c73abbd128181a59",
|
||||
"tests/ContentCheck.ExitCode.Tests.ps1": "efa0d1e8a77715932670ab8ac299984e023867d07ff57b09fc7da6d68c4d6fd9",
|
||||
"tests/test_abnormal_shutdown.py": "0abdeaf51e2ffc3f771e09aefa9ec647a72b7f64757c9f3851926fbd392cbbcd",
|
||||
"tests/test_all_buttons.py": "897ae449a15fe36fb6198a947575609346d5ce1a22c0a8c4d2950b9f00035d4f",
|
||||
"tests/test_application.py": "bba12187fca6fee0f4f8862182bb40d939e2995016af2cdbb3fd756f6a99135d",
|
||||
"tests/test_automation_license.py": "45e9c75d0d3e1a76f997f7da4cc87b5eb1b05a4ea2356408725742eac8a09ffb",
|
||||
"tests/test_background_icdb.py": "df9bd9e8252e0dee4527dc6a740c0c33e76d1fb06a79b816cc15809d95716e44",
|
||||
"tests/test_background_queue_regressions.py": "132866bfccc9a7ac5cb234f97aaf6a290e2e4ef949f31e2f70b0f3eafeb99046",
|
||||
"tests/test_backup_recovery.py": "efd88c0c00440ac915b147c2e6dee8044ca805b03f90ab9f171cbde1db11cb9b",
|
||||
"tests/test_backup_recovery_dialog.py": "b2f65864b861d95e99d5efb61ada915ae41973d2b49d08f2d536781997dd00cb",
|
||||
"tests/test_batch_blockers.py": "4387293d3a5820fab630e3c5fe1b424f61ba6947773e5a61125d840433c5c62a",
|
||||
"tests/test_batch_item_yield.py": "ed4be6d1e854b18d054a75c92171cd46b6b64411c2f74e9a3caf31fba3c7366b",
|
||||
"tests/test_batch_status.py": "c1f9af0c7c6f3171b3726fb53346f480b13b8d9cd88111a9c12e2fae2392bbff",
|
||||
"tests/test_batch_status_faults.py": "314e890c9aee439c8a75b4dfd605685240c74f6212da975fd50526bd70b4a0ff",
|
||||
"tests/test_desktop_worker.py": "671d616f04a01d74508b328e3b6fc8f6c7191a91de0dcaa486aa98a3718353ff",
|
||||
"tests/test_diagnostic_open.py": "b44f8f7b171602ad2691ea2e064ac9fe94f2fabb9fcc2eb6760cc1dd365b9423",
|
||||
"tests/test_dialog_agent.py": "8c746e47d55637ca18d7cc998f324a0c2e0a5214dcfe8fcb6458c060619c211c",
|
||||
"tests/test_dialog_models.py": "6902cf5c292458340fb48241b34875e111a0113d706cd82775934a7f72bab7b9",
|
||||
"tests/test_dialog_probe.py": "55c98f6102957a27a96dcfd4f4bf3af499b5055225b77ef93b7b332dfd4ac472",
|
||||
"tests/test_dialog_rules.py": "96bf36493da770679e9207e96b3088ef7f471aea22e17c254f33326ffef0d7f9",
|
||||
"tests/test_dialog_startup_budget.py": "6f23c01836e4894ae82c3345a2383c4f8eb0517056c5b953c43100acd0fc3739",
|
||||
"tests/test_dialog_supervisor.py": "4c1b00050127a65b0a8cf1c7a94fd673431ea3f04b76033a463804d0468ad2d9",
|
||||
"tests/test_extended_safety.py": "7450816abba89aba1f4739f819f43631def82701fe07481279db2b3f3ed96cf6",
|
||||
"tests/test_external_owner_release.py": "675ddbab4a97e86febac3003b9083c259295534941aa0463488a5a1206cfaf92",
|
||||
"tests/test_failed_startup.py": "eca757ea46a4c0aa4fb0368ff53f26822af71612d251ecd87132686fe3c3794b",
|
||||
"tests/test_failure_lifecycle.py": "dfeac56744a44e6f4c7898516749ca478f53d7c7f08b3843a05ef7f448c469a7",
|
||||
"tests/test_icdb_address.py": "cbdc07e5043349c796a4ea1ce3d4989062094cd28929a9ef7d42c5ba75b77907",
|
||||
"tests/test_icdb_batch_check.py": "e83982e0fd0b3744bdc62965b26970ded31aacfedea94283d9e321ef70a8232f",
|
||||
"tests/test_icdb_open_check.py": "1f3750169755d0553bac3e0f8bec244038b84f9cd970e17c9f6eb67dee0e3dba",
|
||||
"tests/test_icdb_recovery.py": "298ddac4b79b4400efc99ff27c58ca49fffea1f401a31071451b2fdaca59036e",
|
||||
"tests/test_import_without_export_gate.py": "ae3dd0fb41c41773ce2d54aa9f9be83bbb56a0d09c59d600b10575fa8f0d2cd4",
|
||||
"tests/test_incident_safety.py": "52f3ccb04db8971bf38628c2bd334d4fd79795e97de6538f6f66cb35f7123ece",
|
||||
"tests/test_independent_operations.py": "4ba5798df3346bce74c3703c158f1dce1d1ba14df748606fcaf900c8568753e0",
|
||||
"tests/test_integration.py": "9e9d30692607c889e1e3744a63c79c68e3af7d4c86804e0bcebe48e68765086c",
|
||||
"tests/test_late_release_continuation.py": "34c62a628cbc08f4e8b9a1919c13f17772a2d26d1996fae34a35f814725b00e2",
|
||||
"tests/test_library_lock.py": "3d65bd941faa441404045ce0140ea3ea5e58fb7d410b7b76bb9f03a9ea03d3af",
|
||||
"tests/test_library_reader.py": "b39a1dc9d99c2463b744141e3c3489cd49ac4a637e7835559a9c3fe9cbafbb58",
|
||||
"tests/test_lifecycle_supervision.py": "cfe29f1e73c6ef38d11e185e211b6e2fb60247f53a44e99dd1e2f8cf7a009faa",
|
||||
"tests/test_maintenance_diagnosis.py": "0849aef555475a03b061eacf499f261fb75f2e727f35dba3cbceafac92e2a638",
|
||||
"tests/test_maintenance_entry.py": "5ed3cda8e0c829fb2964e27f1bdc6fa8ee8dcde93ec63338959bf754b62d6a0b",
|
||||
"tests/test_maintenance_owner_scope.py": "7cf64dc7f2b126684dcac6e619cbd87eca3d85ec2fc1f70f057154679dad6026",
|
||||
"tests/test_maintenance_review.py": "ba807fd8c25c1b52cf2443d8bcf2f57539819715c0bc6c358d31d8542c2e7ce5",
|
||||
"tests/test_maintenance_startup_gate.py": "4f69d33218483a658b51b2012ae8bfa83aff8a787152a38b19dadc4c0d3ffe36",
|
||||
"tests/test_maintenance_ui.py": "2a640ba5e979a3fead81f0a38603b6105ffcb883dbb8484ccc42c99ee8c311db",
|
||||
"tests/test_management.py": "cad0fb43eca9e7022a33a5e9ff0a408465b262fd304b146cdc85c28265f2e74f",
|
||||
"tests/test_management_diagnostics.py": "671a9d7c112ededbee332db9b6fbab786fb37e9367d992f902f3ab2c9f60880b",
|
||||
"tests/test_management_native_transaction.py": "7ca227aae6426c4d0d998edfd8620ec18905aaf212f0be20ceba97b1cde3a9a4",
|
||||
"tests/test_management_probe_guards.py": "ae9be3dbd7c6a616478b7d4ea3498c428ff94a985089fe798463c5cab456f151",
|
||||
"tests/test_management_retry_blockers.py": "124dbef291dbe331ba0c3e7de1665c910ea43e37b1563429b387f0f2233953ee",
|
||||
"tests/test_management_source.py": "16e608ed9c8b0aa81cf08d49f165a33a1403c4ea7f2a5be44e8cfc8cb49850ad",
|
||||
"tests/test_management_supervision.py": "2dcadd6551a94c52e5d4e74285959f10144a89c48af87e508abaea945652d1f6",
|
||||
"tests/test_management_ui.py": "da3e2bc0b5c73926324a539edfa2f718ae1b585df96324a928a0c1a909e48083",
|
||||
"tests/test_manual_backup_ui.py": "927e42ec4a1e0139c71a41b0cad1389ad47b0881381203c18b307cd2d137983a",
|
||||
"tests/test_mentor_paths.py": "a05a91812a74b58e76f36d581216ee43969d2576b8a8e7d1cde3e301c52cf4c1",
|
||||
"tests/test_native_add_failures.py": "ceedd60e030628b1af149d08d16216d5f7158a63686729bb357c148da86fb0ec",
|
||||
"tests/test_native_backup.py": "43ec0c6b14b53864553feaf5d9fb498b37866f24edc486c0749160d3f803db5f",
|
||||
"tests/test_native_engineering_identity.py": "a1adcf6883a9b55c2c37d9f491faf40dd4928f4d8db675419fd288dd31552c69",
|
||||
"tests/test_native_export_guard.py": "f8ec4fa1058af55008e9628f79f2dc70b6e551f36815a812d10bfdf955cada51",
|
||||
"tests/test_native_inspection_release_regressions.py": "8f7bb0b2b641d437872f1dd1d0c2547c2522c81e3c0351c31a7125f751d91927",
|
||||
"tests/test_native_management.py": "badf33d4d00104c7e96e336777fb3e49690cc9db5ce1b071f98520aa5b6668f1",
|
||||
"tests/test_native_management_fields.py": "9917ca0910e19bd809c86d0120c652145261528ace33c3b805f5663442c4a973",
|
||||
"tests/test_native_occupancy.py": "56293dbe24bd3cd4f74cf8208e933faab7d737e5a5684a5d38838d063c3aef6d",
|
||||
"tests/test_native_repair.py": "113185ced72d8f4f4eafca99054d97fe80a504d1c6cc91aaf86f55cea1b7e138",
|
||||
"tests/test_navigation_tabs.py": "d7d5bbfc752f73c1b1d4615ffafc1266e772d96f3f3ba3d82c4b4baf678b292d",
|
||||
"tests/test_network_path.py": "f52624391ae78e9b913dace2b1a9a2875a5855f86dc9e12c324ef493e6c7817b",
|
||||
"tests/test_network_release_safety.py": "caef536d0a40b2eb848c1b8ab095ab374af247c03dd44acf8a70f0f500db6dac",
|
||||
"tests/test_operation_lifecycle.py": "c0ce6c86b73021a8b162ae9e67a10aeec8a27a98e382fd82e1449a451a9a8c3c",
|
||||
"tests/test_operation_queue.py": "8137528603f015695ed4d60a0c8fa8e7bf0a1c4659f8dc2a181291f5d500e6a1",
|
||||
"tests/test_owner_probe.py": "deb757e022980f11ef48e57a2fd002ee3e90ec647a4666a0c4d4427313b6f725",
|
||||
"tests/test_packaging.py": "87a6d04419775c0c5c806e0e569a48d7ef199a0bff8736b211443a1f471e7e8a",
|
||||
"tests/test_packaging_status_bridge.py": "cbfaeac070a1494a1d8609fc25e9a779a63354c8914b4c6c57fdc7c31b70d472",
|
||||
"tests/test_pcb_bridge.py": "527fb63147a203a2e9419da989aff600d3e461580989e39e8ede3a8cc57b901a",
|
||||
"tests/test_pcb_open_consent.py": "5bf9ef6276d221b73ebe0dd14cff4fe5dc11bfec7b8be3266ae4a6b6a588d354",
|
||||
"tests/test_pcb_restore_prompt.py": "a005691d0296587e520e20c4430e9e55227d767c8e910e950a9f2e93aeccb2c7",
|
||||
"tests/test_pcb_version_choice.py": "0825c28333e4ed4f5a63847b6f5bb11143e922c7203d2770ce9c78fc8edec20f",
|
||||
"tests/test_post_repair_consent.py": "bf417b378255386dc97ad8efdf5003b0691aa5d69da9d9256aa367dc16a2d4bb",
|
||||
"tests/test_post_verify_diagnostics.py": "212857e56581998a3a3cd53635030b68a089fc4d630a8b0ee7ef3f137090dcc4",
|
||||
"tests/test_private_desktop_discovery.py": "5361493313ae6864e252cdb9f2c72e71b39264a1c022beb4cf0c04c143cdd91e",
|
||||
"tests/test_readonly_status_policy.py": "3ed40d7bdf2d3e6f70b38803b89a8b982336556444b45c6ba6b0a7c6df52a97f",
|
||||
"tests/test_reimport_recovery.py": "875e5e2a0f6251ec5a251457848c7eac5dfd1674fcbb4745155f6d5d8bf4a4be",
|
||||
"tests/test_residual_release_dialog.py": "10b23d009703d542e5ce8ecb35a4833e0135bb8852b4116e49eedc7010397a1e",
|
||||
"tests/test_residual_sessions.py": "2c51ed1dc95a3afa7ebb24027963dfa9d13aba9c407e508e22ccc6e9f762dfeb",
|
||||
"tests/test_review313_residual_isolation.py": "52a8024ed4e2a7fed219fe46cacdf76fa971166feedd557206716ef7f6d3c914",
|
||||
"tests/test_review326_dispatch_and_receipts.py": "ce4d529246da1c4d53c3dec70ef49542165064404301dec3e32851df62492ecf",
|
||||
"tests/test_review326_queue_guidance.py": "c2c97aceddd9713618afdd5f2a7be4764b56a1b62fc672282fb8c218b4969c74",
|
||||
"tests/test_review345_ui_cli.py": "795e7e4f9bda8874c6a65a08863cab19f4adb3412287276ee2960588f0fd2fa8",
|
||||
"tests/test_review348_release_comparison.py": "ceccdb3d6f7bc6cb65562c059f13aa2bc5d89d98c6f64b0f11d9b943ebbde165",
|
||||
"tests/test_review381_queue_release.py": "e0d62424cbf70ec9573db78ede0a4c6534775399194eed4c6b28ba8d468307be",
|
||||
"tests/test_review391.py": "304d46d63af87ea4a9bca83834b77cc44c5c9addf7b0f3752431304ee612568c",
|
||||
"tests/test_review414_export_and_audit.py": "ec785c2656bed97de6c8467885f2ad0877b55ee872b02928744d399e8767d8a0",
|
||||
"tests/test_review414_open_and_queue.py": "db065207dacaccd0bd80af52c1f1edaf36a278e7cf2dce7c9b44bc51dd0e1cec",
|
||||
"tests/test_review414_write_admission.py": "604ee7429053d408943a1d74b18c6bbf2de817e9e0b76c82abe7a1faceafdf9f",
|
||||
"tests/test_review_319.py": "831fd34d426abb4436b9132bfb7ed754994155a34ac60a59378dee0964b54d28",
|
||||
"tests/test_review_backend_followup.py": "2f3f51a72ecd05fc33c6b5a8dddaecfd12d2b50df423c87b4c18d1e52b2609bd",
|
||||
"tests/test_review_foreign_release_evidence.py": "cbf2af02418f6bd3ec720a7a7658cf97f06d1a6e12009fdff2a99f465711591e",
|
||||
"tests/test_review_management_ui_followup.py": "746602a84c3ba9cb041c5dd354b39d344355b71a3666b27a47eb9aee231e171c",
|
||||
"tests/test_review_release_followup.py": "ab375f67e63cf3f33fa67ce19058be442c2ec56f810d4fc58ef5484272cbda49",
|
||||
"tests/test_runtime_timing.py": "7152cd8fedfe165e769dadc1238c347d9f4d3e93cd57f6ed991e14d959e720f7",
|
||||
"tests/test_safety.py": "ccf5febaf0a974d5e5357398a6946d3f121e07a6247c2f0dc5b71d86b39cac52",
|
||||
"tests/test_save_helper_identity.py": "178a68c4a9a8c618dad3d8393e816dd1d2a16aef8d1fb9984117fe9dc8d06add",
|
||||
"tests/test_save_helper_runtime.py": "00b092ec799da4bca424e1ee63a83bee783c81dbcdc20b7526fda8b45bb4b72a",
|
||||
"tests/test_scan_isolation.py": "cab02bfe55ed515f889d3fcba6e6880344f482cc3a78a072b543b7a871cf92ab",
|
||||
"tests/test_scoped_manifest.py": "fe9b2047d2c43812e851dd89ff250a2e5907dda89b3f5d9ae0a4dc4c5f452eac",
|
||||
"tests/test_session_record.py": "6b51b19adfb232275195da7ff1ba91a5ce5e296f9424a7a1a29fc67ecfdfb108",
|
||||
"tests/test_status_bridge.py": "fe1c0632d4d5fd5a1caf221903d4cfe38eda62aaa4298e3438735e31b8459ab2",
|
||||
"tests/test_status_bridge_server.py": "7d8cd72d69afae0f96ebbd9bb3be2ae3c222f01108e45ab51a09e54d4d8527cc",
|
||||
"tests/test_ui.py": "306a66698296a050744869b0756ddd0eefee5019618ff90b684da136a9787854",
|
||||
"tests/test_ui_batch_safety.py": "12a8d82d4aedbeee315a02a49ec0e9888547ad4abd63e181e7f392b2a39e26dc",
|
||||
"tests/test_ui_filters.py": "155e8f72d18c5c76b353d4b99f3828339c80908a9910f01641ba5c32a3929c75",
|
||||
"tests/test_ui_lease_lifecycle.py": "18ea8af868373fa795a4911754be55068fe75833ce35579c1212fd7f4713f149",
|
||||
"tests/test_verify_diagnostics.py": "b6431194e9f4c86a42110cac0d5f712c27b063f43b4ce820327aded81602908c",
|
||||
"tests/test_verify_probe.py": "aeb65b5bd2df14e8a8f3ba5501855b5946e6f8a22f0d26960c00ff1b0daea56b",
|
||||
"tests/test_verify_runner.py": "e58619f55873302c39129ce50e50fb25173a96ab309d975aa4f47f0bd3459fbb",
|
||||
"tests/test_verify_worker_stability.py": "eae03400c2e3c8a0bc339c8dc05d890403c6bfb4c6d70d0361bc1b882b47d618",
|
||||
"tests/fixtures/icdb-repair-startup-windows-sanitized.json": "a7fe3a34d47fb36d7f98ca8c1df4bb9a50d5faa9aee5bf76db5dbc3f3d06d03d",
|
||||
"tests/fixtures/issue2-lost-session-sanitized.json": "7ed4b567acabb38ff643ebd2c5b3d90b4fd9f33368f67ce3f436ba93ccf24519",
|
||||
"tests/fixtures/pcb-version-choice-sanitized.json": "ce0cb6d9135970cb4fbfa31fa057271b174dc37e57d90a5d4ac9ecf3ebabddfd",
|
||||
"tests/support/runtime_lifecycle_frozen_boundaries.py": "bf98533a1c06ccf4453d20b3804323779719e697141b8dc64fa679960a979cfd",
|
||||
"tests/support/runtime_lifecycle_frozen_fixture.py": "b87761c06a300f0d93bce864d3d31e045f2135324b2a9a42f8682ccbff09ad22",
|
||||
"tests/support/runtime_lifecycle_frozen_smoke.py": "b11e0aac71c1079625ac9832dc5c38197bc80110478c4d9e02c2a3bc58a2a2d0"
|
||||
},
|
||||
"automatic_icdb_repair": false,
|
||||
"merged": false,
|
||||
"published": false,
|
||||
"limitations": [
|
||||
"Real field lost-server-session recovery is not accepted.",
|
||||
"Windows 10 and cross-machine SMB not tested.",
|
||||
"PCB sharing-violation regression uses real Win32 handles with controlled callback; no claim of field popup repair acceptance.",
|
||||
"Long native Add waits remain undiagnosed.",
|
||||
"Preexisting LibraryManager still prevents native catalog activation; user must close it normally before continuing. Multi-client COM ownership is not verified.",
|
||||
"Unknown-client consent is user attestation, not proof of future native ownership."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
# PR #13 评论 414 修复与验证
|
||||
|
||||
审查基准为 main `cbc57238496bc84f4228aa44929208a9516dff1b`;本轮修改基于
|
||||
`1572e2d`,保留正常导入与可选导出诊断解耦。审查链接:
|
||||
https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-414
|
||||
|
||||
## 审查意见处理
|
||||
|
||||
| 意见 | 处理及验证 |
|
||||
| --- | --- |
|
||||
| P2-1 未知原生进程在写前被忽略 | 仅在中心库写入和备份替换时要求明确选择继续、跳过本项或取消批次。许可限定本批次、目标库、PID/创建时间/映像/用户/会话,先落盘后生效。实际目标进程、数据库句柄冲突和地址记录不能用此确认绕过。确认后重新查询进程及资源。 |
|
||||
| P2-2 独占探测句柄跨越原生“读写打开”点击 | 退出 resource_guard、释放句柄并重核原生进程身份后才派发点击;保留实时窗口身份核对及单次回答。真实 Windows CreateFile 回归试验在原实现产生 sharing violation,修复后读写打开成功。 |
|
||||
| 后台读 QWidget / 使用当前库 | 队列、批次结束刷新及备份会话读取使用请求绑定的库;后台缺少显式库参数直接拒绝,避免从控件推导。Qt 工作线程回归试验验证不再读取 lmc_edit.text。 |
|
||||
| 导出预存进程豁免偏宽 | 需要最新快照的创建时间与完整映像匹配;当前绑定副本或归属未知的原生客户端不豁免。相同创建时间但映像冲突不能解释为原进程已退出。内存和磁盘释放路径均有测试。 |
|
||||
| 非 checkpoint 租约不落盘 | 此描述不准确:已有 LibraryLock 会写入并 flush `.lock` 审计文本(机器/PID/时间/库),原生校验另有 session 记录。增加实测断言;审计不是占用证明,不增加新阻塞记录。 |
|
||||
| 历史测试数字缺少复现信息 | 见下表及命令;区分记录提交和精确被测树,不用单个旧提交冒充混合工作树。 |
|
||||
|
||||
整批校验和 ICDB 检查仍独立。未知进程确认不会关闭这些进程。用户需要确认它们在本批次完成前不使用目标库;程序仍无法仅凭命令行证明另一个客户端未来不会打开此库。
|
||||
|
||||
独立复核另发现两个集成缺陷:确认记录创建恢复目录后,恢复再次以独占方式创建同名目录;以及调用方未传 Event 时“取消本批次”仍执行下一项。均先以回归测试复现,再修复;跳过继续、取消停止,新出现进程和记录写盘失败也有覆盖。
|
||||
|
||||
## 历史测试数字的来源与复现边界
|
||||
|
||||
| 数字 | 保存记录的提交 | 原始证据 |
|
||||
| --- | --- | --- |
|
||||
| 1775 | `fdd07224aac99bee8d1f29e8e82d6a2c49964c87` | `2026-11-09-full-review-followup-validation.json`:四个分支 head、27 个被测文件散列、XML 路径与散列。 |
|
||||
| 1851 | `42d0cebc54191681b53dcecb120f53236c1963bb` | `2026-11-12-native-acceptance-validation.json`:baseline `b86e4e3`、XML 结果、candidate-release4/source-sha256.json。 |
|
||||
| 1880 | `466f400514acc8531a219db8e75641be35304a3f` | `2026-11-12-scoped-release-validation.json`:full-scoped-final10.xml、冻结包散列。 |
|
||||
|
||||
本轮从以上三个提交分别导出干净快照,设置各自 PYTHONPATH 后运行
|
||||
`python -X utf8 -m pytest --collect-only -q tests`,实际分别收集到
|
||||
1775 / 1851 / 1880 项;对应记录的 27 / 70 / 72 个文件散列均与这些提交一致。
|
||||
以上提交可作为复现入口,但本轮没有重跑三份历史全套测试,收集数量不等于重新验证通过。
|
||||
历史记录未覆盖的测试文件及外部环境不能靠这项散列核对证明完全相同。
|
||||
|
||||
当前版本可从本修复提交干净检出后运行以下命令。必须显式设置 PYTHONPATH,避免可编辑安装及测试子进程加载到另一份工作区:
|
||||
|
||||
```powershell
|
||||
$env:PYTHONPATH = (Resolve-Path ./src).Path
|
||||
python -X utf8 -m pytest -q tests --junitxml=full-suite.xml
|
||||
python -X utf8 -m pytest -q tests/test_review414_open_and_queue.py tests/test_review414_write_admission.py tests/test_review414_export_and_audit.py --junitxml=review414.xml
|
||||
python -X utf8 -m compileall -q src tests
|
||||
git diff --check
|
||||
```
|
||||
|
||||
本轮实际命令、XML、源码散列、冻结包核对及隔离原生操作结果见相邻
|
||||
`2026-11-13-review-414-validation.json`。
|
||||
|
||||
全量 1912 项通过后新增两个边界用例,追加的 14 项测试全部通过(其中 12 项与全量重合,合计 1914 个不同用例)。
|
||||
冻结包 66 个模块与当前源码一致,图标及资源一致。隔离空库的实际按钮操作得到:
|
||||
取消仅产生一个 CANCELLED;新批次第一项 SKIPPED、第二项 UPLOADED,独立读取只确认第二个工程。
|
||||
两个来源目录的工程内容清单保持一致,程序与原生任务正常退出。
|
||||
“继续”之前由测试用户正常关闭本任务创建的空 LibraryManager;没有强制终止外部软件。
|
||||
两轮旧驱动卡在模态窗的 UIA 读取、一次保留 LibraryManager 导致原生拒绝,以及一次回归测试与原生试验并行造成互斥拒绝,均保留原记录,不计为通过。
|
||||
|
||||
## 验收边界
|
||||
|
||||
本轮不启用自动 ICDB Repair,不关闭现场工单。Windows 10、跨机器 SMB、现场服务器会话失联完整修复未验收。原生 Add 长等待的原因尚未定位;这轮不以缩短超时掩盖它。当前云端发布包保持不变。
|
||||
|
||||
冻结包实测额外确认一项既有边界:原生 `_catalog_com` 仍要求启动前没有其他
|
||||
LibraryManager,避免将其他客户端错误登记为本次所有者。因此当未知客户端恰为
|
||||
LibraryManager 时,选择继续仍可能得到“已有 Library Manager 运行”;确认不会绕过该原生入口限制。
|
||||
并行 LibraryManager 的隔离接入需要单独验证 COM 返回对象与窗口/PID 的精确归属,
|
||||
本轮没有直接删除检查。该失败试验及正常关闭测试会话后重试的结果分别保留。
|
||||
@@ -0,0 +1,309 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"created": "2026-11-16T10:04:07.868924+08:00",
|
||||
"review": "https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-430",
|
||||
"base_commit": "fee4a67",
|
||||
"code_commit": "fa5590468d62d7b4605f73e09fe961416020727c",
|
||||
"environment": {
|
||||
"windows": [
|
||||
"11",
|
||||
"10.0.26200",
|
||||
"SP0",
|
||||
"Multiprocessor Free"
|
||||
],
|
||||
"python": "3.12.10",
|
||||
"mentor": "EE7.9.5"
|
||||
},
|
||||
"full_suite": {
|
||||
"local_path": "F:\\CbbReview414\\review430-full.xml",
|
||||
"sha256": "dda0f591d2652fc39622a62fb3767cfd4eba5420fa099dcfa7aa87b14733dee5",
|
||||
"tests": 1924,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 316.455
|
||||
},
|
||||
"focused_suite": {
|
||||
"local_path": "F:\\CbbReview414\\review430-focused.xml",
|
||||
"sha256": "a09dac537ddf2adc8f014cfeea58454e3c05a1f0fe3ea8abd784f81b8843832e",
|
||||
"tests": 89,
|
||||
"failures": 0,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 32.99
|
||||
},
|
||||
"red_reproduction": {
|
||||
"local_path": "F:\\CbbReview414\\review430-red.xml",
|
||||
"sha256": "a0280295b7415e28974227b8a94bc62612b45d4903c1e0257ba269e37a149d7c",
|
||||
"tests": 10,
|
||||
"failures": 7,
|
||||
"errors": 0,
|
||||
"skipped": 0,
|
||||
"seconds": 7.787
|
||||
},
|
||||
"commands": [
|
||||
"PYTHONPATH=<checkout>/src python -X utf8 -m pytest -q tests --junitxml=full-suite.xml",
|
||||
"python -X utf8 -m compileall -q src tests",
|
||||
"git diff --check",
|
||||
"python -X utf8 <local-evidence-root>/build.py",
|
||||
"python -X utf8 <local-evidence-root>/verify_bundle.py",
|
||||
"python -X utf8 <local-evidence-root>/driver.py"
|
||||
],
|
||||
"compileall_passed": true,
|
||||
"diff_check_passed": true,
|
||||
"bundle": {
|
||||
"module_count": 66,
|
||||
"source_and_frozen_code_equal": true,
|
||||
"source_sha256_checked": true,
|
||||
"packaged_assets_equal": true,
|
||||
"exe_icon_images_equal": true,
|
||||
"executable_sha256": "ab02971c5bd8e46881433b66922e927075ab0cea7c18fb7f79243089de97ce22"
|
||||
},
|
||||
"smoke": {
|
||||
"backup_status": "SKIPPED",
|
||||
"backup_target_unchanged": true,
|
||||
"management": [
|
||||
{
|
||||
"name": "1GPHY_RTL8211F",
|
||||
"status": "SKIPPED",
|
||||
"safe_to_continue": true,
|
||||
"evidence_path": "F:\\CbbReview430\\data\\management\\management-c1bb58f1e8f543f68453c03c138deba0\\checkpoint.json"
|
||||
},
|
||||
{
|
||||
"name": "1GPHY_RTL8211F_A",
|
||||
"status": "UPLOADED",
|
||||
"safe_to_continue": true,
|
||||
"evidence_path": "F:\\CbbReview430\\data\\management\\management-c6a380a4685a41669f5d2fc615de3756\\checkpoint.json"
|
||||
}
|
||||
],
|
||||
"readback_names": [
|
||||
"1GPHY_RTL8211F",
|
||||
"1GPHY_RTL8211F_A"
|
||||
],
|
||||
"sources_unchanged": true,
|
||||
"choices": [
|
||||
"skip",
|
||||
"skip",
|
||||
"continue"
|
||||
],
|
||||
"client_normal_quit_before_continue": true,
|
||||
"app_exit_code": 0
|
||||
},
|
||||
"smoke_evidence": {
|
||||
"local_path": "F:\\CbbReview430\\smoke.json",
|
||||
"sha256": "e3903cc6c2eb9e8cb4c7c3a4f83036703cd60622f0ced3211be8de8a9c52956c"
|
||||
},
|
||||
"actions": {
|
||||
"local_path": "F:\\CbbReview430\\actions.jsonl",
|
||||
"sha256": "2e442ac332fb56bf355f69254283361dab386634972fac6e1a6cc5b0649a9806"
|
||||
},
|
||||
"source_manifest": {
|
||||
"local_path": "F:\\CbbReview430\\candidate\\source-sha256.json",
|
||||
"sha256": "76cfa8ab47243c569ab9ee284b5c66df4b3f9eca7bfa0dae19a236a9c2ee1035"
|
||||
},
|
||||
"code_review": "Independent read-only review: no actionable findings; ready for PR after full suite.",
|
||||
"warning": "Existing pywinauto Revert to STA COM threading mode warning.",
|
||||
"evidence_note": "local_path values name local audit artifacts, not public download locations; redact before external sharing.",
|
||||
"source_sha256": {
|
||||
"src/cbb_refresh_verify/application.py": "62b9b013563a216d020c8366cccb8f949b02afa72dc63c26940804441cc23057",
|
||||
"src/cbb_refresh_verify/backup_recovery.py": "1d7ef08ef53ca7a0971cdacb0908d9bb06d067b06dc2329fa58722ce9068921d",
|
||||
"src/cbb_refresh_verify/batch_status.py": "55a4007cf54491ca8e045a5bf86aa4353ac8437cca5a76cd79304962e3d3fa0a",
|
||||
"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": "a1c03192f4a61ad0924b24bb635705b1ee4811d35483a02864200f95edbbebe3",
|
||||
"src/cbb_refresh_verify/desktop_worker.py": "27d751816552d215dd8ee9cd67941d824f7b4493120ead7c3f87e5eba5ec4a92",
|
||||
"src/cbb_refresh_verify/diagnostic_open.py": "d6c49ffe5a9969d95edbbc896d47a7e100f248380a287f99ba7bb8b92dbb3072",
|
||||
"src/cbb_refresh_verify/dialog_agent.py": "5acb6e5cf1350a7ca20a6fe480668435fac785835874f266881973010db6504b",
|
||||
"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": "e81d253d8b4d3e7c1000c45335a392c72b110748675c2c3324ebe524a7252e98",
|
||||
"src/cbb_refresh_verify/icdb_ownership.py": "7bf2342c1efa34a2ebcbf27964a40a490220f7146fbb6ef957b8d8dd1e511f03",
|
||||
"src/cbb_refresh_verify/icdb_recovery.py": "358c0e9a004f1e0b2127513286e1dffd94b0180a8b7314aa9655462f570b6360",
|
||||
"src/cbb_refresh_verify/integration.py": "f188856af69ba25e265988c51db7a6d4263326440d972ca78378b733b891c1ed",
|
||||
"src/cbb_refresh_verify/library_lock.py": "6836ec8ac21e788eb75326ff44cb31ad4bdfb5f381bd35cdf33e6b34c7fca89e",
|
||||
"src/cbb_refresh_verify/library_manager_verify.py": "71e16a8581ad44b646be78b480f9812d596a6d162b3eec03d078bf4ea4503195",
|
||||
"src/cbb_refresh_verify/library_reader.py": "d4007caa361edd467773e49f721e02671d5a9bcb30741769a57349850b12c438",
|
||||
"src/cbb_refresh_verify/maintenance_entry.py": "3b93c25f69d7a961facd8004e20e155a84cc18f06d57b741a9055786ed058990",
|
||||
"src/cbb_refresh_verify/management.py": "7ead9bfffeb44201e44f73d9f039590f091e9a456982f2110dca8ec3695f8803",
|
||||
"src/cbb_refresh_verify/management_transaction.py": "32c53caaead05d5db3a31d3e30721e65434e5837095dc0a7812f825603aa37a0",
|
||||
"src/cbb_refresh_verify/mentor_adapter.py": "1fc8c98d5508120e03bf001a42dd3e0da7b165eb18c90f1aed83147d17db8638",
|
||||
"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": "8c0fc144707d68a9b85f6da50ef950f1f6e7fee248acbf34d19b707d51212be0",
|
||||
"src/cbb_refresh_verify/native_export_guard.py": "523cdf44db8e1665634feadba963ccf26777dc8942fb2eb604d2c30bbe92cbb6",
|
||||
"src/cbb_refresh_verify/native_management.py": "eb2ec311489eaf5deb06893a54a02469c9b2bb9baccbdd6563bae295aafcf363",
|
||||
"src/cbb_refresh_verify/native_occupancy.py": "7d686079d12217382adace6361cd343d977b91075e3b157cf410ca92d07ffc49",
|
||||
"src/cbb_refresh_verify/native_repair.py": "9f024dcb5e3a76369191033474fefd30787b6ae350c315f3cf38e92e5a1f3e98",
|
||||
"src/cbb_refresh_verify/native_repair_ui.py": "3eb2af181befea94af8b3b3131edff09589f340bcba777abbe3b67fd31b80393",
|
||||
"src/cbb_refresh_verify/network_path.py": "6b5b159502d42a46bf4ee26d5698fd2c6498b359088e2138eae46e9065b13c6f",
|
||||
"src/cbb_refresh_verify/operation_lifecycle.py": "3838c5a501711d16f578c45ebbc6f960872b0c3ba6bbda9a597f994ef746cef6",
|
||||
"src/cbb_refresh_verify/operation_queue.py": "a6932d8bc68ac436091f6d362557c66d274ec52d0f295a22f014a3396845c79f",
|
||||
"src/cbb_refresh_verify/owner_probe.py": "8dcfd60246cb2979db34d02e0a2d605c334b6f7e2666f22daa2f50c0408bc903",
|
||||
"src/cbb_refresh_verify/pcb_bridge.py": "2f6c2b09642100468814500569dbfc6695fc2a46b9a3b8333daa8e1530cdeef5",
|
||||
"src/cbb_refresh_verify/pcb_open_consent.py": "59b6998afab074a98a1bf7eb0d05f2347ccb642b3b217e399ea856a5a8b1c56b",
|
||||
"src/cbb_refresh_verify/pcb_restore_prompt.py": "39e0b8623a838911eff61066f3e9c8ede4364dbf73efc5a8994197ec72a96488",
|
||||
"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": "ef148549751fa47518f5f2ca8f32ba25794ec5f22e0de545476ea33f89a3f0bf",
|
||||
"src/cbb_refresh_verify/residual_sessions.py": "4ac500b33b209611d54eb496c6c30727ba159742d625431ceea84471a5fc3442",
|
||||
"src/cbb_refresh_verify/runtime_logging.py": "44ac25430a89c5ffc9e48e88c227e88052f4c815365e8556f67918f3edaba39e",
|
||||
"src/cbb_refresh_verify/runtime_timing.py": "c4ed4057b5000e0b86ccc7dd1fe2004d6e0dae29f397fec77b01ad41a81c6367",
|
||||
"src/cbb_refresh_verify/save_verified_block.vbs": "926175562ef82bb2e732231dbc18d8a88059c7e6143c9f4e502cabfd0d170bcd",
|
||||
"src/cbb_refresh_verify/scoped_manifest.py": "9318bf0f929d23c18466a25d83a4a9903822093c123aae10510061788c6d0ab7",
|
||||
"src/cbb_refresh_verify/session_record.py": "2bc3cff365008864584138a4ff13538bb6b2f90d981e7d008a1300f9102c6e7e",
|
||||
"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": "3027ef7fc1ef6365ff36ae0c83389d869b92ffcd96985d10275bca4dc9483e3f",
|
||||
"src/cbb_refresh_verify/write_admission.py": "0f8280912ec5c7af07a5f08b62a6b2cf7c95f93c745b443d0c7812d752558ce3",
|
||||
"src/cbb_refresh_verify/__init__.py": "dd960394d88657820dba858792abf0de258e05efceb08ae2f0b39c6ad78bc469",
|
||||
"src/cbb_refresh_verify/__main__.py": "dc4be034a0e43d4b659a9300137c29a6a6b7a32b7eaef02b6dff9a88c41305c0",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.ico": "62d4472ebaa94f9b39aebae06459685d3322041d0e1a7ada9f368cfd816ba1d6",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.png": "840f657fd7c622d9afd78625a64ed8ad04c90a895dd3c9fd37eebae543cdebe8",
|
||||
"src/cbb_refresh_verify/assets/cbb_refresh_verify.svg": "cbba5b3f339cbeb5eb43012709237359442ef67c69fc5b6679a8ee4c0a1b7328",
|
||||
"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": "be4796d664b8bc812244ced70f4cb616e433cef698813787f68d74408cd5cbbd",
|
||||
"src/cbb_refresh_verify/ui/icdb_check_task.py": "ade3bf414aa29b42f4c1535c613b2cacb2735f6abc7900e6da25999390a5891d",
|
||||
"src/cbb_refresh_verify/ui/main_window.py": "2c919badeeee0280e49387b88b058555a9fa6ace04835c094fccd782bf0af9c0",
|
||||
"src/cbb_refresh_verify/ui/management_dialog.py": "8e2024957be874905685167c7eab440ecee9320170c1553340025b10fa1754d6",
|
||||
"src/cbb_refresh_verify/ui/pcb_open_dialog.py": "3cabdc15f1b2abaeb919a7f29f32d4b053186701fd514646d9bdd3ea32f364f6",
|
||||
"src/cbb_refresh_verify/ui/pcb_restore_dialog.py": "b7228d828df235ac51502dc68760d28c4896af02c780e9806e11c32dba7f62da",
|
||||
"src/cbb_refresh_verify/ui/residual_release_dialog.py": "1d2a26bfc7ee21b11d7edbc3074b4c525e8c9fb628bca45b08bd06fc672586c8",
|
||||
"src/cbb_refresh_verify/ui/workers.py": "4cc9360a4820ded27a7d5ef709fc9f04b1d4804cb1e7a614f6c357ed547da888",
|
||||
"src/cbb_refresh_verify/ui/write_owner_dialog.py": "00c6091cc7d6109e41cdc3f9433b55c24725be444e440b894af21cbf751537c3",
|
||||
"src/cbb_refresh_verify/ui/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||
},
|
||||
"tests_sha256": {
|
||||
"tests/button_simulation.py": "3278868565853001103557d5f7ada42b11b05c03feb9032deed0327b6609de2b",
|
||||
"tests/test_abnormal_shutdown.py": "0abdeaf51e2ffc3f771e09aefa9ec647a72b7f64757c9f3851926fbd392cbbcd",
|
||||
"tests/test_all_buttons.py": "897ae449a15fe36fb6198a947575609346d5ce1a22c0a8c4d2950b9f00035d4f",
|
||||
"tests/test_application.py": "bba12187fca6fee0f4f8862182bb40d939e2995016af2cdbb3fd756f6a99135d",
|
||||
"tests/test_automation_license.py": "45e9c75d0d3e1a76f997f7da4cc87b5eb1b05a4ea2356408725742eac8a09ffb",
|
||||
"tests/test_background_icdb.py": "df9bd9e8252e0dee4527dc6a740c0c33e76d1fb06a79b816cc15809d95716e44",
|
||||
"tests/test_background_queue_regressions.py": "132866bfccc9a7ac5cb234f97aaf6a290e2e4ef949f31e2f70b0f3eafeb99046",
|
||||
"tests/test_backup_recovery.py": "efd88c0c00440ac915b147c2e6dee8044ca805b03f90ab9f171cbde1db11cb9b",
|
||||
"tests/test_backup_recovery_dialog.py": "b2f65864b861d95e99d5efb61ada915ae41973d2b49d08f2d536781997dd00cb",
|
||||
"tests/test_batch_blockers.py": "4387293d3a5820fab630e3c5fe1b424f61ba6947773e5a61125d840433c5c62a",
|
||||
"tests/test_batch_item_yield.py": "ed4be6d1e854b18d054a75c92171cd46b6b64411c2f74e9a3caf31fba3c7366b",
|
||||
"tests/test_batch_status.py": "c1f9af0c7c6f3171b3726fb53346f480b13b8d9cd88111a9c12e2fae2392bbff",
|
||||
"tests/test_batch_status_faults.py": "314e890c9aee439c8a75b4dfd605685240c74f6212da975fd50526bd70b4a0ff",
|
||||
"tests/test_desktop_worker.py": "671d616f04a01d74508b328e3b6fc8f6c7191a91de0dcaa486aa98a3718353ff",
|
||||
"tests/test_diagnostic_open.py": "b44f8f7b171602ad2691ea2e064ac9fe94f2fabb9fcc2eb6760cc1dd365b9423",
|
||||
"tests/test_dialog_agent.py": "8c746e47d55637ca18d7cc998f324a0c2e0a5214dcfe8fcb6458c060619c211c",
|
||||
"tests/test_dialog_models.py": "6902cf5c292458340fb48241b34875e111a0113d706cd82775934a7f72bab7b9",
|
||||
"tests/test_dialog_probe.py": "55c98f6102957a27a96dcfd4f4bf3af499b5055225b77ef93b7b332dfd4ac472",
|
||||
"tests/test_dialog_rules.py": "96bf36493da770679e9207e96b3088ef7f471aea22e17c254f33326ffef0d7f9",
|
||||
"tests/test_dialog_startup_budget.py": "6f23c01836e4894ae82c3345a2383c4f8eb0517056c5b953c43100acd0fc3739",
|
||||
"tests/test_dialog_supervisor.py": "4c1b00050127a65b0a8cf1c7a94fd673431ea3f04b76033a463804d0468ad2d9",
|
||||
"tests/test_extended_safety.py": "7450816abba89aba1f4739f819f43631def82701fe07481279db2b3f3ed96cf6",
|
||||
"tests/test_external_owner_release.py": "675ddbab4a97e86febac3003b9083c259295534941aa0463488a5a1206cfaf92",
|
||||
"tests/test_failed_startup.py": "eca757ea46a4c0aa4fb0368ff53f26822af71612d251ecd87132686fe3c3794b",
|
||||
"tests/test_failure_lifecycle.py": "dfeac56744a44e6f4c7898516749ca478f53d7c7f08b3843a05ef7f448c469a7",
|
||||
"tests/test_icdb_address.py": "cbdc07e5043349c796a4ea1ce3d4989062094cd28929a9ef7d42c5ba75b77907",
|
||||
"tests/test_icdb_batch_check.py": "e83982e0fd0b3744bdc62965b26970ded31aacfedea94283d9e321ef70a8232f",
|
||||
"tests/test_icdb_open_check.py": "1f3750169755d0553bac3e0f8bec244038b84f9cd970e17c9f6eb67dee0e3dba",
|
||||
"tests/test_icdb_recovery.py": "298ddac4b79b4400efc99ff27c58ca49fffea1f401a31071451b2fdaca59036e",
|
||||
"tests/test_import_without_export_gate.py": "ae3dd0fb41c41773ce2d54aa9f9be83bbb56a0d09c59d600b10575fa8f0d2cd4",
|
||||
"tests/test_incident_safety.py": "52f3ccb04db8971bf38628c2bd334d4fd79795e97de6538f6f66cb35f7123ece",
|
||||
"tests/test_independent_operations.py": "4ba5798df3346bce74c3703c158f1dce1d1ba14df748606fcaf900c8568753e0",
|
||||
"tests/test_integration.py": "9e9d30692607c889e1e3744a63c79c68e3af7d4c86804e0bcebe48e68765086c",
|
||||
"tests/test_late_release_continuation.py": "34c62a628cbc08f4e8b9a1919c13f17772a2d26d1996fae34a35f814725b00e2",
|
||||
"tests/test_library_lock.py": "3d65bd941faa441404045ce0140ea3ea5e58fb7d410b7b76bb9f03a9ea03d3af",
|
||||
"tests/test_library_reader.py": "b39a1dc9d99c2463b744141e3c3489cd49ac4a637e7835559a9c3fe9cbafbb58",
|
||||
"tests/test_lifecycle_supervision.py": "cfe29f1e73c6ef38d11e185e211b6e2fb60247f53a44e99dd1e2f8cf7a009faa",
|
||||
"tests/test_maintenance_diagnosis.py": "0849aef555475a03b061eacf499f261fb75f2e727f35dba3cbceafac92e2a638",
|
||||
"tests/test_maintenance_entry.py": "5ed3cda8e0c829fb2964e27f1bdc6fa8ee8dcde93ec63338959bf754b62d6a0b",
|
||||
"tests/test_maintenance_owner_scope.py": "7cf64dc7f2b126684dcac6e619cbd87eca3d85ec2fc1f70f057154679dad6026",
|
||||
"tests/test_maintenance_review.py": "ba807fd8c25c1b52cf2443d8bcf2f57539819715c0bc6c358d31d8542c2e7ce5",
|
||||
"tests/test_maintenance_startup_gate.py": "4f69d33218483a658b51b2012ae8bfa83aff8a787152a38b19dadc4c0d3ffe36",
|
||||
"tests/test_maintenance_ui.py": "2a640ba5e979a3fead81f0a38603b6105ffcb883dbb8484ccc42c99ee8c311db",
|
||||
"tests/test_management.py": "cad0fb43eca9e7022a33a5e9ff0a408465b262fd304b146cdc85c28265f2e74f",
|
||||
"tests/test_management_diagnostics.py": "671a9d7c112ededbee332db9b6fbab786fb37e9367d992f902f3ab2c9f60880b",
|
||||
"tests/test_management_native_transaction.py": "7ca227aae6426c4d0d998edfd8620ec18905aaf212f0be20ceba97b1cde3a9a4",
|
||||
"tests/test_management_probe_guards.py": "ae9be3dbd7c6a616478b7d4ea3498c428ff94a985089fe798463c5cab456f151",
|
||||
"tests/test_management_retry_blockers.py": "124dbef291dbe331ba0c3e7de1665c910ea43e37b1563429b387f0f2233953ee",
|
||||
"tests/test_management_source.py": "16e608ed9c8b0aa81cf08d49f165a33a1403c4ea7f2a5be44e8cfc8cb49850ad",
|
||||
"tests/test_management_supervision.py": "2dcadd6551a94c52e5d4e74285959f10144a89c48af87e508abaea945652d1f6",
|
||||
"tests/test_management_ui.py": "da3e2bc0b5c73926324a539edfa2f718ae1b585df96324a928a0c1a909e48083",
|
||||
"tests/test_manual_backup_ui.py": "927e42ec4a1e0139c71a41b0cad1389ad47b0881381203c18b307cd2d137983a",
|
||||
"tests/test_mentor_paths.py": "a05a91812a74b58e76f36d581216ee43969d2576b8a8e7d1cde3e301c52cf4c1",
|
||||
"tests/test_native_add_failures.py": "ceedd60e030628b1af149d08d16216d5f7158a63686729bb357c148da86fb0ec",
|
||||
"tests/test_native_backup.py": "43ec0c6b14b53864553feaf5d9fb498b37866f24edc486c0749160d3f803db5f",
|
||||
"tests/test_native_engineering_identity.py": "a1adcf6883a9b55c2c37d9f491faf40dd4928f4d8db675419fd288dd31552c69",
|
||||
"tests/test_native_export_guard.py": "f8ec4fa1058af55008e9628f79f2dc70b6e551f36815a812d10bfdf955cada51",
|
||||
"tests/test_native_inspection_release_regressions.py": "8f7bb0b2b641d437872f1dd1d0c2547c2522c81e3c0351c31a7125f751d91927",
|
||||
"tests/test_native_management.py": "badf33d4d00104c7e96e336777fb3e49690cc9db5ce1b071f98520aa5b6668f1",
|
||||
"tests/test_native_management_fields.py": "9917ca0910e19bd809c86d0120c652145261528ace33c3b805f5663442c4a973",
|
||||
"tests/test_native_occupancy.py": "56293dbe24bd3cd4f74cf8208e933faab7d737e5a5684a5d38838d063c3aef6d",
|
||||
"tests/test_native_repair.py": "113185ced72d8f4f4eafca99054d97fe80a504d1c6cc91aaf86f55cea1b7e138",
|
||||
"tests/test_navigation_tabs.py": "d7d5bbfc752f73c1b1d4615ffafc1266e772d96f3f3ba3d82c4b4baf678b292d",
|
||||
"tests/test_network_path.py": "f52624391ae78e9b913dace2b1a9a2875a5855f86dc9e12c324ef493e6c7817b",
|
||||
"tests/test_network_release_safety.py": "caef536d0a40b2eb848c1b8ab095ab374af247c03dd44acf8a70f0f500db6dac",
|
||||
"tests/test_operation_lifecycle.py": "c0ce6c86b73021a8b162ae9e67a10aeec8a27a98e382fd82e1449a451a9a8c3c",
|
||||
"tests/test_operation_queue.py": "8137528603f015695ed4d60a0c8fa8e7bf0a1c4659f8dc2a181291f5d500e6a1",
|
||||
"tests/test_owner_probe.py": "deb757e022980f11ef48e57a2fd002ee3e90ec647a4666a0c4d4427313b6f725",
|
||||
"tests/test_packaging.py": "87a6d04419775c0c5c806e0e569a48d7ef199a0bff8736b211443a1f471e7e8a",
|
||||
"tests/test_packaging_status_bridge.py": "cbfaeac070a1494a1d8609fc25e9a779a63354c8914b4c6c57fdc7c31b70d472",
|
||||
"tests/test_pcb_bridge.py": "527fb63147a203a2e9419da989aff600d3e461580989e39e8ede3a8cc57b901a",
|
||||
"tests/test_pcb_open_consent.py": "5bf9ef6276d221b73ebe0dd14cff4fe5dc11bfec7b8be3266ae4a6b6a588d354",
|
||||
"tests/test_pcb_restore_prompt.py": "a005691d0296587e520e20c4430e9e55227d767c8e910e950a9f2e93aeccb2c7",
|
||||
"tests/test_pcb_version_choice.py": "0825c28333e4ed4f5a63847b6f5bb11143e922c7203d2770ce9c78fc8edec20f",
|
||||
"tests/test_post_repair_consent.py": "bf417b378255386dc97ad8efdf5003b0691aa5d69da9d9256aa367dc16a2d4bb",
|
||||
"tests/test_post_verify_diagnostics.py": "212857e56581998a3a3cd53635030b68a089fc4d630a8b0ee7ef3f137090dcc4",
|
||||
"tests/test_private_desktop_discovery.py": "5361493313ae6864e252cdb9f2c72e71b39264a1c022beb4cf0c04c143cdd91e",
|
||||
"tests/test_readonly_status_policy.py": "3ed40d7bdf2d3e6f70b38803b89a8b982336556444b45c6ba6b0a7c6df52a97f",
|
||||
"tests/test_reimport_recovery.py": "875e5e2a0f6251ec5a251457848c7eac5dfd1674fcbb4745155f6d5d8bf4a4be",
|
||||
"tests/test_residual_release_dialog.py": "10b23d009703d542e5ce8ecb35a4833e0135bb8852b4116e49eedc7010397a1e",
|
||||
"tests/test_residual_sessions.py": "2c51ed1dc95a3afa7ebb24027963dfa9d13aba9c407e508e22ccc6e9f762dfeb",
|
||||
"tests/test_review313_residual_isolation.py": "52a8024ed4e2a7fed219fe46cacdf76fa971166feedd557206716ef7f6d3c914",
|
||||
"tests/test_review326_dispatch_and_receipts.py": "ce4d529246da1c4d53c3dec70ef49542165064404301dec3e32851df62492ecf",
|
||||
"tests/test_review326_queue_guidance.py": "c2c97aceddd9713618afdd5f2a7be4764b56a1b62fc672282fb8c218b4969c74",
|
||||
"tests/test_review345_ui_cli.py": "795e7e4f9bda8874c6a65a08863cab19f4adb3412287276ee2960588f0fd2fa8",
|
||||
"tests/test_review348_release_comparison.py": "ceccdb3d6f7bc6cb65562c059f13aa2bc5d89d98c6f64b0f11d9b943ebbde165",
|
||||
"tests/test_review381_queue_release.py": "e0d62424cbf70ec9573db78ede0a4c6534775399194eed4c6b28ba8d468307be",
|
||||
"tests/test_review391.py": "304d46d63af87ea4a9bca83834b77cc44c5c9addf7b0f3752431304ee612568c",
|
||||
"tests/test_review414_export_and_audit.py": "ec785c2656bed97de6c8467885f2ad0877b55ee872b02928744d399e8767d8a0",
|
||||
"tests/test_review414_open_and_queue.py": "db065207dacaccd0bd80af52c1f1edaf36a278e7cf2dce7c9b44bc51dd0e1cec",
|
||||
"tests/test_review414_write_admission.py": "b1b18fc69eeb9110baf3a7bb214938d5b8f681d7ad234991c92550210c8bf171",
|
||||
"tests/test_review430.py": "7350f3883ddb9be48cc66fa7b0f612e1b45acf2298c80a7faa3da1f05d6d4c83",
|
||||
"tests/test_review_319.py": "831fd34d426abb4436b9132bfb7ed754994155a34ac60a59378dee0964b54d28",
|
||||
"tests/test_review_backend_followup.py": "2f3f51a72ecd05fc33c6b5a8dddaecfd12d2b50df423c87b4c18d1e52b2609bd",
|
||||
"tests/test_review_foreign_release_evidence.py": "cbf2af02418f6bd3ec720a7a7658cf97f06d1a6e12009fdff2a99f465711591e",
|
||||
"tests/test_review_management_ui_followup.py": "746602a84c3ba9cb041c5dd354b39d344355b71a3666b27a47eb9aee231e171c",
|
||||
"tests/test_review_release_followup.py": "ab375f67e63cf3f33fa67ce19058be442c2ec56f810d4fc58ef5484272cbda49",
|
||||
"tests/test_runtime_timing.py": "7152cd8fedfe165e769dadc1238c347d9f4d3e93cd57f6ed991e14d959e720f7",
|
||||
"tests/test_safety.py": "ccf5febaf0a974d5e5357398a6946d3f121e07a6247c2f0dc5b71d86b39cac52",
|
||||
"tests/test_save_helper_identity.py": "178a68c4a9a8c618dad3d8393e816dd1d2a16aef8d1fb9984117fe9dc8d06add",
|
||||
"tests/test_save_helper_runtime.py": "00b092ec799da4bca424e1ee63a83bee783c81dbcdc20b7526fda8b45bb4b72a",
|
||||
"tests/test_scan_isolation.py": "cab02bfe55ed515f889d3fcba6e6880344f482cc3a78a072b543b7a871cf92ab",
|
||||
"tests/test_scoped_manifest.py": "fe9b2047d2c43812e851dd89ff250a2e5907dda89b3f5d9ae0a4dc4c5f452eac",
|
||||
"tests/test_session_record.py": "6b51b19adfb232275195da7ff1ba91a5ce5e296f9424a7a1a29fc67ecfdfb108",
|
||||
"tests/test_status_bridge.py": "fe1c0632d4d5fd5a1caf221903d4cfe38eda62aaa4298e3438735e31b8459ab2",
|
||||
"tests/test_status_bridge_server.py": "7d8cd72d69afae0f96ebbd9bb3be2ae3c222f01108e45ab51a09e54d4d8527cc",
|
||||
"tests/test_ui.py": "306a66698296a050744869b0756ddd0eefee5019618ff90b684da136a9787854",
|
||||
"tests/test_ui_batch_safety.py": "12a8d82d4aedbeee315a02a49ec0e9888547ad4abd63e181e7f392b2a39e26dc",
|
||||
"tests/test_ui_filters.py": "155e8f72d18c5c76b353d4b99f3828339c80908a9910f01641ba5c32a3929c75",
|
||||
"tests/test_ui_lease_lifecycle.py": "18ea8af868373fa795a4911754be55068fe75833ce35579c1212fd7f4713f149",
|
||||
"tests/test_verify_diagnostics.py": "b6431194e9f4c86a42110cac0d5f712c27b063f43b4ce820327aded81602908c",
|
||||
"tests/test_verify_probe.py": "aeb65b5bd2df14e8a8f3ba5501855b5946e6f8a22f0d26960c00ff1b0daea56b",
|
||||
"tests/test_verify_runner.py": "e58619f55873302c39129ce50e50fb25173a96ab309d975aa4f47f0bd3459fbb",
|
||||
"tests/test_verify_worker_stability.py": "eae03400c2e3c8a0bc339c8dc05d890403c6bfb4c6d70d0361bc1b882b47d618"
|
||||
},
|
||||
"semantic_decision": "File-only identity failure remains RECOVERY_REQUIRED; native exit/resource proof governs independent continuation, and same-target replay remains prohibited.",
|
||||
"merged": false,
|
||||
"published": false,
|
||||
"automatic_icdb_repair": false,
|
||||
"limits": [
|
||||
"Schematic semantic equivalence is not proven by import; UPLOADED is distinct from READY.",
|
||||
"Other LibraryManager must be closed normally before native catalog activation; concurrent COM ownership remains unverified.",
|
||||
"Windows 10, cross-machine SMB and field lost-server-session recovery remain unverified.",
|
||||
"EDIF crash root cause remains undiagnosed; ordinary import does not invoke export."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
# PR #13 后续评论 430
|
||||
|
||||
对应审查:https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-430
|
||||
|
||||
基准为本地 `fee4a67`。新 PR 同时包含 main `cbc5723` 后尚未推送的导入解耦和评论 414 修复。
|
||||
本次为代码候选版,不更新云端 `v0.2.4-beta.2`,不启用自动 ICDB Repair。
|
||||
|
||||
## 三项语义处理
|
||||
|
||||
1. **文件身份不等于原生释放证明。** `capture_registration_identity` 只读文件,不创建原生进程。
|
||||
原生注册及目录重新打开后,必须先确认其会话已退出,才进行文件核对。
|
||||
文件核对异常仍返回该项 `RECOVERY_REQUIRED`,不能改报上传成功、READY,也不能自动重放该目标。
|
||||
后续独立 CBB 可在自身写前检查通过后继续;不把文件读取异常伪装成“原生会话未释放”。
|
||||
代码保留最后一次原生目录读取的退出证明,不再用文件采集对象的同名字段覆盖它。
|
||||
原生释放未确认则拒绝文件采集,后续仍按已有释放证明流程处理。
|
||||
2. **未执行与失败分开。** 无界面无法完成占用确认时返回 `SKIPPED`,保留原因码及“需通过界面确认”的说明。
|
||||
备份替换在安装前跳过或取消,分别返回 `SKIPPED` / `CANCELLED`,界面显示“恢复已跳过” / “恢复已取消”。
|
||||
安装后的失败仍按失败记录,不能被重新解释成未执行。真实占用、身份变化、检查失败仍拒绝操作。
|
||||
3. **避免无等待时的重复探测。** 无未知原生客户端时只做一轮进程查询和资源探测。
|
||||
只要进入未知客户端确认路径,返回后仍重新查询进程并探测资源;不会持有独占句柄等待用户选择。
|
||||
|
||||
整理了新增的确认模块及相关修改的空格、分行,并在 PCB 点击处写明已知取舍:
|
||||
为避免 Mentor 自身的 sharing violation,先关闭独占探测句柄,再复核身份和点击。
|
||||
两者之间仍有短暂竞态窗口,不能当作跨机器资源锁。
|
||||
|
||||
## 验证与复现
|
||||
|
||||
先复现错误再修改:新增 10 项用例中 7 项在旧代码上失败,3 项确认原有边界。
|
||||
针对性 89 项、全量 1924 项通过。冻结包 66 个模块、资源及 PE 图标与源码一致。
|
||||
私有桌面中实际恢复跳过后显示“恢复已跳过”,目标工程内容未变;
|
||||
批量新增第一项 SKIPPED、第二项 UPLOADED,独立目录重新读取确认新增条目存在。
|
||||
两个来源工程保持一致,程序退出码为 0。本轮未启用上传后自动 Verify,因此不声称 READY。
|
||||
完整结果见相邻
|
||||
`2026-11-16-review-430-validation.json`。
|
||||
|
||||
在 Windows Python 3.12、已安装项目依赖的干净工作树执行:
|
||||
|
||||
```powershell
|
||||
$env:PYTHONPATH = (Resolve-Path ./src).Path
|
||||
python -X utf8 -m pytest -q tests --junitxml=full-suite.xml
|
||||
python -X utf8 -m pytest -q tests/test_review430.py tests/test_review414_write_admission.py tests/test_import_without_export_gate.py tests/test_management_native_transaction.py tests/test_backup_recovery.py tests/test_backup_recovery_dialog.py
|
||||
python -X utf8 -m compileall -q src tests
|
||||
git diff --check
|
||||
```
|
||||
|
||||
包含全局任务互斥的测试与实际 Mentor 试验串行执行。
|
||||
验证 JSON 中列出的本机证据路径仅供本次审计,不作为其他机器可直接访问的下载路径。
|
||||
未入库的 XML、进程记录、截图及冻结程序按文件散列关联;外发前需处理本机路径和工程名称。
|
||||
|
||||
## 产品与验收边界
|
||||
|
||||
正常导入确认原生注册、名称/分区、工程引用、允许的顶层块和 Layout;原生重写后的 ICDB 字节不作原理图语义等价证明。
|
||||
`schematic_semantics_checked=False` 保持明确;上传成功不等于 READY,完整 Verify 为独立、可选步骤。
|
||||
单项输入或可选 Verify 失败不阻止已释放的独立 CBB 继续,这与本轮用户确认的行为一致。
|
||||
|
||||
原生 COM 入口仍拒绝已有其他 LibraryManager 的情况,未冒险将其他客户端登记为本任务所有者;
|
||||
用户可正常关闭相关会话再继续。EDIF 崩溃根因、Windows 10、跨机器 SMB 和现场服务器会话失联修复仍未验收。
|
||||
本次实际按钮试验只操作隔离库及本任务创建的空会话,不关闭用户的其他程序。
|
||||
|
||||
## 回滚
|
||||
|
||||
通过 revert 新 PR 合入的提交回滚程序代码;云端旧发布包不受该 PR 自动影响。
|
||||
程序回滚不会撤销用户已完成的库写入:根据逐项检查点与人工备份恢复,不自动重放管理任务。
|
||||
@@ -9,3 +9,12 @@ Dependency rationale: library release imports native engineering identity and re
|
||||
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,5 +1,7 @@
|
||||
# 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,25 @@
|
||||
# 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
|
||||
|
||||
- [x] Reproduce BlockA releasing historical BlockB checkpoints and retained owners without naming BlockB in proof.
|
||||
- [x] 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.
|
||||
- [x] Run backend/lease regressions, compile/diff checks, commit on codex/review-native-backend.
|
||||
|
||||
## PR #11/#12
|
||||
|
||||
- [x] Forward-merge backend into UI, then UI into residual branch; no history rewriting.
|
||||
- [x] Test one unreadable process/thread not affecting another, without fabricated modal windows; cover preview and action-time rechecks.
|
||||
- [x] Enumerate only target-process threads/windows, store incomplete-read metadata per PID. Keep unknown/active writers protected rather than adding a blind force override.
|
||||
- [x] Persist window identities and at most a 4 KiB output excerpt, preserve full preview in memory, stop duplicating activity output.
|
||||
- [x] Carry exact preview block scope into native Cancel and recheck identity/scope before clicking.
|
||||
- [x] Run residual/UI regressions, compile/diff checks, commit on residual branch.
|
||||
|
||||
## Chain tip
|
||||
|
||||
- [x] Merge residual fixes into PR #13, preserving ca39fb3 and icon.
|
||||
- [x] Address #11's line-ending note once at the tip: application.py to LF; pin it and main_window.py with targeted .gitattributes exceptions. Preserve all other file endings and the global * -text rule; EditorConfig is unnecessary.
|
||||
- [x] Independent review, integrated full suite, compile/diff checks, validation records and fast-forward pushes to existing PR branches.
|
||||
- [x] Update PR descriptions with precise results and no new package/native acceptance. Leave #3 as historical umbrella, without merging or closing it.
|
||||
@@ -0,0 +1,13 @@
|
||||
# 占用范围、释放及原生确认实施计划
|
||||
|
||||
按用户已确认的误判复核方案执行,沿用隔离分支 codex/runtime-lifecycle-safety;原工作区和其他软件会话不改动。
|
||||
|
||||
1. 先以真实外部命令回放补充失败测试:未知外部观察项不接收关闭请求,目标独占资源证明成功后不阻止本库释放;真实本库进程、在途助手、数据库句柄或地址仍阻止。统一库证明与维护入口的进程候选判断,保留观测证据。
|
||||
2. 修正释放结果:观察项与可操作目标分开,未允许且自然退出不计主动释放;对绑定身份已退出的旧 UNCONFIRMED 日志不再认定调用仍在执行。覆盖 PID 复用和读取失败。
|
||||
3. 单项失败后,先尝试本库/本工程新鲜释放证明;证明完成才解除相应保留状态并继续,无法证明的共享占用仍停止相关写入。普通校验/管理在完整单项事务结束后让出队列,支持等待及取消。
|
||||
4. 普通 PCB 打开接通精确读写提示的用户确认;复用现有异步选择模型,绑定 PID、工程、私有桌面、当前提示,取消/跳过不自动写入。自动 Repair 保持关闭;恢复副本也传递用户选择。识别未知提示不猜测点击。
|
||||
5. 每项先红后绿;全量回归、编译、冻结代码/图标一致性;其他软件独立工程持续运行、真实目标句柄占用、停止后重试、提示确认/取消、真实校验与备份恢复。EDIF 崩溃单独保留原生失败证据,不跳过身份校验。尚未达到 READY 不宣称验收通过。
|
||||
|
||||
主要代码:library_lock.py、residual_sessions.py、session_record.py、verify_runner.py、management.py、ui/icdb_check_task.py、ui/management_dialog.py、ui/main_window.py、ui/residual_release_dialog.py、backup_recovery.py;原生确认按现有 pcb_restore_prompt 和 dialog_agent 模式实现。
|
||||
|
||||
验证记录写入 docs/releases,原始运行证据放 F 盘独立验收目录。开发与原生验收串行执行,所有原生操作局限隔离副本。
|
||||
@@ -1,5 +1,7 @@
|
||||
# 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 启动一个桥进程”的启动开销。
|
||||
|
||||
@@ -1,170 +1,194 @@
|
||||
from __future__ import annotations
|
||||
import argparse, os, sys
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Sequence
|
||||
from .runtime_logging import configure
|
||||
|
||||
|
||||
@contextmanager
|
||||
def batch_stop_signals(stop):
|
||||
import signal
|
||||
previous = {}
|
||||
try:
|
||||
for name in ('SIGINT', 'SIGTERM', 'SIGBREAK'):
|
||||
signum = getattr(signal, name, None)
|
||||
if signum is not None:
|
||||
previous[signum] = signal.signal(signum, lambda *_: stop.set())
|
||||
yield
|
||||
finally:
|
||||
for signum, handler in previous.items():
|
||||
signal.signal(signum, handler)
|
||||
|
||||
|
||||
def configure_qt_application(app):
|
||||
"""Apply a predictable light palette across machines and Qt themes."""
|
||||
from PySide6.QtGui import QColor, QPalette
|
||||
|
||||
app.setStyle('Fusion')
|
||||
palette = app.palette()
|
||||
colors = {
|
||||
QPalette.ColorRole.Window: '#f5f6f8',
|
||||
QPalette.ColorRole.WindowText: '#202124',
|
||||
QPalette.ColorRole.Base: '#ffffff',
|
||||
QPalette.ColorRole.AlternateBase: '#eef1f5',
|
||||
QPalette.ColorRole.Text: '#202124',
|
||||
QPalette.ColorRole.Button: '#eef1f5',
|
||||
QPalette.ColorRole.ButtonText: '#202124',
|
||||
QPalette.ColorRole.Highlight: '#2f6fed',
|
||||
QPalette.ColorRole.HighlightedText: '#ffffff',
|
||||
QPalette.ColorRole.ToolTipBase: '#ffffff',
|
||||
QPalette.ColorRole.ToolTipText: '#202124',
|
||||
QPalette.ColorRole.PlaceholderText: '#6b7280',
|
||||
}
|
||||
for role, color in colors.items():
|
||||
palette.setColor(role, QColor(color))
|
||||
for role in (QPalette.ColorRole.WindowText, QPalette.ColorRole.Text, QPalette.ColorRole.ButtonText):
|
||||
palette.setColor(QPalette.ColorGroup.Disabled, role, QColor('#858b94'))
|
||||
app.setPalette(palette)
|
||||
app.setStyleSheet(
|
||||
'QWidget { color: #202124; }'
|
||||
'QTableWidget, QLineEdit, QTextEdit, QSpinBox { '
|
||||
'background: #ffffff; color: #202124; selection-color: #202124; }'
|
||||
'QHeaderView::section { background: #e9edf2; color: #202124; }'
|
||||
'QPushButton, QToolButton { color: #202124; }'
|
||||
'QPushButton:disabled, QToolButton:disabled { color: #858b94; background: #e3e6eb; }'
|
||||
)
|
||||
return app
|
||||
|
||||
def resolve_data_root(cli_value: Path | None) -> Path:
|
||||
if cli_value is not None: return cli_value.expanduser().resolve()
|
||||
if getattr(sys, "frozen", False): return Path(sys.executable).resolve().parent / "data"
|
||||
local = os.environ.get("LOCALAPPDATA")
|
||||
return (Path(local) / "CbbRefreshVerify" if local else Path.home() / "AppData" / "Local" / "CbbRefreshVerify").resolve()
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(prog="CbbRefreshVerify")
|
||||
parser.add_argument('--verify-worker', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--repair-worker', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--owner-probe', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--native-backup-worker', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--management-worker', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--dialog-agent', type=Path, help=argparse.SUPPRESS)
|
||||
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('--libspec', default='', help=argparse.SUPPRESS)
|
||||
parser.add_argument('--dms-login-config', default='', help=argparse.SUPPRESS)
|
||||
parser.add_argument('--mentor-bin', default='', help=argparse.SUPPRESS)
|
||||
parser.add_argument("--smoke-test", action="store_true", help=argparse.SUPPRESS); parser.add_argument("--data-root", type=Path, help=argparse.SUPPRESS)
|
||||
args = parser.parse_args(list(argv) if argv is not None else None)
|
||||
if args.owner_probe:
|
||||
from .owner_probe import owner_probe_main
|
||||
return owner_probe_main(args.owner_probe)
|
||||
if args.native_backup_worker:
|
||||
from .native_backup import native_backup_worker_main
|
||||
return native_backup_worker_main(args.native_backup_worker)
|
||||
if args.management_worker:
|
||||
from .native_management import management_worker_main
|
||||
return management_worker_main(args.management_worker)
|
||||
if args.repair_worker:
|
||||
from .native_repair_ui import repair_worker_main
|
||||
return repair_worker_main(args.repair_worker)
|
||||
if args.collect_failure_logs:
|
||||
from .verify_diagnostics import failure_logs_main
|
||||
return failure_logs_main(args.collect_failure_logs)
|
||||
if args.dialog_agent:
|
||||
from .dialog_agent import dialog_agent_main
|
||||
return dialog_agent_main(args.dialog_agent)
|
||||
if args.verify_worker:
|
||||
from .mentor_adapter import worker_main
|
||||
import contextlib
|
||||
with args.verify_worker.with_name('worker.log').open('a', encoding='utf-8') as log:
|
||||
with contextlib.redirect_stdout(log), contextlib.redirect_stderr(log):
|
||||
return worker_main(args.verify_worker)
|
||||
context = configure(resolve_data_root(args.data_root)); logger = context.logger; logger.info("application_start")
|
||||
try:
|
||||
if args.batch_lmc:
|
||||
from .verify_runner import (VerifyRequest, native_lm_verify_enabled,
|
||||
run_batch, write_batch_report, failure_report_path)
|
||||
from .library_reader import read_library_fast
|
||||
from .batch_status import authoritative_status_map
|
||||
from .network_path import LibraryPathLease, select_library_file
|
||||
with LibraryPathLease.acquire(args.batch_lmc) as lease:
|
||||
mentor_path = select_library_file(lease.mentor_path)
|
||||
logger.info(
|
||||
'library_path_lease display=%s mentor=%s drive=%s remote=%s created=%s',
|
||||
lease.display_path, mentor_path, lease.drive or '-',
|
||||
lease.remote_root or '-', lease.created)
|
||||
names = list(args.block)
|
||||
if not names:
|
||||
library = read_library_fast(
|
||||
mentor_path,
|
||||
status_reader=lambda path, names: authoritative_status_map(
|
||||
names, path, context.root/'status-scan.jsonl'),
|
||||
)
|
||||
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')
|
||||
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,
|
||||
mapped_drive=lease.drive,
|
||||
mapped_remote_root=lease.remote_root,
|
||||
native_lm_verify=native_lm_verify_enabled())
|
||||
for name in names]
|
||||
try:
|
||||
from threading import Event
|
||||
stop = Event()
|
||||
with batch_stop_signals(stop):
|
||||
results = run_batch(requests, stop=stop)
|
||||
except Exception:
|
||||
lease.retain_for_recovery()
|
||||
raise
|
||||
if any(not result.safe_to_continue for result in results):
|
||||
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))
|
||||
code = 0 if all(result.status == 'PASS' for result in results) else 2
|
||||
logger.info('application_clean_shutdown exit_code=%s', code)
|
||||
return code
|
||||
from .ui.main_window import MainWindow, application_icon_path
|
||||
if args.smoke_test:
|
||||
os.environ.setdefault('QT_QPA_PLATFORM', 'offscreen')
|
||||
from PySide6.QtWidgets import QApplication
|
||||
app = QApplication.instance() or QApplication([sys.executable])
|
||||
configure_qt_application(app)
|
||||
window = MainWindow(logging_context=context); window.show()
|
||||
icon_path = application_icon_path()
|
||||
if icon_path.is_file():
|
||||
from PySide6.QtGui import QIcon
|
||||
app.setWindowIcon(QIcon(str(icon_path)))
|
||||
if args.smoke_test:
|
||||
from PySide6.QtCore import QTimer
|
||||
logger.info('gui_smoke_window_created title=%s', window.windowTitle())
|
||||
QTimer.singleShot(250, app.quit)
|
||||
code = int(app.exec()); logger.info("application_clean_shutdown exit_code=%s", code); return code
|
||||
except Exception: logger.exception("application_startup_failure"); return 1
|
||||
finally:
|
||||
for handler in logger.handlers: handler.flush()
|
||||
from __future__ import annotations
|
||||
import argparse, os, sys
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Sequence
|
||||
from .runtime_logging import configure
|
||||
|
||||
|
||||
@contextmanager
|
||||
def batch_stop_signals(stop):
|
||||
import signal
|
||||
previous = {}
|
||||
try:
|
||||
for name in ('SIGINT', 'SIGTERM', 'SIGBREAK'):
|
||||
signum = getattr(signal, name, None)
|
||||
if signum is not None:
|
||||
previous[signum] = signal.signal(signum, lambda *_: stop.set())
|
||||
yield
|
||||
finally:
|
||||
for signum, handler in previous.items():
|
||||
signal.signal(signum, handler)
|
||||
|
||||
|
||||
def configure_qt_application(app):
|
||||
"""Apply a predictable light palette across machines and Qt themes."""
|
||||
from PySide6.QtGui import QColor, QPalette
|
||||
|
||||
app.setStyle('Fusion')
|
||||
palette = app.palette()
|
||||
colors = {
|
||||
QPalette.ColorRole.Window: '#f5f6f8',
|
||||
QPalette.ColorRole.WindowText: '#202124',
|
||||
QPalette.ColorRole.Base: '#ffffff',
|
||||
QPalette.ColorRole.AlternateBase: '#eef1f5',
|
||||
QPalette.ColorRole.Text: '#202124',
|
||||
QPalette.ColorRole.Button: '#eef1f5',
|
||||
QPalette.ColorRole.ButtonText: '#202124',
|
||||
QPalette.ColorRole.Highlight: '#2f6fed',
|
||||
QPalette.ColorRole.HighlightedText: '#ffffff',
|
||||
QPalette.ColorRole.ToolTipBase: '#ffffff',
|
||||
QPalette.ColorRole.ToolTipText: '#202124',
|
||||
QPalette.ColorRole.PlaceholderText: '#6b7280',
|
||||
}
|
||||
for role, color in colors.items():
|
||||
palette.setColor(role, QColor(color))
|
||||
for role in (QPalette.ColorRole.WindowText, QPalette.ColorRole.Text, QPalette.ColorRole.ButtonText):
|
||||
palette.setColor(QPalette.ColorGroup.Disabled, role, QColor('#858b94'))
|
||||
app.setPalette(palette)
|
||||
app.setStyleSheet(
|
||||
'QWidget { color: #202124; }'
|
||||
'QTableWidget, QLineEdit, QTextEdit, QSpinBox { '
|
||||
'background: #ffffff; color: #202124; selection-color: #202124; }'
|
||||
'QHeaderView::section { background: #e9edf2; color: #202124; }'
|
||||
'QPushButton, QToolButton { color: #202124; }'
|
||||
'QPushButton:disabled, QToolButton:disabled { color: #858b94; background: #e3e6eb; }'
|
||||
)
|
||||
return app
|
||||
|
||||
def resolve_data_root(cli_value: Path | None) -> Path:
|
||||
if cli_value is not None: return cli_value.expanduser().resolve()
|
||||
if getattr(sys, "frozen", False): return Path(sys.executable).resolve().parent / "data"
|
||||
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)
|
||||
parser.add_argument('--repair-worker', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--owner-probe', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--native-backup-worker', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--management-worker', type=Path, help=argparse.SUPPRESS)
|
||||
parser.add_argument('--dialog-agent', type=Path, help=argparse.SUPPRESS)
|
||||
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)
|
||||
parser.add_argument("--smoke-test", action="store_true", help=argparse.SUPPRESS); parser.add_argument("--data-root", type=Path, help=argparse.SUPPRESS)
|
||||
args = parser.parse_args(list(argv) if argv is not None else None)
|
||||
if args.owner_probe:
|
||||
from .owner_probe import owner_probe_main
|
||||
return owner_probe_main(args.owner_probe)
|
||||
if args.native_backup_worker:
|
||||
from .native_backup import native_backup_worker_main
|
||||
return native_backup_worker_main(args.native_backup_worker)
|
||||
if args.management_worker:
|
||||
from .native_management import management_worker_main
|
||||
return management_worker_main(args.management_worker)
|
||||
if args.repair_worker:
|
||||
from .native_repair_ui import repair_worker_main
|
||||
return repair_worker_main(args.repair_worker)
|
||||
if args.collect_failure_logs:
|
||||
from .verify_diagnostics import failure_logs_main
|
||||
return failure_logs_main(args.collect_failure_logs)
|
||||
if args.dialog_agent:
|
||||
from .dialog_agent import dialog_agent_main
|
||||
return dialog_agent_main(args.dialog_agent)
|
||||
if args.verify_worker:
|
||||
from .mentor_adapter import worker_main
|
||||
import contextlib
|
||||
with args.verify_worker.with_name('worker.log').open('a', encoding='utf-8') as log:
|
||||
with contextlib.redirect_stdout(log), contextlib.redirect_stderr(log):
|
||||
return worker_main(args.verify_worker)
|
||||
context = configure(resolve_data_root(args.data_root)); logger = context.logger; logger.info("application_start")
|
||||
try:
|
||||
if args.batch_lmc:
|
||||
from .verify_runner import (VerifyRequest, native_lm_verify_enabled,
|
||||
run_batch, write_batch_report, failure_report_path)
|
||||
from .library_reader import read_library_fast
|
||||
from .batch_status import authoritative_status_map
|
||||
from .network_path import LibraryPathLease, select_library_file
|
||||
with LibraryPathLease.acquire(args.batch_lmc) as lease:
|
||||
mentor_path = select_library_file(lease.mentor_path)
|
||||
logger.info(
|
||||
'library_path_lease display=%s mentor=%s drive=%s remote=%s created=%s',
|
||||
lease.display_path, mentor_path, lease.drive or '-',
|
||||
lease.remote_root or '-', lease.created)
|
||||
names = list(args.block)
|
||||
if not names:
|
||||
library = read_library_fast(
|
||||
mentor_path,
|
||||
status_reader=lambda path, names: authoritative_status_map(
|
||||
names, path, context.root/'status-scan.jsonl'),
|
||||
)
|
||||
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,
|
||||
mapped_drive=lease.drive,
|
||||
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:
|
||||
from threading import Event
|
||||
stop = Event()
|
||||
with batch_stop_signals(stop):
|
||||
results = run_batch(requests, stop=stop)
|
||||
except Exception:
|
||||
retain_mapping('batch_exception')
|
||||
raise
|
||||
if any(not result.safe_to_continue for result in results):
|
||||
retain_mapping('native_release_unconfirmed')
|
||||
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))
|
||||
code = 0 if all(result.status == 'PASS' for result in results) else 2
|
||||
logger.info('application_clean_shutdown exit_code=%s', code)
|
||||
return code
|
||||
from .ui.main_window import MainWindow, application_icon_path
|
||||
if args.smoke_test:
|
||||
os.environ.setdefault('QT_QPA_PLATFORM', 'offscreen')
|
||||
from PySide6.QtWidgets import QApplication
|
||||
app = QApplication.instance() or QApplication([sys.executable])
|
||||
configure_qt_application(app)
|
||||
window = MainWindow(logging_context=context); window.show()
|
||||
icon_path = application_icon_path()
|
||||
if icon_path.is_file():
|
||||
from PySide6.QtGui import QIcon
|
||||
app.setWindowIcon(QIcon(str(icon_path)))
|
||||
if args.smoke_test:
|
||||
from PySide6.QtCore import QTimer
|
||||
logger.info('gui_smoke_window_created title=%s', window.windowTitle())
|
||||
QTimer.singleShot(250, app.quit)
|
||||
code = int(app.exec()); logger.info("application_clean_shutdown exit_code=%s", code); return code
|
||||
except Exception: logger.exception("application_startup_failure"); return 1
|
||||
finally:
|
||||
for handler in logger.handlers: handler.flush()
|
||||
@@ -28,32 +28,49 @@ def _paths(root):
|
||||
return list(_scan(root))
|
||||
|
||||
|
||||
def _idle_check(library, project, pcb):
|
||||
from .mentor_adapter import _process_details
|
||||
def _idle_check(library, project, pcb, *, confirmation=None, evidence=None, block=''):
|
||||
from .owner_probe import query_owners
|
||||
from .icdb_ownership import database_directories, unreleased_addresses
|
||||
from contextlib import ExitStack
|
||||
import win32con, win32file
|
||||
directories = database_directories(library, project, pcb)
|
||||
scope = (Path(project).parent, *directories)
|
||||
for name in ('ExpeditionPCB.exe', 'LibraryManager.exe', 'viewdraw.exe',
|
||||
'iCDBProjectBackup.exe', 'ReuseBlockImporter.exe'):
|
||||
for pid, executable, command, parent in _process_details(name):
|
||||
match = _native_scope_match(command, roots=scope, files=(library, project, pcb))
|
||||
def owners():
|
||||
unknown = []
|
||||
names = ('ExpeditionPCB.exe', 'LibraryManager.exe', 'viewdraw.exe',
|
||||
'iCDBProjectBackup.exe', 'ReuseBlockImporter.exe')
|
||||
for row in query_owners(names):
|
||||
match = _native_scope_match(row['command'], roots=scope, files=(library, project, pcb))
|
||||
if match is True:
|
||||
raise ValueError(f'TARGET_NATIVE_OWNER_ACTIVE: 目标工程或共享库有原生会话,PID={pid}')
|
||||
raise ValueError(f'TARGET_NATIVE_OWNER_ACTIVE: 目标工程或共享库有原生会话,PID={row["pid"]}')
|
||||
if match is None:
|
||||
raise ValueError(f'TARGET_NATIVE_OWNER_UNCONFIRMED: 无法确认原生会话所属工程,PID={pid}')
|
||||
addresses = unreleased_addresses(library, project, pcb)
|
||||
if addresses:
|
||||
raise ValueError(f'TARGET_DATABASE_ADDRESS_UNCONFIRMED: 地址记录需原生确认;未据此判定正在占用:{addresses}')
|
||||
with ExitStack() as stack:
|
||||
paths = [Path(library), Path(pcb).parent/'Layout/LayoutDB.lyt',
|
||||
*(directory/'icdb.dat' for directory in directories)]
|
||||
for path in dict.fromkeys(paths):
|
||||
if path.is_file():
|
||||
handle = win32file.CreateFile(str(path), win32con.GENERIC_READ, 0, None,
|
||||
win32con.OPEN_EXISTING, 0, None)
|
||||
stack.callback(handle.Close)
|
||||
unknown.append(row)
|
||||
return unknown
|
||||
def resources():
|
||||
addresses = unreleased_addresses(library, project, pcb)
|
||||
if addresses:
|
||||
raise ValueError(f'TARGET_DATABASE_ADDRESS_UNCONFIRMED: 地址记录需原生确认;未据此判定正在占用:{addresses}')
|
||||
with ExitStack() as stack:
|
||||
paths = [Path(library), Path(pcb).parent/'Layout/LayoutDB.lyt',
|
||||
*(directory/'icdb.dat' for directory in directories)]
|
||||
for path in dict.fromkeys(paths):
|
||||
if path.is_file():
|
||||
handle = win32file.CreateFile(str(path), win32con.GENERIC_READ, 0, None,
|
||||
win32con.OPEN_EXISTING, 0, None)
|
||||
stack.callback(handle.Close)
|
||||
unknown = owners()
|
||||
resources() # Never hold exclusive probe handles while waiting for a user.
|
||||
if not unknown:
|
||||
return
|
||||
if confirmation is None:
|
||||
from .write_admission import WriteAdmissionDeclined
|
||||
raise WriteAdmissionDeclined('skip',
|
||||
'TARGET_NATIVE_OWNER_UNCONFIRMED: 原生程序的工程归属未知,未执行;写入前需要确认。')
|
||||
confirmation.confirm(library, unknown, evidence=evidence, block=block)
|
||||
unknown = owners()
|
||||
if unknown and not confirmation.confirmed(library, unknown):
|
||||
raise ValueError('TARGET_NATIVE_OWNER_UNCONFIRMED: 占用确认后出现新的未知进程,请重新检查。')
|
||||
resources()
|
||||
|
||||
|
||||
def _native_scope_match(command, *, roots=(), files=()):
|
||||
@@ -110,14 +127,15 @@ def _source_check(source, name, original):
|
||||
if not pcb.is_relative_to(source.parent.resolve()):
|
||||
raise ValueError('备份 PCB 引用越出工程目录。')
|
||||
if not all(path.is_file() for path in (pcb, pcb.parent/'Layout/LayoutDB.lyt',
|
||||
pcb.parent/'pcb.prj', source.parent/'database/icdb.dat')):
|
||||
raise ValueError('备份不完整:需要原理图数据库、PCB、布局数据库和 PCB 工程文件。')
|
||||
source.parent/'database/icdb.dat')):
|
||||
raise ValueError('备份不完整:需要原理图数据库、PCB 和布局数据库。')
|
||||
project_refs = re.findall(r'^KEY ProjectFile "([^"]+)"', _project_text(pcb), re.M)
|
||||
for value in project_refs:
|
||||
require_relative(value)
|
||||
if len(project_refs) != 1 or (pcb.parent/project_refs[0]).resolve() != source.resolve():
|
||||
raise ValueError('备份 PCB 必须引用所选工程,不能引用其他位置的工程。')
|
||||
for project in (source, pcb.parent/'pcb.prj'):
|
||||
from .maintenance_entry import maintenance_project_files
|
||||
for project in maintenance_project_files(source, pcb):
|
||||
data = _project_text(project)
|
||||
for value in re.findall(r'^KEY iCDBDir "([^"]+)"', data, re.M):
|
||||
require_relative(value)
|
||||
@@ -141,17 +159,21 @@ def _align_library(project, pcb, library):
|
||||
ensure_project_central_library(path, library)
|
||||
|
||||
|
||||
def recover_from_backup(request, source, *, progress=None, verifier=None, idle_check=None):
|
||||
def recover_from_backup(request, source, *, progress=None, verifier=None, idle_check=None, version_prompt=None,stop=None):
|
||||
"""Validate in copies before changing Work; preserve all recovery evidence."""
|
||||
import pythoncom, win32con, win32event
|
||||
from .network_path import absolute_preserving_drive
|
||||
from .verify_runner import run_verify, read_library_flag_if_available
|
||||
verifier = verifier or run_verify
|
||||
idle_check = idle_check or _idle_check
|
||||
source = Path(source).resolve()
|
||||
library = absolute_preserving_drive(request.lmc_file)
|
||||
library_root = library.parent.resolve()
|
||||
root = Path(request.evidence_dir).resolve() / ('backup-restore-' + uuid4().hex[:12])
|
||||
if idle_check is None:
|
||||
from .write_admission import WriteAdmission
|
||||
admission=WriteAdmission(prompt=version_prompt,stop=stop)
|
||||
idle_check=lambda library,project,pcb:_idle_check(library,project,pcb,
|
||||
confirmation=admission,evidence=root,block=request.block_name)
|
||||
# Packaged desktop apps can redirect AppData to a very deep MSIX path.
|
||||
# Keep native EE7.9 files in a genuinely short, user-owned directory.
|
||||
validation_base = Path.home() / '.cbb-restore'
|
||||
@@ -202,9 +224,9 @@ def recover_from_backup(request, source, *, progress=None, verifier=None, idle_c
|
||||
raise ValueError('请选择目标中心库之外的独立备份工程。')
|
||||
project, pcb = preflight(replace(request, lmc_file=library))
|
||||
source_pcb = _source_check(source, request.block_name, project)
|
||||
root.mkdir(parents=True, exist_ok=False)
|
||||
idle_check(library, project, pcb)
|
||||
idle_check(library, source, source_pcb)
|
||||
root.mkdir(parents=True, exist_ok=False)
|
||||
validation_base.mkdir(parents=True, exist_ok=True)
|
||||
library_size = sum(info.st_size for info in _scan(library_root).values() if stat.S_ISREG(info.st_mode))
|
||||
source_size = sum(info.st_size for info in _scan(source.parent).values() if stat.S_ISREG(info.st_mode))
|
||||
@@ -240,7 +262,9 @@ def recover_from_backup(request, source, *, progress=None, verifier=None, idle_c
|
||||
preflight(validation)
|
||||
emit('validate_source', '正在副本中打开备份工程并执行原生校验…')
|
||||
release_confirmed = False
|
||||
source_result = verifier(validation, progress=progress, flag_reader=read_library_flag_if_available)
|
||||
choice_options = {'version_prompt': version_prompt} if version_prompt is not None else {}
|
||||
if stop is not None:choice_options['stop']=stop
|
||||
source_result = verifier(validation, progress=progress, flag_reader=read_library_flag_if_available, **choice_options)
|
||||
release_confirmed = source_result.safe_to_continue
|
||||
record['source_validation'] = asdict(source_result)
|
||||
if (source_result.status != 'PASS' or source_result.library_flag != 'GREEN'
|
||||
@@ -274,7 +298,7 @@ def recover_from_backup(request, source, *, progress=None, verifier=None, idle_c
|
||||
release_confirmed = False
|
||||
final = verifier(replace(request, lmc_file=library, evidence_dir=root/'target-verify',
|
||||
auto_repair=False, native_lm_verify=False, interactive_input=False),
|
||||
progress=progress, flag_reader=read_library_flag_if_available)
|
||||
progress=progress, flag_reader=read_library_flag_if_available, **choice_options)
|
||||
release_confirmed = final.safe_to_continue
|
||||
if final.status == 'PASS' and (final.library_flag != 'GREEN' or not final.safe_to_continue):
|
||||
final = replace(final, status='FAIL', stderr='目标工程恢复后的 Ready 状态未确认。')
|
||||
@@ -282,6 +306,10 @@ def recover_from_backup(request, source, *, progress=None, verifier=None, idle_c
|
||||
final = replace(final, stderr=(final.stderr + '\n原 Work 已改名保留;应用未创建完整库备份,请查看恢复记录并使用手动备份。').strip())
|
||||
return save(final)
|
||||
except Exception as error:
|
||||
from .write_admission import WriteAdmissionDeclined
|
||||
if isinstance(error, WriteAdmissionDeclined) and not installed:
|
||||
status = 'CANCELLED' if error.decision == 'cancel' else 'SKIPPED'
|
||||
return save(VerifyResult(status, stderr=str(error), safe_to_continue=release_confirmed))
|
||||
return save(VerifyResult('FAIL' if installed else 'BLOCKED', stderr=str(error),
|
||||
safe_to_continue=release_confirmed))
|
||||
finally:
|
||||
|
||||
@@ -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 so a changed central library can never reuse an old status row.
|
||||
# digest to invalidate changed LMC bytes; payload edits remain outside this key.
|
||||
content_sha256 = _sha256_file(path)
|
||||
combined = hashlib.sha256()
|
||||
combined.update(str(path).casefold().encode('utf-8', errors='surrogatepass'))
|
||||
@@ -186,7 +186,12 @@ def _now() -> str:
|
||||
|
||||
|
||||
class BatchStatusSession:
|
||||
"""Supervised serial bridge session with checkpoint recovery."""
|
||||
"""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.
|
||||
"""
|
||||
|
||||
def __init__(self, bridge: StatusBridgeClient, *, timeout_seconds: float = 10.0,
|
||||
rotate_every: int = 500) -> None:
|
||||
@@ -196,7 +201,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 = True) -> list[BatchStatusRecord]:
|
||||
*, block_type: str = "RULP", resume: bool = False) -> list[BatchStatusRecord]:
|
||||
fingerprint = fingerprint_library(Path(lmc_file))
|
||||
if resume:
|
||||
checkpoint = BatchCheckpoint.load(checkpoint_path)
|
||||
@@ -291,6 +296,8 @@ 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``.
|
||||
"""
|
||||
|
||||
@@ -28,9 +28,12 @@ def _phase_pending(phase):
|
||||
|
||||
|
||||
@contextmanager
|
||||
def worker_phase(operation_id, phase):
|
||||
def worker_phase(operation_id, phase, *, continuation=False):
|
||||
with _automation_clients_lock:
|
||||
if _supervisor_lost.is_set() and phase in ('NATIVE_CALL', 'CLOSING'):
|
||||
existing = continuation and _native_phases.get(operation_id) == phase and _phase_pending(phase) is True
|
||||
if continuation and not existing:
|
||||
raise RuntimeError('WORKER_STATE_UNCONFIRMED: 尚无已派发的原生调用可继续登记')
|
||||
if _supervisor_lost.is_set() and phase in ('NATIVE_CALL', 'CLOSING') and not existing:
|
||||
raise RuntimeError('WORKER_CANCELLED: 监督器已退出,未提交新的原生调用')
|
||||
_native_phases[operation_id] = phase
|
||||
yield
|
||||
|
||||
@@ -236,6 +236,14 @@ class DialogActionExecutor:
|
||||
def perform(self, snapshot: WindowSnapshot, action: dict) -> ActionResult:
|
||||
channels = tuple(action.get("channels", ()))
|
||||
action_name = action.get("action")
|
||||
if action_name == 'user_confirmed_pcb_open':
|
||||
try:
|
||||
from .pcb_open_consent import validate_action_window
|
||||
if channels != ('win32_button_click',):
|
||||
raise ValueError('PCB_OPEN_ACTION_CHANNEL_CHANGED')
|
||||
validate_action_window(snapshot, action)
|
||||
except Exception as error:
|
||||
return ActionResult(error_code='DATABASE_RECOVERY_REQUIRED', detail=str(error))
|
||||
if action_name == 'user_selected_pcb_version':
|
||||
try:
|
||||
from .pcb_restore_prompt import validate_action_window
|
||||
|
||||
@@ -84,6 +84,19 @@ def has_retained_library(library):
|
||||
|
||||
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:
|
||||
with _guard:
|
||||
owner = _owners.get(LibraryLock(library).key)
|
||||
marker = blocker_path(library)
|
||||
record = checkpoint_record(marker)
|
||||
if (owner and owner['thread'] == threading.get_ident() and owner['depth'] > 0
|
||||
and not owner['retained'] and not marker.with_suffix('.pending').exists()
|
||||
and record and record['lease_id'] == owner['lease_id']
|
||||
and record['pid'] == os.getpid() and record['status'] == 'OPERATION_IN_PROGRESS'
|
||||
and record.get('block_name') == owner.get('block_name')
|
||||
and owner.get('block_name') in (None, block_name)
|
||||
and 'export_analysis' not in record):
|
||||
return None # Nested Verify belongs to this live transaction, not a past crash.
|
||||
if not (required or has_blocker(library) or has_retained_library(library)):
|
||||
return None
|
||||
def notify(stage, **details):
|
||||
@@ -362,6 +375,23 @@ def _owner_matches_scope(item, library, roots):
|
||||
return False if candidates else None
|
||||
|
||||
|
||||
def _owner_is_blocking(item, library, roots):
|
||||
"""Unknown external clients need resource proof, not a global exit rule."""
|
||||
scope = _owner_matches_scope(item, library, roots)
|
||||
if scope is not None:
|
||||
return scope
|
||||
command = str(item.get('command') or '').casefold()
|
||||
flags = ('--verify-worker', '--repair-worker', '--management-worker', '--native-backup-worker')
|
||||
if any(flag in command for flag in flags):
|
||||
return True # An unreadable in-flight request is not proof of another library.
|
||||
from .failed_session import _command_args
|
||||
try:
|
||||
return any(Path(arg).name.casefold() in ('close_failed_block.vbs', 'save_verified_block.vbs')
|
||||
for arg in _command_args(command)[1:])
|
||||
except (OSError, ValueError):
|
||||
return False
|
||||
|
||||
|
||||
def _enter_maintenance(lease):
|
||||
"""Transfer only a valid known lease, after project admission under lock."""
|
||||
import win32con, win32event, win32file
|
||||
@@ -466,14 +496,21 @@ def _prove_library_released(library, block_name=None, *, allow_unknown_checkpoin
|
||||
shared_root = Path(library).resolve().parent/'SymbolLibs'
|
||||
if allow_unknown_checkpoint and scope_root is not None:
|
||||
raise LibraryBusy('未知检查点必须执行完整库释放证明。')
|
||||
observed = []
|
||||
def check_owners():
|
||||
owners = []
|
||||
observed.clear()
|
||||
from .session_record import active_write_records
|
||||
if active_write_records(library):
|
||||
raise LibraryBusy('本库原生调用或助手尚未确认返回,请等待当前操作结束。')
|
||||
for item in query_owners(names):
|
||||
if item['pid'] == os.getpid():
|
||||
continue
|
||||
if not allow_unknown_checkpoint:
|
||||
roots = (scope_root, shared_root) if scope_root is not None else (Path(library).parent,)
|
||||
if _owner_matches_scope(item, library, roots) is False:
|
||||
if not _owner_is_blocking(item, library, roots):
|
||||
if _owner_matches_scope(item, library, roots) is None:
|
||||
observed.append(item)
|
||||
continue
|
||||
automation = item['name'].casefold() in ('python.exe', 'pythonw.exe', 'cbbrefreshverify.exe')
|
||||
command = item['command'].casefold()
|
||||
@@ -513,7 +550,8 @@ def _prove_library_released(library, block_name=None, *, allow_unknown_checkpoin
|
||||
win32con.OPEN_EXISTING, win32con.FILE_ATTRIBUTE_NORMAL, None)
|
||||
stack.callback(handle.Close)
|
||||
owners = check_owners()
|
||||
yield {'native_owners': owners, 'addresses': addresses, 'export_copies': export_copies,
|
||||
yield {'native_owners': owners, 'observed_owners': list(observed),
|
||||
'addresses': addresses, 'export_copies': export_copies,
|
||||
'unknown_checkpoint_recovery': allow_unknown_checkpoint,
|
||||
'exclusive_files': [str(path) for path in native]}
|
||||
finally:
|
||||
@@ -528,7 +566,8 @@ def release_retained_library(library, evidence_dir, *, block_name=None):
|
||||
"""
|
||||
import win32con, win32event, win32file
|
||||
library = Path(library).resolve(strict=True)
|
||||
from .session_record import retained_session_snapshot, acknowledge_library_release
|
||||
from .session_record import (retained_session_snapshot, acknowledge_library_release,
|
||||
reconciled_retained_sessions)
|
||||
retained = retained_session_snapshot(library)
|
||||
evidence = Path(evidence_dir).resolve()
|
||||
if evidence.is_relative_to(library.parent) or library.parent.is_relative_to(evidence):
|
||||
@@ -561,6 +600,16 @@ 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))
|
||||
@@ -571,7 +620,15 @@ def release_retained_library(library, evidence_dir, *, block_name=None):
|
||||
raise LibraryBusy('释放检查期间协调检查点变化,保留原文件。')
|
||||
root = evidence/('release-' + uuid4().hex)
|
||||
root.mkdir(parents=True, exist_ok=False)
|
||||
reconciled_sessions = reconciled_retained_sessions(retained, block_name=scoped)
|
||||
reconciled_blocks = sorted({item['block_name'] for item in (*reconciled, *reconciled_sessions)
|
||||
if item.get('block_name')})
|
||||
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': sorted(set(foreign) | {
|
||||
block for block in reconciled_blocks if block_name and block != block_name}),
|
||||
'reconciled_blocks': reconciled_blocks, 'reconciled_sessions': reconciled_sessions,
|
||||
'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,
|
||||
copy_verified, hash_file, scan_tree)
|
||||
comparison_rules, copy_verified, hash_file, scan_tree)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -169,7 +169,8 @@ def _may_have_mutated(record):
|
||||
or any(not isinstance(item, dict) or item.get('stage') not in prewrite for item in history))
|
||||
|
||||
|
||||
def run_management(request, *, adapter=None, verifier=None, idle_check=None, progress=None, stop=None):
|
||||
def run_management(request, *, adapter=None, verifier=None, idle_check=None, progress=None, stop=None, version_prompt=None,
|
||||
write_admission=None):
|
||||
from .verify_runner import VerifyRequest, run_verify
|
||||
from .backup_recovery import _idle_check
|
||||
import win32con, win32event
|
||||
@@ -178,8 +179,13 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
from .native_management import NativeManagementAdapter
|
||||
adapter = NativeManagementAdapter()
|
||||
verifier = verifier or run_verify
|
||||
idle_check = idle_check or _idle_check
|
||||
root = report = None
|
||||
native_idle_check = idle_check is None
|
||||
if native_idle_check:
|
||||
from .write_admission import WriteAdmission
|
||||
write_admission=write_admission or WriteAdmission(prompt=version_prompt,stop=stop)
|
||||
idle_check=lambda library,project,pcb:_idle_check(library,project,pcb,
|
||||
confirmation=write_admission,evidence=root,block=request.name)
|
||||
stage = 'preflight'
|
||||
history = []
|
||||
mutated = uploaded = removed = False
|
||||
@@ -214,6 +220,7 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
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:
|
||||
@@ -299,6 +306,8 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
return finish('BLOCKED', f'存在未完成/需恢复任务,禁止自动重放:{unfinished_target["evidence_path"]}')
|
||||
if hasattr(adapter, 'bind_library_mapping'):
|
||||
adapter.bind_library_mapping(request.mapped_drive, request.mapped_remote_root)
|
||||
if hasattr(adapter,'bind_write_admission'):
|
||||
adapter.bind_write_admission(write_admission if native_idle_check else None)
|
||||
with LibraryLock(library, block_name=request.name, safe_to_release=lambda: owner_safe or (
|
||||
callable(getattr(adapter, 'release_confirmed', None)) and adapter.release_confirmed(library))):
|
||||
work = library.parent/'ReusableBlocksLP'/request.name/'Work'
|
||||
@@ -388,27 +397,41 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
owner_safe = after.safe_to_continue
|
||||
matches = [entry for entry in after.entries if entry.name == request.name
|
||||
and entry.partition == request.partition]
|
||||
proof_matches = (native.identity_matches is True and native.identity_proof == identity
|
||||
expected_proof, registered_proof = identity, native.identity_proof
|
||||
if isinstance(identity, dict) and identity.get('policy') == 'mentor795-import-assets-v1':
|
||||
expected_proof = {key: value for key, value in identity.items() if key != 'assets'}
|
||||
registered_proof = ({key: value for key, value in registered_proof.items() if key != 'assets'}
|
||||
if isinstance(registered_proof, dict) else None)
|
||||
# Library Manager may name the imported top block after the CBB.
|
||||
if registered_proof is not None and registered_proof.get('top_level_block') == request.name:
|
||||
expected_proof['top_level_block'] = request.name
|
||||
proof_matches = (native.identity_matches is True and registered_proof == expected_proof
|
||||
if hasattr(adapter, 'prepare_add_transaction') else
|
||||
len(matches) == 1 and matches[0].engineering_identity == identity)
|
||||
if (not owner_safe or Path(after.library).resolve() != canonical_library or after.flow != 1
|
||||
or len(matches) != 1 or not proof_matches):
|
||||
return finish('RECOVERY_REQUIRED', '原生新增后名称、分区或来源工程内容未确认一致。', owner_safe)
|
||||
return finish('RECOVERY_REQUIRED', '原生新增后名称、分区或工程关联未确认一致。\n'+native.detail, owner_safe)
|
||||
uploaded = True
|
||||
checkpoint('uploaded')
|
||||
if not request.auto_verify:
|
||||
return finish('UPLOADED', '上传已确认;本批次未启用自动校验。')
|
||||
return finish('UPLOADED', '上传已确认;本批次未启用自动校验。\n'+native.detail)
|
||||
# Adapter catalog cannot return until its exact native owner exits.
|
||||
checkpoint('verify')
|
||||
owner_safe = False
|
||||
options = {'version_prompt': version_prompt} if version_prompt is not None else {}
|
||||
verified = verifier(VerifyRequest(library, request.name, root/'verify',
|
||||
mapped_drive=request.mapped_drive, mapped_remote_root=request.mapped_remote_root), progress=progress, stop=stop)
|
||||
mapped_drive=request.mapped_drive, mapped_remote_root=request.mapped_remote_root),
|
||||
progress=progress, stop=stop, **options)
|
||||
owner_safe = verified.safe_to_continue
|
||||
checkpoint('verified', verification=asdict(verified))
|
||||
good = verified.status == 'PASS' and verified.library_flag == 'GREEN' and owner_safe
|
||||
return finish('UPLOADED_VERIFIED' if good else 'UPLOADED_VERIFY_FAILED',
|
||||
verified.stderr or verified.library_flag_detail, owner_safe)
|
||||
'\n'.join(filter(None, (native.detail, verified.stderr or verified.library_flag_detail))), owner_safe)
|
||||
except Exception as error:
|
||||
from .write_admission import WriteAdmissionDeclined
|
||||
if isinstance(error,WriteAdmissionDeclined):
|
||||
return finish('RECOVERY_REQUIRED' if mutated else
|
||||
'CANCELLED' if error.decision=='cancel' else 'SKIPPED',str(error),owner_safe)
|
||||
if uploaded:
|
||||
return finish('UPLOADED_VERIFY_FAILED', str(error), owner_safe)
|
||||
status = 'RECOVERY_REQUIRED' if mutated else ('UPLOAD_FAILED' if request.operation in ('add', 'update') else 'BLOCKED')
|
||||
@@ -426,7 +449,12 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
|
||||
uninitialize_com(initialized)
|
||||
|
||||
|
||||
def run_management_batch(requests, *, stop=None, progress=None, **kwargs):
|
||||
def run_management_batch(requests, *, stop=None, progress=None, item_executor=None, **kwargs):
|
||||
from threading import Event
|
||||
from .write_admission import WriteAdmission
|
||||
if stop is None:
|
||||
stop = Event()
|
||||
kwargs.setdefault('write_admission',WriteAdmission(prompt=kwargs.get('version_prompt'),stop=stop))
|
||||
results = []
|
||||
retained_libraries = set()
|
||||
for request in requests:
|
||||
@@ -441,11 +469,25 @@ def run_management_batch(requests, *, stop=None, progress=None, **kwargs):
|
||||
if progress:
|
||||
progress({'stage': result.status, 'block': result.name, 'detail': result.detail})
|
||||
continue
|
||||
result = run_management(request, progress=progress, stop=stop, **kwargs)
|
||||
def action():
|
||||
result = run_management(request, progress=progress, stop=stop, **kwargs)
|
||||
if not result.safe_to_continue:
|
||||
from .operation_lifecycle import recheck_failed_release
|
||||
result = recheck_failed_release(request.library, request.name, result)
|
||||
return result
|
||||
from .operation_queue import QueueCancelled
|
||||
try:
|
||||
result = item_executor(request, action) if item_executor is not None else action()
|
||||
except QueueCancelled as error:
|
||||
results.append(ManagementResult(request.operation, request.library, request.name, request.partition,
|
||||
request.source, request.auto_verify, 'complete', 'CANCELLED', True, str(error)))
|
||||
break
|
||||
results.append(result)
|
||||
if progress:
|
||||
progress({'stage': result.status, 'block': result.name, 'detail': result.detail,
|
||||
'evidence_path': str(result.evidence_path or '')})
|
||||
if not result.safe_to_continue:
|
||||
retained_libraries.add(key)
|
||||
if result.status == 'CANCELLED':
|
||||
break
|
||||
return results
|
||||
@@ -191,17 +191,21 @@ def _normalized_project(path, expected_library):
|
||||
data = path.read_bytes(); encoding = _project_encoding(data)
|
||||
text = data.decode(encoding)
|
||||
refs = re.findall(r'^KEY CentralLibrary "([^"\r\n]*)"', text, re.M)
|
||||
if not refs or any((path.parent/value).resolve() != expected_library.resolve() for value in refs):
|
||||
if (not refs or any(not value.strip() for value in refs)
|
||||
or expected_library is not None and any(
|
||||
(path.parent/value).resolve() != expected_library.resolve() for value in refs)):
|
||||
raise ValueError(f'CentralLibrary reference does not resolve to the approved library: {path}')
|
||||
return re.sub(r'(?m)^(KEY CentralLibrary ")[^"\r\n]*(")',
|
||||
r'\1<CENTRAL_LIBRARY>\2', text).encode(encoding)
|
||||
|
||||
|
||||
def asset_identity(source, expected_library):
|
||||
"""Normalize old library paths when None; imported projects require the exact target."""
|
||||
from .backup_recovery import _project_text
|
||||
source, pcb, top = source_project(source)
|
||||
expected_library = Path(expected_library)
|
||||
if not expected_library.is_file(): raise ValueError('Approved CentralLibrary is missing.')
|
||||
expected_library = Path(expected_library) if expected_library is not None else None
|
||||
if expected_library is not None and not expected_library.is_file():
|
||||
raise ValueError('Approved CentralLibrary is missing.')
|
||||
root = source.parent
|
||||
from .maintenance_entry import maintenance_project_files
|
||||
projects = maintenance_project_files(source, pcb)
|
||||
@@ -236,6 +240,22 @@ def asset_identity(source, expected_library):
|
||||
'layout_sha256': hash_file(pcb.parent/'Layout/LayoutDB.lyt'), 'assets': assets}
|
||||
|
||||
|
||||
def capture_registration_identity(source, evidence_root, *, expected_library):
|
||||
"""File-only import evidence; native database normalization is not semantic proof."""
|
||||
root = Path(evidence_root)
|
||||
try:
|
||||
root.mkdir(parents=True, exist_ok=False)
|
||||
identity = {**asset_identity(source, expected_library),
|
||||
'policy': 'mentor795-import-assets-v1',
|
||||
'coverage': {'primary_assets_checked': True,
|
||||
'schematic_semantics_checked': False}}
|
||||
_write_json(root/'identity.json', {'identity': identity, 'safe_to_continue': True})
|
||||
return IdentityOutcome(identity, True, 'Engineering files and project references checked; no native export.', root)
|
||||
except Exception as error:
|
||||
# No native session was acquired; the caller retains its own release proof.
|
||||
return IdentityOutcome(None, True, str(error), root)
|
||||
|
||||
|
||||
def check_exporters(mentor_home):
|
||||
for name, expected in EXPORTER_PROOF.items():
|
||||
path = Path(mentor_home)/('wv/win32/bin' if name == 'edifExporter.exe' else 'iCDB/win32/bin')/name
|
||||
@@ -285,9 +305,54 @@ def _database_released(project_root):
|
||||
return True
|
||||
|
||||
|
||||
def _process_birth(value):
|
||||
from datetime import datetime, timezone, timedelta
|
||||
if not value:
|
||||
return None
|
||||
if isinstance(value, datetime):
|
||||
return value.astimezone(timezone.utc)
|
||||
if re.fullmatch(r'\d{14}\.\d{6}[+-]\d{3}', value):
|
||||
zone = timezone(timedelta(minutes=int(value[21:])))
|
||||
return datetime.strptime(value[:21], '%Y%m%d%H%M%S.%f').replace(tzinfo=zone).astimezone(timezone.utc)
|
||||
try:
|
||||
parsed = datetime.fromisoformat(value)
|
||||
if parsed.tzinfo is not None:
|
||||
return parsed.astimezone(timezone.utc)
|
||||
except ValueError:
|
||||
pass
|
||||
return value
|
||||
|
||||
|
||||
def _export_descendants(snapshot, tracked, existing):
|
||||
"""A historical parent PID is not evidence of current parentage."""
|
||||
from datetime import datetime
|
||||
rows = {row['pid']: row for row in snapshot}
|
||||
def matches(row):
|
||||
birth = _process_birth(row.get('created'))
|
||||
return tracked[row['pid']] is None or birth is None or tracked[row['pid']] == birth
|
||||
changed = True
|
||||
while changed:
|
||||
changed = False
|
||||
for row in snapshot:
|
||||
if row['pid'] in tracked or row['parent'] not in tracked:
|
||||
continue
|
||||
birth = _process_birth(row.get('created'))
|
||||
if (row['pid'], birth) in existing:
|
||||
continue
|
||||
parent = rows.get(row['parent'])
|
||||
parent_birth = tracked[row['parent']]
|
||||
if parent is not None and not matches(parent):
|
||||
continue
|
||||
if isinstance(birth, datetime) and isinstance(parent_birth, datetime) and birth < parent_birth:
|
||||
continue
|
||||
tracked[row['pid']] = birth
|
||||
changed = True
|
||||
return [row for row in snapshot if row['pid'] in tracked and matches(row)]
|
||||
|
||||
|
||||
def _run_exports(project, root, mentor_home, timeout_seconds):
|
||||
"""Observe exact exporter/descendant handles; never kill a database owner."""
|
||||
import win32api, win32con, win32event, pywintypes
|
||||
import win32api, win32con, win32event, win32process, pywintypes
|
||||
root = Path(root)
|
||||
try:
|
||||
_write_json(root/'export-launch.json', {'started': False})
|
||||
@@ -338,27 +403,32 @@ def _run_exports(project, root, mentor_home, timeout_seconds):
|
||||
creationflags=subprocess.CREATE_NO_WINDOW)
|
||||
record['native_started'] = True
|
||||
record['pid'] = process.pid
|
||||
descendants = {process.pid}
|
||||
handle = getattr(process, '_handle', None)
|
||||
birth = _process_birth(win32process.GetProcessTimes(handle)['CreationTime']) if handle is not None else None
|
||||
descendants = {process.pid: birth}
|
||||
existing = {(p['pid'], _process_birth(p.get('created'))) for p in before}
|
||||
if birth is not None:
|
||||
record['root_created'] = birth.isoformat()
|
||||
_write_json(root/(kind+'-process.json'), record)
|
||||
while time.monotonic() < deadline:
|
||||
snapshot = _process_snapshot()
|
||||
changed = True
|
||||
while changed:
|
||||
previous = len(descendants)
|
||||
descendants.update(p['pid'] for p in snapshot if p['parent'] in descendants)
|
||||
changed = len(descendants) != previous
|
||||
owners = [p for p in snapshot if p['pid'] in descendants or (
|
||||
owned = {p['pid'] for p in _export_descendants(snapshot, descendants, existing)}
|
||||
owners = [p for p in snapshot if p['pid'] in owned or (
|
||||
p['name'].casefold() in _OWNER_NAMES and _native_scope_match(
|
||||
p.get('command', ''), roots=(project.parent,)) is True)]
|
||||
for owner in owners:
|
||||
if owner['pid'] not in handles:
|
||||
try: handles[owner['pid']] = win32api.OpenProcess(win32con.SYNCHRONIZE, False, owner['pid'])
|
||||
except pywintypes.error as error:
|
||||
if error.winerror != 87: raise
|
||||
record['observed_pids'] = sorted(descendants | handles.keys())
|
||||
identities.update({owner['pid']:
|
||||
{key: owner.get(key, '') for key in ('pid', 'created', 'executable')}
|
||||
for owner in owners})
|
||||
if error.winerror not in (5, 87): raise
|
||||
# A dying process can deny OpenProcess. Keep it in
|
||||
# owners until a fresh snapshot proves it absent.
|
||||
record.setdefault('process_observation_errors', {})[str(owner['pid'])] = {
|
||||
'winerror': error.winerror, 'detail': str(error)}
|
||||
record['observed_pids'] = sorted(descendants.keys() | handles.keys())
|
||||
for owner in owners:
|
||||
identities.setdefault(owner['pid'],
|
||||
{key: owner.get(key, '') for key in ('pid', 'created', 'executable')})
|
||||
record['process_identities'] = list(identities.values())
|
||||
if (process.poll() is not None and not owners
|
||||
and all(win32event.WaitForSingleObject(h, 0) == win32con.WAIT_OBJECT_0 for h in handles.values())):
|
||||
|
||||
@@ -1,12 +1,45 @@
|
||||
"""Export-copy ownership bound to the existing per-library lease checkpoint."""
|
||||
from contextlib import contextmanager, ExitStack
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from uuid import uuid4
|
||||
|
||||
from .management import _write_json
|
||||
|
||||
|
||||
def _preexisting_export_pids(record, snapshot=None, *, project_root=None):
|
||||
from datetime import datetime
|
||||
from .native_engineering_identity import _process_birth
|
||||
identities = record.get('process_identities', [])
|
||||
root = next((p for p in identities if p.get('pid') == record.get('pid')), {})
|
||||
birth = _process_birth(record.get('root_created') or root.get('created'))
|
||||
if not isinstance(birth, datetime):
|
||||
return set()
|
||||
earlier = [p for p in identities if p.get('pid') != record.get('pid')
|
||||
and isinstance(_process_birth(p.get('created')), datetime)
|
||||
and _process_birth(p['created']) < birth]
|
||||
if not earlier:return set()
|
||||
from .native_engineering_identity import _process_snapshot,_OWNER_NAMES
|
||||
from .backup_recovery import _native_scope_match
|
||||
import ntpath
|
||||
current={p['pid']:p for p in (_process_snapshot() if snapshot is None else snapshot)}
|
||||
native_names=_OWNER_NAMES|{'viewdraw.exe','expeditionpcb.exe','librarymanager.exe',
|
||||
'icdbprojectbackup.exe','reuseblockimporter.exe'}
|
||||
excluded=set()
|
||||
for recorded in earlier:
|
||||
actual=current.get(recorded['pid'])
|
||||
if (actual is None or _process_birth(actual.get('created'))!=_process_birth(recorded['created'])
|
||||
or not recorded.get('executable') or not actual.get('executable')
|
||||
or ntpath.normcase(actual['executable'])!=ntpath.normcase(recorded['executable'])):
|
||||
continue
|
||||
match=_native_scope_match(actual.get('command',''),roots=(project_root,)) if project_root is not None else None
|
||||
if match is True or match is None and actual.get('name','').casefold() in native_names:
|
||||
continue
|
||||
excluded.add(recorded['pid'])
|
||||
return excluded
|
||||
|
||||
|
||||
def assert_retained_exports_idle(library=None):
|
||||
import win32con, win32event
|
||||
from .native_engineering_identity import _retained_exports
|
||||
@@ -17,9 +50,32 @@ def assert_retained_exports_idle(library=None):
|
||||
if (library is not None and scope.get('library')
|
||||
and Path(scope['library']).resolve() != Path(library).resolve()):
|
||||
continue
|
||||
if process.poll() is None or any(win32event.WaitForSingleObject(handle, 0) != win32con.WAIT_OBJECT_0
|
||||
for handle in handles.values()):
|
||||
raise LibraryBusy('Native identity exporter or descendant has not released.')
|
||||
excluded = set()
|
||||
exclusion_error = ''
|
||||
if scope.get('analysis_root') and getattr(process, 'pid', None):
|
||||
evidence_path = Path(scope['analysis_root'])
|
||||
try:
|
||||
matched = False
|
||||
for path in Path(scope['analysis_root']).glob('*-process.json'):
|
||||
evidence_path = path
|
||||
record = json.loads(path.read_text('utf-8'))
|
||||
if not isinstance(record, dict):
|
||||
raise ValueError('Export process evidence must be a JSON object')
|
||||
if record.get('pid') == process.pid:
|
||||
matched = True
|
||||
excluded.update(_preexisting_export_pids(record,project_root=Path(scope['analysis_root'])/'project'))
|
||||
if not matched:
|
||||
raise ValueError(f'No process evidence matches exporter PID {process.pid}')
|
||||
except (OSError, ValueError, KeyError, TypeError) as error:
|
||||
excluded.clear()
|
||||
exclusion_error = f'exclusion_unavailable: {evidence_path}: {error}'
|
||||
logging.getLogger(__name__).warning('%s; library=%s; pid=%s',
|
||||
exclusion_error, scope.get('library'), process.pid)
|
||||
if process.poll() is None or any(pid not in excluded
|
||||
and win32event.WaitForSingleObject(handle, 0) != win32con.WAIT_OBJECT_0
|
||||
for pid, handle in handles.items()):
|
||||
raise LibraryBusy('Native identity exporter or descendant has not released.'
|
||||
+ (' '+exclusion_error if exclusion_error else ''))
|
||||
|
||||
|
||||
def begin_export_analysis(library, root, project):
|
||||
@@ -119,12 +175,18 @@ def prove_export_copies_released(library, *, allow_unknown_checkpoint=False, uns
|
||||
if any(not isinstance(pid, int) or pid <= 0 for pid in pids):
|
||||
raise ValueError('Invalid export process identity.')
|
||||
identities = {p['pid']: p for p in process.get('process_identities', [])}
|
||||
excluded = _preexisting_export_pids(process,snapshot,project_root=project.parent)
|
||||
def original_alive(pid):
|
||||
if pid in excluded:
|
||||
return False
|
||||
recorded = identities.get(pid, {})
|
||||
current = next((p for p in snapshot if p['pid'] == pid), None)
|
||||
if recorded.get('created') and current and current.get('created'):
|
||||
return (recorded['created'] == current['created']
|
||||
and recorded.get('executable') == current.get('executable'))
|
||||
from datetime import datetime
|
||||
from .native_engineering_identity import _process_birth
|
||||
before,now=_process_birth(recorded['created']),_process_birth(current['created'])
|
||||
if isinstance(before,datetime) and isinstance(now,datetime):
|
||||
return before==now
|
||||
return any(p['pid'] == pid for p in snapshot) or _supervisor_alive(pid)
|
||||
if any(original_alive(pid) for pid in pids):
|
||||
raise LibraryBusy('A recorded export process or descendant remains alive.')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Version-pinned native adapter, private desktop transport and strict catalog.
|
||||
"""Version-pinned native import/removal, private desktop transport and catalog.
|
||||
|
||||
The installed Tcl CleanWGLib/F4 contract has isolated removal proof. Discovery
|
||||
of an Add dialog is deliberately insufficient to enable production Add/Update.
|
||||
Normal import checks native registration and engineering files without invoking
|
||||
the independent schematic exporters. Optional Verify determines READY.
|
||||
"""
|
||||
from dataclasses import asdict, replace
|
||||
import ctypes
|
||||
@@ -71,10 +71,14 @@ class NativeManagementAdapter:
|
||||
self._pending_workers = {}
|
||||
self.stop = None
|
||||
self.session_progress = None
|
||||
self.write_admission = None
|
||||
|
||||
def bind_stop(self, stop):
|
||||
self.stop = stop
|
||||
|
||||
def bind_write_admission(self, admission):
|
||||
self.write_admission=admission
|
||||
|
||||
def release_confirmed(self, library):
|
||||
"""Worker exit/result files do not replace independent resource proof."""
|
||||
key = str(Path(library).resolve()).casefold()
|
||||
@@ -131,17 +135,12 @@ class NativeManagementAdapter:
|
||||
|
||||
def capabilities(self):
|
||||
reason = self._binary_capability()
|
||||
add_reason = reason
|
||||
if not add_reason:
|
||||
from .native_engineering_identity import check_exporters
|
||||
try: check_exporters(self.home)
|
||||
except (ValueError, OSError, TypeError) as error: add_reason = str(error)
|
||||
return {
|
||||
'remove': Capability(not reason, reason or '已验证 CleanWGLib/F4;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。'),
|
||||
'add': Capability(not add_reason and _PRODUCTION_ADD_VALIDATED, add_reason or
|
||||
'已验证 EE7.9.5 原生导入及完整工程复读;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。'),
|
||||
'update': Capability(not add_reason and _PRODUCTION_ADD_VALIDATED and _PRODUCTION_UPDATE_VALIDATED,
|
||||
add_reason or '已验证同名原生替换:移除并重新导入;操作前请手动备份。'),
|
||||
'add': Capability(not reason and _PRODUCTION_ADD_VALIDATED, reason or
|
||||
'EE7.9.5 原生导入及工程关联复读;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。'),
|
||||
'update': Capability(not reason and _PRODUCTION_ADD_VALIDATED and _PRODUCTION_UPDATE_VALIDATED,
|
||||
reason or '同名原生替换:移除并重新导入;操作前请手动备份。'),
|
||||
}
|
||||
|
||||
def _worker(self, job, evidence):
|
||||
@@ -310,7 +309,7 @@ class NativeManagementAdapter:
|
||||
return self._add_transaction(request, Path(evidence))
|
||||
|
||||
def prepare_add_transaction(self, request, root, *, original_source):
|
||||
from .native_engineering_identity import project_library, asset_identity, capture_identity, IdentityOutcome
|
||||
from .native_engineering_identity import asset_identity, capture_registration_identity, IdentityOutcome
|
||||
from .native_add_failures import validate_native_copy_paths
|
||||
from .management_transaction import current_lease, prepare_transaction
|
||||
from .management import source_project
|
||||
@@ -320,7 +319,8 @@ class NativeManagementAdapter:
|
||||
raise ValueError(self.capabilities()['add'].reason)
|
||||
validate_native_copy_paths(request.source, request.library, request.name)
|
||||
current_lease(request.library)
|
||||
original_assets = asset_identity(original_source, project_library(original_source))
|
||||
# The selected destination replaces old library paths in the staged copy.
|
||||
original_assets = asset_identity(original_source, None)
|
||||
staged, pcb, _ = source_project(request.source, request.top_level_block)
|
||||
if staged.parent != Path(root).resolve()/'source':
|
||||
raise ValueError('Only the engine staged source can be aligned for native Add.')
|
||||
@@ -329,8 +329,7 @@ class NativeManagementAdapter:
|
||||
raise ValueError('Staged engineering assets differ from the original source.')
|
||||
except Exception as error:
|
||||
return request, IdentityOutcome(None, True, str(error), Path(root))
|
||||
proof = capture_identity(staged, Path(root)/'source-identity', expected_library=request.library,
|
||||
owner_library=request.library, mentor_home=self.home, timeout_seconds=request.timeout_seconds)
|
||||
proof = capture_registration_identity(staged, Path(root)/'source-identity', expected_library=request.library)
|
||||
if proof.identity is None or not proof.safe_to_continue:
|
||||
return request, proof
|
||||
try:
|
||||
@@ -344,7 +343,7 @@ class NativeManagementAdapter:
|
||||
from contextlib import contextmanager
|
||||
from .management_transaction import validate_transaction
|
||||
from .library_lock import LibraryLock
|
||||
from .native_engineering_identity import capture_identity, project_library
|
||||
from .native_engineering_identity import capture_registration_identity, project_library
|
||||
from .management import source_project
|
||||
from .backup_recovery import _align_library, _idle_check
|
||||
try:
|
||||
@@ -383,8 +382,12 @@ class NativeManagementAdapter:
|
||||
if len(projects) != 1:
|
||||
return NativeOutcome(True, owner_safe, 'Registered engineering project is not unique.',
|
||||
identity_matches=False, evidence_path=evidence)
|
||||
target, pcb, _ = source_project(projects[0], request.top_level_block)
|
||||
_idle_check(request.library, target, pcb)
|
||||
target, pcb, _ = source_project(projects[0])
|
||||
if self.write_admission is None:
|
||||
_idle_check(request.library,target,pcb)
|
||||
else:
|
||||
_idle_check(request.library,target,pcb,confirmation=self.write_admission,
|
||||
evidence=evidence,block=request.name)
|
||||
from .maintenance_entry import maintenance_project_files
|
||||
project_files = maintenance_project_files(target, pcb)
|
||||
before_refs = {str(p): hash_file(p) for p in project_files}
|
||||
@@ -401,18 +404,31 @@ class NativeManagementAdapter:
|
||||
or catalog.flow != 1 or len(entries) != 1):
|
||||
return NativeOutcome(True, owner_safe, 'Aligned target did not reopen with the exact catalog identity.',
|
||||
identity_matches=False, evidence_path=evidence)
|
||||
owner_safe = False
|
||||
proof = capture_identity(target, evidence/'registered-identity', expected_library=request.library,
|
||||
owner_library=request.library, mentor_home=self.home, timeout_seconds=request.timeout_seconds)
|
||||
owner_safe = proof.safe_to_continue
|
||||
matched = proof.identity is not None and proof.identity == prepared['expected_identity']
|
||||
proof = capture_registration_identity(target, evidence/'registered-identity', expected_library=request.library)
|
||||
# File-only content evidence cannot change the catalog owner's exit proof.
|
||||
expected, registered = prepared['expected_identity'], proof.identity
|
||||
# Native Add rewrites PRJ metadata and runtime history. Registration
|
||||
# identity uses the top block and Layout; other file diffs are evidence.
|
||||
allowed_tops = (expected['top_level_block'], request.name)
|
||||
matched = (registered is not None and registered['top_level_block'] in allowed_tops
|
||||
and registered['layout_sha256'] == expected['layout_sha256'])
|
||||
before_assets, after_assets = expected['assets'], (registered or {}).get('assets', {})
|
||||
differences = {'added': sorted(after_assets.keys()-before_assets.keys()),
|
||||
'deleted': sorted(before_assets.keys()-after_assets.keys()),
|
||||
'modified': sorted(key for key in before_assets.keys() & after_assets.keys()
|
||||
if before_assets[key] != after_assets[key])}
|
||||
assets_match = registered is not None and not any(differences.values())
|
||||
_write_json(evidence/'identity-comparison.json', {'identity_matches': matched,
|
||||
'expected': prepared['expected_identity'], 'registered': proof.identity,
|
||||
'assets_match': assets_match, 'asset_differences': differences,
|
||||
'top_level_block_mapping': {'source': expected['top_level_block'],
|
||||
'registered': (registered or {}).get('top_level_block'), 'allowed': list(allowed_tops)},
|
||||
'expected': expected, 'registered': registered,
|
||||
'safe_to_continue': owner_safe, 'detail': proof.detail})
|
||||
return NativeOutcome(True, owner_safe,
|
||||
'Native ASCII/CSV/EDIF, physical assets and library references match.' if matched else
|
||||
'Native registration succeeded but complete engineering identity proof did not match: '+proof.detail,
|
||||
identity_matches=matched, evidence_path=evidence, identity_proof=proof.identity)
|
||||
('原生注册、工程关联、顶层块和 Layout 已确认;未核验原理图语义。'
|
||||
+ ('其他工程文件有差异,已记录供核对。' if not assets_match else '')) if matched else
|
||||
'原生注册成功,但工程关联、顶层块或 Layout 未确认一致:'+proof.detail,
|
||||
identity_matches=matched, evidence_path=evidence, identity_proof=registered)
|
||||
|
||||
def add_owned_fixture(self, request, evidence, *, probe_token):
|
||||
"""Research only: stage and back up a token-bound, actively leased fixture."""
|
||||
@@ -463,13 +479,10 @@ class _OwnedFixtureManagementAdapter(NativeManagementAdapter):
|
||||
|
||||
def capabilities(self):
|
||||
from .management_transaction import fixture_authority
|
||||
from .native_engineering_identity import check_exporters
|
||||
fixture = self._fixture_authority
|
||||
fixture_authority(fixture['root'], Path(fixture['root'])/'native-add/fixture/mentor_lib.lmc', fixture['token'])
|
||||
caps = super().capabilities()
|
||||
reason = self._binary_capability()
|
||||
try: check_exporters(self.home)
|
||||
except (ValueError, OSError) as error: reason = str(error)
|
||||
for operation in ('add', 'update'):
|
||||
caps[operation] = Capability(not reason, reason or 'Owned fixture engine validation only; production capability unchanged.')
|
||||
return caps
|
||||
@@ -798,7 +811,8 @@ def _probe_add_dialog_impl(app, job, desktop, owned_pids, root, *, library=None)
|
||||
pythoncom.PumpWaitingMessages(); time.sleep(.1)
|
||||
raise TimeoutError(f'原生窗口未出现:{title}')
|
||||
_require_add_supervisor(job, root)
|
||||
app.OnReusableBlocksEditor()
|
||||
from .session_record import dispatch_native
|
||||
dispatch_native(job, lambda: app.OnReusableBlocksEditor())
|
||||
_require_add_supervisor(job, root)
|
||||
editor = await_window('Reusable Blocks')
|
||||
tabs = Desktop(backend='uia').window(handle=editor).descendants(control_type='TabItem')
|
||||
@@ -835,10 +849,11 @@ def _probe_add_dialog_impl(app, job, desktop, owned_pids, root, *, library=None)
|
||||
_write_json(root/'native-add-log-baseline.json', log_baseline)
|
||||
observed_failures = {}
|
||||
_require_add_supervisor(job, root)
|
||||
from .session_record import update_worker_state
|
||||
update_worker_state(job, 'NATIVE_CALL', required=True)
|
||||
job['_native_add_pending'] = True
|
||||
win32gui.PostMessage(ok, win32con.BM_CLICK, 0, 0)
|
||||
from .session_record import dispatch_native, update_worker_state
|
||||
def submit_add():
|
||||
job['_native_add_pending'] = True
|
||||
win32gui.PostMessage(ok, win32con.BM_CLICK, 0, 0)
|
||||
dispatch_native(job, submit_add, asynchronous=True, required=True)
|
||||
success = None
|
||||
while time.monotonic() < deadline:
|
||||
pythoncom.PumpWaitingMessages()
|
||||
@@ -1106,9 +1121,10 @@ def _catalog_com(job, root):
|
||||
watcher = None
|
||||
try:
|
||||
_require_management_continuation(job, root)
|
||||
from .session_record import update_worker_state
|
||||
update_worker_state(job, 'NATIVE_CALL')
|
||||
app = win32com.client.DispatchEx('LibraryManager.Application')
|
||||
from .session_record import dispatch_native, update_worker_state
|
||||
# Keep the launch pending until its exact native identity is recorded.
|
||||
app = dispatch_native(job, lambda: win32com.client.DispatchEx('LibraryManager.Application'),
|
||||
asynchronous=True)
|
||||
app.Visible = True
|
||||
processes = _process_details('LibraryManager.exe')
|
||||
owned_pids.update(int(p[0]) for p in processes)
|
||||
@@ -1124,15 +1140,14 @@ def _catalog_com(job, root):
|
||||
if job['operation'] in ('probe_create_add', 'probe_create'):
|
||||
target = prepare_probe_library(job, root)
|
||||
_require_management_continuation(job, root)
|
||||
update_worker_state(job, 'NATIVE_CALL')
|
||||
library = app.CreateLibrary(str(target), 1)
|
||||
library = dispatch_native(job, lambda: app.CreateLibrary(str(target), 1), asynchronous=True)
|
||||
_write_json(root.parent/'probe-owner.json', {'library': str(target), 'token': job['probe_token']})
|
||||
else:
|
||||
if job['operation'] == 'probe_readd':
|
||||
validate_probe_readd(job, root)
|
||||
_require_management_continuation(job, root)
|
||||
update_worker_state(job, 'NATIVE_CALL')
|
||||
library = app.OpenLibrary(str(absolute_preserving_drive(job['library'])))
|
||||
library = dispatch_native(job, lambda: app.OpenLibrary(str(absolute_preserving_drive(job['library']))),
|
||||
asynchronous=True)
|
||||
update_worker_state(job, 'POSTCALL')
|
||||
if refused:
|
||||
raise RuntimeError('目录读取需要升级中心库或选择流程;已拒绝,目标未获准自动升级。')
|
||||
@@ -1142,12 +1157,10 @@ def _catalog_com(job, root):
|
||||
if int(library.FlowType) != 1:
|
||||
raise RuntimeError('Native Add requires the DxDesigner Logical-Physical library flow.')
|
||||
_probe_add_dialog(app, job, desktop, owned_pids, root, library=library)
|
||||
update_worker_state(job, 'CLOSING')
|
||||
library.Close()
|
||||
dispatch_native(job, lambda: library.Close(), phase='CLOSING')
|
||||
library = None
|
||||
_require_management_continuation(job, root)
|
||||
update_worker_state(job, 'NATIVE_CALL')
|
||||
library = app.OpenLibrary(str(absolute_preserving_drive(job['library'])))
|
||||
library = dispatch_native(job, lambda: app.OpenLibrary(str(absolute_preserving_drive(job['library']))))
|
||||
if (library is None or Path(str(library.FullName)).resolve() != Path(job['library']).resolve()
|
||||
or int(library.FlowType) != 1):
|
||||
raise RuntimeError('Native Add reopen did not confirm the exact library and flow.')
|
||||
@@ -1189,16 +1202,14 @@ def _catalog_com(job, root):
|
||||
finally:
|
||||
if library is not None and not job.get('_native_add_pending'):
|
||||
try:
|
||||
update_worker_state(job, 'CLOSING')
|
||||
library.Close()
|
||||
dispatch_native(job, lambda: library.Close(), phase='CLOSING')
|
||||
except Exception as error:
|
||||
result['close_detail'] = str(error)
|
||||
result['close_exception'] = _exception_details(error)
|
||||
library = None
|
||||
if app is not None and not job.get('_native_add_pending'):
|
||||
try:
|
||||
update_worker_state(job, 'CLOSING')
|
||||
app.Quit()
|
||||
dispatch_native(job, lambda: app.Quit(), phase='CLOSING')
|
||||
except Exception as error:
|
||||
result['quit_detail'] = str(error)
|
||||
result['quit_exception'] = _exception_details(error)
|
||||
@@ -1266,16 +1277,15 @@ def management_worker_main(request_path):
|
||||
_write_json(root/'command.json', command)
|
||||
with (root/'native-output.txt').open('wb') as output:
|
||||
_require_management_continuation(job, root)
|
||||
from .session_record import update_worker_state
|
||||
update_worker_state(job, 'NATIVE_CALL')
|
||||
from .session_record import dispatch_native, update_worker_state
|
||||
result['safe_to_continue'] = False
|
||||
try:
|
||||
process = subprocess.Popen(command, stdout=output, stderr=subprocess.STDOUT,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW)
|
||||
process = dispatch_native(job, lambda: subprocess.Popen(command, stdout=output,
|
||||
stderr=subprocess.STDOUT, creationflags=subprocess.CREATE_NO_WINDOW), asynchronous=True)
|
||||
except (FileNotFoundError, PermissionError):
|
||||
result['safe_to_continue'] = True
|
||||
raise
|
||||
update_worker_state(job, 'NATIVE_CALL', identities=[('native', process.pid)])
|
||||
update_worker_state(job, 'NATIVE_CALL', identities=[('native', process.pid)], continuation=True)
|
||||
try:
|
||||
_write_json(root/'native-process.json', {'pid': process.pid, 'command': command})
|
||||
except OSError:
|
||||
@@ -1292,6 +1302,7 @@ def management_worker_main(request_path):
|
||||
except subprocess.TimeoutExpired:
|
||||
continue
|
||||
result['wait_exceeded'] = True
|
||||
update_worker_state(job, 'POSTCALL')
|
||||
result.update(safe_to_continue=True, exit_code=code)
|
||||
text = (root/'native-output.txt').read_bytes().decode('mbcs', errors='replace')
|
||||
result.update(success=removal_output_ok(code, text, job['name'], job['partition']),
|
||||
@@ -1305,6 +1316,7 @@ def management_worker_main(request_path):
|
||||
result['exception'] = _exception_details(error)
|
||||
finally:
|
||||
from .session_record import update_worker_state
|
||||
update_worker_state(job, 'FINISHED' if result.get('safe_to_continue') is True else 'UNCONFIRMED')
|
||||
_write_json(root/'result.json', result)
|
||||
# FINISHED permits the orphan watchdog to exit immediately.
|
||||
update_worker_state(job, 'FINISHED' if result.get('safe_to_continue') is True else 'UNCONFIRMED')
|
||||
return 0 if result['success'] and result['safe_to_continue'] else 2
|
||||
@@ -2,6 +2,52 @@
|
||||
from collections.abc import Sequence
|
||||
|
||||
|
||||
def recheck_failed_release(library, block, result):
|
||||
"""Refresh resource facts after a late exit; keep the original business failure."""
|
||||
if result.safe_to_continue or not result.evidence_path:
|
||||
return result
|
||||
from pathlib import Path
|
||||
from dataclasses import replace
|
||||
import json
|
||||
from .session_record import read_session_record, inspect_session_record
|
||||
from .library_lock import release_retained_library
|
||||
evidence = Path(result.evidence_path)
|
||||
try:
|
||||
session = Path(getattr(result, 'session_record_path', None) or evidence.with_name('session.json'))
|
||||
if session.is_file():
|
||||
record = read_session_record(session, evidence_root=evidence.parent)
|
||||
if record.get('block') != block or Path(record.get('library', '')).resolve() != Path(library).resolve():
|
||||
return result
|
||||
if inspect_session_record(session, evidence_root=evidence.parent).get('status') == 'ACTIVE':
|
||||
return result
|
||||
else:
|
||||
record = json.loads(evidence.read_text('utf-8'))
|
||||
if (record.get('name') != block or record.get('operation') not in ('add', 'update', 'remove')
|
||||
or Path(record.get('library', '')).resolve() != Path(library).resolve()):
|
||||
return result
|
||||
bound = []
|
||||
for phase in ('before', 'remove', 'after-remove', 'add', 'after-add'):
|
||||
candidate = evidence.parent/phase/'session.json'
|
||||
if candidate.is_file():
|
||||
owned = read_session_record(candidate, evidence_root=evidence.parent)
|
||||
if Path(owned.get('library', '')).resolve() != Path(library).resolve():
|
||||
return result
|
||||
if inspect_session_record(candidate, evidence_root=evidence.parent).get('status') == 'ACTIVE':
|
||||
return result
|
||||
bound.append(candidate)
|
||||
if not bound:
|
||||
return result # A generic timeout without a bound owner is not an exit fact.
|
||||
proof = release_retained_library(library, evidence.parent/'late-release', block_name=block)
|
||||
if proof.get('status') != 'RELEASE_CONFIRMED' or Path(proof.get('library', '')).resolve() != Path(library).resolve():
|
||||
return result
|
||||
evidence.with_name('late-release-result.json').write_text(json.dumps(dict(
|
||||
business_status=result.status, safe_to_continue=True, release_proof=proof),
|
||||
ensure_ascii=False, default=str, indent=2), 'utf-8')
|
||||
return replace(result, safe_to_continue=True, release_proof=proof)
|
||||
except Exception:
|
||||
return result
|
||||
|
||||
|
||||
def classify_save_state(markers: Sequence[str], *, helper_exited: bool | None,
|
||||
native_released: bool | None, forced: bool = False) -> dict:
|
||||
names = {line.strip().split('|', 1)[0] for line in markers}
|
||||
|
||||
@@ -15,9 +15,10 @@ class NativeQueue:
|
||||
def wake(self):
|
||||
with self.condition: self.condition.notify_all()
|
||||
|
||||
def run(self, action, *, stop=None, waiting=None, ready=lambda: True):
|
||||
def run(self, action, *, stop=None, waiting=None, ready=lambda: True, wait_state=None):
|
||||
ticket = object()
|
||||
acquired, notified = False, False
|
||||
previous_state = None
|
||||
with self.condition: self.pending.append((ticket, ready))
|
||||
try:
|
||||
while not acquired:
|
||||
@@ -30,10 +31,14 @@ class NativeQueue:
|
||||
self.active = acquired = True
|
||||
else:
|
||||
self.condition.wait(.1)
|
||||
if not acquired and not notified and waiting is not None:
|
||||
notified = True
|
||||
try: waiting()
|
||||
except Exception: pass
|
||||
if not acquired and waiting is not None:
|
||||
try:
|
||||
current_state = wait_state() if wait_state is not None else None
|
||||
if not notified or current_state != previous_state:
|
||||
waiting()
|
||||
notified, previous_state = True, current_state
|
||||
except Exception:
|
||||
pass
|
||||
if stop is not None and stop.is_set():
|
||||
raise QueueCancelled('已取消排队,未启动原生操作。')
|
||||
return action()
|
||||
|
||||
@@ -160,18 +160,3 @@ 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,159 @@
|
||||
"""Explicit user answers to the owned PCB's exact read/write question."""
|
||||
from contextlib import contextmanager, ExitStack
|
||||
from pathlib import Path
|
||||
from threading import Lock
|
||||
import time
|
||||
|
||||
from .post_repair_consent import exact_prompt
|
||||
|
||||
|
||||
def _prompt_identity(snapshot):
|
||||
# UIA adds chrome/reorders controls and omits Win32 caption accelerator marks.
|
||||
return tuple(sorted((c.handle, c.control_id, c.class_name,
|
||||
c.name.replace('&', '') if c.class_name == 'Button' else c.name)
|
||||
for c in snapshot.controls if c.handle and c.handle != snapshot.hwnd))
|
||||
|
||||
|
||||
class OpenChoice:
|
||||
def __init__(self, block, library):
|
||||
self.block, self.library = block, library
|
||||
self.decision = None
|
||||
self._lock = Lock()
|
||||
|
||||
def choose(self, decision):
|
||||
if decision not in ('continue', 'skip', 'cancel'):
|
||||
raise ValueError('无效的打开工程选择')
|
||||
with self._lock:
|
||||
if self.decision is None:
|
||||
self.decision = decision
|
||||
|
||||
|
||||
def validate_owner(job, target_pid, launcher_pid, worker_pid):
|
||||
from .owner_probe import query_process_snapshot
|
||||
from .session_record import process_identity
|
||||
from .mentor_adapter import is_reusable_circuit_pcb
|
||||
rows = {r['pid']: r for r in query_process_snapshot()}
|
||||
target, launcher = rows.get(target_pid), rows.get(launcher_pid)
|
||||
if (not target or not launcher or target['parent'] != launcher_pid or launcher['parent'] != worker_pid
|
||||
or not str(job.get('desktop', '')).startswith('CbbVerify_')
|
||||
or job.get('interactive_input') or job.get('native_lm_verify') or job.get('diagnostic_only')):
|
||||
raise ValueError('PCB_OPEN_OWNER_UNCONFIRMED')
|
||||
for row in (target, launcher):
|
||||
if not is_reusable_circuit_pcb(row['executable'], row['command'], job['pcb']):
|
||||
raise ValueError('PCB_OPEN_TARGET_CHANGED')
|
||||
return {'target': process_identity(target_pid), 'launcher': process_identity(launcher_pid)}
|
||||
|
||||
|
||||
@contextmanager
|
||||
def resource_guard(job, allowed_pids):
|
||||
import win32con, win32file
|
||||
from .icdb_ownership import database_directories, unreleased_addresses
|
||||
from .owner_probe import query_process_snapshot
|
||||
from .library_lock import _owner_is_blocking
|
||||
from .verify_runner import preflight, VerifyRequest
|
||||
library = Path(job['lmc_file'])
|
||||
project, pcb = preflight(VerifyRequest(library, job['block_name'], Path(job['root'])))
|
||||
if project.resolve() != Path(job['project']).resolve() or pcb.resolve() != Path(job['pcb']).resolve():
|
||||
raise ValueError('PCB_OPEN_PROJECT_CHANGED')
|
||||
roots = (project.parent, library.parent/'SymbolLibs')
|
||||
def check():
|
||||
if unreleased_addresses(library, project, pcb):
|
||||
raise ValueError('目标仍有数据库地址记录,暂不能确认读写打开。')
|
||||
for row in query_process_snapshot():
|
||||
if row['pid'] not in allowed_pids and _owner_is_blocking(row, library, roots):
|
||||
raise ValueError(f'目标还有其他会话,PID={row["pid"]};未确认读写打开。')
|
||||
check()
|
||||
paths = [library, pcb.parent/'Layout/LayoutDB.lyt',
|
||||
*(d/'icdb.dat' for d in database_directories(library, project, pcb) if (d/'icdb.dat').is_file())]
|
||||
with ExitStack() as stack:
|
||||
for path in dict.fromkeys(paths):
|
||||
handle = win32file.CreateFile(str(path), win32con.GENERIC_READ, 0, None,
|
||||
win32con.OPEN_EXISTING, win32con.FILE_ATTRIBUTE_NORMAL, None)
|
||||
stack.callback(handle.Close)
|
||||
check()
|
||||
yield
|
||||
|
||||
|
||||
class OpenController:
|
||||
def __init__(self, job):
|
||||
self.job = job
|
||||
self.choice = None
|
||||
self.original = self.owner = None
|
||||
self.sent = False
|
||||
self.sent_at = 0.0
|
||||
|
||||
def handle(self, snapshot, snapshots, *, target_pid, launcher_pid, worker_pid, show, perform):
|
||||
from .dialog_supervisor import DialogPollResult
|
||||
from .management import _write_json
|
||||
try:
|
||||
if not exact_prompt(snapshot) or snapshot.pid != target_pid or len(snapshots) != 1:
|
||||
raise ValueError('PCB_OPEN_PROMPT_CHANGED')
|
||||
owner = validate_owner(self.job, target_pid, launcher_pid, worker_pid)
|
||||
if self.choice is None:
|
||||
self.owner, self.original = owner, snapshot
|
||||
self.choice = OpenChoice(self.job['block_name'], self.job['lmc_file'])
|
||||
show(self.choice)
|
||||
if (owner != self.owner or snapshot.hwnd != self.original.hwnd
|
||||
or _prompt_identity(snapshot) != _prompt_identity(self.original)):
|
||||
raise ValueError('PCB_OPEN_IDENTITY_CHANGED')
|
||||
if self.sent:
|
||||
if time.monotonic()-self.sent_at < 2:
|
||||
return DialogPollResult(observed_snapshots=tuple(snapshots))
|
||||
raise ValueError('PCB_OPEN_ANSWER_NOT_COMPLETED')
|
||||
if self.choice.decision is None:
|
||||
return DialogPollResult(activity=True, observed_snapshots=tuple(snapshots))
|
||||
control = 6 if self.choice.decision == 'continue' else 7
|
||||
action = {'action': 'user_confirmed_pcb_open', 'channels': ['win32_button_click'],
|
||||
'target': {'control_id': control}, 'desktop': self.job['desktop'],
|
||||
'pid': target_pid, 'owner': owner, 'choice': self.choice.decision}
|
||||
def send():
|
||||
_write_json(Path(self.job['root'])/'pcb-open-user-choice.json', dict(
|
||||
choice=self.choice.decision, project=self.job['project'], pcb=self.job['pcb'],
|
||||
library=self.job['lmc_file'], owner=owner, snapshot=snapshot.to_record()))
|
||||
self.sent, self.sent_at = True, time.monotonic()
|
||||
return perform(snapshot, action, snapshot.phase)
|
||||
if control == 6:
|
||||
allowed = {target_pid, launcher_pid, worker_pid, self.job.get('supervisor_pid')}
|
||||
with resource_guard(self.job, allowed):
|
||||
pass
|
||||
# Deliberate TOCTOU tradeoff: release probes before Yes so Mentor
|
||||
# can acquire the files without a sharing violation; recheck identity.
|
||||
if validate_owner(self.job, target_pid, launcher_pid, worker_pid) != owner:
|
||||
raise ValueError('PCB_OPEN_IDENTITY_CHANGED')
|
||||
result = send()
|
||||
else:
|
||||
result = send()
|
||||
error = result.error_code
|
||||
if not error and result.accepted_controls != (control,):
|
||||
error = 'PCB_OPEN_ANSWER_FAILED'
|
||||
if not error and control == 7:
|
||||
error = 'PCB_OPEN_SKIPPED' if self.choice.decision == 'skip' else 'USER_CANCELLED'
|
||||
return DialogPollResult(activity=True, action_sent=True, snapshot=snapshot,
|
||||
error_code=error, detail=result.detail or ('用户跳过本项。' if control == 7 else ''),
|
||||
accepted_controls=result.accepted_controls, channel=result.channel,
|
||||
action=action['action'], observed_snapshots=tuple(snapshots))
|
||||
except Exception as error:
|
||||
return DialogPollResult(error_code='DATABASE_RECOVERY_REQUIRED', detail=str(error),
|
||||
snapshot=snapshot, observed_snapshots=tuple(snapshots))
|
||||
|
||||
|
||||
def validate_action_window(snapshot, action):
|
||||
from dataclasses import replace
|
||||
import win32gui, win32process
|
||||
from .native_repair_ui import _current_desktop_name
|
||||
from .dialog_models import ControlSnapshot
|
||||
from .session_record import process_identity
|
||||
if (not exact_prompt(snapshot) or action.get('target', {}).get('control_id') not in (6, 7)
|
||||
or snapshot.pid != action.get('pid') or _current_desktop_name() != action.get('desktop')
|
||||
or not str(action.get('desktop', '')).startswith('CbbVerify_')
|
||||
or win32process.GetWindowThreadProcessId(snapshot.hwnd)[1] != snapshot.pid
|
||||
or process_identity(snapshot.pid) != action.get('owner', {}).get('target')):
|
||||
raise ValueError('PCB_OPEN_LIVE_OWNER_CHANGED')
|
||||
children = []
|
||||
win32gui.EnumChildWindows(snapshot.hwnd, lambda h, _: children.append(int(h)), None)
|
||||
controls = tuple(ControlSnapshot(h, win32gui.GetDlgCtrlID(h) & 0xffff,
|
||||
win32gui.GetClassName(h), win32gui.GetWindowText(h), enabled=bool(win32gui.IsWindowEnabled(h))) for h in children)
|
||||
if not exact_prompt(replace(snapshot, controls=controls)) or any(
|
||||
c.handle != next(x.handle for x in snapshot.controls if x.control_id == c.control_id)
|
||||
for c in controls if c.class_name == 'Button'):
|
||||
raise ValueError('PCB_OPEN_LIVE_PROMPT_CHANGED')
|
||||
@@ -37,10 +37,11 @@ def _choice(snapshot):
|
||||
|
||||
|
||||
class RestoreController:
|
||||
def __init__(self, job):
|
||||
def __init__(self, job, *, user_open=False):
|
||||
from .post_repair_consent import _validate_grant
|
||||
self.job = job
|
||||
self.grant = _validate_grant(job)
|
||||
self.grant = None if user_open else _validate_grant(job)
|
||||
self.owner = None
|
||||
self.prompt = None
|
||||
self.original = None
|
||||
self.selection_sent = self.confirm_sent = self.failed = False
|
||||
@@ -60,13 +61,20 @@ class RestoreController:
|
||||
or snapshot.pid != self.original.pid
|
||||
or _candidate_key(choice['candidates']) != _candidate_key(self.prompt.candidates)):
|
||||
raise ValueError('PCB_VERSION_CANDIDATES_CHANGED')
|
||||
pre = json.loads((Path(self.job['root'])/'post-repair-prelaunch.json').read_text(encoding='utf-8'))
|
||||
if (pre.get('nonce') != self.grant['nonce'] or pre.get('desktop') != self.job['desktop']
|
||||
or pre.get('worker_pid') != worker_pid or pre.get('supervisor_pid') != self.job['supervisor_pid']
|
||||
or pre.get('addresses') != []
|
||||
or not all(consent._same(pre[key], self.grant[key]) for key in ('project', 'pcb', 'library'))):
|
||||
raise ValueError('PCB_VERSION_PRELAUNCH_PROOF_INVALID')
|
||||
consent._validate_current_processes(self.job, pre, target_pid, launcher_pid, worker_pid, companion_pids)
|
||||
if self.grant is None:
|
||||
from .pcb_open_consent import validate_owner
|
||||
owner = validate_owner(self.job, target_pid, launcher_pid, worker_pid)
|
||||
if self.owner is not None and owner != self.owner:
|
||||
raise ValueError('PCB_VERSION_OWNER_CHANGED')
|
||||
self.owner = owner
|
||||
else:
|
||||
pre = json.loads((Path(self.job['root'])/'post-repair-prelaunch.json').read_text(encoding='utf-8'))
|
||||
if (pre.get('nonce') != self.grant['nonce'] or pre.get('desktop') != self.job['desktop']
|
||||
or pre.get('worker_pid') != worker_pid or pre.get('supervisor_pid') != self.job['supervisor_pid']
|
||||
or pre.get('addresses') != []
|
||||
or not all(consent._same(pre[key], self.grant[key]) for key in ('project', 'pcb', 'library'))):
|
||||
raise ValueError('PCB_VERSION_PRELAUNCH_PROOF_INVALID')
|
||||
consent._validate_current_processes(self.job, pre, target_pid, launcher_pid, worker_pid, companion_pids)
|
||||
if self.prompt is None:
|
||||
self.original = snapshot
|
||||
self.prompt = RestoreChoice(self.job['block_name'], self.job['lmc_file'], choice['candidates'])
|
||||
@@ -91,6 +99,8 @@ class RestoreController:
|
||||
action = {'action': 'user_selected_pcb_version', 'channels': ['win32_button_click'],
|
||||
'target': {'control_id': control}, 'desktop': self.job['desktop'], 'pid': target_pid,
|
||||
'choice': selected['kind'], 'candidates': list(self.prompt.candidates)}
|
||||
if self.owner is not None:
|
||||
action['owner'] = self.owner
|
||||
self.selection_sent = True
|
||||
self.confirm_sent = confirming
|
||||
self.sent_at = time.monotonic()
|
||||
@@ -119,6 +129,10 @@ def validate_action_window(snapshot, action):
|
||||
import win32gui, win32process
|
||||
from .native_repair_ui import _current_desktop_name
|
||||
from .dialog_models import ControlSnapshot
|
||||
if action.get('owner') is not None:
|
||||
from .session_record import process_identity
|
||||
if process_identity(snapshot.pid) != action['owner']['target']:
|
||||
raise ValueError('PCB_VERSION_LIVE_PROCESS_CHANGED')
|
||||
if (not str(action.get('desktop', '')).startswith('CbbVerify_')
|
||||
or _current_desktop_name() != action.get('desktop') or snapshot.pid != action.get('pid')
|
||||
or win32process.GetWindowThreadProcessId(snapshot.hwnd)[1] != snapshot.pid
|
||||
|
||||
@@ -12,7 +12,7 @@ def offers_reimport(result):
|
||||
|
||||
|
||||
def run_reimport_recovery(requests, *, previous_evidence, evidence_dir,
|
||||
adapter=None, stop=None, progress=None):
|
||||
adapter=None, stop=None, progress=None,version_prompt=None):
|
||||
from .management import ManagementResult, _write_json, source_project, run_management_batch
|
||||
from .library_lock import release_retained_library
|
||||
requests = tuple(requests)
|
||||
@@ -62,7 +62,8 @@ def run_reimport_recovery(requests, *, previous_evidence, evidence_dir,
|
||||
if cancelled(): return []
|
||||
stage = 'management'
|
||||
save(stage, management_started=True)
|
||||
results = run_management_batch(requests, adapter=adapter, stop=stop, progress=progress)
|
||||
results = run_management_batch(requests, adapter=adapter, stop=stop, progress=progress,
|
||||
version_prompt=version_prompt)
|
||||
save('complete', results=[asdict(result) for result in results],
|
||||
version_review_required=True)
|
||||
return results
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Preview and cooperatively close the exact native sessions a user confirms."""
|
||||
from contextlib import contextmanager
|
||||
import json
|
||||
import hashlib
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
@@ -41,8 +42,8 @@ def force_block_reason(row):
|
||||
return ''
|
||||
|
||||
|
||||
def native_activity(name, windows):
|
||||
if any(w['class'] == 'UNCONFIRMED' for w in windows):
|
||||
def native_activity(name, windows, *, incomplete=None):
|
||||
if incomplete or any(w['class'] == 'UNCONFIRMED' for w in windows):
|
||||
return {'status': 'UNCONFIRMED', 'detail': '原生窗口读取不完整'}
|
||||
if any((name.casefold() == 'icdbprojectbackup.exe' and not w['enabled'])
|
||||
or any(c['class'].casefold() == 'msctls_progress32' for c in w['children']) for w in windows):
|
||||
@@ -114,16 +115,156 @@ def _force_ownership(handle, pid):
|
||||
and session == win32ts.ProcessIdToSessionId(os.getpid())}
|
||||
|
||||
|
||||
def _process_windows(pids):
|
||||
if not pids: return {}
|
||||
import win32api, win32con, win32gui, win32process, win32service
|
||||
from .native_repair_ui import _native_output
|
||||
class _WindowSnapshot(dict):
|
||||
def __init__(self, pids):
|
||||
super().__init__((pid, []) for pid in pids)
|
||||
self.incomplete = {}
|
||||
|
||||
|
||||
def _process_threads(pids):
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
class ThreadEntry(ctypes.Structure):
|
||||
_fields_ = [('size', wintypes.DWORD), ('usage', wintypes.DWORD), ('tid', wintypes.DWORD),
|
||||
('pid', wintypes.DWORD), ('base', wintypes.LONG), ('delta', wintypes.LONG),
|
||||
('flags', wintypes.DWORD)]
|
||||
kernel = ctypes.WinDLL('kernel32', use_last_error=True)
|
||||
kernel.CreateToolhelp32Snapshot.argtypes = [wintypes.DWORD, wintypes.DWORD]
|
||||
kernel.CreateToolhelp32Snapshot.restype = wintypes.HANDLE
|
||||
kernel.CloseHandle.argtypes = [wintypes.HANDLE]
|
||||
for name in ('Thread32First', 'Thread32Next'):
|
||||
function = getattr(kernel, name)
|
||||
function.argtypes = [wintypes.HANDLE, ctypes.POINTER(ThreadEntry)]
|
||||
function.restype = wintypes.BOOL
|
||||
snapshot = kernel.CreateToolhelp32Snapshot(4, 0) # TH32CS_SNAPTHREAD
|
||||
if snapshot == ctypes.c_void_p(-1).value:
|
||||
raise ctypes.WinError(ctypes.get_last_error())
|
||||
result = {pid: [] for pid in pids}
|
||||
try:
|
||||
entry = ThreadEntry(); entry.size = ctypes.sizeof(entry)
|
||||
more = kernel.Thread32First(snapshot, ctypes.byref(entry))
|
||||
while more:
|
||||
if entry.pid in result:
|
||||
result[entry.pid].append(int(entry.tid))
|
||||
entry.size = ctypes.sizeof(entry)
|
||||
more = kernel.Thread32Next(snapshot, ctypes.byref(entry))
|
||||
if ctypes.get_last_error() != 18: # ERROR_NO_MORE_FILES
|
||||
raise ctypes.WinError(ctypes.get_last_error())
|
||||
finally:
|
||||
kernel.CloseHandle(snapshot)
|
||||
return result
|
||||
|
||||
|
||||
def _thread_desktop_name(tid):
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
user = ctypes.WinDLL('user32', use_last_error=True)
|
||||
user.GetThreadDesktop.argtypes = [wintypes.DWORD]
|
||||
user.GetThreadDesktop.restype = wintypes.HANDLE
|
||||
user.GetUserObjectInformationW.argtypes = [wintypes.HANDLE, ctypes.c_int, wintypes.LPVOID,
|
||||
wintypes.DWORD, ctypes.POINTER(wintypes.DWORD)]
|
||||
user.GetUserObjectInformationW.restype = wintypes.BOOL
|
||||
ctypes.set_last_error(0)
|
||||
desktop = user.GetThreadDesktop(tid)
|
||||
if not desktop:
|
||||
if error := ctypes.get_last_error():
|
||||
raise ctypes.WinError(error)
|
||||
return None # A non-GUI thread need not have an assigned desktop.
|
||||
# GetThreadDesktop returns a borrowed handle; never CloseDesktop it.
|
||||
name, needed = ctypes.create_unicode_buffer(512), wintypes.DWORD()
|
||||
if not user.GetUserObjectInformationW(desktop, 2, name, ctypes.sizeof(name), ctypes.byref(needed)):
|
||||
raise ctypes.WinError(ctypes.get_last_error())
|
||||
return name.value
|
||||
|
||||
|
||||
def _window_error(snapshot, pid):
|
||||
return getattr(snapshot, 'incomplete', {}).get(pid)
|
||||
|
||||
|
||||
def _desktop_names():
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
user = ctypes.WinDLL('user32', use_last_error=True)
|
||||
callback_type = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.LPWSTR, wintypes.LPARAM)
|
||||
user.GetProcessWindowStation.restype = wintypes.HANDLE
|
||||
user.EnumDesktopsW.argtypes = [wintypes.HANDLE, callback_type, wintypes.LPARAM]
|
||||
names = []
|
||||
@callback_type
|
||||
def collect(name, _):
|
||||
names.append(name)
|
||||
return len(names) <= 128
|
||||
ctypes.set_last_error(0)
|
||||
if not user.EnumDesktopsW(user.GetProcessWindowStation(), collect, 0) or len(names) > 128:
|
||||
raise OSError('无法完整枚举当前 Windows 窗口站桌面')
|
||||
return names
|
||||
|
||||
|
||||
@contextmanager
|
||||
def _window_desktop(name, *, write=False):
|
||||
"""Keep the desktop accessible while reading or messaging its HWNDs."""
|
||||
if not name:
|
||||
yield None
|
||||
return
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
user = ctypes.WinDLL('user32', use_last_error=True)
|
||||
user.OpenDesktopW.argtypes = [wintypes.LPCWSTR, wintypes.DWORD, wintypes.BOOL, wintypes.DWORD]
|
||||
user.OpenDesktopW.restype = wintypes.HANDLE
|
||||
user.CloseDesktop.argtypes = [wintypes.HANDLE]
|
||||
desktop = user.OpenDesktopW(name, 0, False, 1 | (128 if write else 0))
|
||||
if not desktop:
|
||||
raise ctypes.WinError(ctypes.get_last_error())
|
||||
try:
|
||||
# OpenDesktop alone does not map a foreign desktop's HWNDs into this
|
||||
# process. Enumerate while its handle stays open before any ownership
|
||||
# checks or messages; otherwise GetWindowThreadProcessId returns 0.
|
||||
_desktop_windows(desktop)
|
||||
yield desktop
|
||||
finally:
|
||||
user.CloseDesktop(desktop)
|
||||
|
||||
|
||||
def _desktop_windows(desktop):
|
||||
import ctypes
|
||||
from ctypes import wintypes
|
||||
user = ctypes.WinDLL('user32', use_last_error=True)
|
||||
callback_type = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
|
||||
user.EnumDesktopWindows.argtypes = [wintypes.HANDLE, callback_type, wintypes.LPARAM]
|
||||
windows = []
|
||||
@callback_type
|
||||
def collect(hwnd, _):
|
||||
windows.append(int(hwnd))
|
||||
return len(windows) <= 4096
|
||||
ctypes.set_last_error(0)
|
||||
complete = user.EnumDesktopWindows(desktop, collect, 0)
|
||||
error = ctypes.get_last_error()
|
||||
# Windows also returns zero with ERROR_SUCCESS for an empty desktop.
|
||||
if (not complete and (error or windows)) or len(windows) > 4096:
|
||||
raise OSError('无法完整读取原生桌面窗口')
|
||||
return windows
|
||||
|
||||
|
||||
def _post_window_message(window, hwnd, pid, message):
|
||||
import win32gui, win32process
|
||||
with _window_desktop(window.get('desktop', ''), write=True):
|
||||
if win32process.GetWindowThreadProcessId(hwnd)[1] != pid:
|
||||
raise ValueError('窗口归属已变化,未发送请求')
|
||||
win32gui.PostMessage(hwnd, message, 0, 0)
|
||||
|
||||
|
||||
def _process_windows(pids):
|
||||
result = _WindowSnapshot(pids)
|
||||
if not pids: return result
|
||||
import win32api, win32con, win32gui, win32process
|
||||
from .native_repair_ui import _native_output
|
||||
observed = set()
|
||||
def capture(hwnd, _=None, *, desktop_name='Default'):
|
||||
pid = win32process.GetWindowThreadProcessId(hwnd)[1]
|
||||
if pid not in result or hwnd in observed or not win32gui.IsWindowVisible(hwnd):
|
||||
def capture(hwnd, _, *, pid, desktop_name):
|
||||
if win32process.GetWindowThreadProcessId(hwnd)[1] != pid:
|
||||
raise ValueError('窗口所属进程已变化')
|
||||
if hwnd in observed or not win32gui.IsWindowVisible(hwnd):
|
||||
return
|
||||
if desktop_name is None:
|
||||
raise ValueError('窗口所属桌面无法读取')
|
||||
observed.add(hwnd)
|
||||
children, documents = [], []
|
||||
def child(handle, _):
|
||||
@@ -143,31 +284,51 @@ def _process_windows(pids):
|
||||
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()
|
||||
threads = _process_threads(pids)
|
||||
except Exception as error:
|
||||
result.incomplete = {pid: str(error)[:500] for pid in pids}
|
||||
return result
|
||||
for name in desktops:
|
||||
if name != 'Default' and not name.startswith(('CbbVerify_', 'CbbRepair_', 'CbbManagement_', 'CbbStatusRead_', 'CbbFlagRead_')):
|
||||
continue
|
||||
desktop = None
|
||||
desktops, unresolved = {}, set()
|
||||
for pid in pids:
|
||||
if not threads.get(pid):
|
||||
result.incomplete[pid] = '进程线程已退出或暂时无法读取'
|
||||
for tid in threads.get(pid, ()):
|
||||
try:
|
||||
desktop = _thread_desktop_name(tid)
|
||||
if desktop:
|
||||
desktops.setdefault(desktop, set()).add(pid)
|
||||
except Exception as error:
|
||||
unresolved.add(pid)
|
||||
if pid not in unresolved and not any(pid in members for members in desktops.values()):
|
||||
result.incomplete.setdefault(pid, '窗口所属桌面暂时无法确认')
|
||||
if unresolved:
|
||||
# Native PCB threads can deny GetThreadDesktop even when their named
|
||||
# desktop is readable. Complete a bounded station scan for those PIDs.
|
||||
try:
|
||||
desktop = win32service.OpenDesktop(name, 0, False, win32con.DESKTOP_READOBJECTS)
|
||||
for hwnd in desktop.EnumDesktopWindows(): capture(int(hwnd), desktop_name=name)
|
||||
except Exception:
|
||||
incomplete()
|
||||
finally:
|
||||
if desktop is not None: desktop.CloseDesktop()
|
||||
names = _desktop_names()
|
||||
if not names: raise OSError('当前窗口站未返回桌面')
|
||||
for name in names:
|
||||
desktops.setdefault(name, set()).update(unresolved)
|
||||
except Exception as error:
|
||||
for pid in unresolved:
|
||||
result.incomplete.setdefault(pid, str(error)[:500])
|
||||
# Filter by PID before reading window data, including on fallback desktops.
|
||||
for name, members in desktops.items():
|
||||
try:
|
||||
with _window_desktop(name) as desktop:
|
||||
for hwnd in _desktop_windows(desktop):
|
||||
pid = None
|
||||
try:
|
||||
pid = win32process.GetWindowThreadProcessId(hwnd)[1]
|
||||
if pid in members:
|
||||
capture(hwnd, None, pid=pid, desktop_name=name)
|
||||
except Exception as error:
|
||||
for affected in (members if pid is None else {pid} & members):
|
||||
result.incomplete.setdefault(affected, str(error)[:500])
|
||||
except Exception as error:
|
||||
for pid in members:
|
||||
result.incomplete.setdefault(pid, str(error)[:500])
|
||||
return result
|
||||
|
||||
|
||||
@@ -183,8 +344,10 @@ def _project_name(row, library):
|
||||
return '当前库关联会话'
|
||||
|
||||
|
||||
def close_target(name, windows):
|
||||
def close_target(name, windows, *, incomplete=None):
|
||||
"""No save/restore approval and no close against an unknown modal/window."""
|
||||
if incomplete:
|
||||
return None, '该会话窗口读取不完整,请重新检查:'+str(incomplete)
|
||||
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')
|
||||
@@ -214,7 +377,9 @@ def close_target(name, windows):
|
||||
return window, ('将正常关闭工程;未保存时等待确认' if window.get('documents') else '可正常关闭')
|
||||
|
||||
|
||||
def _save_question(windows):
|
||||
def _save_question(windows, *, incomplete=None):
|
||||
if incomplete:
|
||||
return None
|
||||
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']}
|
||||
@@ -226,8 +391,9 @@ def _save_question(windows):
|
||||
return None
|
||||
|
||||
|
||||
def _cancel_question(name, windows):
|
||||
if name.casefold() != 'icdbprojectbackup.exe' or native_activity(name, windows)['status'] != 'ACTIVE':
|
||||
def _cancel_question(name, windows, *, incomplete=None):
|
||||
if (name.casefold() != 'icdbprojectbackup.exe'
|
||||
or native_activity(name, windows, incomplete=incomplete)['status'] != 'ACTIVE'):
|
||||
return None
|
||||
candidates = []
|
||||
for window in windows:
|
||||
@@ -275,20 +441,23 @@ def inspect_residual_sessions(library, *, block_names=()):
|
||||
item['library'] = str(library)
|
||||
if runtime_writes and row['scope_confirmed']:
|
||||
item['runtime_phase'] = runtime_writes[0]['phase']
|
||||
item['block_names'] = list(blocks)
|
||||
error = _window_error(windows, row['pid'])
|
||||
item.update(windows_incomplete=bool(error), window_read_error=error)
|
||||
try:
|
||||
item.update(_process_identity(row))
|
||||
target, detail = close_target(row['name'], windows.get(row['pid'], [])) if row['scope_confirmed'] else (
|
||||
None, '归属未确认,请在原生窗口确认工程并关闭后重新检查')
|
||||
target, detail = close_target(row['name'], windows.get(row['pid'], []), incomplete=error) 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}')
|
||||
except Exception as identity_error:
|
||||
item.update(can_close=False, detail=f'进程已变化或暂时无法确认:{identity_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
|
||||
item['prompt'] = _save_question(windows.get(row['pid'], []), incomplete=error) if row['scope_confirmed'] else None
|
||||
observed = windows.get(row['pid'], [])
|
||||
item['windows'] = observed
|
||||
item['desktops'] = sorted({w.get('desktop', '') for w in observed if w.get('desktop')})
|
||||
item['native_activity'] = native_activity(row['name'], observed)
|
||||
item['cancel_prompt'] = (_cancel_question(row['name'], observed)
|
||||
item['native_activity'] = native_activity(row['name'], observed, incomplete=error)
|
||||
item['cancel_prompt'] = (_cancel_question(row['name'], observed, incomplete=error)
|
||||
if row['scope_confirmed'] and item.get('force_user_confirmed') is True else None)
|
||||
if any(name.startswith('Cbb') for name in item['desktops']) and not item['can_close']:
|
||||
item['detail'] += ';窗口在后台,可查看原生提示并使用已提供的保存/取消操作'
|
||||
@@ -314,37 +483,42 @@ def inspect_residual_sessions(library, *, block_names=()):
|
||||
|
||||
|
||||
def _request_close(row, *, stop=None):
|
||||
import win32con, win32event, win32gui, win32process
|
||||
import win32con, win32event
|
||||
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'], [])
|
||||
snapshot = _process_windows({row['pid']})
|
||||
windows, error = snapshot.get(row['pid'], []), _window_error(snapshot, row['pid'])
|
||||
if error:
|
||||
return {'release_status': 'WAITING', 'detail': '该会话窗口读取不完整,请重新检查:'+error}
|
||||
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']))
|
||||
with _window_desktop(window.get('desktop', '')):
|
||||
target = _cancel_target(_startup_snapshot(window['hwnd'], row['pid']))
|
||||
if target:
|
||||
win32gui.PostMessage(target[1].handle, win32con.BM_CLICK, 0, 0)
|
||||
_post_window_message(window, target[1].handle, row['pid'], win32con.BM_CLICK)
|
||||
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'], [])
|
||||
snapshot = _process_windows({row['pid']})
|
||||
windows, error = snapshot.get(row['pid'], []), _window_error(snapshot, row['pid'])
|
||||
if error:
|
||||
break
|
||||
if close_target(row['name'], windows)[0] is not None: break
|
||||
break
|
||||
target, detail = close_target(row['name'], windows)
|
||||
target, detail = close_target(row['name'], windows, incomplete=error)
|
||||
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)
|
||||
_post_window_message(target, target['hwnd'], row['pid'], win32con.WM_CLOSE)
|
||||
deadline = time.monotonic()+3
|
||||
while time.monotonic() < deadline:
|
||||
if win32event.WaitForSingleObject(handle, 100) == win32con.WAIT_OBJECT_0:
|
||||
@@ -373,7 +547,9 @@ def _force_close(row, *, stop=None):
|
||||
if (not ownership['force_user_confirmed'] or
|
||||
any(ownership[k] != row.get(k) for k in ('owner_sid', 'session_id'))):
|
||||
return {'release_status': 'IDENTITY_CHANGED', 'detail': '用户或 Windows 会话已变化,未结束'}
|
||||
activity = native_activity(row['name'], _process_windows({row['pid']}).get(row['pid'], []))
|
||||
snapshot = _process_windows({row['pid']})
|
||||
activity = native_activity(row['name'], snapshot.get(row['pid'], []),
|
||||
incomplete=_window_error(snapshot, row['pid']))
|
||||
if reason := force_block_reason({**row, 'native_activity': activity}):
|
||||
return {'release_status': 'WAITING', 'detail': reason, 'native_activity': activity}
|
||||
if stop is not None and stop.is_set():
|
||||
@@ -391,7 +567,7 @@ def _finish_library_release(library, evidence):
|
||||
|
||||
def _request_native_cancel(row, *, stop=None):
|
||||
"""Only click the exact currently visible Cancel control the user confirmed."""
|
||||
import win32con, win32gui, win32process
|
||||
import win32con
|
||||
if row.get('scope_confirmed') is not True:
|
||||
raise ValueError('取消目标归属未确认,请重新检查')
|
||||
fresh = next((r for r in query_process_snapshot() if r['pid'] == row['pid']), None)
|
||||
@@ -403,24 +579,48 @@ def _request_native_cancel(row, *, stop=None):
|
||||
owner = _force_ownership(handle, row['pid'])
|
||||
if not owner['force_user_confirmed'] or any(owner[k] != row.get(k) for k in ('owner_sid', 'session_id')):
|
||||
raise ValueError('取消目标用户/会话已变化')
|
||||
prompt = _cancel_question(row['name'], _process_windows({row['pid']}).get(row['pid'], []))
|
||||
snapshot = _process_windows({row['pid']})
|
||||
prompt = _cancel_question(row['name'], snapshot.get(row['pid'], []),
|
||||
incomplete=_window_error(snapshot, row['pid']))
|
||||
if not prompt or prompt != row.get('cancel_prompt'):
|
||||
raise ValueError('原生取消按钮已变化,请重新检查')
|
||||
button = prompt['button']
|
||||
if win32process.GetWindowThreadProcessId(button['hwnd'])[1] != row['pid']:
|
||||
raise ValueError('原生取消按钮归属已变化')
|
||||
if stop is not None and stop.is_set():
|
||||
return {'release_status': 'CANCELLED', 'detail': '已停止,未请求原生取消'}
|
||||
win32gui.PostMessage(button['hwnd'], win32con.BM_CLICK, 0, 0)
|
||||
_post_window_message(prompt, button['hwnd'], row['pid'], win32con.BM_CLICK)
|
||||
return {'release_status': 'WAITING', 'detail': '已请求原生取消,需重新检查实际结果;未强制结束'}
|
||||
|
||||
|
||||
def request_native_cancel(row, library, evidence_dir, *, stop=None):
|
||||
# Reuse serialized admission, consent and incremental evidence for cancellation.
|
||||
plan = {'library': str(library), 'sessions': [row]}
|
||||
plan = {'library': str(library), 'sessions': [row], 'block_names': row.get('block_names', [])}
|
||||
return release_residual_sessions(plan, evidence_dir, stop=stop, cancel_native=True)
|
||||
|
||||
|
||||
def _session_evidence(row):
|
||||
"""Keep the full preview in memory, but bound repeatedly written Output."""
|
||||
value = dict(row)
|
||||
if 'native_activity' in value:
|
||||
value['native_activity'] = {k: v for k, v in value['native_activity'].items() if k != 'output'}
|
||||
if 'windows' in value:
|
||||
value['windows'] = []
|
||||
for window in row['windows']:
|
||||
saved = {k: window[k] for k in ('hwnd', 'title', 'class', 'desktop', 'enabled') if k in window}
|
||||
output = window.get('output')
|
||||
if isinstance(output, str):
|
||||
data = output.encode('utf-8')
|
||||
saved.update(output_excerpt=data[:4096].decode('utf-8', errors='ignore'),
|
||||
output_bytes=len(data), output_sha256=hashlib.sha256(data).hexdigest(),
|
||||
output_truncated=len(data) > 4096)
|
||||
value['windows'].append(saved)
|
||||
return value
|
||||
|
||||
|
||||
def release_targets_complete(rows):
|
||||
return all(row.get('release_status') == 'RELEASED' or (
|
||||
row.get('scope_confirmed') is False and row.get('release_status') == 'OBSERVED') for row in rows)
|
||||
|
||||
|
||||
def _release_residual_sessions(plan, evidence_dir, *, stop=None, force=False, cancel_native=False):
|
||||
library = Path(plan['library']).resolve()
|
||||
root = Path(evidence_dir).resolve()/('sessions-'+uuid4().hex[:12])
|
||||
@@ -436,7 +636,7 @@ def _release_residual_sessions(plan, evidence_dir, *, stop=None, force=False, ca
|
||||
from .management import _write_json
|
||||
try:
|
||||
result['report_saved'] = True
|
||||
_write_json(root/'result.json', result)
|
||||
_write_json(root/'result.json', {**result, 'sessions': [_session_evidence(row) for row in result['sessions']]})
|
||||
return True
|
||||
except OSError as error:
|
||||
result.update(status='PARTIAL', report_saved=False, evidence_error=str(error))
|
||||
@@ -447,7 +647,7 @@ def _release_residual_sessions(plan, evidence_dir, *, stop=None, force=False, ca
|
||||
consent_path = root/'consent.json'
|
||||
consent = {'version': 1, 'mode': 'cancel_native' if cancel_native else 'force_document_clients', 'library': str(library),
|
||||
'time_ns': time.time_ns(), 'sessions': [
|
||||
{**row, 'force_allowed': not force_block_reason(row),
|
||||
{**_session_evidence(row), 'force_allowed': not force_block_reason(row),
|
||||
'cancel_allowed': bool(row.get('cancel_prompt')) and row.get('scope_confirmed') is True,
|
||||
'force_block_reason': force_block_reason(row)} for row in plan['sessions']]}
|
||||
try:
|
||||
@@ -471,6 +671,11 @@ def _release_residual_sessions(plan, evidence_dir, *, stop=None, force=False, ca
|
||||
outcome = {'release_status': 'RELEASED', 'detail': '已退出'}
|
||||
if stop is not None and stop.is_set():
|
||||
outcome = {'release_status': 'CANCELLED', 'detail': '已停止释放'}
|
||||
elif row.get('scope_confirmed') is False:
|
||||
from .library_lock import _owner_is_blocking
|
||||
outcome = ({'release_status': 'WAITING', 'detail': '当前归属已变化,请重新检查确认;未关闭'}
|
||||
if current is not None and _owner_is_blocking(current, library, roots) else
|
||||
{'release_status': 'OBSERVED', 'detail': '仅观察,未关闭;由目标资源检查确认是否影响当前库'})
|
||||
elif current is not None:
|
||||
from .library_lock import _owner_matches_scope
|
||||
scoped = _owner_matches_scope(current, library, roots) is True
|
||||
@@ -501,11 +706,13 @@ def _release_residual_sessions(plan, evidence_dir, *, stop=None, force=False, ca
|
||||
row.update(release_status='RELEASED', detail='已退出')
|
||||
elif row['release_status'] == 'WAITING':
|
||||
windows = remaining_windows.get(row['pid'], [])
|
||||
row.update(prompt=_save_question(windows), windows=windows,
|
||||
cancel_prompt=(_cancel_question(row['name'], windows)
|
||||
error = _window_error(remaining_windows, row['pid'])
|
||||
row.update(prompt=_save_question(windows, incomplete=error), windows=windows,
|
||||
windows_incomplete=bool(error), window_read_error=error,
|
||||
cancel_prompt=(_cancel_question(row['name'], windows, incomplete=error)
|
||||
if row.get('force_user_confirmed') is True else None),
|
||||
native_activity=native_activity(row['name'], windows))
|
||||
if all(row['release_status'] == 'RELEASED' for row in result['sessions']) and not (stop and stop.is_set()):
|
||||
native_activity=native_activity(row['name'], windows, incomplete=error))
|
||||
if release_targets_complete(result['sessions']) and not (stop and stop.is_set()):
|
||||
result['proof'] = _finish_library_release(library, root/'library-proof')
|
||||
proof = result['proof']
|
||||
if (proof.get('status') != 'RELEASE_CONFIRMED'
|
||||
@@ -562,18 +769,16 @@ def answer_save_question(row, choice):
|
||||
|
||||
|
||||
def _answer_save_question(row, choice):
|
||||
import win32con, win32gui
|
||||
import win32con
|
||||
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'], []))
|
||||
snapshot = _process_windows({row['pid']})
|
||||
prompt = _save_question(snapshot.get(row['pid'], []), incomplete=_window_error(snapshot, 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)
|
||||
_post_window_message(prompt, button['hwnd'], row['pid'], win32con.BM_CLICK)
|
||||
@@ -15,6 +15,15 @@ import stat
|
||||
|
||||
|
||||
MANIFEST_VERSION = 1
|
||||
MANIFEST_RULE_VERSION = 2
|
||||
_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', 'saddress_.adr')
|
||||
_NONPRIMARY_FILENAME_PREFIXES = ('~$',)
|
||||
_NONPRIMARY_DIRECTORIES = frozenset({
|
||||
'log', 'logs', 'temp', 'tmp', '__pycache__', 'backup', 'backups',
|
||||
'output', 'outputs', 'report', 'reports', 'gerber', 'gerbers', 'odb++',
|
||||
@@ -29,22 +38,21 @@ 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('work.before-restore-')
|
||||
or directories[:2] == ('projectbackup', 'backups')))
|
||||
or directories[0].startswith(_ROOT_RUNTIME_PREFIX)
|
||||
or directories[:len(_ROOT_RUNTIME_PATH)] == _ROOT_RUNTIME_PATH))
|
||||
|
||||
|
||||
def _native_runtime(directories, database_prefix):
|
||||
runtime_prefix = database_prefix + ('cdbsvr',)
|
||||
runtime_prefix = database_prefix + (_NATIVE_SERVER_DIRECTORY,)
|
||||
return (directories[:len(runtime_prefix)] == runtime_prefix
|
||||
and len(directories) > len(runtime_prefix)
|
||||
and directories[len(runtime_prefix)] in ('log', 'dbcheck', 'dbrestore'))
|
||||
and directories[len(runtime_prefix)] in _NATIVE_RUNTIME_DIRECTORIES)
|
||||
|
||||
|
||||
def _project_runtime(directories):
|
||||
return (_root_runtime(directories)
|
||||
or (directories[:1] == ('pcb',) and _root_runtime(directories[1:]))
|
||||
or _native_runtime(directories, ('database',))
|
||||
or _native_runtime(directories, ('pcb', 'database')))
|
||||
or (directories[:1] == (_PROJECT_PCB_DIRECTORY,) and _root_runtime(directories[1:]))
|
||||
or any(_native_runtime(directories, prefix) for prefix in _PROJECT_DATABASE_PREFIXES))
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -85,7 +93,8 @@ class ManifestScope:
|
||||
"""
|
||||
directories = parts if directory else parts[:-1]
|
||||
if not directory and (Path(parts[-1]).suffix in _NONPRIMARY_SUFFIXES
|
||||
or parts[-1] == 'saddress.adr' or parts[-1].startswith('~$')):
|
||||
or parts[-1] in _NONPRIMARY_FILENAMES
|
||||
or parts[-1].startswith(_NONPRIMARY_FILENAME_PREFIXES)):
|
||||
return True
|
||||
if self.kind == 'project':
|
||||
return _project_runtime(directories)
|
||||
@@ -123,6 +132,36 @@ 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:
|
||||
@@ -271,7 +310,10 @@ 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. Failures retain the partial destination evidence.
|
||||
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.
|
||||
Progress receives one dict with stage, hashed_files/bytes and copied_files.
|
||||
"""
|
||||
import win32con
|
||||
@@ -329,9 +371,15 @@ 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):
|
||||
|
||||
@@ -32,24 +32,36 @@ def library_available(library):
|
||||
def retained_session_snapshot(library):
|
||||
key = _library_key(library)
|
||||
with _observer_guard:
|
||||
return {path: (aliases, _retained_results.get(path, {}).get('block'))
|
||||
return {path: (aliases, _retained_results.get(path, {}).get('block'),
|
||||
_retained_results.get(path, {}).get('operation_id'))
|
||||
for path, aliases in _retained_libraries.items() if key in aliases}
|
||||
|
||||
|
||||
def reconciled_retained_sessions(snapshot, *, block_name=None):
|
||||
with _observer_guard:
|
||||
return [{'path': path, 'block_name': block, 'operation_id': operation_id}
|
||||
for path, (aliases, block, operation_id) in snapshot.items()
|
||||
if _retained_libraries.get(path) is aliases
|
||||
and _retained_results.get(path, {}).get('operation_id') == operation_id
|
||||
and (block_name is None or block == block_name)]
|
||||
|
||||
|
||||
def acknowledge_library_release(proof, snapshot, *, block_name=None):
|
||||
"""Called under fresh proof handles; never clear a newer handoff."""
|
||||
if proof.get('status') != 'RELEASE_CONFIRMED':
|
||||
return
|
||||
key = _library_key(proof['library'])
|
||||
with _observer_guard:
|
||||
records = [dict(_retained_results.get(path, {}), path=path)
|
||||
for path, (aliases, block) in snapshot.items()
|
||||
records = [dict(path=path, operation_id=operation_id)
|
||||
for path, (aliases, block, operation_id) in snapshot.items()
|
||||
if key in aliases and _retained_libraries.get(path) is aliases
|
||||
and _retained_results.get(path, {}).get('operation_id') == operation_id
|
||||
and (block_name is None or block == block_name)]
|
||||
record_session_release(proof, records)
|
||||
with _observer_guard:
|
||||
for path, (aliases, block) in snapshot.items():
|
||||
for path, (aliases, block, operation_id) in snapshot.items():
|
||||
if (key in aliases and _retained_libraries.get(path) is aliases
|
||||
and _retained_results.get(path, {}).get('operation_id') == operation_id
|
||||
and (block_name is None or block == block_name)):
|
||||
_retained_libraries.pop(path, None)
|
||||
_retained_results.pop(path, None)
|
||||
@@ -84,6 +96,15 @@ def retained_session_states(library):
|
||||
if key in aliases and path in _retained_results]
|
||||
|
||||
|
||||
def library_wait_reason(library):
|
||||
"""Cached explanation for queue admission; never probe disk or native clients."""
|
||||
key = _library_key(library)
|
||||
with _observer_guard:
|
||||
retained = [path for path, aliases in _retained_libraries.items() if key in aliases]
|
||||
names = sorted({_retained_results.get(path, {}).get('block') or '当前库' for path in retained})
|
||||
return '该库有残留会话('+', '.join(names)+'),请查看并处理。' if names else ''
|
||||
|
||||
|
||||
def register_worker_session(worker, job):
|
||||
"""The launcher must persist identity before opening the worker's gate."""
|
||||
path = Path(job['session_record_path'])
|
||||
@@ -94,13 +115,14 @@ def register_worker_session(worker, job):
|
||||
worker.cbb_library = job['library']
|
||||
|
||||
|
||||
def update_worker_state(job, phase, *, identities=(), write_outcome=None, required=False):
|
||||
def update_worker_state(job, phase, *, identities=(), write_outcome=None, required=False, continuation=False):
|
||||
"""required controls I/O; only existing same-phase calls may continue recording after supervisor loss."""
|
||||
if not job.get('session_record_path'):
|
||||
if required:
|
||||
raise ValueError('原生写入缺少会话记录位置,未提交新的调用')
|
||||
return False
|
||||
from .desktop_worker import worker_phase
|
||||
with worker_phase(job['operation_id'], phase):
|
||||
with worker_phase(job['operation_id'], phase, continuation=continuation):
|
||||
path = Path(job['session_record_path']).with_name('worker-state.json')
|
||||
try:
|
||||
state = ({'operation_id': job['operation_id'], 'processes': []} if not path.exists()
|
||||
@@ -123,6 +145,19 @@ def update_worker_state(job, phase, *, identities=(), write_outcome=None, requir
|
||||
return False
|
||||
|
||||
|
||||
def dispatch_native(job, call, *, phase='NATIVE_CALL', asynchronous=False, required=False):
|
||||
"""Reserve the native call before dispatch; asynchronous results require an explicit acknowledgment."""
|
||||
update_worker_state(job, phase, required=required)
|
||||
try:
|
||||
result = call()
|
||||
except BaseException:
|
||||
update_worker_state(job, 'UNCONFIRMED')
|
||||
raise
|
||||
if not asynchronous:
|
||||
update_worker_state(job, 'POSTCALL')
|
||||
return result
|
||||
|
||||
|
||||
def process_identity(pid):
|
||||
from .residual_sessions import _process_handle, _handle_identity, _force_ownership
|
||||
with _process_handle(pid) as handle:
|
||||
@@ -414,13 +449,13 @@ def active_write_records(library):
|
||||
for path in paths:
|
||||
try:
|
||||
session, state, processes = _session(path, path.parent)
|
||||
if state.get('phase') in ('NATIVE_CALL', 'CLOSING', 'UNCONFIRMED'):
|
||||
result.append({**session, 'phase': state['phase']})
|
||||
else:
|
||||
if processes:
|
||||
from .residual_sessions import _process_handle, _handle_identity, _force_ownership
|
||||
import win32con, win32event
|
||||
for identity in processes:
|
||||
if identity.get('role') not in ('worker', 'helper'):
|
||||
if identity.get('role') == 'supervisor' or (
|
||||
state.get('phase') not in ('NATIVE_CALL', 'CLOSING', 'UNCONFIRMED')
|
||||
and identity.get('role') not in ('worker', 'helper')):
|
||||
continue
|
||||
try:
|
||||
with _process_handle(identity['pid']) as handle:
|
||||
@@ -430,7 +465,8 @@ def active_write_records(library):
|
||||
if any(actual[k] != identity[k] for k in IDENTITY_KEYS if k != 'pid'):
|
||||
continue
|
||||
# A retained caller may be inside Close after the last journal write failed.
|
||||
result.append({**session, 'phase': 'UNCONFIRMED'})
|
||||
result.append({**session, 'phase': state['phase'] if state.get('phase') in (
|
||||
'NATIVE_CALL', 'CLOSING', 'UNCONFIRMED') else 'UNCONFIRMED'})
|
||||
break
|
||||
except Exception as error:
|
||||
if getattr(error, 'winerror', None) != 87:
|
||||
|
||||
@@ -12,6 +12,7 @@ from .backup_notice import MANUAL_BACKUP_NOTICE
|
||||
|
||||
class RecoverySignals(QObject):
|
||||
progress = Signal(object)
|
||||
choice = Signal(object)
|
||||
|
||||
|
||||
class BackupRecoveryDialog(QDialog):
|
||||
@@ -31,6 +32,8 @@ class BackupRecoveryDialog(QDialog):
|
||||
self.pool.setMaxThreadCount(1)
|
||||
self.signals = RecoverySignals(self)
|
||||
self.signals.progress.connect(self._progress)
|
||||
if parent is not None and hasattr(parent, '_show_version_choice'):
|
||||
self.signals.choice.connect(parent._show_version_choice)
|
||||
self.block_combo = QComboBox()
|
||||
self.block_combo.addItems(list(names))
|
||||
self.source_edit = QLineEdit()
|
||||
@@ -96,7 +99,8 @@ class BackupRecoveryDialog(QDialog):
|
||||
self.status_label.setText('正在准备恢复…')
|
||||
self.started.emit(name)
|
||||
def execute():
|
||||
action = lambda: recoverer(request, source, progress=self.signals.progress.emit)
|
||||
options = {'version_prompt': self.signals.choice.emit,'stop':self.stop} if self.recoverer is None else {}
|
||||
action = lambda: recoverer(request, source, progress=self.signals.progress.emit, **options)
|
||||
if self.native_queue is None: return action()
|
||||
from ..operation_queue import QueueCancelled
|
||||
def restore():
|
||||
@@ -130,6 +134,9 @@ class BackupRecoveryDialog(QDialog):
|
||||
def _result(self, name, result):
|
||||
if result.status == 'PASS':
|
||||
message = '恢复完成,工程打开与校验通过。'
|
||||
elif result.status in ('SKIPPED', 'CANCELLED'):
|
||||
label = '恢复已跳过' if result.status == 'SKIPPED' else '恢复已取消'
|
||||
message = f'{label}:{result.stderr or result.stdout or result.status}'
|
||||
else:
|
||||
message = f'恢复未通过:{result.stderr or result.stdout or result.status}'
|
||||
if result.evidence_path:
|
||||
|
||||
@@ -65,7 +65,7 @@ class IcdbCheckTask(QObject):
|
||||
if self.paused: return
|
||||
request = self.requests[len(self.results)]
|
||||
def check():
|
||||
from ..session_record import library_available
|
||||
from ..session_record import library_available, library_wait_reason
|
||||
try:
|
||||
def execute():
|
||||
if request.block_name in self.ready_names:
|
||||
@@ -73,11 +73,17 @@ class IcdbCheckTask(QObject):
|
||||
if request.block_name in self.invalidated:
|
||||
return VerifyResult('SKIPPED', stderr='目标已有后续管理操作,请重新检查。')
|
||||
self.event.emit({'stage': 'icdb_check_start', 'block': request.block_name})
|
||||
return self.verifier(request)
|
||||
result = self.verifier(request)
|
||||
if not result.safe_to_continue:
|
||||
from ..operation_lifecycle import recheck_failed_release
|
||||
result = recheck_failed_release(request.lmc_file, request.block_name, result)
|
||||
return result
|
||||
return self.queue.run(execute, stop=self.stop,
|
||||
wait_state=lambda: (self.paused, library_wait_reason(request.lmc_file)),
|
||||
ready=lambda: not self.paused and library_available(request.lmc_file),
|
||||
waiting=lambda: self.event.emit({'stage': 'waiting_native_slot', 'block': request.block_name,
|
||||
'detail': '已排队,等待当前原生操作结束'}))
|
||||
'library': str(request.lmc_file), 'retained': not library_available(request.lmc_file),
|
||||
'detail': library_wait_reason(request.lmc_file) or '已排队,等待当前原生操作结束'}))
|
||||
except QueueCancelled as error:
|
||||
return VerifyResult('CANCELLED', stderr=str(error))
|
||||
except Exception as error:
|
||||
|
||||
@@ -57,6 +57,7 @@ from cbb_refresh_verify.verify_runner import (VerifyRequest, preflight_skip_reas
|
||||
class ProgressSignals(QObject):
|
||||
event = Signal(object)
|
||||
version_choice = Signal(object)
|
||||
batch_ready = Signal(object)
|
||||
|
||||
|
||||
STATUS_LABELS = {
|
||||
@@ -99,7 +100,6 @@ class MainWindow(QWidget):
|
||||
self._management_unsafe_libraries = set()
|
||||
self._management_operation_library = None
|
||||
self._maintenance_recovery_view = False
|
||||
self._reload_after_maintenance = False
|
||||
self._reimport_offers = ()
|
||||
self._batch_requests = ()
|
||||
self._batch_records = {}
|
||||
@@ -135,6 +135,12 @@ class MainWindow(QWidget):
|
||||
self._mapping_auto_idle = False
|
||||
self._mapping_finish_waiters = []
|
||||
self._closing = self._close_ready = False
|
||||
self._queue_wait_library = None
|
||||
self._queue_release_mode = False
|
||||
self.close_wait_timer = QTimer(self)
|
||||
self.close_wait_timer.setSingleShot(True)
|
||||
self.close_wait_timer.setInterval(120_000)
|
||||
self.close_wait_timer.timeout.connect(self._show_close_wait_notice)
|
||||
from cbb_refresh_verify.operation_queue import NativeQueue
|
||||
self.native_queue = NativeQueue()
|
||||
self.icdb_task = None
|
||||
@@ -148,6 +154,7 @@ class MainWindow(QWidget):
|
||||
self._global_icdb_run = False
|
||||
self._icdb_completed = 0
|
||||
self.signals = ProgressSignals(self); self.signals.event.connect(self._progress)
|
||||
self.signals.batch_ready.connect(self._batch_done)
|
||||
if hasattr(self.management_adapter, 'session_progress'):
|
||||
self.management_adapter.session_progress = self.signals.event.emit
|
||||
self.signals.version_choice.connect(self._show_version_choice)
|
||||
@@ -309,6 +316,10 @@ class MainWindow(QWidget):
|
||||
self.section_stack.addWidget(management)
|
||||
layout.addWidget(self.section_stack)
|
||||
layout.addWidget(self.status_label)
|
||||
self.queue_release_button = QPushButton('查看残留会话…')
|
||||
self.queue_release_button.hide()
|
||||
self.queue_release_button.clicked.connect(lambda: self.check_library_release(queued=True))
|
||||
layout.addWidget(self.queue_release_button)
|
||||
self.runtime_log_toggle = QToolButton(); self.runtime_log_toggle.setText('查看运行日志')
|
||||
self.runtime_log_toggle.setCheckable(True)
|
||||
self.runtime_log_toggle.toggled.connect(self.output.setVisible)
|
||||
@@ -410,6 +421,15 @@ class MainWindow(QWidget):
|
||||
self.backup_restore_button.setEnabled(ready and bool(
|
||||
self._eligible_names(checked_only=bool(self.selected_records()))))
|
||||
self.release_library_button.setEnabled(not self.busy and bool(self.lmc_edit.text().strip()))
|
||||
waiting_library = self._queued_release_library()
|
||||
self.queue_release_button.setVisible(waiting_library is not None)
|
||||
self.queue_release_button.setEnabled(waiting_library is not None and not self._closing)
|
||||
for task in self.icdb_tasks:
|
||||
action = getattr(task, 'release_action', None)
|
||||
if action is not None and isValid(action):
|
||||
queued_target = bool(waiting_library and _library_path_keys(waiting_library, task.path_lease)
|
||||
& _library_path_keys(task.requests[0].lmc_file, task.path_lease))
|
||||
action.setEnabled(not self._closing and (not self.busy or queued_target))
|
||||
reasons = []
|
||||
for operation, widget in (('add', self.add_button), ('update', self.update_button), ('remove', self.remove_button)):
|
||||
reason = self._management_block_reason(operation)
|
||||
@@ -481,13 +501,42 @@ class MainWindow(QWidget):
|
||||
self.output.append(f'未完成会话:{session.get("block") or ""} · '
|
||||
f'{phase} · {session.get("detail", "")}\n{session["path"]}')
|
||||
|
||||
def check_library_release(self):
|
||||
if self.busy or not self.lmc_edit.text().strip():
|
||||
def _queued_release_library(self):
|
||||
from cbb_refresh_verify.session_record import library_available
|
||||
if self._queue_wait_library is not None and library_available(self._queue_wait_library):
|
||||
self._queue_wait_library = None
|
||||
return self._queue_wait_library
|
||||
|
||||
def _queue_waiting(self, event):
|
||||
from cbb_refresh_verify.session_record import library_available
|
||||
library = event.get('library')
|
||||
if event.get('retained') and library and not library_available(library):
|
||||
self._queue_wait_library = library
|
||||
self._update()
|
||||
|
||||
def check_library_release(self, checked=False, *, queued=False):
|
||||
if self._closing:
|
||||
return
|
||||
allowed_queue = queued and self._queued_release_library() is not None
|
||||
if queued and not allowed_queue:
|
||||
self._update()
|
||||
return
|
||||
if (self.busy and not allowed_queue) or not self.lmc_edit.text().strip():
|
||||
return
|
||||
from shiboken6 import isValid
|
||||
previous = getattr(self, 'release_dialog', None)
|
||||
if previous is not None and isValid(previous) and previous.isVisible():
|
||||
previous.raise_()
|
||||
return
|
||||
from .residual_release_dialog import ResidualReleaseDialog
|
||||
library = Path(self.mentor_lmc_path or self.lmc_edit.text().strip())
|
||||
library = Path(self._queue_wait_library if allowed_queue else self.mentor_lmc_path or self.lmc_edit.text().strip())
|
||||
self._queue_release_mode = bool(allowed_queue and self.busy)
|
||||
self.release_dialog = ResidualReleaseDialog(library, self.data_root/'release-checks', self)
|
||||
self.release_dialog.native_queue = self.native_queue
|
||||
if self._queue_release_mode:
|
||||
from cbb_refresh_verify.network_path import release_retained_path_leases
|
||||
lease = self.library_lease
|
||||
self.release_dialog.release_finalizer = lambda proof: release_retained_path_leases(proof, current_lease=lease)
|
||||
self.release_dialog.before_release.connect(self._stop_icdb_check)
|
||||
self.release_dialog.released.connect(lambda result: self._complete_library_release(self.release_dialog.library, result))
|
||||
self.release_dialog.finished.connect(self._release_dialog_finished)
|
||||
@@ -495,10 +544,20 @@ class MainWindow(QWidget):
|
||||
self.release_dialog.show()
|
||||
|
||||
def _release_dialog_finished(self, _=None):
|
||||
if self._queue_release_mode:
|
||||
self._queue_release_mode = False
|
||||
self._update()
|
||||
return
|
||||
if self._defer_mapping_finish(self._release_dialog_finished): return
|
||||
self._finished()
|
||||
pending = getattr(self, '_resume_batch', None)
|
||||
if pending and pending['released']:
|
||||
if getattr(self, 'summary', None) is None:
|
||||
self.summary = self._new_result_summary('_batch_summary')
|
||||
self.summary.setWindowTitle('继续未执行项')
|
||||
self._resume_batch_action = self.summary.addButton('继续未执行项', QMessageBox.ActionRole)
|
||||
self._resume_batch_action.clicked.connect(self._resume_released_batch)
|
||||
self._update()
|
||||
self.summary.setText('会话已释放,可以继续未执行项。')
|
||||
self.summary.show()
|
||||
|
||||
@@ -512,6 +571,9 @@ class MainWindow(QWidget):
|
||||
except Exception as error:
|
||||
self._failed(error)
|
||||
return
|
||||
if result.get('mapping_cleanup_complete') is True:
|
||||
self._library_release_ready(library, result)
|
||||
return
|
||||
lease = self.library_lease
|
||||
def release():
|
||||
try:
|
||||
@@ -597,6 +659,7 @@ class MainWindow(QWidget):
|
||||
self.management_dialog = ManagementDialog(requests, self, adapter=self.management_adapter,
|
||||
recovery_from=recovery_from)
|
||||
self.management_dialog.native_queue = self.native_queue
|
||||
self.management_dialog.release_requested.connect(self._open_waiting_release)
|
||||
self.management_dialog.before_execute.connect(lambda names: self._invalidate_check_targets(requests[0].library, names))
|
||||
self._management_results = []
|
||||
self.management_dialog.completed.connect(self._management_completed)
|
||||
@@ -604,6 +667,12 @@ class MainWindow(QWidget):
|
||||
self.busy = True; self._update()
|
||||
self.management_dialog.show()
|
||||
|
||||
def _open_waiting_release(self, library):
|
||||
from cbb_refresh_verify.session_record import library_available
|
||||
if not library_available(library):
|
||||
self._queue_wait_library = str(library)
|
||||
self.check_library_release(queued=True)
|
||||
|
||||
def reimport_failed(self):
|
||||
if self.busy or not self._reimport_offers or not self.management_capabilities['update'].supported:
|
||||
return
|
||||
@@ -620,7 +689,6 @@ class MainWindow(QWidget):
|
||||
mapped_drive=getattr(self.library_lease, 'drive', ''),
|
||||
mapped_remote_root=getattr(self.library_lease, 'remote_root', '')))
|
||||
previous[record.name] = str(result.evidence_path)
|
||||
self._reload_after_maintenance = False
|
||||
if getattr(self, 'summary', None): self.summary.close()
|
||||
self._open_management_dialog(requests, recovery_from=previous)
|
||||
|
||||
@@ -766,22 +834,34 @@ class MainWindow(QWidget):
|
||||
path = QFileDialog.getOpenFileName(self, '选择中心库', '', 'LMC (*.lmc)')[0]
|
||||
if path: self.lmc_edit.setText(path); self.load_library()
|
||||
|
||||
def _start(self, action, callback):
|
||||
def _start(self, action, callback, *, queued=True):
|
||||
self.stop.clear()
|
||||
self.busy = True; self._update()
|
||||
self.worker = ServiceWorker(self._queued_action(action))
|
||||
self.worker = ServiceWorker(self._queued_action(action) if queued else action)
|
||||
self.worker.signals.succeeded.connect(callback)
|
||||
self.worker.signals.failed.connect(self._failed)
|
||||
self.worker.signals.finished.connect(self._finished)
|
||||
self.pool.start(self.worker)
|
||||
|
||||
def _queued_action(self, action):
|
||||
from cbb_refresh_verify.session_record import library_available
|
||||
library = getattr(self, 'mentor_lmc_path', None) or self.lmc_edit.text()
|
||||
return lambda: self.native_queue.run(action, stop=self.stop,
|
||||
def _queued_action(self, action, *, label='', library=None):
|
||||
from cbb_refresh_verify.session_record import library_available, library_wait_reason
|
||||
if library is None:
|
||||
from PySide6.QtCore import QThread
|
||||
if QThread.currentThread() != self.thread():
|
||||
raise RuntimeError('后台入队必须传入任务绑定的中心库路径')
|
||||
library = getattr(self, 'mentor_lmc_path', None) or self.lmc_edit.text()
|
||||
def execute():
|
||||
event = {'stage': 'native_slot_acquired', 'library': str(library)}
|
||||
if label:
|
||||
event['detail'] = label+'中…'
|
||||
self.signals.event.emit(event)
|
||||
return action()
|
||||
return lambda: self.native_queue.run(execute, stop=self.stop,
|
||||
ready=lambda: library_available(library),
|
||||
wait_state=lambda: library_wait_reason(library),
|
||||
waiting=lambda: self.signals.event.emit({'stage': 'waiting_native_slot',
|
||||
'detail': '已排队,等待当前原生操作结束'}))
|
||||
'library': str(library), 'retained': not library_available(library),
|
||||
'detail': (label+':' if label else '')+(library_wait_reason(library) or '已排队,等待当前原生操作结束')}))
|
||||
|
||||
def _icdb_active(self):
|
||||
return self.icdb_task is not None and self.icdb_task.active
|
||||
@@ -799,7 +879,7 @@ class MainWindow(QWidget):
|
||||
if hasattr(task, 'summary'):
|
||||
prefix = '已更新的工程:'+', '.join(sorted(task.invalidated))+'。下列为此前检查记录。\n'
|
||||
task.summary.setDetailedText(prefix+task.summary.detailedText())
|
||||
if names & getattr(task, 'recovery_names', set()):
|
||||
if names & getattr(task, 'recovery_names', set()) and hasattr(task, 'recovery_action'):
|
||||
task.recovery_action.setEnabled(False)
|
||||
task.recovery_action.setToolTip('工程已有后续管理操作,请重新检查。')
|
||||
self._reimport_offers = tuple(offer for offer in self._reimport_offers if offer[0].block_name not in names
|
||||
@@ -842,7 +922,11 @@ class MainWindow(QWidget):
|
||||
name, stage = str(event.get('block', '')), str(event.get('stage', ''))
|
||||
detail = str(event.get('detail') or stage)
|
||||
self.icdb_phase.setText(f'{name} · '+({'icdb_check_start': '正在检查',
|
||||
'icdb_startup_check': '正在打开工程', 'waiting_native_slot': '已排队,等待执行'}.get(stage, detail)))
|
||||
'icdb_startup_check': '正在打开工程'}.get(stage, detail)))
|
||||
if stage == 'waiting_native_slot':
|
||||
self._queue_waiting(event)
|
||||
elif stage == 'icdb_check_start':
|
||||
self._update()
|
||||
if not self.busy: self.status_label.setText('后台 ICDB 检查:'+self.icdb_phase.text())
|
||||
if self.logging_context:
|
||||
self.logging_context.logger.info('icdb_background block=%s stage=%s detail=%s', name, stage, detail)
|
||||
@@ -878,6 +962,11 @@ class MainWindow(QWidget):
|
||||
|
||||
def _icdb_done(self, task):
|
||||
from cbb_refresh_verify.icdb_maintenance import maintenance_counts
|
||||
task_keys = _library_path_keys(task.requests[0].lmc_file, task.path_lease)
|
||||
if (task_keys & _library_path_keys(self._queue_wait_library, task.path_lease)
|
||||
and (not self.busy or not task_keys & _library_path_keys(
|
||||
self.mentor_lmc_path or self.loaded_path, self.library_lease))):
|
||||
self._queue_wait_library = None
|
||||
counts = maintenance_counts(task.results)
|
||||
lease = task.path_lease
|
||||
if lease is not None:
|
||||
@@ -899,7 +988,7 @@ class MainWindow(QWidget):
|
||||
self.icdb_phase.setText(text)
|
||||
if not self.busy: self.status_label.setText(text)
|
||||
self.output.append(text+'\n'+str(task.report or task.report_error))
|
||||
summary = QMessageBox(self); self.icdb_summary = summary
|
||||
summary = self._new_result_summary('icdb_summary')
|
||||
task.summary = summary
|
||||
if not self.busy: self.summary = summary
|
||||
summary.setWindowTitle('ICDB 批量检查结果'); summary.setText(text)
|
||||
@@ -914,8 +1003,9 @@ class MainWindow(QWidget):
|
||||
& _library_path_keys(self.mentor_lmc_path or self.loaded_path, self.library_lease)):
|
||||
self.status_label.setText(f'请切回 {task.requests[0].lmc_file} 后释放该检查的残留。')
|
||||
return
|
||||
self.check_library_release()
|
||||
summary.addButton('查看残留并释放…', QMessageBox.ActionRole).clicked.connect(release_task)
|
||||
self.check_library_release(queued=self.busy)
|
||||
task.release_action = summary.addButton('查看残留并释放…', QMessageBox.ActionRole)
|
||||
task.release_action.clicked.connect(release_task)
|
||||
if offers:
|
||||
action = summary.addButton('选择副本恢复…', QMessageBox.ActionRole)
|
||||
task.recovery_action = action
|
||||
@@ -1161,7 +1251,7 @@ class MainWindow(QWidget):
|
||||
if (not self._native_backup_matches_library(result['library'], getattr(session, 'path_lease', None))
|
||||
or result['block'] != session.block):
|
||||
raise ValueError('原生会话返回的工程身份不一致。')
|
||||
refresh = (self._read_affected_records((session.block,))
|
||||
refresh = (self._read_affected_records((session.block,), library=session.library)
|
||||
if result.get('safe_to_continue') is True and same_library else None)
|
||||
return result, refresh
|
||||
def completed(payload):
|
||||
@@ -1183,7 +1273,7 @@ class MainWindow(QWidget):
|
||||
self.output.append(f'{session.block} · 退出尚未确认:{error}\n{session.job}')
|
||||
self.busy = True; self._update()
|
||||
self.stop.clear()
|
||||
self.worker = ServiceWorker(self._queued_action(read_result))
|
||||
self.worker = ServiceWorker(self._queued_action(read_result, library=session.library))
|
||||
self.worker.signals.succeeded.connect(completed)
|
||||
self.worker.signals.failed.connect(unconfirmed)
|
||||
self.worker.signals.finished.connect(self._finished)
|
||||
@@ -1262,6 +1352,7 @@ class MainWindow(QWidget):
|
||||
self._update()
|
||||
return
|
||||
requests = [replace(self._request(name), maintenance=maintenance, auto_repair=False) for name in names]
|
||||
library = requests[0].lmc_file
|
||||
self._batch_requests = tuple(requests)
|
||||
self._batch_records = {name: self._records_by_name[name] for name in names}
|
||||
self._reimport_offers = ()
|
||||
@@ -1289,6 +1380,7 @@ class MainWindow(QWidget):
|
||||
self.signals.event.emit({'block': req.block_name, 'stage': 'icdb_check_start'})
|
||||
return verify(req)
|
||||
results = run_batch(requests, verifier=verifier, stop=self.stop,
|
||||
item_executor=lambda req, action: self._queued_action(action, library=req.lmc_file)(),
|
||||
progress=lambda name, result: self.signals.event.emit({'block': name, 'stage': result.status,
|
||||
'error_category': result.error_category, 'evidence': str(result.evidence_path or ''),
|
||||
'detail': result.stderr or result.stdout}))
|
||||
@@ -1302,16 +1394,24 @@ class MainWindow(QWidget):
|
||||
self.signals.event.emit({'stage': 'report_failed', 'detail': str(error)})
|
||||
affected = [req.block_name for req, result in zip(requests, results) if result.status != 'SKIPPED']
|
||||
safe = all(result.safe_to_continue for result in results)
|
||||
refresh = self._read_affected_records(affected) if safe else None
|
||||
self.signals.batch_ready.emit((results, report))
|
||||
refresh = None
|
||||
if safe and not self.stop.is_set():
|
||||
from cbb_refresh_verify.operation_queue import QueueCancelled
|
||||
try:
|
||||
refresh = self._queued_action(lambda: self._read_affected_records(affected, library=library),
|
||||
label='批次已结束,状态刷新', library=library)()
|
||||
except QueueCancelled:
|
||||
pass # Cancelling the refresh must not erase completed item results.
|
||||
return results, report, affected, refresh
|
||||
self._start(action, self._batch_done)
|
||||
self._start(action, self._batch_refreshed, queued=False)
|
||||
|
||||
def _read_affected_records(self, names):
|
||||
def _read_affected_records(self, names, *, library):
|
||||
"""Worker-only read; never derive library state from action outcomes."""
|
||||
import pythoncom
|
||||
pythoncom.CoInitialize()
|
||||
try:
|
||||
path = Path(self.mentor_lmc_path or self.loaded_path)
|
||||
path = Path(library)
|
||||
try:
|
||||
statuses = self.status_refresher(tuple(names), path)
|
||||
# Publish before yielding the native queue, ahead of Qt callbacks.
|
||||
@@ -1367,9 +1467,8 @@ class MainWindow(QWidget):
|
||||
self._apply_filters()
|
||||
return tuple(self._records_by_name[name] for name in names if name in self._records_by_name)
|
||||
|
||||
def _defer_status_refresh(self, names):
|
||||
self._apply_refreshed_records((tuple(names), {}, None,
|
||||
'会话或数据库安全未确认;暂缓原生状态复核,请确认释放后重新读取。'))
|
||||
def _defer_status_refresh(self, names, reason='会话或数据库安全未确认;暂缓原生状态复核,请确认释放后重新读取。'):
|
||||
self._apply_refreshed_records((tuple(names), {}, None, reason))
|
||||
|
||||
def refresh_affected_records(self, names, callback=None):
|
||||
"""Start an affected-only authoritative refresh once native owners release.
|
||||
@@ -1390,13 +1489,20 @@ class MainWindow(QWidget):
|
||||
self._refreshing_records = False
|
||||
if callback:
|
||||
callback(records)
|
||||
self._start(lambda: self._read_affected_records(targets), refreshed)
|
||||
library = self.mentor_lmc_path or self.loaded_path
|
||||
self._start(lambda: self._read_affected_records(targets, library=library), refreshed)
|
||||
return True
|
||||
|
||||
def _progress(self, event):
|
||||
from shiboken6 import isValid
|
||||
if not isValid(self) or not isValid(self.cbb_table):
|
||||
return
|
||||
if event.get('stage') == 'waiting_native_slot':
|
||||
self.status_label.setText(event.get('detail', '已排队,等待执行'))
|
||||
self._queue_waiting(event)
|
||||
elif event.get('stage') == 'native_slot_acquired':
|
||||
self.status_label.setText(event.get('detail') or '正在执行当前任务…')
|
||||
self._update()
|
||||
if event.get('stage') in ('session_handoff', 'save_stop_requested'):
|
||||
self.status_label.setText(event.get('detail', '当前状态无法确认'))
|
||||
if (event.get('stage') == 'session_observation' and event.get('status') == 'RELEASED'
|
||||
@@ -1446,6 +1552,45 @@ class MainWindow(QWidget):
|
||||
if cell is not None:
|
||||
cell.setBackground(QColor('#E8F5E9'))
|
||||
|
||||
def _new_result_summary(self, attribute):
|
||||
previous = getattr(self, attribute, None)
|
||||
if previous is not None:
|
||||
previous.close()
|
||||
summary = QMessageBox(self)
|
||||
setattr(self, attribute, summary)
|
||||
summary.setAttribute(Qt.WA_DeleteOnClose)
|
||||
summary.finished.connect(lambda _: self._forget_result_summary(summary))
|
||||
return summary
|
||||
|
||||
def _forget_result_summary(self, summary):
|
||||
if getattr(self, '_batch_summary', None) is summary:
|
||||
self._reimport_summary_action = None
|
||||
self._residual_release_action = None
|
||||
self._resume_batch_action = None
|
||||
for attribute in ('summary', '_batch_summary', 'icdb_summary'):
|
||||
if getattr(self, attribute, None) is summary:
|
||||
setattr(self, attribute, None)
|
||||
for task in self.icdb_tasks:
|
||||
if getattr(task, 'summary', None) is summary:
|
||||
del task.summary
|
||||
if hasattr(task, 'recovery_action'):
|
||||
del task.recovery_action
|
||||
|
||||
def _batch_refreshed(self, outcome):
|
||||
if len(outcome) <= 2:
|
||||
return
|
||||
results, _, affected, refresh = outcome
|
||||
if refresh is None:
|
||||
reason = ('状态尚未复核,请重新读取。' if all(r.safe_to_continue for r in results)
|
||||
else '会话或数据库安全未确认;暂缓原生状态复核,请确认释放后重新读取。')
|
||||
self._defer_status_refresh(affected, reason)
|
||||
else:
|
||||
self._apply_refreshed_records(refresh)
|
||||
from shiboken6 import isValid
|
||||
summary = getattr(self, 'summary', None)
|
||||
self.status_label.setText(summary.text().replace('\n', ' ') if summary is not None and isValid(summary)
|
||||
else '批次已结束。')
|
||||
|
||||
def _batch_done(self, outcome):
|
||||
results, report = outcome[:2]
|
||||
failure_report = failure_report_path(report) if report is not None else '未写入'
|
||||
@@ -1454,12 +1599,7 @@ class MainWindow(QWidget):
|
||||
self._reimport_offers = tuple((req, self._batch_records[req.block_name], result)
|
||||
for req, result in zip(self._batch_requests, results)
|
||||
if req.maintenance and req.block_name in self._batch_records and offers_reimport(result))
|
||||
if len(outcome) > 2:
|
||||
_, _, affected, refresh = outcome
|
||||
if refresh is None:
|
||||
self._defer_status_refresh(affected)
|
||||
else:
|
||||
self._apply_refreshed_records(refresh)
|
||||
self._batch_refreshed(outcome)
|
||||
if self.library_lease is not None and any(not result.safe_to_continue for result in results):
|
||||
self._retain_path_lease(self.library_lease, hold_busy=True)
|
||||
for result in results:
|
||||
@@ -1507,7 +1647,7 @@ class MainWindow(QWidget):
|
||||
text += guidance
|
||||
status_text += guidance
|
||||
self.status_label.setText(status_text.replace('\n', ' ')); self.output.append(text)
|
||||
self.summary = QMessageBox(self)
|
||||
self.summary = self._new_result_summary('_batch_summary')
|
||||
self.summary.setWindowTitle('ICDB 批量检查结果' if self._global_icdb_run else 'CBB 校验结果')
|
||||
self.summary.setText(status_text)
|
||||
self.summary.setDetailedText(text)
|
||||
@@ -1544,9 +1684,22 @@ class MainWindow(QWidget):
|
||||
if not self.busy or self.stop.is_set():
|
||||
choice.choose('cancel')
|
||||
return
|
||||
self.version_dialog = PcbRestoreDialog(choice, self)
|
||||
self.status_label.setText(f'{choice.block}:等待选择 PCB 恢复版本。')
|
||||
self.icdb_phase.setText(f'{choice.block} · 等待选择 PCB 恢复版本')
|
||||
from ..pcb_open_consent import OpenChoice
|
||||
from .pcb_open_dialog import PcbOpenDialog
|
||||
from ..write_admission import WriteOwnerChoice
|
||||
from .write_owner_dialog import WriteOwnerDialog
|
||||
parent = self
|
||||
backup = getattr(self, 'backup_dialog', None)
|
||||
if backup is not None and backup.isVisible(): parent = backup
|
||||
management = getattr(self, 'management_dialog', None)
|
||||
if management is not None and management.isVisible(): parent = management
|
||||
dialog_class = (WriteOwnerDialog if isinstance(choice,WriteOwnerChoice) else
|
||||
PcbOpenDialog if isinstance(choice,OpenChoice) else PcbRestoreDialog)
|
||||
self.version_dialog = dialog_class(choice,parent)
|
||||
detail = ('等待确认库未被其他程序使用' if isinstance(choice,WriteOwnerChoice) else
|
||||
'等待读写打开确认' if isinstance(choice,OpenChoice) else '等待选择 PCB 恢复版本')
|
||||
self.status_label.setText(f'{choice.block}:{detail}。')
|
||||
self.icdb_phase.setText(f'{choice.block} · {detail}')
|
||||
self.version_dialog.show()
|
||||
|
||||
def request_stop(self):
|
||||
@@ -1576,14 +1729,19 @@ class MainWindow(QWidget):
|
||||
if self.version_dialog is not None:
|
||||
self.version_dialog.reject()
|
||||
self.version_dialog = None
|
||||
# Foreground completion must not erase an independent check's wait.
|
||||
if not (self._icdb_active() and not self.icdb_task.stop.is_set()
|
||||
and _library_path_keys(self._queue_wait_library, self.icdb_task.path_lease)
|
||||
& _library_path_keys(self.icdb_task.requests[0].lmc_file, self.icdb_task.path_lease)):
|
||||
self._queue_wait_library = None
|
||||
self.busy = False; self._update()
|
||||
if self._reload_after_maintenance:
|
||||
from PySide6.QtCore import QTimer
|
||||
self._reload_after_maintenance = False
|
||||
QTimer.singleShot(0, self.load_library)
|
||||
|
||||
def open_logs(self):
|
||||
self.data_root.mkdir(parents=True, exist_ok=True); os.startfile(str(self.data_root))
|
||||
try:
|
||||
self.data_root.mkdir(parents=True, exist_ok=True)
|
||||
os.startfile(str(self.data_root))
|
||||
except Exception as error:
|
||||
self._display_error(error)
|
||||
|
||||
def recover(self):
|
||||
if not self.recovery_path: return
|
||||
@@ -1602,6 +1760,9 @@ class MainWindow(QWidget):
|
||||
else:
|
||||
self._closing = True
|
||||
self.busy = True; self._update()
|
||||
self.setWindowTitle('CBB 刷新校验 · 等待任务安全结束')
|
||||
self.status_label.setText('正在等待当前操作安全结束,完成后关闭。')
|
||||
self.close_wait_timer.start()
|
||||
retained = None
|
||||
if self._native_backup_session is not None:
|
||||
self.native_backup_timer.stop()
|
||||
@@ -1614,11 +1775,16 @@ class MainWindow(QWidget):
|
||||
self._close_when_idle()
|
||||
event.ignore()
|
||||
|
||||
def _show_close_wait_notice(self):
|
||||
if self._closing and not self._close_ready:
|
||||
self.setWindowTitle('CBB 刷新校验 · 仍在等待任务安全结束')
|
||||
self.status_label.setText('当前操作尚未结束,仍在等待安全关闭。')
|
||||
|
||||
def _close_when_idle(self):
|
||||
owners = [self, *self.icdb_tasks]
|
||||
for name in ('management_dialog', 'backup_dialog', 'release_dialog'):
|
||||
owners.append(getattr(self, name, None))
|
||||
active = False
|
||||
active = bool(self.lifecycle_pool.activeThreadCount())
|
||||
for owner in owners:
|
||||
try:
|
||||
pool = getattr(owner, 'pool', None)
|
||||
@@ -1628,5 +1794,6 @@ class MainWindow(QWidget):
|
||||
if self._lease_pending or active:
|
||||
QTimer.singleShot(20, self._close_when_idle)
|
||||
return
|
||||
self.close_wait_timer.stop()
|
||||
self._close_ready = True
|
||||
self.close()
|
||||
@@ -9,16 +9,17 @@ from PySide6.QtWidgets import (QCheckBox, QDialog, QFileDialog, QHBoxLayout, QLa
|
||||
|
||||
from .workers import ServiceWorker
|
||||
from .backup_notice import MANUAL_BACKUP_NOTICE
|
||||
from ..management import run_management_batch, validate_name
|
||||
from ..management import run_management_batch
|
||||
|
||||
RESULT_LABELS = {
|
||||
'REMOVED': '已移除', 'UPLOADED': '已上传 / 未自动校验',
|
||||
'UPLOADED_VERIFIED': '已上传且校验通过', 'UPLOADED_VERIFY_FAILED': '已上传但校验未通过',
|
||||
'UPLOAD_FAILED': '上传失败', 'RECOVERY_REQUIRED': '需要人工恢复',
|
||||
'BLOCKED': '操作被阻止', 'UNSUPPORTED': '当前环境不支持',
|
||||
'SKIPPED': '已跳过 / 未执行', 'CANCELLED': '已取消',
|
||||
}
|
||||
STAGE_LABELS = {
|
||||
'prepare_identity': '正在核对来源工程内容',
|
||||
'prepare_identity': '正在检查来源工程文件',
|
||||
'catalog_before': '正在核对原生目录', 'baseline': '正在记录中心库内容基线',
|
||||
'stage_source': '正在复制并检查来源工程', 'native_remove': '正在移除',
|
||||
'removed': '原条目已移除', 'native_add': '正在上传', 'uploaded': '上传已确认',
|
||||
@@ -33,11 +34,13 @@ STAGE_LABELS = {
|
||||
|
||||
class ManagementSignals(QObject):
|
||||
progress = Signal(object)
|
||||
choice = Signal(object)
|
||||
|
||||
|
||||
class ManagementDialog(QDialog):
|
||||
completed = Signal(object)
|
||||
before_execute = Signal(object)
|
||||
release_requested = Signal(object)
|
||||
|
||||
def __init__(self, requests, parent=None, *, adapter=None, runner=None, recovery_from=None):
|
||||
super().__init__(parent)
|
||||
@@ -59,6 +62,8 @@ class ManagementDialog(QDialog):
|
||||
self.pool = QThreadPool(self); self.pool.setMaxThreadCount(1)
|
||||
self.signals = ManagementSignals(self)
|
||||
self.signals.progress.connect(self._progress)
|
||||
if parent is not None and hasattr(parent, '_show_version_choice'):
|
||||
self.signals.choice.connect(parent._show_version_choice)
|
||||
self.setWindowTitle({'add': '新增 CBB', 'update': '同名更新 CBB', 'remove': '移除 CBB'}[self.operation])
|
||||
self.resize(850, 450)
|
||||
self.table = QTableWidget(0, 4)
|
||||
@@ -73,6 +78,9 @@ class ManagementDialog(QDialog):
|
||||
self.auto_verify.setVisible(self.operation != 'remove')
|
||||
self.status_label = QLabel(MANUAL_BACKUP_NOTICE + ' 更新会先移除再重新导入,失败时请使用手动备份恢复。')
|
||||
self.status_label.setWordWrap(True)
|
||||
self.release_wait_button = QPushButton('查看残留会话…')
|
||||
self.release_wait_button.hide()
|
||||
self.release_wait_button.clicked.connect(lambda: self.release_requested.emit(self.template.library))
|
||||
self.output = QTextEdit(); self.output.setReadOnly(True)
|
||||
self.output.document().setMaximumBlockCount(2000)
|
||||
self.output.hide()
|
||||
@@ -93,7 +101,8 @@ class ManagementDialog(QDialog):
|
||||
layout.addWidget(QLabel(f'目标库:{self.template.library}'))
|
||||
layout.addWidget(self.table)
|
||||
layout.addWidget(self.sources_button); layout.addWidget(self.auto_verify)
|
||||
layout.addWidget(self.status_label); layout.addWidget(self.logs_button); layout.addWidget(self.output)
|
||||
layout.addWidget(self.status_label); layout.addWidget(self.release_wait_button)
|
||||
layout.addWidget(self.logs_button); layout.addWidget(self.output)
|
||||
buttons = QHBoxLayout()
|
||||
for widget in (self.execute_button, self.stop_button, self.close_button): buttons.addWidget(widget)
|
||||
layout.addLayout(buttons)
|
||||
@@ -142,10 +151,7 @@ class ManagementDialog(QDialog):
|
||||
try:
|
||||
if not requests:
|
||||
raise ValueError('请先选择来源工程。')
|
||||
for request in requests:
|
||||
validate_name(request.name)
|
||||
if request.operation != 'remove' and (request.source is None or not request.source.is_file()):
|
||||
raise ValueError(f'{request.name}:请选择完整来源 PRJ。')
|
||||
# Per-item input errors belong in batch results, so valid rows still run.
|
||||
if len({(r.partition.casefold(), r.name.casefold()) for r in requests}) != len(requests):
|
||||
raise ValueError('批次包含重复目标名称。')
|
||||
except ValueError as error:
|
||||
@@ -167,15 +173,30 @@ class ManagementDialog(QDialog):
|
||||
self._enabled(False)
|
||||
self.before_execute.emit([r.name for r in requests])
|
||||
def execute():
|
||||
choices={'version_prompt':self.signals.choice.emit} if self.runner is run_management_batch or self.recovery_from else {}
|
||||
action = lambda: self.runner(requests, adapter=self.adapter, stop=self.stop,
|
||||
progress=self.signals.progress.emit)
|
||||
progress=self.signals.progress.emit,**choices)
|
||||
if self.native_queue is None: return action()
|
||||
from ..operation_queue import QueueCancelled
|
||||
from ..session_record import library_available
|
||||
from ..session_record import library_available, library_wait_reason
|
||||
try:
|
||||
if self.runner is run_management_batch:
|
||||
def item(request, action):
|
||||
return self.native_queue.run(action, stop=self.stop,
|
||||
ready=lambda: library_available(request.library),
|
||||
wait_state=lambda: library_wait_reason(request.library),
|
||||
waiting=lambda: self.signals.progress.emit({'stage': 'waiting_native_slot',
|
||||
'retained': not library_available(request.library),
|
||||
'detail': library_wait_reason(request.library) or '已排队,等待当前原生操作结束'}))
|
||||
return self.runner(requests, adapter=self.adapter, stop=self.stop,
|
||||
progress=self.signals.progress.emit, item_executor=item,
|
||||
version_prompt=self.signals.choice.emit)
|
||||
return self.native_queue.run(action, stop=self.stop, waiting=lambda: self.signals.progress.emit(
|
||||
{'stage': 'waiting_native_slot', 'detail': '已排队,等待当前检查结束'}),
|
||||
ready=lambda: library_available(self.template.library))
|
||||
{'stage': 'waiting_native_slot',
|
||||
'retained': not library_available(self.template.library),
|
||||
'detail': library_wait_reason(self.template.library) or '已排队,等待当前检查结束'}),
|
||||
ready=lambda: library_available(self.template.library),
|
||||
wait_state=lambda: library_wait_reason(self.template.library))
|
||||
except QueueCancelled as error:
|
||||
from ..management import ManagementResult
|
||||
return [ManagementResult(r.operation, r.library, r.name, r.partition, r.source, r.auto_verify,
|
||||
@@ -194,6 +215,7 @@ class ManagementDialog(QDialog):
|
||||
|
||||
def _progress(self, event):
|
||||
stage = str(event.get('stage', ''))
|
||||
self.release_wait_button.setVisible(stage == 'waiting_native_slot' and bool(event.get('retained')))
|
||||
text = f'{event.get("block", "")} {STAGE_LABELS.get(stage, RESULT_LABELS.get(stage, "正在处理"))}'
|
||||
if stage == 'waiting_native_slot': text = str(event.get('detail', '已排队,等待执行'))
|
||||
self.output.append(str(event))
|
||||
@@ -211,8 +233,8 @@ class ManagementDialog(QDialog):
|
||||
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"])} 个主要文件。')
|
||||
text += (f'\n已比对的工程文件:新增 {len(changes["added"])}、删除 {len(changes["deleted"])}、'
|
||||
f'修改 {len(changes["modified"])};范围仅限报告列出的工程文件。')
|
||||
else:
|
||||
summary += ',变更清单待核对'
|
||||
text += '\n'+changes.get('detail', '变更清单未确认')
|
||||
@@ -239,6 +261,7 @@ class ManagementDialog(QDialog):
|
||||
request.source, request.auto_verify, 'complete', 'RECOVERY_REQUIRED', False, str(error))])
|
||||
|
||||
def _finished(self):
|
||||
self.release_wait_button.hide()
|
||||
self.busy = False; self._enabled(True)
|
||||
|
||||
def reject(self):
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
|
||||
|
||||
class PcbOpenDialog(QMessageBox):
|
||||
def __init__(self, choice, parent=None):
|
||||
super().__init__(parent)
|
||||
self.choice = choice
|
||||
self.setWindowTitle('确认打开 PCB 工程')
|
||||
self.setIcon(QMessageBox.Question)
|
||||
self.setText(f'CBB:{choice.block}\n中心库:{choice.library}\n\n'
|
||||
'PCB 提示上次可能未正常关闭,或工程仍被其他用户打开。\n'
|
||||
'请确认没有其他用户打开此工程,再选择继续以读写权限打开。')
|
||||
self.continue_button = self.addButton('确认无人使用,继续打开', QMessageBox.ActionRole)
|
||||
self.skip_button = self.addButton('跳过本项', QMessageBox.ActionRole)
|
||||
self.cancel_button = self.addButton('取消本批次', QMessageBox.RejectRole)
|
||||
self.setDefaultButton(self.cancel_button)
|
||||
self.setEscapeButton(self.cancel_button)
|
||||
self.setModal(True)
|
||||
self.buttonClicked.connect(lambda b: choice.choose('continue' if b is self.continue_button else
|
||||
'skip' if b is self.skip_button else 'cancel'))
|
||||
self.finished.connect(lambda _: choice.choose('cancel'))
|
||||
@@ -7,7 +7,7 @@ from PySide6.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushB
|
||||
QTableWidget, QTableWidgetItem, QHeaderView, QMessageBox)
|
||||
|
||||
from .workers import ServiceWorker
|
||||
from ..residual_sessions import force_block_reason
|
||||
from ..residual_sessions import force_block_reason, release_targets_complete
|
||||
|
||||
|
||||
class ResidualReleaseDialog(QDialog):
|
||||
@@ -19,6 +19,7 @@ class ResidualReleaseDialog(QDialog):
|
||||
self.library, self.evidence_dir = Path(library), Path(evidence_dir)
|
||||
self.plan = None
|
||||
self.native_queue = None
|
||||
self.release_finalizer = None
|
||||
self.busy = False
|
||||
self.stop = Event()
|
||||
self._refresh_after = False
|
||||
@@ -33,8 +34,8 @@ class ResidualReleaseDialog(QDialog):
|
||||
self.runtime_label = QLabel()
|
||||
self.runtime_label.setWordWrap(True)
|
||||
layout.addWidget(self.runtime_label)
|
||||
self.table = QTableWidget(0, 6)
|
||||
self.table.setHorizontalHeaderLabels(['工程', '程序', 'PID', '状态', '窗口位置', '程序路径'])
|
||||
self.table = QTableWidget(0, 8)
|
||||
self.table.setHorizontalHeaderLabels(['工程', '程序', 'PID', '状态', '窗口位置', '程序路径', '确认范围', '执行结果'])
|
||||
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
|
||||
self.table.horizontalHeader().setSectionResizeMode(3, QHeaderView.Stretch)
|
||||
self.table.setEditTriggers(QTableWidget.NoEditTriggers)
|
||||
@@ -91,9 +92,15 @@ class ResidualReleaseDialog(QDialog):
|
||||
def _rows(self, sessions):
|
||||
self.table.setRowCount(len(sessions))
|
||||
for index, session in enumerate(sessions):
|
||||
allowed = session.get('consent_allowed')
|
||||
permission = '允许' if allowed is True else '未允许' if allowed is False else '待确认'
|
||||
outcome = {'RELEASED': '已释放', 'WAITING': '未释放', 'IDENTITY_CHANGED': '身份已变化',
|
||||
'OBSERVED': '仅观察,未关闭',
|
||||
'CANCELLED': '已停止', 'REQUESTING': '执行中', 'NOT_STARTED': '尚未执行'}.get(
|
||||
session.get('release_status'), '待执行')
|
||||
for column, value in enumerate((session.get('project', ''), session['name'],
|
||||
session['pid'], session.get('detail', ''), ', '.join(session.get('desktops', [])),
|
||||
session.get('image', session.get('executable', '')))):
|
||||
session.get('image', session.get('executable', '')), permission, outcome)):
|
||||
self.table.setItem(index, column, QTableWidgetItem(str(value)))
|
||||
if sessions: self.table.setCurrentCell(0, 0)
|
||||
|
||||
@@ -137,7 +144,8 @@ class ResidualReleaseDialog(QDialog):
|
||||
from cbb_refresh_verify.residual_sessions import request_native_cancel
|
||||
self.before_release.emit(); self.stop.clear()
|
||||
def execute():
|
||||
action = lambda: request_native_cancel(session, self.library, self.evidence_dir, stop=self.stop)
|
||||
action = lambda: self._finalize_release_result(
|
||||
request_native_cancel(session, self.library, self.evidence_dir, stop=self.stop))
|
||||
return self.native_queue.run(action, stop=self.stop) if self.native_queue is not None else action()
|
||||
def done(result):
|
||||
self.message.setText(result.get('detail') or '\n'.join(r.get('detail', '') for r in result['sessions']))
|
||||
@@ -155,13 +163,23 @@ class ResidualReleaseDialog(QDialog):
|
||||
# Both paths were canonicalized by the worker; GUI comparison must not touch SMB.
|
||||
if (proof.get('status') != 'RELEASE_CONFIRMED'
|
||||
or Path(proof.get('library', '')).absolute() != self.library.absolute()
|
||||
or any(r.get('release_status') != 'RELEASED' for r in result['sessions'])):
|
||||
or not release_targets_complete(result['sessions'])):
|
||||
return False
|
||||
self.plan = None
|
||||
self.runtime_label.clear()
|
||||
self.released.emit(proof)
|
||||
return True
|
||||
|
||||
def _finalize_release_result(self, result):
|
||||
"""Complete mapping cleanup before the serialized release admits new work."""
|
||||
proof = result.get('proof', {})
|
||||
if (self.release_finalizer is not None and proof.get('status') == 'RELEASE_CONFIRMED'
|
||||
and Path(proof.get('library', '')).absolute() == self.library.absolute()
|
||||
and release_targets_complete(result['sessions'])):
|
||||
self.release_finalizer(proof)
|
||||
return {**result, 'proof': {**proof, 'mapping_cleanup_complete': True}}
|
||||
return result
|
||||
|
||||
def answer_prompt(self):
|
||||
if self.busy or not self.plan: return
|
||||
row = self.table.currentRow()
|
||||
@@ -186,7 +204,7 @@ class ResidualReleaseDialog(QDialog):
|
||||
self.library = Path(plan['library'])
|
||||
self.plan = plan
|
||||
self._rows(plan['sessions'])
|
||||
text = ('确认后逐项正常关闭下列会话;有未保存更改时,可选择保存或保留。'
|
||||
text = ('确认后正常关闭已确认属于当前库的会话,并复查库占用;其他会话仅作观察。'
|
||||
if plan['sessions'] else '未发现活跃会话。')
|
||||
records = plan.get('previous_records', [])
|
||||
if records:
|
||||
@@ -231,7 +249,8 @@ class ResidualReleaseDialog(QDialog):
|
||||
def done(result):
|
||||
self.plan = {**plan, 'sessions': result['sessions']}
|
||||
self._rows(result['sessions'])
|
||||
count = sum(row['release_status'] == 'RELEASED' for row in result['sessions'])
|
||||
count = sum(row['release_status'] == 'RELEASED' and row.get('scope_confirmed') is not False
|
||||
for row in result['sessions'])
|
||||
if self._accept_release_proof(result):
|
||||
self.message.setText(f'已释放 {count} 个会话,旧占用记录已解除。'
|
||||
+ ('\n记录保存失败:'+result['evidence_error'] if result.get('evidence_error') else ''))
|
||||
@@ -239,8 +258,13 @@ class ResidualReleaseDialog(QDialog):
|
||||
self.message.setText(f'已释放 {count} 个会话,其余会话或库状态仍待确认。'
|
||||
+ ('\n'+result['detail'] if result.get('detail') else '可查看原生提示、处理保存或请求取消后重新检查。')
|
||||
+ ('\n记录保存失败:'+result['evidence_error'] if result.get('evidence_error') else ''))
|
||||
allowed = [row for row in result['sessions'] if row.get('consent_allowed') is True]
|
||||
pending = sum(row.get('release_status') != 'RELEASED' for row in allowed)
|
||||
self.message.setText(self.message.text()+f'\n确认允许 {len(allowed)} 项,其中未释放 {pending} 项。')
|
||||
def execute():
|
||||
action = lambda: release_residual_sessions(plan, self.evidence_dir, stop=self.stop, force=force)
|
||||
def action():
|
||||
result = release_residual_sessions(plan, self.evidence_dir, stop=self.stop, force=force)
|
||||
return self._finalize_release_result(result)
|
||||
return self.native_queue.run(action, stop=self.stop) if self.native_queue is not None else action()
|
||||
self._start(execute, done)
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
|
||||
|
||||
class WriteOwnerDialog(QMessageBox):
|
||||
def __init__(self, choice, parent=None):
|
||||
super().__init__(parent)
|
||||
self.choice = choice
|
||||
self.setWindowTitle('确认中心库未被占用')
|
||||
self.setIcon(QMessageBox.Question)
|
||||
owners = '\n'.join(f'{row["name"]} · PID {row["pid"]}' for row in choice.owners)
|
||||
self.setText(f'中心库:{choice.library}\n当前 CBB:{choice.block}\n\n'
|
||||
f'无法确认下列程序是否打开了此库:\n{owners}\n\n'
|
||||
'请确认这些程序在本批次完成前都不使用此库,再继续。')
|
||||
self.setDetailedText('\n'.join(f'PID {row["pid"]}:{row["image"]}' for row in choice.owners))
|
||||
self.continue_button = self.addButton('已确认未使用此库,继续', QMessageBox.ActionRole)
|
||||
self.skip_button = self.addButton('跳过本项', QMessageBox.ActionRole)
|
||||
self.cancel_button = self.addButton('取消本批次', QMessageBox.RejectRole)
|
||||
self.setDefaultButton(self.cancel_button)
|
||||
self.setEscapeButton(self.cancel_button)
|
||||
self.setModal(True)
|
||||
self.buttonClicked.connect(lambda b: choice.choose('continue' if b is self.continue_button else
|
||||
'skip' if b is self.skip_button else 'cancel'))
|
||||
self.finished.connect(lambda _: choice.choose('cancel'))
|
||||
@@ -940,6 +940,7 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
|
||||
last_activity_key = None
|
||||
phase = DialogPhase.PCB_STARTING
|
||||
restore_controller = None
|
||||
open_controller = None
|
||||
dialog_agent = None
|
||||
latest_snapshots = ()
|
||||
if dialog_supervisor_factory is None:
|
||||
@@ -1038,6 +1039,17 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
|
||||
dialog_result = dialog_supervisor.poll()
|
||||
else:
|
||||
dialog_result = dialog_supervisor.poll()
|
||||
if (version_prompt is not None and consent is None and dialog_agent is not None
|
||||
and not request.diagnostic_only and not request.native_lm_verify
|
||||
and dialog_result.error_code == 'DATABASE_RECOVERY_REQUIRED'
|
||||
and dialog_result.snapshot is not None):
|
||||
from .pcb_open_consent import OpenController, exact_prompt
|
||||
if exact_prompt(dialog_result.snapshot):
|
||||
if open_controller is None:
|
||||
open_controller = OpenController(job)
|
||||
dialog_result = open_controller.handle(dialog_result.snapshot, dialog_result.observed_snapshots,
|
||||
target_pid=target_pid, launcher_pid=launcher_pid, worker_pid=process.pid,
|
||||
show=version_prompt, perform=dialog_supervisor.backend.perform)
|
||||
if (consent is not None and dialog_agent is not None
|
||||
and dialog_result.error_code == 'DATABASE_RECOVERY_REQUIRED'
|
||||
and dialog_result.snapshot is not None and exact_prompt(dialog_result.snapshot)):
|
||||
@@ -1050,11 +1062,11 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
|
||||
from .dialog_rules import archive_version_choice
|
||||
choice_path = archive_version_choice(dialog_result.snapshot, root)
|
||||
dialog_result = replace(dialog_result, detail=dialog_result.detail + f'\n版本候选与原生窗口证据:{choice_path}')
|
||||
if (version_prompt is not None and consent is not None and dialog_agent is not None
|
||||
if (version_prompt is not None and not request.diagnostic_only and dialog_agent is not None
|
||||
and dialog_result.snapshot.hwnd in {int(h) for h in process.desktop.EnumDesktopWindows()}):
|
||||
from .pcb_restore_prompt import RestoreController
|
||||
if restore_controller is None:
|
||||
restore_controller = RestoreController(job)
|
||||
restore_controller = RestoreController(job, user_open=consent is None)
|
||||
dialog_result = restore_controller.handle(dialog_result.snapshot,
|
||||
dialog_result.observed_snapshots, target_pid=target_pid, launcher_pid=launcher_pid,
|
||||
worker_pid=process.pid, companion_pids=tuple(process.companion_pids),
|
||||
@@ -1089,7 +1101,8 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
|
||||
# recovery checks for remaining native database clients.
|
||||
_stop_worker(process, timeout=40)
|
||||
return finish(VerifyResult(
|
||||
'FAIL',
|
||||
'CANCELLED' if dialog_result.error_code == 'USER_CANCELLED' else
|
||||
'SKIPPED' if dialog_result.error_code == 'PCB_OPEN_SKIPPED' else 'FAIL',
|
||||
stderr=f'{dialog_result.error_code}: {dialog_result.detail}',
|
||||
error_stage=phase.value,
|
||||
safe_to_continue=False,
|
||||
@@ -1291,7 +1304,7 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
|
||||
return finish(result)
|
||||
|
||||
|
||||
def run_batch(requests, max_workers=1, verifier=None, *, stop=None, progress=None):
|
||||
def run_batch(requests, max_workers=1, verifier=None, *, stop=None, progress=None, item_executor=None):
|
||||
"""Run serially and stop when database/session safety is unconfirmed."""
|
||||
if max_workers != 1:
|
||||
raise ValueError('Only serial Verify is supported for the shared Library Manager session')
|
||||
@@ -1308,10 +1321,18 @@ def run_batch(requests, max_workers=1, verifier=None, *, stop=None, progress=Non
|
||||
result = VerifyResult('SKIPPED', stderr='同库原生会话尚未释放,未启动新的写入')
|
||||
else:
|
||||
try:
|
||||
result = verifier(request)
|
||||
def execute():
|
||||
result = verifier(request)
|
||||
if not result.safe_to_continue:
|
||||
from .operation_lifecycle import recheck_failed_release
|
||||
result = recheck_failed_release(request.lmc_file, request.block_name, result)
|
||||
return result
|
||||
result = item_executor(request, execute) if item_executor is not None else execute()
|
||||
except Exception as error:
|
||||
from .operation_queue import QueueCancelled
|
||||
# An unexpected exception cannot establish database safety.
|
||||
result = VerifyResult('FAIL', stderr=str(error), safe_to_continue=False)
|
||||
result = VerifyResult('CANCELLED' if isinstance(error, QueueCancelled) else 'FAIL',
|
||||
stderr=str(error), safe_to_continue=isinstance(error, QueueCancelled))
|
||||
results.append(result)
|
||||
# Never start another writer after an unconfirmed native shutdown.
|
||||
if not result.safe_to_continue:
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
"""Batch-local user confirmation for native clients with unknown target paths."""
|
||||
from pathlib import Path
|
||||
import time
|
||||
from uuid import uuid4
|
||||
|
||||
from .pcb_open_consent import OpenChoice
|
||||
from .session_record import process_identity
|
||||
|
||||
|
||||
class WriteOwnerChoice(OpenChoice):
|
||||
def __init__(self, block, library, owners):
|
||||
super().__init__(block, library)
|
||||
self.owners = tuple(dict(row) for row in owners)
|
||||
|
||||
|
||||
class WriteAdmissionDeclined(ValueError):
|
||||
def __init__(self, decision, detail=None):
|
||||
self.decision = decision
|
||||
super().__init__(detail or ('已取消本批次,未提交后续写入。' if decision == 'cancel' else
|
||||
'用户跳过本项,未确认未知程序与目标库无关。'))
|
||||
|
||||
|
||||
class WriteAdmission:
|
||||
def __init__(self, *, prompt=None, stop=None):
|
||||
self.prompt, self.stop = prompt, stop
|
||||
self._grants = {}
|
||||
|
||||
def _identities(self, owners):
|
||||
rows = []
|
||||
for row in owners:
|
||||
try:
|
||||
identity = process_identity(row['pid'])
|
||||
except Exception as error:
|
||||
if getattr(error, 'winerror', None) == 87:
|
||||
continue
|
||||
raise
|
||||
if Path(identity['image']).name.casefold() != row['name'].casefold():
|
||||
raise ValueError('TARGET_NATIVE_OWNER_UNCONFIRMED: PID 已被其他程序复用,请重新检查。')
|
||||
if row.get('executable') and Path(row['executable']).resolve() != Path(identity['image']).resolve():
|
||||
raise ValueError('TARGET_NATIVE_OWNER_UNCONFIRMED: 原生程序身份已变化,请重新检查。')
|
||||
rows.append({**identity, 'name': row['name']})
|
||||
return tuple(sorted((row['pid'], row['created_handle'], row['image'], row['owner_sid'], row['session_id'])
|
||||
for row in rows)), rows
|
||||
|
||||
def confirmed(self, library, owners):
|
||||
key = str(Path(library).resolve()).casefold()
|
||||
identities, _ = self._identities(owners)
|
||||
return set(identities).issubset(self._grants.get(key, set()))
|
||||
|
||||
def confirm(self, library, owners, *, evidence, block):
|
||||
key = str(Path(library).resolve()).casefold()
|
||||
identities, rows = self._identities(owners)
|
||||
if set(identities).issubset(self._grants.get(key, set())):
|
||||
return
|
||||
if self.prompt is None:
|
||||
raise WriteAdmissionDeclined('skip',
|
||||
'TARGET_NATIVE_OWNER_UNCONFIRMED: 无法确认原生程序是否使用目标库,未执行;请通过界面核对后选择。')
|
||||
choice = WriteOwnerChoice(block, str(Path(library)), rows)
|
||||
self.prompt(choice)
|
||||
while choice.decision is None and not (self.stop is not None and self.stop.is_set()):
|
||||
time.sleep(.05)
|
||||
decision = choice.decision or 'cancel'
|
||||
if decision != 'continue':
|
||||
if decision == 'cancel' and self.stop is not None:
|
||||
self.stop.set()
|
||||
raise WriteAdmissionDeclined(decision)
|
||||
current, _ = self._identities(owners)
|
||||
if not set(current).issubset(identities):
|
||||
raise ValueError('TARGET_NATIVE_OWNER_UNCONFIRMED: 确认期间进程身份已变化,请重新检查。')
|
||||
from .management import _write_json
|
||||
root = Path(evidence)
|
||||
root.mkdir(parents=True, exist_ok=True)
|
||||
_write_json(root/('write-owner-consent-'+uuid4().hex+'.json'), dict(
|
||||
intent='user_confirmed_unknown_clients_do_not_use_target_library', library=str(Path(library).resolve()),
|
||||
block=block, scope='current_batch_library', owners=rows, choice='continue',
|
||||
proves_native_ownership=False, requires_fresh_resource_checks=True))
|
||||
self._grants.setdefault(key, set()).update(current)
|
||||
@@ -0,0 +1,77 @@
|
||||
"""Real Qt click helpers; external native writers stay outside these UI tests."""
|
||||
from contextlib import contextmanager
|
||||
|
||||
from PySide6.QtCore import QPoint, QTimer, Qt
|
||||
from PySide6.QtWidgets import QApplication, QCheckBox, QDialogButtonBox, QFileDialog, QMessageBox
|
||||
|
||||
|
||||
def press(qtbot, button):
|
||||
assert button.isVisible(), button.text()
|
||||
assert button.isEnabled(), button.text()
|
||||
if isinstance(button, QCheckBox):
|
||||
qtbot.mouseClick(button, Qt.LeftButton, pos=QPoint(8, button.height()//2))
|
||||
else:
|
||||
qtbot.mouseClick(button, Qt.LeftButton)
|
||||
|
||||
|
||||
def tab(qtbot, window, index):
|
||||
qtbot.mouseClick(window.section_tabs, Qt.LeftButton,
|
||||
pos=window.section_tabs.tabRect(index).center())
|
||||
assert window.section_stack.currentIndex() == index
|
||||
|
||||
|
||||
@contextmanager
|
||||
def modal_click(qtbot, standard=None, *, file=None, cancel_file=False):
|
||||
"""Answer the real nested dialog by clicking its actual button."""
|
||||
timer = QTimer()
|
||||
deadline = QTimer()
|
||||
deadline.setSingleShot(True)
|
||||
seen, errors = [], []
|
||||
prepared = False
|
||||
|
||||
def answer():
|
||||
nonlocal prepared
|
||||
dialog = QApplication.activeModalWidget()
|
||||
try:
|
||||
if standard is not None and isinstance(dialog, QMessageBox):
|
||||
button = dialog.button(standard)
|
||||
if button is None:
|
||||
return
|
||||
elif isinstance(dialog, QFileDialog) and (file is not None or cancel_file):
|
||||
box = dialog.findChild(QDialogButtonBox)
|
||||
if not cancel_file and not prepared:
|
||||
dialog.setDirectory(str(file.parent))
|
||||
dialog.selectFile(str(file))
|
||||
prepared = True
|
||||
return
|
||||
button = box.button(QDialogButtonBox.Cancel if cancel_file else QDialogButtonBox.Open)
|
||||
else:
|
||||
return
|
||||
if button is None or not button.isEnabled():
|
||||
return
|
||||
seen.append(dialog.windowTitle())
|
||||
timer.stop()
|
||||
press(qtbot, button)
|
||||
except Exception as error:
|
||||
errors.append(str(error))
|
||||
timer.stop()
|
||||
if dialog is not None:
|
||||
dialog.reject()
|
||||
|
||||
def timeout():
|
||||
errors.append('The expected modal button did not become available')
|
||||
dialog = QApplication.activeModalWidget()
|
||||
if dialog is not None:
|
||||
dialog.reject()
|
||||
|
||||
timer.timeout.connect(answer)
|
||||
deadline.timeout.connect(timeout)
|
||||
timer.start(10)
|
||||
deadline.start(4000)
|
||||
try:
|
||||
yield seen
|
||||
finally:
|
||||
timer.stop()
|
||||
deadline.stop()
|
||||
assert not errors, errors
|
||||
assert len(seen) == 1, seen
|
||||
@@ -0,0 +1,573 @@
|
||||
"""Click every owned control; use real dialogs and controlled native outcomes."""
|
||||
from pathlib import Path
|
||||
from threading import Event
|
||||
from types import SimpleNamespace
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QMessageBox, QPushButton, QTextEdit
|
||||
from shiboken6 import isValid
|
||||
|
||||
from button_simulation import modal_click, press, tab
|
||||
from cbb_refresh_verify.management import Capability, ManagementRequest, ManagementResult
|
||||
from cbb_refresh_verify.models import CbbRecord, LibraryReadResult
|
||||
from cbb_refresh_verify.verify_runner import VerifyRequest, VerifyResult
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def controls(qtbot, tmp_path, monkeypatch, qapp):
|
||||
import cbb_refresh_verify.ui.main_window as ui
|
||||
from cbb_refresh_verify import library_lock
|
||||
old_native = qapp.testAttribute(Qt.AA_DontUseNativeDialogs)
|
||||
qapp.setAttribute(Qt.AA_DontUseNativeDialogs, True)
|
||||
library = tmp_path/'library.lmc'
|
||||
library.touch()
|
||||
source = tmp_path/'Beta.prj'
|
||||
source.write_text('KEY iCDBDir "database"\n', encoding='utf-8')
|
||||
state = SimpleNamespace(library=library, source=source, reads=[], runs=[], opened=[],
|
||||
entered=Event(), finish=Event(), native=[], result=None)
|
||||
state.finish.set()
|
||||
records = (CbbRecord('Ready', 'Power', status='READY'),
|
||||
CbbRecord('Beta', 'Power', status='PENDING'), CbbRecord('Gamma', 'Analog', status='UNKNOWN'))
|
||||
lease = SimpleNamespace(mentor_path=library, display_path=library, drive='', remote_root='',
|
||||
close=lambda: None, retain_for_recovery=lambda: None)
|
||||
|
||||
def verify(request):
|
||||
state.runs.append(request)
|
||||
state.entered.set()
|
||||
assert state.finish.wait(5)
|
||||
return state.result or VerifyResult('CHECKED' if request.maintenance else 'PASS')
|
||||
|
||||
monkeypatch.setattr(ui, 'preflight_skip_reason', lambda *_: None)
|
||||
monkeypatch.setattr(ui.os, 'startfile', lambda path: state.opened.append(Path(path)))
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions',
|
||||
lambda path: dict(library=str(path), sessions=[]))
|
||||
adapter = SimpleNamespace(capabilities=lambda: {op: Capability(True, 'validated fixture')
|
||||
for op in ('add', 'update', 'remove')})
|
||||
window = ui.MainWindow(reader=lambda path: (state.reads.append(path) or LibraryReadResult(records)),
|
||||
verifier=verify, data_root=tmp_path/'data', path_lease_factory=lambda _: lease,
|
||||
status_refresher=lambda names, _: {name:'PENDING' for name in names}, management_adapter=adapter)
|
||||
state.window = window
|
||||
window.show()
|
||||
window.lmc_edit.setText(str(library))
|
||||
press(qtbot, window.load_button)
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
yield state
|
||||
state.finish.set()
|
||||
window.stop.set()
|
||||
if window._icdb_active():
|
||||
window.icdb_task.cancel()
|
||||
window.native_queue.wake()
|
||||
if window._closing:
|
||||
qtbot.waitUntil(lambda: not isValid(window) or not window.isVisible())
|
||||
if isValid(window):
|
||||
window.deleteLater()
|
||||
qtbot.waitUntil(lambda: not isValid(window))
|
||||
qapp.setAttribute(Qt.AA_DontUseNativeDialogs, old_native)
|
||||
return
|
||||
dialog = getattr(window, 'management_dialog', None)
|
||||
if dialog is not None and isValid(dialog):
|
||||
dialog.stop.set()
|
||||
qtbot.waitUntil(lambda: not window.busy or (dialog is not None and not dialog.busy))
|
||||
for child in window.findChildren(QMessageBox):
|
||||
if isValid(child):
|
||||
child.close()
|
||||
for name in ('management_dialog', 'backup_dialog', 'release_dialog'):
|
||||
child = getattr(window, name, None)
|
||||
if child is not None and isValid(child):
|
||||
qtbot.waitUntil(lambda child=child: not child.busy)
|
||||
child.close()
|
||||
qtbot.waitUntil(lambda: not window.busy and not window._icdb_active())
|
||||
window.close()
|
||||
qtbot.waitUntil(lambda: not isValid(window) or not window.isVisible())
|
||||
if isValid(window):
|
||||
window.deleteLater()
|
||||
qtbot.waitUntil(lambda: not isValid(window))
|
||||
qapp.setAttribute(Qt.AA_DontUseNativeDialogs, old_native)
|
||||
|
||||
|
||||
def test_main_navigation_selection_and_toggles(controls, qtbot):
|
||||
w = controls.window
|
||||
for index in (2, 1, 0, 2, 0):
|
||||
tab(qtbot, w, index)
|
||||
press(qtbot, w.select_visible_button)
|
||||
assert len(w.selected_records()) == 3
|
||||
press(qtbot, w.clear_selection_button)
|
||||
assert w.selected_records() == ()
|
||||
press(qtbot, w.advanced_toggle)
|
||||
assert w.advanced_panel.isVisible()
|
||||
original = w.native_lm_verify_check.isChecked()
|
||||
press(qtbot, w.native_lm_verify_check)
|
||||
assert w.native_lm_verify_check.isChecked() != original
|
||||
press(qtbot, w.native_lm_verify_check)
|
||||
press(qtbot, w.advanced_toggle)
|
||||
assert not w.advanced_panel.isVisible()
|
||||
press(qtbot, w.runtime_log_toggle)
|
||||
assert w.output.isVisible()
|
||||
press(qtbot, w.runtime_log_toggle)
|
||||
assert not w.output.isVisible()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cancel', [True, False])
|
||||
def test_main_library_chooser_real_open_and_cancel(controls, qtbot, cancel):
|
||||
w = controls.window
|
||||
before = len(controls.reads)
|
||||
with modal_click(qtbot, file=None if cancel else controls.library, cancel_file=cancel):
|
||||
press(qtbot, w.browse_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
assert len(controls.reads) == before + (0 if cancel else 1)
|
||||
press(qtbot, w.load_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
assert len(controls.reads) == before + (1 if cancel else 2)
|
||||
|
||||
|
||||
def test_main_logs_and_evidence_buttons_open_the_correct_paths(controls, qtbot):
|
||||
w = controls.window
|
||||
press(qtbot, w.logs_button)
|
||||
evidence = controls.library.parent/'evidence'
|
||||
evidence.mkdir()
|
||||
w.recovery_path = evidence
|
||||
w.recovery_button.setEnabled(True)
|
||||
press(qtbot, w.recovery_button)
|
||||
assert controls.opened == [w.data_root, evidence]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('attribute', ['selected_batch_button', 'batch_button', 'icdb_repair_button'])
|
||||
@pytest.mark.parametrize('answer', [QMessageBox.No, QMessageBox.Yes])
|
||||
def test_main_check_buttons_have_real_confirm_and_cancel_paths(controls, qtbot, attribute, answer):
|
||||
w = controls.window
|
||||
if attribute == 'icdb_repair_button':
|
||||
tab(qtbot, w, 1)
|
||||
w.search_edit.setText('Beta')
|
||||
press(qtbot, w.select_visible_button)
|
||||
with modal_click(qtbot, answer):
|
||||
press(qtbot, getattr(w, attribute))
|
||||
qtbot.waitUntil(lambda: not w.busy and not w._icdb_active())
|
||||
assert [request.block_name for request in controls.runs] == ([] if answer == QMessageBox.No else ['Beta'])
|
||||
if controls.runs:
|
||||
assert controls.runs[0].auto_repair is False
|
||||
summary = w.summary
|
||||
details = next((b for b in summary.findChildren(QPushButton) if 'Details' in b.text()), None)
|
||||
assert details is not None
|
||||
press(qtbot, details)
|
||||
assert summary.findChild(QTextEdit).isVisible()
|
||||
press(qtbot, summary.button(QMessageBox.Ok))
|
||||
assert not isValid(summary) or not summary.isVisible()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('background', [True, False])
|
||||
def test_main_stop_buttons_stop_additional_items(controls, qtbot, background):
|
||||
w = controls.window
|
||||
controls.finish.clear()
|
||||
if background:
|
||||
tab(qtbot, w, 1)
|
||||
button = w.icdb_repair_button if background else w.batch_button
|
||||
try:
|
||||
with modal_click(qtbot, QMessageBox.Yes):
|
||||
press(qtbot, button)
|
||||
qtbot.waitUntil(controls.entered.is_set)
|
||||
stop = w.icdb_stop_button if background else w.stop_button
|
||||
press(qtbot, stop)
|
||||
assert (w.icdb_task.stop if background else w.stop).is_set()
|
||||
finally:
|
||||
controls.finish.set()
|
||||
qtbot.waitUntil(lambda: not w.busy and not w._icdb_active())
|
||||
assert [request.block_name for request in controls.runs] == ['Beta']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('operation', ['add', 'update', 'remove'])
|
||||
def test_main_management_buttons_open_the_requested_operation(controls, qtbot, operation):
|
||||
w = controls.window
|
||||
tab(qtbot, w, 2)
|
||||
w.search_edit.setText('Beta')
|
||||
press(qtbot, w.select_visible_button)
|
||||
press(qtbot, getattr(w, operation+'_button'))
|
||||
dialog = w.management_dialog
|
||||
assert dialog.operation == operation and w.busy
|
||||
if operation != 'add':
|
||||
assert [request.name for request in dialog.requests()] == ['Beta']
|
||||
press(qtbot, dialog.close_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
|
||||
|
||||
def test_main_backup_restore_and_release_entries(controls, qtbot):
|
||||
w = controls.window
|
||||
tab(qtbot, w, 1)
|
||||
w.search_edit.setText('Beta')
|
||||
press(qtbot, w.select_visible_button)
|
||||
press(qtbot, w.backup_restore_button)
|
||||
assert w.backup_dialog.block_combo.currentText() == 'Beta'
|
||||
press(qtbot, w.backup_dialog.close_button)
|
||||
tab(qtbot, w, 2)
|
||||
press(qtbot, w.release_library_button)
|
||||
qtbot.waitUntil(lambda: not w.release_dialog.busy)
|
||||
assert w.release_dialog.plan['library'] == str(controls.library)
|
||||
press(qtbot, w.release_dialog.close_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
|
||||
|
||||
def test_native_backup_entry_starts_once_and_reenables_after_receipt(controls, qtbot):
|
||||
w = controls.window
|
||||
tab(qtbot, w, 1)
|
||||
w.search_edit.setText('Beta')
|
||||
press(qtbot, w.select_visible_button)
|
||||
job = controls.library.parent/'request.json'
|
||||
job.write_text('{}', encoding='utf-8')
|
||||
ended = Event()
|
||||
session = SimpleNamespace(library=controls.library, block='Beta', job=job,
|
||||
process=SimpleNamespace(poll=lambda: 0 if ended.is_set() else None))
|
||||
w.native_backup_launcher = lambda request: (controls.native.append(request) or session)
|
||||
press(qtbot, w.native_backup_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
for _ in range(5):
|
||||
qtbot.mouseClick(w.native_backup_button, Qt.LeftButton)
|
||||
assert len(controls.native) == 1 and not w.native_backup_button.isEnabled()
|
||||
job.with_name('result.json').write_text(json.dumps(dict(status='CLOSED', safe_to_continue=True,
|
||||
library=str(controls.library), block='Beta', restore_confirmed=False)), encoding='utf-8')
|
||||
ended.set()
|
||||
qtbot.waitUntil(lambda: w._native_backup_session is None and not w.busy, timeout=3000)
|
||||
assert w.native_backup_button.isEnabled()
|
||||
assert 'PASS' not in w.cbb_table.item(w._row_by_name['Beta'], 3).text()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('operation', ['add', 'update'])
|
||||
@pytest.mark.parametrize('cancel', [True, False])
|
||||
def test_management_source_chooser_and_auto_verify_toggle(controls, qtbot, operation, cancel):
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
req = ManagementRequest(operation, controls.library, '' if operation == 'add' else 'Beta')
|
||||
dialog = ManagementDialog([req])
|
||||
qtbot.addWidget(dialog)
|
||||
dialog.show()
|
||||
with modal_click(qtbot, file=None if cancel else controls.source, cancel_file=cancel):
|
||||
press(qtbot, dialog.sources_button)
|
||||
assert dialog.table.rowCount() == (0 if operation == 'add' and cancel else 1)
|
||||
if not cancel:
|
||||
assert dialog.requests()[0].source == controls.source
|
||||
checked = dialog.auto_verify.isChecked()
|
||||
press(qtbot, dialog.auto_verify)
|
||||
assert dialog.auto_verify.isChecked() != checked
|
||||
press(qtbot, dialog.logs_button)
|
||||
assert dialog.output.isVisible()
|
||||
press(qtbot, dialog.logs_button)
|
||||
assert not dialog.output.isVisible()
|
||||
press(qtbot, dialog.close_button)
|
||||
assert not dialog.isVisible()
|
||||
|
||||
|
||||
def test_management_confirm_cancel_execute_stop_and_repeated_click(controls, qtbot):
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
entered, finish = Event(), Event()
|
||||
calls = []
|
||||
def runner(requests, **kwargs):
|
||||
calls.extend(requests)
|
||||
entered.set()
|
||||
assert finish.wait(5)
|
||||
return [ManagementResult('remove', controls.library, 'Beta', 'Logical-Physical', None,
|
||||
False, 'complete', 'REMOVED', True)]
|
||||
dialog = ManagementDialog([ManagementRequest('remove', controls.library, 'Beta')], runner=runner)
|
||||
qtbot.addWidget(dialog)
|
||||
dialog.show()
|
||||
with modal_click(qtbot, QMessageBox.No):
|
||||
press(qtbot, dialog.execute_button)
|
||||
assert calls == [] and not dialog.executed
|
||||
try:
|
||||
with modal_click(qtbot, QMessageBox.Yes):
|
||||
press(qtbot, dialog.execute_button)
|
||||
qtbot.waitUntil(entered.is_set)
|
||||
for _ in range(5):
|
||||
qtbot.mouseClick(dialog.execute_button, Qt.LeftButton)
|
||||
qtbot.mouseClick(dialog.close_button, Qt.LeftButton)
|
||||
assert len(calls) == 1 and dialog.isVisible()
|
||||
press(qtbot, dialog.stop_button)
|
||||
assert dialog.stop.is_set()
|
||||
finally:
|
||||
finish.set()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert '已移除' in dialog.status_label.text()
|
||||
press(qtbot, dialog.close_button)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cancel', [True, False])
|
||||
def test_recovery_real_source_chooser_and_confirmation_options(controls, qtbot, cancel):
|
||||
from cbb_refresh_verify.ui.backup_recovery_dialog import BackupRecoveryDialog
|
||||
calls = []
|
||||
def recover(request, source, **kwargs):
|
||||
calls.append((request.block_name, source))
|
||||
return VerifyResult('PASS')
|
||||
dialog = BackupRecoveryDialog(['Beta'],
|
||||
lambda name: VerifyRequest(controls.library, name, controls.library.parent/'evidence'), recoverer=recover)
|
||||
qtbot.addWidget(dialog)
|
||||
dialog.show()
|
||||
with modal_click(qtbot, file=None if cancel else controls.source, cancel_file=cancel):
|
||||
press(qtbot, dialog.browse_button)
|
||||
if cancel:
|
||||
assert dialog.source_edit.text() == ''
|
||||
else:
|
||||
assert Path(dialog.source_edit.text()) == controls.source
|
||||
if cancel:
|
||||
press(qtbot, dialog.restore_button)
|
||||
assert '有效' in dialog.status_label.text() and not dialog.busy
|
||||
else:
|
||||
with modal_click(qtbot, QMessageBox.No):
|
||||
press(qtbot, dialog.restore_button)
|
||||
assert calls == []
|
||||
with modal_click(qtbot, QMessageBox.Yes):
|
||||
press(qtbot, dialog.restore_button)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert calls == [('Beta', controls.source)]
|
||||
assert '恢复完成' in dialog.status_label.text()
|
||||
press(qtbot, dialog.close_button)
|
||||
assert not dialog.isVisible()
|
||||
|
||||
|
||||
def test_recovery_cancel_queue_never_calls_native_restore(controls, qtbot):
|
||||
from cbb_refresh_verify.operation_queue import NativeQueue
|
||||
from cbb_refresh_verify.ui.backup_recovery_dialog import BackupRecoveryDialog
|
||||
calls = []
|
||||
queue = NativeQueue()
|
||||
queue.active = True
|
||||
dialog = BackupRecoveryDialog(['Beta'],
|
||||
lambda name: VerifyRequest(controls.library, name, controls.library.parent/'evidence'),
|
||||
recoverer=lambda *a, **k: calls.append(a))
|
||||
dialog.native_queue = queue
|
||||
qtbot.addWidget(dialog)
|
||||
dialog.show()
|
||||
dialog.source_edit.setText(str(controls.source))
|
||||
with modal_click(qtbot, QMessageBox.Yes):
|
||||
press(qtbot, dialog.restore_button)
|
||||
qtbot.waitUntil(dialog.cancel_queue_button.isEnabled)
|
||||
press(qtbot, dialog.cancel_queue_button)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert calls == [] and dialog.stop.is_set()
|
||||
press(qtbot, dialog.close_button)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('attribute, expected', [('manual_button','last_user_saved'),
|
||||
('auto_button','autosave'), ('cancel_button','cancel')])
|
||||
def test_version_choice_buttons_choose_only_the_clicked_version(qtbot, attribute, expected):
|
||||
from cbb_refresh_verify.pcb_restore_prompt import RestoreChoice
|
||||
from cbb_refresh_verify.ui.pcb_restore_dialog import PcbRestoreDialog
|
||||
choice = RestoreChoice('Beta', 'fixture.lmc', [dict(kind=kind, enabled=True, date='2026/11/11 10:00')
|
||||
for kind in ('last_user_saved','autosave')])
|
||||
dialog = PcbRestoreDialog(choice)
|
||||
qtbot.addWidget(dialog)
|
||||
dialog.show()
|
||||
press(qtbot, getattr(dialog, attribute))
|
||||
assert choice.decision == expected
|
||||
dialog.close()
|
||||
assert choice.decision == expected
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def residual(controls, qtbot, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock, residual_sessions
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
row = dict(project='Beta', name='ExpeditionPCB.exe', pid=10, detail='fixture session',
|
||||
scope_confirmed=True, owner_sid='S-1-fixture', session_id=1, force_user_confirmed=True,
|
||||
image='C:/Fixture/ExpeditionPCB.exe', created_handle='fixture-created',
|
||||
native_activity=dict(status='IDLE', detail='fixture returned'),
|
||||
desktops=['CbbFixture'], windows=[dict(title='Fixture native prompt', output='Fixture details')],
|
||||
prompt=dict(text='Save the changed fixture?'), cancel_prompt=dict(text='Cancel fixture'))
|
||||
plan = dict(library=str(controls.library), sessions=[row])
|
||||
state = SimpleNamespace(scans=[], releases=[], cancels=[], saves=[], row=row, plan=plan,
|
||||
entered=Event(), finish=Event(), hold=False)
|
||||
def inspect(library):
|
||||
state.scans.append(library)
|
||||
return plan
|
||||
def release(actual, folder, **kwargs):
|
||||
state.releases.append(kwargs)
|
||||
if state.hold:
|
||||
state.entered.set()
|
||||
assert state.finish.wait(5)
|
||||
return dict(status='PARTIAL', sessions=[dict(row, release_status='WAITING', consent_allowed=True)])
|
||||
def cancel(actual, library, folder, **kwargs):
|
||||
state.cancels.append(actual)
|
||||
return dict(status='PARTIAL', detail='Fixture cancel received',
|
||||
sessions=[dict(row, release_status='WAITING')])
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', inspect)
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', release)
|
||||
monkeypatch.setattr(residual_sessions, 'request_native_cancel', cancel)
|
||||
monkeypatch.setattr(residual_sessions, 'answer_save_question',
|
||||
lambda actual, code: state.saves.append((actual['pid'], code)))
|
||||
dialog = ResidualReleaseDialog(controls.library, controls.library.parent/'release-evidence')
|
||||
qtbot.addWidget(dialog)
|
||||
dialog.show()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
state.dialog = dialog
|
||||
yield state
|
||||
state.finish.set()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
|
||||
|
||||
def test_residual_refresh_details_confirm_and_close(residual, qtbot):
|
||||
d = residual.dialog
|
||||
press(qtbot, d.refresh_button)
|
||||
qtbot.waitUntil(lambda: not d.busy)
|
||||
assert len(residual.scans) == 2 and d.table.rowCount() == 1
|
||||
press(qtbot, d.details_button)
|
||||
details = d.native_details
|
||||
assert 'Fixture native prompt' in details.detailedText()
|
||||
expand = next(b for b in details.findChildren(QPushButton) if 'Details' in b.text())
|
||||
press(qtbot, expand)
|
||||
assert details.findChild(QTextEdit).isVisible()
|
||||
press(qtbot, details.button(QMessageBox.Ok))
|
||||
press(qtbot, d.confirm_button)
|
||||
qtbot.waitUntil(lambda: not d.busy)
|
||||
assert len(residual.releases) == 1 and residual.releases[0]['force'] is False
|
||||
assert d.table.item(0, 6).text() == '允许'
|
||||
assert d.table.item(0, 7).text() == '未释放'
|
||||
press(qtbot, d.close_button)
|
||||
assert not d.isVisible()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('answer, code', [(QMessageBox.Yes,6),(QMessageBox.No,7),(QMessageBox.Cancel,2)])
|
||||
def test_residual_save_prompt_buttons_preserve_the_users_choice(residual, qtbot, answer, code):
|
||||
d = residual.dialog
|
||||
with modal_click(qtbot, answer):
|
||||
press(qtbot, d.prompt_button)
|
||||
qtbot.waitUntil(lambda: not d.busy)
|
||||
assert residual.saves == [(10, code)]
|
||||
assert d.isVisible() and residual.releases == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize('answer', [QMessageBox.No,QMessageBox.Yes])
|
||||
def test_residual_native_cancel_confirm_and_decline(residual, qtbot, answer):
|
||||
d = residual.dialog
|
||||
with modal_click(qtbot, answer):
|
||||
press(qtbot, d.cancel_native_button)
|
||||
qtbot.waitUntil(lambda: not d.busy)
|
||||
assert len(residual.cancels) == (1 if answer == QMessageBox.Yes else 0)
|
||||
assert residual.releases == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize('answer', [QMessageBox.Cancel,QMessageBox.Yes])
|
||||
def test_residual_force_buttons_require_actual_confirmation(residual, qtbot, answer):
|
||||
d = residual.dialog
|
||||
with modal_click(qtbot, answer):
|
||||
press(qtbot, d.force_button)
|
||||
qtbot.waitUntil(lambda: not d.busy)
|
||||
assert [call['force'] for call in residual.releases] == ([True] if answer == QMessageBox.Yes else [])
|
||||
|
||||
|
||||
def test_residual_busy_repeated_clicks_and_stop_release(residual, qtbot):
|
||||
d = residual.dialog
|
||||
residual.hold = True
|
||||
try:
|
||||
press(qtbot, d.confirm_button)
|
||||
qtbot.waitUntil(residual.entered.is_set)
|
||||
for _ in range(5):
|
||||
qtbot.mouseClick(d.confirm_button, Qt.LeftButton)
|
||||
qtbot.mouseClick(d.refresh_button, Qt.LeftButton)
|
||||
assert len(residual.releases) == 1 and len(residual.scans) == 1
|
||||
press(qtbot, d.close_button)
|
||||
assert d.stop.is_set() and d.isVisible()
|
||||
finally:
|
||||
residual.finish.set()
|
||||
qtbot.waitUntil(lambda: not d.busy)
|
||||
press(qtbot, d.close_button)
|
||||
|
||||
|
||||
def test_result_release_and_resume_buttons_run_only_unexecuted_items(controls, qtbot, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock
|
||||
w = controls.window
|
||||
controls.result = VerifyResult('FAIL', safe_to_continue=False, stderr='Fixture release unconfirmed')
|
||||
with modal_click(qtbot, QMessageBox.Yes):
|
||||
press(qtbot, w.batch_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
assert [request.block_name for request in controls.runs] == ['Beta']
|
||||
assert not w._resume_batch_action.isEnabled()
|
||||
proof = dict(status='RELEASE_CONFIRMED', library=str(controls.library), evidence_path='fixture-proof.json')
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions',
|
||||
lambda *a, **k: dict(status='RELEASE_CONFIRMED', proof=proof, sessions=[]))
|
||||
press(qtbot, w._residual_release_action)
|
||||
qtbot.waitUntil(lambda: not w.release_dialog.busy)
|
||||
press(qtbot, w.release_dialog.confirm_button)
|
||||
qtbot.waitUntil(lambda: not w.release_dialog.busy)
|
||||
press(qtbot, w.release_dialog.close_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
controls.result = VerifyResult('PASS')
|
||||
press(qtbot, w._resume_batch_action)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
assert [request.block_name for request in controls.runs] == ['Beta','Gamma']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('entry', ['icdb_copy', 'icdb_release', 'batch_copy', 'batch_close'])
|
||||
def test_result_recovery_and_release_entries_stay_bound_to_failed_cbb(controls, qtbot, entry):
|
||||
from dataclasses import replace
|
||||
from test_reimport_recovery import failed_repair
|
||||
w = controls.window
|
||||
if entry.startswith('icdb'):
|
||||
tab(qtbot, w, 1)
|
||||
w.search_edit.setText('Beta')
|
||||
controls.result = failed_repair(controls.library.parent/'failure.json', safe=entry=='icdb_copy')
|
||||
with modal_click(qtbot, QMessageBox.Yes):
|
||||
press(qtbot, w.icdb_repair_button)
|
||||
qtbot.waitUntil(lambda: not w._icdb_active())
|
||||
label = '查看残留并释放…' if entry=='icdb_release' else '选择副本恢复…'
|
||||
press(qtbot, next(b for b in w.icdb_summary.buttons() if b.text()==label))
|
||||
else:
|
||||
# This is the supported legacy maintenance-result shape; current UI
|
||||
# maintenance uses the independent IcdbCheckTask route above.
|
||||
req = replace(w._request('Beta'), maintenance=True)
|
||||
w._batch_requests = (req,)
|
||||
w._batch_records = {'Beta':w._records_by_name['Beta']}
|
||||
w._batch_done(([failed_repair(controls.library.parent/'failure.json',safe=True)], None))
|
||||
w._update()
|
||||
if entry=='batch_close':
|
||||
summary = w.summary
|
||||
press(qtbot, summary.button(QMessageBox.Close))
|
||||
assert not isValid(summary) or not summary.isVisible()
|
||||
return
|
||||
press(qtbot, w._reimport_summary_action)
|
||||
if entry=='icdb_release':
|
||||
qtbot.waitUntil(lambda: not w.release_dialog.busy)
|
||||
assert w.release_dialog.library == controls.library
|
||||
press(qtbot, w.release_dialog.close_button)
|
||||
else:
|
||||
dialog = w.management_dialog
|
||||
assert [req.name for req in dialog.requests()] == ['Beta']
|
||||
assert Path(dialog.recovery_from['Beta']) == controls.library.parent/'failure.json'
|
||||
press(qtbot, dialog.close_button)
|
||||
qtbot.waitUntil(lambda: not w.busy)
|
||||
if entry=='icdb_copy':
|
||||
tab(qtbot,w,1)
|
||||
press(qtbot,w.reimport_button)
|
||||
assert [req.name for req in w.management_dialog.requests()] == ['Beta']
|
||||
press(qtbot,w.management_dialog.close_button)
|
||||
|
||||
|
||||
def test_invalidated_catalog_buttons_ignore_clicks(controls, qtbot):
|
||||
w = controls.window
|
||||
w.lmc_edit.setText('not-loaded.lmc')
|
||||
for index, attributes in [(0,['selected_batch_button','batch_button']),
|
||||
(1,['icdb_repair_button','native_backup_button','backup_restore_button']),
|
||||
(2,['add_button','update_button','remove_button'])]:
|
||||
tab(qtbot,w,index)
|
||||
for attribute in attributes:
|
||||
button = getattr(w,attribute)
|
||||
assert not button.isEnabled()
|
||||
qtbot.mouseClick(button,Qt.LeftButton)
|
||||
assert controls.runs == [] and controls.native == []
|
||||
assert getattr(w,'management_dialog',None) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('attribute, failure', [('logs_button','shell'),
|
||||
('logs_button','directory'),('recovery_button','shell')])
|
||||
def test_log_and_evidence_buttons_report_external_failure(controls,qtbot,monkeypatch,attribute,failure):
|
||||
import cbb_refresh_verify.ui.main_window as ui
|
||||
def fail(path):
|
||||
raise OSError('Fixture shell access denied')
|
||||
w = controls.window
|
||||
if failure=='shell':
|
||||
monkeypatch.setattr(ui.os,'startfile',fail)
|
||||
expected = 'Fixture shell access denied'
|
||||
else:
|
||||
w.data_root = controls.source/'logs'
|
||||
expected = 'Beta.prj'
|
||||
if attribute=='recovery_button':
|
||||
w.recovery_path = controls.library.parent
|
||||
w.recovery_button.setEnabled(True)
|
||||
press(qtbot,getattr(w,attribute))
|
||||
assert expected in w.status_label.text()
|
||||
assert controls.opened == []
|
||||
@@ -85,3 +85,28 @@ def test_later_management_invalidates_old_recovery_offer(qtbot, tmp_path, monkey
|
||||
assert action.isEnabled()
|
||||
window._invalidate_check_targets('test.lmc', ['Beta'])
|
||||
assert not action.isEnabled() and not window._reimport_offers
|
||||
|
||||
|
||||
def test_check_release_action_tracks_busy_and_retained_queue(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from test_review326_queue_guidance import retain
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
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())
|
||||
action = next(b for b in window.icdb_summary.buttons() if '释放' in b.text())
|
||||
window.busy = True
|
||||
window._update()
|
||||
assert not action.isEnabled(), 'A normal native call cannot admit release yet'
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
window._queue_wait_library = window.mentor_lmc_path
|
||||
window._update()
|
||||
assert action.isEnabled(), 'Retained-queue release must stay reachable'
|
||||
opened = []
|
||||
monkeypatch.setattr(window, 'check_library_release', lambda **kwargs: opened.append(kwargs))
|
||||
action.click()
|
||||
assert opened == [{'queued': True}]
|
||||
window.busy = False
|
||||
window._update()
|
||||
assert action.isEnabled()
|
||||
@@ -83,7 +83,8 @@ def test_worker_refresh_excludes_ready_before_any_gui_result_callback(qtbot,tmp_
|
||||
status_refresher=lambda names,path:{name:'READY' for name in names})
|
||||
release,calls=background(window,qtbot)
|
||||
try:
|
||||
window._start(lambda:window._read_affected_records(('Gamma',)),lambda payload:None)
|
||||
library=window.mentor_lmc_path or window.loaded_path
|
||||
window._start(lambda:window._read_affected_records(('Gamma',),library=library),lambda payload:None)
|
||||
qtbot.waitUntil(lambda:bool(window.native_queue.pending))
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda:not window._icdb_active() and not window.busy)
|
||||
|
||||
@@ -71,6 +71,31 @@ def test_invalid_source_does_not_touch_target(recovery_files):
|
||||
assert (original.parent/'database/icdb.dat').read_bytes() == b'damaged'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('linked_to_target', [True, False])
|
||||
def test_legacy_backup_without_auxiliary_pcb_project(recovery_files, linked_to_target):
|
||||
from cbb_refresh_verify.backup_recovery import recover_from_backup
|
||||
request, original, source = recovery_files
|
||||
(source.parent/'PCB/pcb.prj').unlink()
|
||||
if not linked_to_target:
|
||||
pcb = source.parent/'PCB/A.pcb'
|
||||
pcb.write_text(pcb.read_text().replace('A.prj', 'OTHER.prj'))
|
||||
calls = []
|
||||
def verify(req, **kwargs):
|
||||
work = req.lmc_file.parent/'ReusableBlocksLP/A/Work'
|
||||
assert not (work/'PCB/pcb.prj').exists()
|
||||
calls.append(req)
|
||||
return VerifyResult('PASS', library_flag='GREEN')
|
||||
result = recover_from_backup(request, source, verifier=verify, idle_check=lambda *_: None)
|
||||
if linked_to_target:
|
||||
assert result.status == 'PASS', result.stderr
|
||||
assert len(calls) == 2
|
||||
assert (original.parent/'database/icdb.dat').read_bytes() == b'healthy'
|
||||
else:
|
||||
assert result.status == 'BLOCKED'
|
||||
assert not calls
|
||||
assert (original.parent/'database/icdb.dat').read_bytes() == b'damaged'
|
||||
|
||||
|
||||
def test_unusable_backup_never_replaces_target(recovery_files):
|
||||
from cbb_refresh_verify.backup_recovery import recover_from_backup
|
||||
request, original, source = recovery_files
|
||||
@@ -158,9 +183,9 @@ def test_idle_guard_ignores_unrelated_project_and_prefix_sibling(recovery_files,
|
||||
request, original, _ = recovery_files
|
||||
unrelated = original.parent.with_name(original.parent.name+'Old')/'PCB/A.pcb'
|
||||
monkeypatch.setattr(mentor_adapter, 'pcb_processes', lambda: [(123, '', str(unrelated))])
|
||||
monkeypatch.setattr(mentor_adapter, '_process_details', lambda name:
|
||||
[(123, 'ExpeditionPCB.exe', f'ExpeditionPCB.exe "{unrelated}" -ReusableCircuit', 0)]
|
||||
if name == 'ExpeditionPCB.exe' else [])
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda names:[
|
||||
dict(pid=123,name='ExpeditionPCB.exe',executable='ExpeditionPCB.exe',
|
||||
command=f'ExpeditionPCB.exe "{unrelated}" -ReusableCircuit',parent=0)])
|
||||
_idle_check(request.lmc_file, original, original.parent/'PCB/A.pcb')
|
||||
|
||||
|
||||
@@ -170,13 +195,45 @@ def test_idle_guard_rejects_exact_target_process(recovery_files, monkeypatch):
|
||||
request, original, _ = recovery_files
|
||||
target = original.parent/'PCB/A.pcb'
|
||||
monkeypatch.setattr(mentor_adapter, 'pcb_processes', lambda: [])
|
||||
monkeypatch.setattr(mentor_adapter, '_process_details', lambda name:
|
||||
[(123, 'ExpeditionPCB.exe', f'ExpeditionPCB.exe "{target}" -ReusableCircuit', 0)]
|
||||
if name == 'ExpeditionPCB.exe' else [])
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda names:[
|
||||
dict(pid=123,name='ExpeditionPCB.exe',executable='ExpeditionPCB.exe',
|
||||
command=f'ExpeditionPCB.exe "{target}" -ReusableCircuit',parent=0)])
|
||||
with pytest.raises(ValueError, match='TARGET_NATIVE_OWNER_ACTIVE'):
|
||||
_idle_check(request.lmc_file, original, target)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('target_state', ['idle', 'open_file', 'address'])
|
||||
def test_pathless_external_client_requires_resource_proof_and_confirmation(recovery_files, monkeypatch, target_state):
|
||||
import pywintypes
|
||||
import win32con
|
||||
import win32file
|
||||
from cbb_refresh_verify import mentor_adapter
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
request, original, _ = recovery_files
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda names:[
|
||||
dict(pid=123,name='viewdraw.exe',executable='viewdraw.exe',command='viewdraw.exe',parent=0)])
|
||||
address = original.parent/'database/cdbsvr/sAddress.adr'
|
||||
handle = None
|
||||
try:
|
||||
if target_state == 'open_file':
|
||||
handle = win32file.CreateFile(str(request.lmc_file), win32con.GENERIC_READ,
|
||||
win32con.FILE_SHARE_READ, None, win32con.OPEN_EXISTING, 0, None)
|
||||
with pytest.raises(pywintypes.error) as error:
|
||||
_idle_check(request.lmc_file, original, original.parent/'PCB/A.pcb')
|
||||
assert error.value.winerror == 32
|
||||
elif target_state == 'address':
|
||||
address.parent.mkdir(parents=True, exist_ok=True)
|
||||
address.write_bytes(b'live or unconfirmed native address')
|
||||
with pytest.raises(ValueError, match='TARGET_DATABASE_ADDRESS_UNCONFIRMED'):
|
||||
_idle_check(request.lmc_file, original, original.parent/'PCB/A.pcb')
|
||||
assert address.read_bytes() == b'live or unconfirmed native address'
|
||||
else:
|
||||
with pytest.raises(ValueError,match='TARGET_NATIVE_OWNER_UNCONFIRMED'):
|
||||
_idle_check(request.lmc_file, original, original.parent/'PCB/A.pcb')
|
||||
finally:
|
||||
if handle is not None: handle.Close()
|
||||
|
||||
|
||||
def test_prelaunch_recovery_rejection_has_no_unreleased_session(recovery_files):
|
||||
from cbb_refresh_verify.backup_recovery import recover_from_backup
|
||||
request, _, source = recovery_files
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
from threading import Event,Thread
|
||||
|
||||
|
||||
def test_normal_verify_batch_yields_after_complete_item(qtbot,tmp_path,monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
started,release,waiting=Event(),Event(),Event()
|
||||
order=[]
|
||||
def verify(request):
|
||||
order.append(request.block_name)
|
||||
if request.block_name=='Beta':started.set();release.wait(5)
|
||||
return VerifyResult('FAIL',stderr='independent failed item',safe_to_continue=True)
|
||||
window=load_window(qtbot,tmp_path,monkeypatch,verifier=verify)
|
||||
window._run(['Beta','Gamma'])
|
||||
qtbot.waitUntil(started.is_set)
|
||||
other=Thread(target=lambda:window.native_queue.run(lambda:order.append('other'),waiting=waiting.set))
|
||||
other.start()
|
||||
try:
|
||||
assert waiting.wait(1)
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda:not window.busy,timeout=10000)
|
||||
other.join(2)
|
||||
assert order==['Beta','other','Gamma']
|
||||
finally:release.set();other.join(5)
|
||||
|
||||
|
||||
def test_management_cancel_between_items_keeps_completed_results(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify import management
|
||||
from cbb_refresh_verify.operation_queue import QueueCancelled
|
||||
from dataclasses import replace
|
||||
request=management.ManagementRequest('remove',tmp_path/'lib.lmc','A')
|
||||
def run(req,**kwargs):
|
||||
return management.ManagementResult(req.operation,req.library,req.name,req.partition,None,False,
|
||||
'complete','REMOVED',True)
|
||||
monkeypatch.setattr(management,'run_management',run)
|
||||
def execute(req,action):
|
||||
if req.name=='B':raise QueueCancelled('cancelled waiting for native slot')
|
||||
return action()
|
||||
results=management.run_management_batch([request,replace(request,name='B')],item_executor=execute)
|
||||
assert [r.status for r in results]==['REMOVED','CANCELLED']
|
||||
assert all(r.safe_to_continue for r in results)
|
||||
|
||||
|
||||
def test_cancelled_verify_keeps_summary_without_queueing_cancelled_refresh(qtbot,tmp_path,monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
calls=[]
|
||||
def verify(req):
|
||||
calls.append(req.block_name)
|
||||
window.stop.set()
|
||||
return VerifyResult('CANCELLED',safe_to_continue=True)
|
||||
window=load_window(qtbot,tmp_path,monkeypatch,verifier=verify)
|
||||
window._run(['Beta','Gamma'])
|
||||
qtbot.waitUntil(lambda:not window.busy,timeout=5000)
|
||||
assert calls==['Beta']
|
||||
assert window.summary is not None
|
||||
assert '队列未执行 1' in window.summary.detailedText()
|
||||
|
||||
|
||||
def test_verify_failure_recheck_finishes_before_yielding_native_queue(qtbot,tmp_path,monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
from cbb_refresh_verify import operation_lifecycle
|
||||
from dataclasses import replace
|
||||
window=load_window(qtbot,tmp_path,monkeypatch,
|
||||
verifier=lambda req:VerifyResult('FAIL',safe_to_continue=False))
|
||||
active=[];seen=[]
|
||||
def queued(action, **kwargs):
|
||||
def run():
|
||||
active.append(True)
|
||||
try:return action()
|
||||
finally:active.pop()
|
||||
return run
|
||||
def recheck(library,block,result):
|
||||
seen.append(bool(active))
|
||||
return replace(result,safe_to_continue=True)
|
||||
monkeypatch.setattr(window,'_queued_action',queued)
|
||||
monkeypatch.setattr(operation_lifecycle,'recheck_failed_release',recheck)
|
||||
window._run(['Beta'])
|
||||
qtbot.waitUntil(lambda:not window.busy,timeout=5000)
|
||||
assert seen==[True]
|
||||
|
||||
|
||||
def test_management_failure_recheck_finishes_before_yielding_native_queue(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify import management,operation_lifecycle
|
||||
from dataclasses import replace
|
||||
request=management.ManagementRequest('remove',tmp_path/'lib.lmc','A')
|
||||
monkeypatch.setattr(management,'run_management',lambda req,**kw:management.ManagementResult(
|
||||
req.operation,req.library,req.name,req.partition,None,False,'complete','BLOCKED',False))
|
||||
active=[];seen=[]
|
||||
def item(req,action):
|
||||
active.append(True)
|
||||
try:return action()
|
||||
finally:active.pop()
|
||||
def recheck(library,block,result):
|
||||
seen.append(bool(active))
|
||||
return replace(result,safe_to_continue=True)
|
||||
monkeypatch.setattr(operation_lifecycle,'recheck_failed_release',recheck)
|
||||
management.run_management_batch([request],item_executor=item)
|
||||
assert seen==[True]
|
||||
@@ -84,11 +84,30 @@ def test_scan_reuses_checkpoint_and_queries_only_missing(tmp_path):
|
||||
encoding="utf-8",
|
||||
)
|
||||
bridge = FakeBridge()
|
||||
records = BatchStatusSession(bridge).scan(["A", "B"], lmc, checkpoint)
|
||||
records = BatchStatusSession(bridge).scan(["A", "B"], lmc, checkpoint, resume=True)
|
||||
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")
|
||||
@@ -180,7 +199,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)
|
||||
second = BatchStatusSession(bridge).scan(['A', 'B'], lmc, checkpoint, resume=True)
|
||||
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)
|
||||
BatchStatusSession(bridge).scan(["A"], lmc, checkpoint, resume=True)
|
||||
assert bridge.requests == ["A"]
|
||||
@@ -0,0 +1,54 @@
|
||||
from contextlib import nullcontext
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
import win32con,win32file
|
||||
from cbb_refresh_verify import library_lock as locks, residual_sessions as sessions
|
||||
from test_residual_sessions import row, OWNERSHIP
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command', ['viewdraw.exe', 'cscript.exe C:/other/QuickPartReplace.vbs'])
|
||||
def test_unknown_external_owner_requires_resources_not_process_exit(tmp_path, monkeypatch, command):
|
||||
library=tmp_path/'lib.lmc';library.touch()
|
||||
owner=dict(pid=998877,name=command.split()[0],command=command)
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda *_:[owner])
|
||||
with locks._prove_library_released(library) as proof:
|
||||
assert proof['exclusive_files']==[str(library)]
|
||||
assert proof['observed_owners']==[owner]
|
||||
handle=win32file.CreateFile(str(library),win32con.GENERIC_READ,0,None,win32con.OPEN_EXISTING,0,None)
|
||||
try:
|
||||
with pytest.raises(Exception) as denied:
|
||||
with locks._prove_library_released(library):pass
|
||||
assert denied.value.winerror == 32
|
||||
finally:handle.Close()
|
||||
|
||||
|
||||
def test_unknown_observation_is_never_closed_or_counted_as_target(tmp_path,monkeypatch):
|
||||
library=tmp_path/'lib/lib.lmc';library.parent.mkdir();library.touch()
|
||||
foreign=dict(row(20,''),name='viewdraw.exe',command='viewdraw.exe',scope_confirmed=False)
|
||||
target=dict(row(10,library.parent/'A.prj'),scope_confirmed=True)
|
||||
monkeypatch.setattr(sessions,'query_process_snapshot',lambda:[target,foreign])
|
||||
monkeypatch.setattr(sessions,'_process_windows',lambda _: {})
|
||||
closed=[]
|
||||
monkeypatch.setattr(sessions,'_request_close',lambda r,**kw:closed.append(r['pid']) or
|
||||
dict(release_status='RELEASED',detail='closed'))
|
||||
monkeypatch.setattr(sessions,'_finish_library_release',lambda *_:dict(status='RELEASE_CONFIRMED',library=str(library)))
|
||||
result=sessions.release_residual_sessions(dict(library=str(library),sessions=[target,foreign]),tmp_path/'evidence')
|
||||
assert result['status']=='RELEASE_CONFIRMED',result
|
||||
assert closed==[10]
|
||||
assert result['sessions'][1]['release_status']=='OBSERVED'
|
||||
|
||||
|
||||
def test_explicit_target_owner_still_blocks_proof(tmp_path,monkeypatch):
|
||||
library=tmp_path/'lib.lmc';library.touch()
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda *_:
|
||||
[dict(pid=998877,name='viewdraw.exe',command=f'viewdraw.exe "{library}"')])
|
||||
with pytest.raises(locks.LibraryBusy):
|
||||
with locks._prove_library_released(library):pass
|
||||
|
||||
|
||||
def test_our_unbound_worker_still_blocks_proof(tmp_path,monkeypatch):
|
||||
library=tmp_path/'lib.lmc';library.touch()
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda *_:
|
||||
[dict(pid=998877,name='CbbRefreshVerify.exe',command='CbbRefreshVerify.exe --verify-worker missing.json')])
|
||||
with pytest.raises(locks.LibraryBusy):
|
||||
with locks._prove_library_released(library):pass
|
||||
@@ -0,0 +1,124 @@
|
||||
"""Normal imports must not depend on optional schematic export tools."""
|
||||
from dataclasses import replace
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from test_management_native_transaction import transaction, execute
|
||||
from test_management import setup
|
||||
|
||||
|
||||
def test_import_capability_does_not_require_exporters(tmp_path, monkeypatch):
|
||||
import cbb_refresh_verify.native_management as native
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
monkeypatch.setattr(native.NativeManagementAdapter, '_binary_capability', lambda _: '')
|
||||
def missing(*_):
|
||||
raise ValueError('edifExporter.exe is not installed')
|
||||
monkeypatch.setattr(identity, 'check_exporters', missing)
|
||||
caps = native.NativeManagementAdapter(mentor_home=tmp_path).capabilities()
|
||||
assert caps['add'].supported and caps['update'].supported
|
||||
|
||||
|
||||
@pytest.mark.parametrize('auto_verify', [False, True])
|
||||
def test_real_engine_imports_without_any_native_export(transaction, monkeypatch, auto_verify):
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
root, request, state = transaction
|
||||
def forbidden(*_a, **_kw):
|
||||
raise AssertionError('An optional native exporter was called by import')
|
||||
monkeypatch.setattr(identity, 'capture_identity', forbidden)
|
||||
monkeypatch.setattr(identity, 'check_exporters', forbidden)
|
||||
verified = []
|
||||
def verify(request, **_):
|
||||
verified.append(request.block_name)
|
||||
return VerifyResult('PASS', library_flag='GREEN', library_flag_detail='READY')
|
||||
monkeypatch.setattr('cbb_refresh_verify.verify_runner.run_verify', verify)
|
||||
result = execute(root, replace(request, auto_verify=auto_verify))
|
||||
assert result.status == ('UPLOADED_VERIFIED' if auto_verify else 'UPLOADED'), result.detail
|
||||
assert result.safe_to_continue
|
||||
assert verified == (['Block'] if auto_verify else [])
|
||||
proof = json.loads((result.evidence_path.parent/'source-identity/identity.json').read_text())
|
||||
assert proof['identity']['coverage']['schematic_semantics_checked'] is False
|
||||
assert 'edif_sha256' not in proof['identity']
|
||||
assert 'add' in state['calls']
|
||||
|
||||
|
||||
def test_bad_source_row_does_not_prevent_valid_rows_from_starting(qtbot, tmp_path, monkeypatch):
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
from cbb_refresh_verify.management import ManagementRequest, ManagementResult
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
good = tmp_path/'good.prj'; good.write_text('fixture')
|
||||
rows = [ManagementRequest('add', tmp_path/'lib.lmc', 'Missing', source=tmp_path/'missing.prj'),
|
||||
ManagementRequest('add', tmp_path/'lib.lmc', 'Good', source=good)]
|
||||
seen = []
|
||||
def runner(requests, **_):
|
||||
seen.extend(requests)
|
||||
return [ManagementResult(r.operation, r.library, r.name, r.partition, r.source,
|
||||
r.auto_verify, 'complete', 'UPLOAD_FAILED' if r.name == 'Missing' else 'UPLOADED',
|
||||
True, 'per-item result') for r in requests]
|
||||
dialog = ManagementDialog(rows, runner=runner); qtbot.addWidget(dialog)
|
||||
monkeypatch.setattr(QMessageBox, 'question', lambda *_a, **_kw: QMessageBox.Yes)
|
||||
dialog.execute_button.click()
|
||||
qtbot.waitUntil(lambda: bool(seen) and not dialog.busy)
|
||||
assert [r.name for r in seen] == ['Missing', 'Good']
|
||||
|
||||
|
||||
def test_import_retargets_old_library_reference_without_requiring_old_library(transaction):
|
||||
root, request, state = transaction
|
||||
for path in (request.source, request.source.parent/'PCB/pcb.prj'):
|
||||
text = path.read_text()
|
||||
path.write_text(text.replace(str(request.library), str(root/'unavailable-old-library.lmc')))
|
||||
before = request.source.read_bytes()
|
||||
result = execute(root, request)
|
||||
assert result.status == 'UPLOADED' and result.safe_to_continue, result.detail
|
||||
assert request.source.read_bytes() == before
|
||||
|
||||
|
||||
def test_input_and_optional_verify_failures_do_not_skip_later_imports(setup, tmp_path):
|
||||
from cbb_refresh_verify.management import run_management_batch
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
request, adapter, source = setup
|
||||
results = run_management_batch([
|
||||
replace(request, operation='add', name='Bad', source=tmp_path/'absent.prj'),
|
||||
replace(request, operation='add', name='First', source=source, auto_verify=True),
|
||||
replace(request, operation='add', name='Second', source=source, auto_verify=False)],
|
||||
adapter=adapter, idle_check=lambda *_: None,
|
||||
verifier=lambda *_a, **_kw: VerifyResult('FAIL', stderr='Optional Verify did not pass'))
|
||||
assert [r.status for r in results] == ['UPLOAD_FAILED', 'UPLOADED_VERIFY_FAILED', 'UPLOADED']
|
||||
assert all(r.safe_to_continue for r in results)
|
||||
assert len(adapter.calls) == 2
|
||||
|
||||
|
||||
def test_native_project_normalization_is_a_recorded_difference_not_import_failure(transaction, monkeypatch):
|
||||
import cbb_refresh_verify.native_management as native
|
||||
root, request, state = transaction
|
||||
original_worker = native.NativeManagementAdapter._worker
|
||||
def worker(adapter, job, evidence):
|
||||
result = original_worker(adapter, job, evidence)
|
||||
if job['operation'] == 'add' and result.get('success'):
|
||||
project = request.library.parent/'ReusableBlocksLP/Block/Work/Source.prj'
|
||||
with project.open('a') as stream:
|
||||
stream.write('SECTION VBPCBIndicators\nKEY VBPCBForwardAnno "0"\nKEY CADBackAnno "0"\nENDSECTION\n')
|
||||
return result
|
||||
monkeypatch.setattr(native.NativeManagementAdapter, '_worker', worker)
|
||||
result = execute(root, request)
|
||||
assert result.status == 'UPLOADED' and result.safe_to_continue, result.detail
|
||||
comparison = json.loads((result.evidence_path.parent/'add/identity-comparison.json').read_text())
|
||||
assert comparison['identity_matches'] and not comparison['assets_match']
|
||||
assert 'Source.prj' in comparison['asset_differences']['modified']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('registered_top,expected', [('Block', 'UPLOADED'), ('Foreign', 'RECOVERY_REQUIRED')])
|
||||
def test_native_top_block_may_match_registration_name_but_not_an_unrelated_name(transaction, monkeypatch, registered_top, expected):
|
||||
import cbb_refresh_verify.native_management as native
|
||||
root, request, state = transaction
|
||||
original_worker = native.NativeManagementAdapter._worker
|
||||
def worker(adapter, job, evidence):
|
||||
result = original_worker(adapter, job, evidence)
|
||||
if job['operation'] == 'add' and result.get('success'):
|
||||
project = request.library.parent/'ReusableBlocksLP/Block/Work/Source.prj'
|
||||
project.write_text(project.read_text().replace('KEY RootBlock "Top"', f'KEY RootBlock "{registered_top}"'))
|
||||
return result
|
||||
monkeypatch.setattr(native.NativeManagementAdapter, '_worker', worker)
|
||||
result = execute(root, request)
|
||||
assert result.status == expected and result.safe_to_continue, result.detail
|
||||
@@ -0,0 +1,28 @@
|
||||
import json
|
||||
from dataclasses import asdict
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
from cbb_refresh_verify.verify_runner import VerifyRequest,VerifyResult,run_batch
|
||||
|
||||
|
||||
@pytest.mark.parametrize('released',[True,False])
|
||||
def test_batch_rechecks_owned_failure_before_skipping_next_item(tmp_path,monkeypatch,released):
|
||||
from cbb_refresh_verify import library_lock,session_record
|
||||
library=tmp_path/'lib.lmc';library.touch()
|
||||
root=tmp_path/'failure';root.mkdir()
|
||||
session_record.write_session_record(root/'session.json',dict(operation_id='test',library=str(library),block='A'))
|
||||
outcome=VerifyResult('FAIL',stderr='original failure',safe_to_continue=False,
|
||||
evidence_path=root/'result.json',session_record_path=root/'session.json')
|
||||
calls=[]
|
||||
monkeypatch.setattr(session_record,'inspect_session_record',lambda *a,**k:dict(status='UNCONFIRMED'))
|
||||
def proof(*a,**k):
|
||||
if not released:raise library_lock.LibraryBusy('shared database still occupied')
|
||||
return dict(status='RELEASE_CONFIRMED',library=str(library),data_recovery_confirmed=False)
|
||||
monkeypatch.setattr(library_lock,'release_retained_library',proof)
|
||||
def verify(req):
|
||||
calls.append(req.block_name)
|
||||
return outcome if req.block_name=='A' else VerifyResult('PASS')
|
||||
results=run_batch([VerifyRequest(library,n,tmp_path/'evidence') for n in ('A','B')],verifier=verify)
|
||||
assert results[0].status=='FAIL' and results[0].stderr=='original failure'
|
||||
assert results[0].safe_to_continue is released
|
||||
assert calls==(['A','B'] if released else ['A'])
|
||||
@@ -70,6 +70,28 @@ def test_verification_refuses_uploader_exclusive_lock_before_native_work(tmp_pat
|
||||
handle.Close()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('checkpoint_matches',[True,False])
|
||||
def test_auto_verify_reuses_only_exact_active_parent_transaction(tmp_path,monkeypatch,checkpoint_matches):
|
||||
import json
|
||||
from cbb_refresh_verify import library_lock as locks,verify_runner as runner
|
||||
library=tmp_path/'library/lib.lmc';library.parent.mkdir();library.touch()
|
||||
calls=[]
|
||||
monkeypatch.setattr(runner,'_run_verify_serialized',lambda *a,**k:
|
||||
calls.append('verified') or runner.VerifyResult('PASS',library_flag='GREEN'))
|
||||
with locks.LibraryLock(library,block_name='A'):
|
||||
if not checkpoint_matches:
|
||||
marker=locks.blocker_path(library)
|
||||
value=json.loads(marker.read_text('utf-8'));value['lease_id']='b'*32
|
||||
marker.write_text(json.dumps(value),'utf-8')
|
||||
result=runner.run_verify(runner.VerifyRequest(library,'A',tmp_path/'evidence'))
|
||||
assert (result.status=='PASS') is checkpoint_matches,result.stderr
|
||||
assert calls==(['verified'] if checkpoint_matches else [])
|
||||
if not checkpoint_matches:
|
||||
# Restore only the fixture checkpoint so the enclosing test lease can exit.
|
||||
owner=locks._owners[locks.LibraryLock(library).key]
|
||||
value['lease_id']=owner['lease_id'];marker.write_text(json.dumps(value),'utf-8')
|
||||
|
||||
|
||||
def test_unsafe_verify_records_failure_without_persistent_library_blocker(tmp_path, monkeypatch):
|
||||
import json
|
||||
import cbb_refresh_verify.verify_runner as runner
|
||||
@@ -203,7 +225,8 @@ def test_release_rechecks_owners_after_database_handles_are_acquired(tmp_path, m
|
||||
calls = []
|
||||
def query(names):
|
||||
calls.append(1)
|
||||
return [] if len(calls) == 1 else [{'pid': 123456, 'name': 'cscript.exe', 'command': 'helper'}]
|
||||
return [] if len(calls) == 1 else [{'pid': 123456, 'name': 'cscript.exe',
|
||||
'command': 'cscript.exe close_failed_block.vbs'}]
|
||||
monkeypatch.setattr(probe, 'query_owners', query)
|
||||
with pytest.raises(locks.LibraryBusy, match='123456'):
|
||||
with locks._prove_library_released(library): pass
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Run the real management engine with only the native/export boundaries faked."""
|
||||
"""Run the real management engine with only the native COM/command boundary faked."""
|
||||
from dataclasses import replace
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -11,9 +11,8 @@ import pytest
|
||||
def transaction(tmp_path, monkeypatch):
|
||||
from test_management import project
|
||||
import cbb_refresh_verify.native_management as native
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
import cbb_refresh_verify.backup_recovery as recovery
|
||||
from cbb_refresh_verify.management import ManagementRequest, engineering_identity, _write_json
|
||||
from cbb_refresh_verify.management import ManagementRequest, engineering_identity
|
||||
from cbb_refresh_verify.management_transaction import validate_transaction
|
||||
root = tmp_path/'probe'
|
||||
library = root/'native-add/fixture/mentor_lib.lmc'
|
||||
@@ -24,15 +23,7 @@ def transaction(tmp_path, monkeypatch):
|
||||
with path.open('a') as stream: stream.write(f'KEY CentralLibrary "{library}"\n')
|
||||
state = {'entries': [], 'calls': [], 'corrupt': False, 'fail_add': False}
|
||||
monkeypatch.setattr(native.NativeManagementAdapter, '_binary_capability', lambda _: '')
|
||||
monkeypatch.setattr(identity, 'check_exporters', lambda _: None)
|
||||
monkeypatch.setattr(recovery, '_idle_check', lambda *_: None)
|
||||
def capture(source, evidence, *, expected_library, **kwargs):
|
||||
evidence = Path(evidence); evidence.mkdir(parents=True, exist_ok=False)
|
||||
value = identity.asset_identity(source, expected_library)
|
||||
value.update(ascii_sha256='logical', csv={'work/identity': 'tables'}, edif_sha256='geometry')
|
||||
_write_json(evidence/'identity.json', {'identity': value, 'safe_to_continue': True})
|
||||
return identity.IdentityOutcome(value, True, 'file-only export proof', evidence)
|
||||
monkeypatch.setattr(identity, 'capture_identity', capture)
|
||||
def worker(adapter, job, evidence):
|
||||
evidence = Path(evidence); evidence.mkdir(parents=True, exist_ok=False)
|
||||
state['calls'].append(job['operation'])
|
||||
@@ -102,15 +93,25 @@ def test_owned_fixture_engine_add_conflict_update_remove_and_identity(transactio
|
||||
assert request.source.read_bytes() == original
|
||||
|
||||
|
||||
@pytest.mark.parametrize('corrupt', [True, 'unknown_cdbsvr'])
|
||||
def test_native_registered_but_asset_mismatch_retains_recovery(transaction, corrupt):
|
||||
def test_native_registered_but_layout_mismatch_retains_recovery(transaction):
|
||||
root, request, state = transaction
|
||||
state['corrupt'] = corrupt
|
||||
state['corrupt'] = True
|
||||
result = execute(root, request)
|
||||
assert result.status == 'RECOVERY_REQUIRED' and result.safe_to_continue
|
||||
assert execute(root, request).status == 'BLOCKED'
|
||||
|
||||
|
||||
def test_native_registered_with_additional_file_records_difference_without_blocking(transaction):
|
||||
root, request, state = transaction
|
||||
state['corrupt'] = 'unknown_cdbsvr'
|
||||
result = execute(root, request)
|
||||
assert result.status == 'UPLOADED' and result.safe_to_continue
|
||||
comparison = json.loads((result.evidence_path.parent/'add/identity-comparison.json').read_text())
|
||||
assert comparison['identity_matches'] and not comparison['assets_match']
|
||||
assert comparison['asset_differences']['added'] == ['database/cdbsvr/persistent.dat']
|
||||
assert '差异' in result.detail
|
||||
|
||||
|
||||
def test_update_readd_failure_preserves_baseline_and_removed_checkpoint(transaction):
|
||||
root, request, state = transaction
|
||||
assert execute(root, request).status == 'UPLOADED'
|
||||
|
||||
@@ -291,7 +291,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')
|
||||
session.scan(['Block'], library, tmp_path/'scan.jsonl', block_type='Other', resume=True)
|
||||
assert calls == ['RULP', 'Other']
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +103,9 @@ def test_real_management_worker_parent_loss_waits_for_native_boundary(tmp_path):
|
||||
while not cancel.exists() and time.monotonic()<deadline:
|
||||
time.sleep(.02)
|
||||
assert cancel.exists() and worker.poll() is None
|
||||
assert worker.wait(5) == 2
|
||||
# Either the normal failed result or orphan exit may win after return;
|
||||
# both require the receipt to have been durably published already.
|
||||
assert worker.wait(5) in (2, 75)
|
||||
assert not continued.exists()
|
||||
assert (tmp_path/'supervisor-lost.json').is_file()
|
||||
assert json.loads((tmp_path/'result.json').read_text())['safe_to_continue'] is True
|
||||
@@ -146,3 +148,20 @@ def test_remove_timeout_keeps_worker_observing_until_native_returns(tmp_path, mo
|
||||
thread.join(3)
|
||||
assert done.is_set()
|
||||
assert json.loads((tmp_path/'result.json').read_text())['safe_to_continue'] is True
|
||||
|
||||
|
||||
def test_terminal_management_state_cannot_precede_its_result_receipt(tmp_path, monkeypatch):
|
||||
job = tmp_path/'request.json'
|
||||
job.write_text(json.dumps(dict(operation='catalog', library=str(tmp_path/'lib.lmc'),
|
||||
desktop='CbbManagement_expected', operation_id='terminal-order')))
|
||||
monkeypatch.setattr(native, '_current_desktop', lambda: (None, 'wrong_desktop'))
|
||||
from cbb_refresh_verify import session_record
|
||||
observed = []
|
||||
def terminal(job, phase, **kwargs):
|
||||
if phase == 'FINISHED':
|
||||
receipt = json.loads((tmp_path/'result.json').read_text('utf-8'))
|
||||
assert receipt['safe_to_continue'] is True and receipt['success'] is False
|
||||
observed.append(phase)
|
||||
monkeypatch.setattr(session_record, 'update_worker_state', terminal)
|
||||
assert native.management_worker_main(job) == 2
|
||||
assert observed == ['FINISHED']
|
||||
@@ -62,7 +62,7 @@ def test_add_dialog_default_auto_verify_and_source_identity_rows(qtbot, tmp_path
|
||||
dialog.auto_verify.setChecked(False)
|
||||
assert not any(r.auto_verify for r in dialog.requests())
|
||||
dialog._progress({'stage': 'prepare_identity', 'block': 'One'})
|
||||
assert '正在核对来源工程内容' in dialog.status_label.text()
|
||||
assert '正在检查来源工程文件' in dialog.status_label.text()
|
||||
assert 'prepare_identity' not in dialog.status_label.text()
|
||||
|
||||
|
||||
|
||||
@@ -221,6 +221,96 @@ def test_export_does_not_adopt_unrelated_existing_native_owner(project, tmp_path
|
||||
assert len(started) == 3
|
||||
|
||||
|
||||
def test_export_does_not_adopt_existing_child_of_reused_parent_pid(project, tmp_path, monkeypatch):
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
import win32api
|
||||
source, _ = project
|
||||
root = tmp_path/'exports'; root.mkdir()
|
||||
# This process predates the exporter; its historical parent PID has been reused.
|
||||
unrelated = dict(pid=888888, parent=987654, name='python.exe', executable='python.exe',
|
||||
command='python other-tool.py', created='20261111120000.000000+480')
|
||||
monkeypatch.setattr(identity, '_process_snapshot', lambda: [unrelated])
|
||||
monkeypatch.setattr(identity, '_database_released', lambda _: True)
|
||||
monkeypatch.setattr(identity, 'validate_export_output', lambda *_: None)
|
||||
monkeypatch.setattr(win32api, 'OpenProcess', lambda *a: pytest.fail('adopted another tool'))
|
||||
class Finished:
|
||||
pid = 987654
|
||||
returncode = 0
|
||||
def __init__(self, *a, **k): pass
|
||||
def poll(self): return 0
|
||||
monkeypatch.setattr(identity.subprocess, 'Popen', Finished)
|
||||
result = identity._run_exports(source, root, tmp_path, 1)
|
||||
assert result['success'] and result['safe_to_continue']
|
||||
|
||||
|
||||
def test_export_lineage_rejects_reused_owner_and_its_new_children():
|
||||
from cbb_refresh_verify.native_engineering_identity import _export_descendants, _process_birth
|
||||
old = '20261112120000.000000+480'
|
||||
new = '20261112120100.000000+480'
|
||||
tracked = {10: _process_birth(old), 20: _process_birth(old)}
|
||||
rows = [dict(pid=20, parent=10, created=new), dict(pid=30, parent=20, created=new)]
|
||||
assert _export_descendants(rows, tracked, set()) == []
|
||||
assert 30 not in tracked
|
||||
# An orphaned real child can outlive its exact original parent.
|
||||
rows = [dict(pid=40, parent=10, created=new)]
|
||||
assert _export_descendants(rows, tracked, set()) == rows
|
||||
|
||||
|
||||
def test_export_lineage_rejects_child_older_than_native_handle_birth():
|
||||
from cbb_refresh_verify.native_engineering_identity import _export_descendants, _process_birth
|
||||
tracked = {10: _process_birth('20261112120000.000000+480')}
|
||||
rows = [dict(pid=20, parent=10, created='20261111120000.000000+480')]
|
||||
assert _export_descendants(rows, tracked, set()) == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize('remains_alive,database_busy', [(False, False), (True, False), (False, True)])
|
||||
def test_export_reobserves_access_denied_child_before_deciding_release(
|
||||
project, tmp_path, monkeypatch, remains_alive, database_busy):
|
||||
import json
|
||||
import pywintypes
|
||||
import win32api
|
||||
from cbb_refresh_verify import native_engineering_identity as identity
|
||||
source, _ = project
|
||||
root = tmp_path/'exports'; root.mkdir()
|
||||
launched, seen = [], {}
|
||||
class Finished:
|
||||
returncode = 0
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.pid = 980000+len(launched)*2
|
||||
launched.append(self)
|
||||
def poll(self): return 0
|
||||
def kill(self): pytest.fail('native owner must not be killed')
|
||||
def snapshot():
|
||||
if not launched: return []
|
||||
pid = launched[-1].pid
|
||||
seen[pid] = seen.get(pid, 0)+1
|
||||
if seen[pid] == 1 or remains_alive:
|
||||
return [{'pid': pid+1, 'parent': pid, 'name': 'conhost.exe',
|
||||
'command': '', 'executable': '', 'created': 'creation-identity'}]
|
||||
return []
|
||||
def denied(*args): raise pywintypes.error(5, 'OpenProcess', 'Access is denied')
|
||||
ticks = iter(i/100 for i in range(1000))
|
||||
monkeypatch.setattr(identity.time, 'monotonic', lambda: next(ticks))
|
||||
monkeypatch.setattr(identity.time, 'sleep', lambda _: None)
|
||||
monkeypatch.setattr(identity.subprocess, 'Popen', Finished)
|
||||
monkeypatch.setattr(identity, '_process_snapshot', snapshot)
|
||||
monkeypatch.setattr(identity, '_database_released', lambda _: not launched or not database_busy)
|
||||
monkeypatch.setattr(identity, 'validate_export_output', lambda *_: None)
|
||||
monkeypatch.setattr(identity, '_retained_exports', [])
|
||||
monkeypatch.setattr(win32api, 'OpenProcess', denied)
|
||||
result = identity._run_exports(source, root, tmp_path, .045)
|
||||
expected = not remains_alive and not database_busy
|
||||
assert result['success'] is expected
|
||||
assert result['safe_to_continue'] is expected
|
||||
record = json.loads((root/'ascii-process.json').read_text('utf-8'))
|
||||
assert record['process_identities'][0]['pid'] == launched[0].pid+1
|
||||
assert record['process_observation_errors'][str(launched[0].pid+1)]['winerror'] == 5
|
||||
if expected:
|
||||
assert len(launched) == 3 and not identity._retained_exports
|
||||
else:
|
||||
assert 'TIMEOUT' in result['detail'] and identity._retained_exports
|
||||
|
||||
|
||||
def test_export_spawn_failure_does_not_manufacture_native_ownership(project, tmp_path, monkeypatch):
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
source, _ = project
|
||||
|
||||
@@ -140,7 +140,7 @@ def test_retained_export_registry_is_scoped_to_its_library(tmp_path, monkeypatch
|
||||
with pytest.raises(LibraryBusy): assert_retained_exports_idle(library_a)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('created,blocked', [('new-process', False), ('original-process', True)])
|
||||
@pytest.mark.parametrize('created,blocked', [('20261113120000.000000+480', False), ('20261112120000.000000+480', True)])
|
||||
def test_recorded_export_pid_reuse_requires_matching_creation_identity(export_case, monkeypatch, created, blocked):
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
@@ -148,7 +148,7 @@ def test_recorded_export_pid_reuse_requires_matching_creation_identity(export_ca
|
||||
library, root, *_ = export_case
|
||||
path = root/'ascii-process.json'
|
||||
record = json.loads(path.read_text('utf-8'))
|
||||
record['process_identities'] = [{'pid': 123456, 'created': 'original-process', 'executable': 'native'}]
|
||||
record['process_identities'] = [{'pid': 123456, 'created': '20261112120000.000000+480', 'executable': 'native'}]
|
||||
path.write_text(json.dumps(record), encoding='utf-8')
|
||||
monkeypatch.setattr(locks, '_supervisor_alive', lambda _: True)
|
||||
monkeypatch.setattr(identity, '_process_snapshot', lambda: [
|
||||
@@ -161,6 +161,29 @@ def test_recorded_export_pid_reuse_requires_matching_creation_identity(export_ca
|
||||
with prove_export_copies_released(library): pass
|
||||
|
||||
|
||||
@pytest.mark.parametrize('in_memory', [False, True])
|
||||
def test_preexisting_process_misrecorded_as_descendant_does_not_retain_copy(export_case, monkeypatch, in_memory):
|
||||
import win32api, win32con
|
||||
from cbb_refresh_verify import native_engineering_identity as identity
|
||||
from cbb_refresh_verify.native_export_guard import prove_export_copies_released
|
||||
library, root, *_ = export_case
|
||||
record = dict(pid=123456, observed_pids=[123456, os.getpid()], process_identities=[
|
||||
dict(pid=123456, created='20261112120000.000000+480', executable='native'),
|
||||
dict(pid=os.getpid(), created='20261111120000.000000+480', executable='other')])
|
||||
(root/'ascii-process.json').write_text(json.dumps(record),'utf-8')
|
||||
monkeypatch.setattr(identity, '_process_snapshot', lambda: [dict(pid=os.getpid(), name='other.exe',
|
||||
parent=123456, created='20261111120000.000000+480', executable='other', command='')])
|
||||
handle = win32api.OpenProcess(win32con.SYNCHRONIZE, False, os.getpid())
|
||||
try:
|
||||
if in_memory:
|
||||
monkeypatch.setattr(identity, '_retained_exports', [(SimpleNamespace(pid=123456,poll=lambda: 0),
|
||||
{os.getpid(): handle}, dict(library=str(library),analysis_root=str(root)))])
|
||||
with prove_export_copies_released(library) as copies:
|
||||
assert copies == [str(root/'project')]
|
||||
finally:
|
||||
handle.Close()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('active', [False, True])
|
||||
def test_unknown_checkpoint_requires_explicit_full_proof_and_no_native_export_owner(tmp_path, monkeypatch, active):
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
|
||||
@@ -173,16 +173,17 @@ def test_add_route_readiness_is_separate_from_conservative_capability_gate(tmp_p
|
||||
import cbb_refresh_verify.native_management as native
|
||||
proof = {'lm/win32/bin/CleanWGLib.exe': hashlib.sha256(b'verified').hexdigest()}
|
||||
monkeypatch.setattr(native, '_BINARY_PROOF', proof)
|
||||
monkeypatch.setattr(native, '_PRODUCTION_ADD_VALIDATED', False)
|
||||
path = tmp_path/next(iter(proof)); path.parent.mkdir(parents=True); path.write_bytes(b'verified')
|
||||
adapter = native.NativeManagementAdapter(mentor_home=tmp_path)
|
||||
assert adapter.route_capabilities()['add'].supported
|
||||
assert not adapter.capabilities()['add'].supported
|
||||
assert 'icdb2ascii' in adapter.capabilities()['add'].reason
|
||||
assert not adapter.capabilities()['update'].supported
|
||||
|
||||
|
||||
@pytest.mark.parametrize('bad', [None, 'CleanWGLib.exe', 'LibraryManager.exe', 'LMCDLL70.dll',
|
||||
'LMCDocAddin70.dll', 'icdb2ascii.exe', 'icdb2csv.exe', 'edifExporter.exe'])
|
||||
def test_public_crud_requires_pinned_core_and_every_identity_exporter(tmp_path, monkeypatch, bad):
|
||||
def test_public_crud_requires_pinned_core_but_not_identity_exporters(tmp_path, monkeypatch, bad):
|
||||
import hashlib
|
||||
import cbb_refresh_verify.native_management as native
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
@@ -198,8 +199,8 @@ def test_public_crud_requires_pinned_core_and_every_identity_exporter(tmp_path,
|
||||
if bad:
|
||||
next(tmp_path.rglob(bad)).write_bytes(b'changed binary')
|
||||
caps = native.NativeManagementAdapter(mentor_home=tmp_path).capabilities()
|
||||
assert caps['add'].supported is (bad is None)
|
||||
assert caps['update'].supported is (bad is None)
|
||||
assert caps['add'].supported is (bad is None or bad in exporters)
|
||||
assert caps['update'].supported is (bad is None or bad in exporters)
|
||||
if bad in exporters: assert caps['remove'].supported
|
||||
|
||||
|
||||
@@ -399,9 +400,10 @@ def test_production_caps_require_all_validated_binary_hashes(tmp_path, monkeypat
|
||||
path = tmp_path/next(iter(proof)); path.parent.mkdir(parents=True); path.write_bytes(b'verified')
|
||||
adapter = native.NativeManagementAdapter(mentor_home=tmp_path)
|
||||
assert adapter.capabilities()['remove'].supported
|
||||
assert not adapter.capabilities()['add'].supported
|
||||
assert adapter.capabilities()['add'].supported
|
||||
path.write_bytes(b'different')
|
||||
assert not adapter.capabilities()['remove'].supported
|
||||
assert not adapter.capabilities()['add'].supported
|
||||
|
||||
|
||||
def test_probe_readd_requires_creation_token_and_fixed_owned_library(tmp_path):
|
||||
|
||||
@@ -2,7 +2,6 @@ import pytest
|
||||
|
||||
from cbb_refresh_verify.pcb_bridge import (
|
||||
PcbBridgeError,
|
||||
execution_outcome,
|
||||
require_document_identity,
|
||||
wait_for_target_document,
|
||||
)
|
||||
@@ -74,23 +73,6 @@ 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,114 @@
|
||||
from contextlib import nullcontext
|
||||
from types import SimpleNamespace
|
||||
from dataclasses import replace
|
||||
import pytest
|
||||
from test_post_repair_consent import snapshot
|
||||
|
||||
|
||||
@pytest.mark.parametrize('decision,control', [('continue',6),('skip',7),('cancel',7)])
|
||||
def test_readwrite_requires_explicit_choice_and_consumes_once(tmp_path,monkeypatch,decision,control):
|
||||
from cbb_refresh_verify import pcb_open_consent as consent
|
||||
monkeypatch.setattr(consent,'validate_owner',lambda *a:('bound-owner',))
|
||||
monkeypatch.setattr(consent,'resource_guard',lambda *a:nullcontext())
|
||||
job=dict(root=str(tmp_path),block_name='A',lmc_file=str(tmp_path/'lib.lmc'),desktop='CbbVerify_test',
|
||||
project=str(tmp_path/'A.prj'),pcb=str(tmp_path/'A.pcb'))
|
||||
controller=consent.OpenController(job)
|
||||
shown=[];sent=[]
|
||||
def perform(s,p,phase):
|
||||
sent.append(p);return SimpleNamespace(accepted_controls=(control,),error_code='',detail='',channel='win32_button_click')
|
||||
kwargs=dict(target_pid=20,launcher_pid=10,worker_pid=5,show=shown.append,perform=perform)
|
||||
first=controller.handle(snapshot(),(snapshot(),),**kwargs)
|
||||
assert not first.error_code and len(shown)==1 and not sent
|
||||
shown[0].choose(decision)
|
||||
result=controller.handle(snapshot(),(snapshot(),),**kwargs)
|
||||
assert len(sent)==1 and sent[0]['target']=={'control_id':control}
|
||||
assert result.error_code==('' if decision=='continue' else 'PCB_OPEN_SKIPPED' if decision=='skip' else 'USER_CANCELLED')
|
||||
controller.handle(snapshot(),(snapshot(),),**kwargs)
|
||||
assert len(sent)==1
|
||||
|
||||
|
||||
def test_no_consent_to_changed_window_or_database_owner(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify import pcb_open_consent as consent
|
||||
monkeypatch.setattr(consent,'validate_owner',lambda *a:('bound',))
|
||||
def occupied(*a):raise ValueError('target database occupied')
|
||||
monkeypatch.setattr(consent,'resource_guard',occupied)
|
||||
controller=consent.OpenController(dict(root=str(tmp_path),block_name='A',lmc_file=str(tmp_path/'lib.lmc'),
|
||||
desktop='CbbVerify_test',project=str(tmp_path/'A.prj'),pcb=str(tmp_path/'A.pcb')))
|
||||
shown=[]
|
||||
kwargs=dict(target_pid=20,launcher_pid=10,worker_pid=5,show=shown.append,perform=lambda *a:pytest.fail('unsafe Yes'))
|
||||
controller.handle(snapshot(),(snapshot(),),**kwargs)
|
||||
shown[0].choose('continue')
|
||||
result=controller.handle(snapshot(),(snapshot(),),**kwargs)
|
||||
assert result.error_code=='DATABASE_RECOVERY_REQUIRED' and 'occupied' in result.detail
|
||||
|
||||
|
||||
def test_explicit_open_dialog_defaults_to_cancel(qtbot):
|
||||
from cbb_refresh_verify.pcb_open_consent import OpenChoice
|
||||
from cbb_refresh_verify.ui.pcb_open_dialog import PcbOpenDialog
|
||||
choice=OpenChoice('A','lib.lmc')
|
||||
dialog=PcbOpenDialog(choice);qtbot.addWidget(dialog)
|
||||
assert dialog.defaultButton() is dialog.cancel_button
|
||||
dialog.skip_button.click()
|
||||
assert choice.decision=='skip'
|
||||
|
||||
|
||||
def test_normal_open_can_request_a_version_without_automatic_repair(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify import pcb_open_consent as consent
|
||||
from cbb_refresh_verify.pcb_restore_prompt import RestoreController
|
||||
from test_pcb_version_choice import captured
|
||||
monkeypatch.setattr(consent,'validate_owner',lambda *a:('owned',))
|
||||
job=dict(root=str(tmp_path),block_name='A',lmc_file=str(tmp_path/'lib.lmc'),
|
||||
desktop='CbbVerify_test',project=str(tmp_path/'A.prj'),pcb=str(tmp_path/'A.pcb'))
|
||||
controller=RestoreController(job,user_open=True)
|
||||
snap=captured();shown=[];sent=[]
|
||||
def perform(s,p,phase):
|
||||
sent.append(p);return SimpleNamespace(accepted_controls=(p['target']['control_id'],),error_code='',detail='',channel='win32_button_click')
|
||||
kwargs=dict(target_pid=snap.pid,launcher_pid=10,worker_pid=5,companion_pids=(),show=shown.append,perform=perform)
|
||||
assert not controller.handle(snap,(snap,),**kwargs).error_code
|
||||
assert len(shown)==1 and not sent
|
||||
shown[0].choose('last_user_saved')
|
||||
assert controller.handle(snap,(snap,),**kwargs).action_sent
|
||||
selected=replace(snap,controls=tuple(replace(c,checked=c.control_id==6213,selected=c.control_id==6213)
|
||||
if c.control_id in (6213,6206) else c for c in snap.controls))
|
||||
assert controller.handle(selected,(selected,),**kwargs).action_sent
|
||||
assert [p['target']['control_id'] for p in sent]==[6213,1]
|
||||
|
||||
|
||||
def test_readwrite_choice_survives_uia_chrome_enrichment(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify import pcb_open_consent as consent
|
||||
from cbb_refresh_verify.dialog_models import ControlSnapshot
|
||||
monkeypatch.setattr(consent,'validate_owner',lambda *a:('owned',))
|
||||
monkeypatch.setattr(consent,'resource_guard',lambda *a:nullcontext())
|
||||
controller=consent.OpenController(dict(root=str(tmp_path),block_name='A',lmc_file='lib.lmc',
|
||||
project='A.prj',pcb='A.pcb',desktop='CbbVerify_test'))
|
||||
original=snapshot();shown=[];sent=[]
|
||||
original=replace(original,controls=tuple(replace(c,name='是(&Y)' if c.control_id==6 else '否(&N)')
|
||||
if c.class_name=='Button' else c for c in original.controls))
|
||||
def perform(s,p,phase):
|
||||
sent.append(p)
|
||||
return SimpleNamespace(accepted_controls=(6,),error_code='',detail='',channel='win32_button_click')
|
||||
kwargs=dict(target_pid=20,launcher_pid=10,worker_pid=5,show=shown.append,perform=perform)
|
||||
controller.handle(original,(original,),**kwargs)
|
||||
shown[0].choose('continue')
|
||||
chrome=(ControlSnapshot(original.hwnd,0,original.window_class,original.title,
|
||||
control_type='Window',patterns=('Window',)),
|
||||
ControlSnapshot(0,0,'','',control_type='TitleBar',patterns=('Value',)))
|
||||
enriched=replace(original,controls=tuple(replace(c,name=c.name.replace('&',''))
|
||||
if c.class_name=='Button' else c for c in reversed(original.controls))+chrome)
|
||||
assert consent.exact_prompt(enriched)
|
||||
result=controller.handle(enriched,(enriched,),**kwargs)
|
||||
assert not result.error_code and len(sent)==1
|
||||
|
||||
|
||||
def test_readwrite_choice_rejects_replaced_native_button(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify import pcb_open_consent as consent
|
||||
monkeypatch.setattr(consent,'validate_owner',lambda *a:('owned',))
|
||||
controller=consent.OpenController(dict(root=str(tmp_path),block_name='A',lmc_file='lib.lmc'))
|
||||
original=snapshot();shown=[]
|
||||
kwargs=dict(target_pid=20,launcher_pid=10,worker_pid=5,show=shown.append,
|
||||
perform=lambda *a:pytest.fail('changed native button accepted'))
|
||||
controller.handle(original,(original,),**kwargs)
|
||||
shown[0].choose('continue')
|
||||
changed=replace(original,controls=tuple(replace(c,handle=c.handle+1) if c.control_id==6 else c
|
||||
for c in original.controls))
|
||||
assert controller.handle(changed,(changed,),**kwargs).error_code=='DATABASE_RECOVERY_REQUIRED'
|
||||
@@ -0,0 +1,134 @@
|
||||
"""Exercise Windows across real processes; thread-desktop mocks miss access denial."""
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
from uuid import uuid4
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize('thread_access_denied', [False, True])
|
||||
def test_foreign_private_desktop_window_is_readable(tmp_path, monkeypatch, thread_access_denied):
|
||||
import win32con
|
||||
import win32gui
|
||||
from cbb_refresh_verify.desktop_worker import DesktopWorker
|
||||
from cbb_refresh_verify.residual_sessions import _process_windows
|
||||
from cbb_refresh_verify import residual_sessions
|
||||
if thread_access_denied:
|
||||
def denied(_): raise PermissionError(5, 'GetThreadDesktop access denied')
|
||||
monkeypatch.setattr(residual_sessions, '_thread_desktop_name', denied)
|
||||
ready = tmp_path/'ready.json'
|
||||
child = tmp_path/'window.py'
|
||||
child.write_text('''
|
||||
import json,sys,os
|
||||
from pathlib import Path
|
||||
import win32api,win32con,win32gui
|
||||
def procedure(hwnd,message,wparam,lparam):
|
||||
if message==win32con.WM_CLOSE:
|
||||
win32gui.DestroyWindow(hwnd); return 0
|
||||
if message==win32con.WM_DESTROY:
|
||||
win32gui.PostQuitMessage(0); return 0
|
||||
return win32gui.DefWindowProc(hwnd,message,wparam,lparam)
|
||||
window=win32gui.WNDCLASS()
|
||||
window.hInstance=win32api.GetModuleHandle(None)
|
||||
window.lpszClassName='CbbPrivateDesktopTest'
|
||||
window.lpfnWndProc=procedure
|
||||
win32gui.RegisterClass(window)
|
||||
hwnd=win32gui.CreateWindow(window.lpszClassName,'CBB private desktop discovery',
|
||||
win32con.WS_OVERLAPPEDWINDOW|win32con.WS_VISIBLE,0,0,300,150,0,0,window.hInstance,None)
|
||||
Path(sys.argv[1]).write_text(json.dumps({'pid':os.getpid(),'hwnd':hwnd}),'utf-8')
|
||||
win32gui.PumpMessages()
|
||||
''', encoding='utf-8')
|
||||
name = 'CbbDiscoveryTest_'+uuid4().hex[:10]
|
||||
worker = DesktopWorker([sys.executable, str(child), str(ready)], name)
|
||||
row = None
|
||||
try:
|
||||
deadline = time.monotonic()+10
|
||||
while not ready.exists() and worker.poll() is None and time.monotonic()<deadline:
|
||||
time.sleep(.02)
|
||||
assert ready.exists(), 'The real Windows test helper failed to start'
|
||||
row = json.loads(ready.read_text('utf-8'))
|
||||
snapshot = _process_windows({row['pid']})
|
||||
assert not snapshot.incomplete, snapshot.incomplete
|
||||
observed = [w for w in snapshot[row['pid']] if w['hwnd'] == row['hwnd']]
|
||||
assert len(observed) == 1
|
||||
assert observed[0]['title'] == 'CBB private desktop discovery'
|
||||
assert observed[0]['desktop'] == name
|
||||
# A fresh process has no mapped heap for this desktop. Merely keeping
|
||||
# OpenDesktop's handle alive does not make its HWNDs readable.
|
||||
import subprocess
|
||||
probe = tmp_path/'probe.py'
|
||||
probe.write_text('''
|
||||
import sys
|
||||
import win32process
|
||||
from cbb_refresh_verify.residual_sessions import _window_desktop
|
||||
with _window_desktop(sys.argv[1], write=True):
|
||||
actual = win32process.GetWindowThreadProcessId(int(sys.argv[2]))
|
||||
assert actual[0] and actual[1] == int(sys.argv[3]), actual
|
||||
''', encoding='utf-8')
|
||||
checked = subprocess.run([sys.executable, str(probe), name, str(row['hwnd']), str(row['pid'])],
|
||||
capture_output=True, text=True, timeout=15)
|
||||
assert checked.returncode == 0, checked.stdout+checked.stderr
|
||||
residual_sessions._post_window_message(observed[0], row['hwnd'], row['pid'], win32con.WM_CLOSE)
|
||||
worker.wait(timeout=5)
|
||||
finally:
|
||||
if row is not None:
|
||||
with residual_sessions._window_desktop(name, write=True):
|
||||
if win32gui.IsWindow(row['hwnd']):
|
||||
win32gui.PostMessage(row['hwnd'], win32con.WM_CLOSE, 0, 0)
|
||||
try: worker.wait(timeout=5)
|
||||
finally: worker.close() # This helper is Python only; it never opens Mentor or a DB.
|
||||
|
||||
|
||||
def test_fallback_desktop_failure_keeps_known_other_process_available(monkeypatch):
|
||||
from contextlib import nullcontext
|
||||
import win32gui, win32process
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
monkeypatch.setattr(sessions, '_process_threads', lambda _: {10: [100], 20: [200]})
|
||||
def desktop(tid):
|
||||
if tid == 200: raise PermissionError('native thread desktop denied')
|
||||
return 'Default'
|
||||
monkeypatch.setattr(sessions, '_thread_desktop_name', desktop)
|
||||
monkeypatch.setattr(sessions, '_desktop_names', lambda: ['Default', 'PrivateBroken'])
|
||||
def opened(name, **kwargs):
|
||||
if name == 'PrivateBroken': raise PermissionError('private desktop unreadable')
|
||||
return nullcontext(name)
|
||||
monkeypatch.setattr(sessions, '_window_desktop', opened)
|
||||
monkeypatch.setattr(sessions, '_desktop_windows', lambda _: [1000])
|
||||
monkeypatch.setattr(win32process, 'GetWindowThreadProcessId', lambda _: (100, 10))
|
||||
monkeypatch.setattr(win32gui, 'IsWindowVisible', lambda _: True)
|
||||
monkeypatch.setattr(win32gui, 'EnumChildWindows', lambda *args: None)
|
||||
monkeypatch.setattr(win32gui, 'GetWindowText', lambda _: 'Expedition PCB')
|
||||
monkeypatch.setattr(win32gui, 'GetClassName', lambda _: 'Afx:main')
|
||||
monkeypatch.setattr(win32gui, 'IsWindowEnabled', lambda _: True)
|
||||
monkeypatch.setattr(win32gui, 'GetWindowRect', lambda _: (0, 0, 100, 100))
|
||||
snapshot = sessions._process_windows({10, 20})
|
||||
assert 10 not in snapshot.incomplete and snapshot[10][0]['hwnd'] == 1000
|
||||
assert 'unreadable' in snapshot.incomplete[20]
|
||||
assert sessions.close_target('ExpeditionPCB.exe', snapshot[20], incomplete=snapshot.incomplete[20])[0] is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('actual_pid', [10, 20])
|
||||
def test_native_message_holds_desktop_and_rechecks_pid(monkeypatch, actual_pid):
|
||||
from contextlib import contextmanager
|
||||
import win32gui, win32process
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
events = []
|
||||
@contextmanager
|
||||
def opened(name, *, write):
|
||||
assert name == 'Private' and write is True
|
||||
events.append('open')
|
||||
try: yield 123
|
||||
finally: events.append('close')
|
||||
monkeypatch.setattr(sessions, '_window_desktop', opened)
|
||||
monkeypatch.setattr(win32process, 'GetWindowThreadProcessId', lambda _: (1, actual_pid))
|
||||
def post(*args):
|
||||
assert events == ['open']
|
||||
events.append('post')
|
||||
monkeypatch.setattr(win32gui, 'PostMessage', post)
|
||||
if actual_pid == 10:
|
||||
sessions._post_window_message({'desktop': 'Private'}, 100, 10, 16)
|
||||
assert events == ['open', 'post', 'close']
|
||||
else:
|
||||
with pytest.raises(ValueError, match='归属已变化'):
|
||||
sessions._post_window_message({'desktop': 'Private'}, 100, 10, 16)
|
||||
assert events == ['open', 'close']
|
||||
@@ -150,6 +150,7 @@ def test_released_batch_can_resume_only_its_unexecuted_items(qtbot, tmp_path, mo
|
||||
window.release_dialog.close()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert window.summary.isVisible()
|
||||
action = window._resume_batch_action
|
||||
assert action.isEnabled()
|
||||
calls = []
|
||||
monkeypatch.setattr(window, '_run', lambda names, **kw: calls.append((names, kw)))
|
||||
|
||||
@@ -53,7 +53,8 @@ def test_unknown_scope_is_visible_but_never_closed_even_with_force(tmp_path, mon
|
||||
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'
|
||||
assert result['status'] == 'RELEASE_CONFIRMED'
|
||||
assert result['sessions'][0]['release_status'] == 'OBSERVED'
|
||||
# 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)
|
||||
@@ -334,11 +335,12 @@ def test_partial_desktop_enumeration_never_offers_normal_close(monkeypatch):
|
||||
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)
|
||||
snapshot = _process_windows({10})
|
||||
windows = snapshot[10]
|
||||
assert snapshot.incomplete[10]
|
||||
windows.append({'hwnd': 100, 'class': 'Afx:main', 'title': 'Design - Expedition PCB',
|
||||
'children': [], 'enabled': True})
|
||||
assert close_target('ExpeditionPCB.exe', windows)[0] is None
|
||||
assert close_target('ExpeditionPCB.exe', windows, incomplete=snapshot.incomplete[10])[0] is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize('choice', [6, 7, 2])
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
from contextlib import nullcontext
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
from uuid import uuid4
|
||||
|
||||
import pytest
|
||||
|
||||
from cbb_refresh_verify import residual_sessions as sessions
|
||||
from test_residual_sessions import row, OWNERSHIP
|
||||
|
||||
|
||||
def window():
|
||||
return dict(hwnd=100, title='Design - Expedition PCB', desktop='Default',
|
||||
**{'class': 'Afx:main'}, enabled=True, children=[], documents=[])
|
||||
|
||||
|
||||
class PartialWindows(dict):
|
||||
incomplete = {10: 'target thread inaccessible'}
|
||||
|
||||
|
||||
def test_thread_read_failure_does_not_poison_another_process(monkeypatch):
|
||||
import win32gui, win32process, win32service
|
||||
def global_failure(*args):
|
||||
raise OSError('an unrelated desktop is inaccessible')
|
||||
monkeypatch.setattr(win32gui, 'EnumWindows', global_failure)
|
||||
monkeypatch.setattr(win32service, 'GetProcessWindowStation',
|
||||
lambda: SimpleNamespace(EnumDesktops=lambda: ['Default', 'CbbManagement_Unrelated']))
|
||||
monkeypatch.setattr(sessions, '_process_threads', lambda _: {10: [100], 20: [200]}, raising=False)
|
||||
monkeypatch.setattr(sessions, '_thread_desktop_name',
|
||||
lambda tid: 'Default' if tid == 100 else 'CbbManagement_Broken', raising=False)
|
||||
def open_desktop(name, *args):
|
||||
if name == 'CbbManagement_Broken':
|
||||
raise PermissionError('only process 20 is unreadable')
|
||||
assert name == 'Default', 'an unrelated desktop must not be inspected'
|
||||
return SimpleNamespace(EnumDesktopWindows=lambda: [1000], CloseDesktop=lambda: None)
|
||||
monkeypatch.setattr(win32service, 'OpenDesktop', open_desktop)
|
||||
monkeypatch.setattr(sessions, '_window_desktop', lambda name, **kwargs: nullcontext(open_desktop(name)))
|
||||
monkeypatch.setattr(sessions, '_desktop_windows', lambda desktop: desktop.EnumDesktopWindows())
|
||||
monkeypatch.setattr(win32process, 'GetWindowThreadProcessId', lambda _: (100, 10))
|
||||
monkeypatch.setattr(win32gui, 'IsWindowVisible', lambda _: True)
|
||||
monkeypatch.setattr(win32gui, 'EnumChildWindows', lambda *args: None)
|
||||
monkeypatch.setattr(win32gui, 'GetWindowText', lambda _: 'Design - Expedition PCB')
|
||||
monkeypatch.setattr(win32gui, 'GetClassName', lambda _: 'Afx:main')
|
||||
monkeypatch.setattr(win32gui, 'IsWindowEnabled', lambda _: True)
|
||||
monkeypatch.setattr(win32gui, 'GetWindowRect', lambda _: (0, 0, 100, 100))
|
||||
result = sessions._process_windows({10, 20})
|
||||
assert [w['hwnd'] for w in result[10]] == [1000]
|
||||
assert 10 not in result.incomplete and 'unreadable' in result.incomplete[20]
|
||||
assert result[20] == [], 'a read error must not be represented as a native modal window'
|
||||
assert sessions.close_target('ExpeditionPCB.exe', result[10])[0]
|
||||
|
||||
|
||||
def test_preview_exposes_only_target_process_incomplete_state(tmp_path, monkeypatch):
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
processes = [row(pid, tmp_path/f'ReusableBlocksLP/{pid}/Work/{pid}.prj', name='ExpeditionPCB.exe')
|
||||
for pid in (10, 20)]
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: processes)
|
||||
monkeypatch.setattr(sessions, '_process_identity', lambda r: dict(created_handle='creation',
|
||||
image=r['executable'], **OWNERSHIP))
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: PartialWindows({10: [window()], 20: [window()]}))
|
||||
affected, healthy = sessions.inspect_residual_sessions(library)['sessions']
|
||||
assert affected['windows_incomplete'] and not affected['can_close'] and not affected['force_allowed']
|
||||
assert affected['native_activity']['status'] == 'UNCONFIRMED'
|
||||
assert '读取' in affected['detail'] and '弹窗' not in affected['detail']
|
||||
assert healthy['can_close'] and healthy['force_allowed']
|
||||
|
||||
|
||||
def test_action_rechecks_incomplete_read_before_force_termination(monkeypatch):
|
||||
import win32api, win32con, win32event
|
||||
process = dict(row(10, 'C:/library/A.prj', name='ExpeditionPCB.exe'),
|
||||
created_handle='creation', image='C:/Mentor/ExpeditionPCB.exe', scope_confirmed=True, **OWNERSHIP)
|
||||
monkeypatch.setattr(sessions, '_process_handle', lambda *a, **kw: nullcontext(123))
|
||||
monkeypatch.setattr(sessions, '_handle_identity', lambda _: {k: process[k] for k in ('created_handle', 'image')})
|
||||
monkeypatch.setattr(sessions, '_force_ownership', lambda *args: dict(OWNERSHIP))
|
||||
monkeypatch.setattr(win32event, 'WaitForSingleObject', lambda *args: win32con.WAIT_TIMEOUT)
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: PartialWindows({10: [window()]}))
|
||||
monkeypatch.setattr(win32api, 'TerminateProcess', lambda *args: pytest.fail('unreadable target was ended'))
|
||||
result = sessions._force_close(process)
|
||||
assert result['release_status'] == 'WAITING' and result['native_activity']['status'] == 'UNCONFIRMED'
|
||||
|
||||
|
||||
def test_identity_read_failure_keeps_the_other_preview_row_available(tmp_path, monkeypatch):
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
processes = [row(pid, tmp_path/f'ReusableBlocksLP/{pid}/Work/A.prj', name='ExpeditionPCB.exe')
|
||||
for pid in (10, 20)]
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: processes)
|
||||
def identity(process):
|
||||
if process['pid'] == 10:
|
||||
raise PermissionError('token inaccessible')
|
||||
return dict(created_handle='creation', image=process['executable'], **OWNERSHIP)
|
||||
monkeypatch.setattr(sessions, '_process_identity', identity)
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {pid: [window()] for pid in (10, 20)})
|
||||
affected, healthy = sessions.inspect_residual_sessions(library)['sessions']
|
||||
assert not affected['force_allowed'] and 'token inaccessible' in affected['detail']
|
||||
assert healthy['force_allowed'] and healthy['can_close']
|
||||
|
||||
|
||||
def test_native_cancel_retains_exact_preview_scope(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock
|
||||
library = tmp_path/'library/lib.lmc'; library.parent.mkdir(); library.touch()
|
||||
process = dict(row(10, library.parent/'ReusableBlocksLP/A/Work/A.prj'),
|
||||
scope_confirmed=True, block_names=['A'], cancel_prompt={'hwnd': 100})
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [process])
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {})
|
||||
expected = (library.parent/'ReusableBlocksLP/A/Work', library.parent/'SymbolLibs')
|
||||
def scoped(actual, selected_library, roots):
|
||||
assert roots == expected, 'Cancel widened the scope from its preview'
|
||||
return True
|
||||
monkeypatch.setattr(library_lock, '_owner_matches_scope', scoped)
|
||||
monkeypatch.setattr(sessions, '_request_native_cancel', lambda *a, **kw:
|
||||
dict(release_status='WAITING', detail='cancel requested'))
|
||||
result = sessions.request_native_cancel(process, library, tmp_path/'evidence')
|
||||
assert result['sessions'][0]['detail'] == 'cancel requested'
|
||||
|
||||
|
||||
def test_persisted_release_evidence_is_bounded_without_changing_preview(tmp_path, monkeypatch):
|
||||
library = tmp_path/'library/lib.lmc'; library.parent.mkdir(); library.touch()
|
||||
output = '原生输出' * 100000
|
||||
observed = dict(window(), output=output, children=[dict(text=output, **{'class': 'RichEdit'})])
|
||||
process = dict(row(10, library.parent/'ReusableBlocksLP/A/Work/A.prj', name='ExpeditionPCB.exe'),
|
||||
created_handle='creation', image='C:/Mentor/ExpeditionPCB.exe', scope_confirmed=True,
|
||||
windows=[observed], native_activity={'status': 'IDLE', 'output': output}, **OWNERSHIP)
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [process])
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {})
|
||||
monkeypatch.setattr(sessions, '_force_close', lambda *a, **kw: dict(release_status='RELEASED', detail='ended'))
|
||||
monkeypatch.setattr(sessions, '_finish_library_release', lambda *args:
|
||||
dict(status='RELEASE_CONFIRMED', library=str(library)))
|
||||
result = sessions.release_residual_sessions(dict(library=str(library), sessions=[process]),
|
||||
tmp_path/'evidence', force=True)
|
||||
assert result['status'] == 'RELEASE_CONFIRMED'
|
||||
for path in (Path(result['evidence_path']), Path(result['consent_path'])):
|
||||
assert path.stat().st_size < 20000
|
||||
saved = json.loads(path.read_text('utf-8'))['sessions'][0]
|
||||
assert 'output' not in saved['native_activity']
|
||||
assert 'children' not in saved['windows'][0] and 'output' not in saved['windows'][0]
|
||||
assert len(saved['windows'][0]['output_excerpt'].encode('utf-8')) <= 4096
|
||||
assert saved['windows'][0]['output_truncated'] is True
|
||||
assert process['windows'][0]['output'] == output
|
||||
|
||||
|
||||
def test_real_private_desktop_is_read_through_its_process_threads(tmp_path):
|
||||
from cbb_refresh_verify.desktop_worker import DesktopWorker
|
||||
ready, stop = tmp_path/'ready.json', tmp_path/'stop'
|
||||
script = tmp_path/'window.py'
|
||||
name = 'CbbManagement_Review_'+uuid4().hex[:10]
|
||||
script.write_text('import json,time,win32api,win32con,win32gui\nfrom pathlib import Path\n'
|
||||
'wc=win32gui.WNDCLASS()\nwc.hInstance=win32api.GetModuleHandle(None)\n'
|
||||
'wc.lpszClassName="CbbReviewWindow"\nwc.lpfnWndProc=win32gui.DefWindowProc\n'
|
||||
'atom=win32gui.RegisterClass(wc)\n'
|
||||
'hwnd=win32gui.CreateWindow(atom,"Controlled review fixture",'
|
||||
'win32con.WS_OVERLAPPEDWINDOW|win32con.WS_VISIBLE,0,0,300,200,0,0,wc.hInstance,None)\n'
|
||||
f'Path({str(ready)!r}).write_text(json.dumps(dict(hwnd=hwnd)))\n'
|
||||
f'while not Path({str(stop)!r}).exists():\n'
|
||||
' win32gui.PumpWaitingMessages();time.sleep(.02)\n'
|
||||
'win32gui.DestroyWindow(hwnd)\n', encoding='utf-8')
|
||||
worker = DesktopWorker([sys.executable, str(script)], name)
|
||||
try:
|
||||
deadline = time.monotonic()+8
|
||||
while not ready.exists() and worker.poll() is None and time.monotonic()<deadline:
|
||||
time.sleep(.02)
|
||||
assert ready.exists()
|
||||
hwnd = json.loads(ready.read_text())['hwnd']
|
||||
snapshot = sessions._process_windows({worker.pid})
|
||||
assert worker.pid not in snapshot.incomplete, snapshot.incomplete
|
||||
target = next(w for w in snapshot[worker.pid] if w['hwnd'] == hwnd)
|
||||
assert target['desktop'] == name and target['title'] == 'Controlled review fixture'
|
||||
finally:
|
||||
stop.touch()
|
||||
worker.wait(5)
|
||||
worker.close()
|
||||
@@ -0,0 +1,122 @@
|
||||
from contextlib import contextmanager
|
||||
import json
|
||||
from pathlib import Path
|
||||
from threading import Event
|
||||
|
||||
import pytest
|
||||
|
||||
from cbb_refresh_verify import desktop_worker as desktop, session_record as sessions
|
||||
|
||||
|
||||
@pytest.mark.parametrize('asynchronous,expected', [(False, 'POSTCALL'), (True, 'NATIVE_CALL')])
|
||||
@pytest.mark.parametrize('phase', ['NATIVE_CALL', 'CLOSING'])
|
||||
def test_dispatch_records_pending_before_call_and_waits_for_async_ack(tmp_path, asynchronous, expected, phase):
|
||||
job = dict(operation_id='dispatch-test', session_record_path=str(tmp_path/'session.json'))
|
||||
def native_call():
|
||||
value = sessions.read_session_record(tmp_path/'worker-state.json', evidence_root=tmp_path)
|
||||
assert value['phase'] == phase
|
||||
assert desktop._native_phases[job['operation_id']] == phase
|
||||
return 'native-result'
|
||||
assert sessions.dispatch_native(job, native_call, phase=phase, asynchronous=asynchronous, required=True) == 'native-result'
|
||||
assert sessions.read_session_record(tmp_path/'worker-state.json', evidence_root=tmp_path)['phase'] == (
|
||||
phase if asynchronous else expected)
|
||||
|
||||
|
||||
def test_dispatch_veto_is_not_swallowed_by_optional_journal_mode(tmp_path, monkeypatch):
|
||||
job = dict(operation_id='veto-test', session_record_path=str(tmp_path/'session.json'))
|
||||
lost = Event()
|
||||
monkeypatch.setattr(desktop, '_supervisor_lost', lost)
|
||||
sessions.update_worker_state(job, 'PRECALL')
|
||||
lost.set()
|
||||
with pytest.raises(RuntimeError, match='WORKER_CANCELLED'):
|
||||
sessions.dispatch_native(job, lambda: pytest.fail('native call after supervisor loss'), required=False)
|
||||
assert sessions.read_session_record(tmp_path/'worker-state.json', evidence_root=tmp_path)['phase'] == 'PRECALL'
|
||||
with pytest.raises(RuntimeError, match='WORKER_STATE_UNCONFIRMED'):
|
||||
sessions.update_worker_state(job, 'NATIVE_CALL', continuation=True)
|
||||
|
||||
|
||||
def test_dispatch_refuses_new_call_if_required_journal_cannot_be_written(tmp_path, monkeypatch):
|
||||
job = dict(operation_id='disk-test', session_record_path=str(tmp_path/'session.json'))
|
||||
def unavailable(*args, **kwargs):
|
||||
raise OSError('disk unavailable')
|
||||
monkeypatch.setattr(sessions, 'write_session_record', unavailable)
|
||||
with pytest.raises(OSError, match='disk unavailable'):
|
||||
sessions.dispatch_native(job, lambda: pytest.fail('unrecorded dispatch'), required=True)
|
||||
|
||||
|
||||
def test_failed_native_return_stays_unconfirmed(tmp_path):
|
||||
job = dict(operation_id='unknown-test', session_record_path=str(tmp_path/'session.json'))
|
||||
def interrupted():
|
||||
raise TimeoutError('COM transport result unknown')
|
||||
with pytest.raises(TimeoutError):
|
||||
sessions.dispatch_native(job, interrupted)
|
||||
assert sessions.read_session_record(tmp_path/'worker-state.json', evidence_root=tmp_path)['phase'] == 'UNCONFIRMED'
|
||||
|
||||
|
||||
def test_whole_library_release_names_every_reconciled_retained_block(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock as locks
|
||||
monkeypatch.setattr(sessions, '_retained_libraries', {})
|
||||
monkeypatch.setattr(sessions, '_retained_results', {})
|
||||
library = tmp_path/'library/lib.lmc'; library.parent.mkdir(); library.touch()
|
||||
for block in ('BlockA', 'BlockB'):
|
||||
path = tmp_path/block/'session.json'; path.parent.mkdir()
|
||||
op = 'operation-'+block
|
||||
sessions.write_session_record(path, dict(operation_id=op, library=str(library), block=block, processes=[]))
|
||||
key = str(path.absolute()).casefold()
|
||||
sessions._retained_libraries[key] = {sessions._library_key(library)}
|
||||
sessions._retained_results[key] = dict(block=block, library=str(library), operation_id=op)
|
||||
locks._persist_blocker(library, lease_id='b'*32, block_name='BlockB')
|
||||
@contextmanager
|
||||
def proof(*args, **kwargs):
|
||||
yield dict(native_owners=[], addresses=[], exclusive_files=[str(library)])
|
||||
monkeypatch.setattr(locks, '_prove_library_released', proof)
|
||||
result = locks.release_retained_library(library, tmp_path/'proof', block_name='BlockA')
|
||||
assert result['reconciled_blocks'] == ['BlockA', 'BlockB']
|
||||
assert {r['operation_id'] for r in result['reconciled_sessions']} == {'operation-BlockA', 'operation-BlockB'}
|
||||
assert result['reconciled_foreign_blockers'] == ['BlockB']
|
||||
assert sessions.library_available(library)
|
||||
for block in ('BlockA', 'BlockB'):
|
||||
receipt = json.loads(next((tmp_path/block).glob('observation-release-*.json')).read_text('utf-8'))
|
||||
assert receipt['release_proof']['reconciled_blocks'] == ['BlockA', 'BlockB']
|
||||
|
||||
|
||||
def test_release_snapshot_cannot_ack_a_replaced_operation(tmp_path, monkeypatch):
|
||||
library = tmp_path/'lib.lmc'
|
||||
key = str(tmp_path/'session.json')
|
||||
aliases = {sessions._library_key(library)}
|
||||
monkeypatch.setattr(sessions, '_retained_libraries', {key: aliases})
|
||||
monkeypatch.setattr(sessions, '_retained_results', {key: dict(block='A', operation_id='before')})
|
||||
snapshot = sessions.retained_session_snapshot(library)
|
||||
sessions._retained_results[key]['operation_id'] = 'after'
|
||||
sessions.acknowledge_library_release(dict(status='RELEASE_CONFIRMED', library=str(library)), snapshot)
|
||||
assert not sessions.library_available(library)
|
||||
assert sessions.reconciled_retained_sessions(snapshot) == []
|
||||
|
||||
|
||||
def test_parent_loss_after_remove_started_still_records_and_waits(tmp_path, monkeypatch):
|
||||
import os
|
||||
from types import SimpleNamespace
|
||||
from cbb_refresh_verify import native_management as native
|
||||
lost = Event()
|
||||
monkeypatch.setattr(desktop, '_supervisor_lost', lost)
|
||||
job = dict(operation='remove', library=str(tmp_path/'lib.lmc'), desktop='CbbManagement_test',
|
||||
mentor_home=str(tmp_path), name='A', partition='Logical-Physical', timeout_seconds=1,
|
||||
supervisor_pid=os.getpid(), operation_id='accepted-remove', session_record_path=str(tmp_path/'session.json'))
|
||||
request = tmp_path/'request.json'; request.write_text(json.dumps(job))
|
||||
monkeypatch.setattr(native, '_current_desktop', lambda: (None, job['desktop']))
|
||||
monkeypatch.setattr(native.NativeManagementAdapter, 'capabilities',
|
||||
lambda _: {'remove': SimpleNamespace(supported=True)})
|
||||
monkeypatch.setattr(sessions, 'process_identity', lambda pid: dict(pid=pid, created_handle='native',
|
||||
image='CleanWGLib.exe', owner_sid='S-1-test', session_id=1))
|
||||
waited = []
|
||||
def wait(timeout):
|
||||
state = sessions.read_session_record(tmp_path/'worker-state.json', evidence_root=tmp_path)
|
||||
assert state['phase'] == 'NATIVE_CALL' and state['processes'][0]['pid'] == 123456
|
||||
waited.append(True)
|
||||
return 0
|
||||
def launch(*args, **kwargs):
|
||||
lost.set()
|
||||
return SimpleNamespace(pid=123456, wait=wait)
|
||||
monkeypatch.setattr(native.subprocess, 'Popen', launch)
|
||||
native.management_worker_main(request)
|
||||
assert waited == [True], 'loss during accepted launch abandoned the native owner'
|
||||
@@ -0,0 +1,158 @@
|
||||
from pathlib import Path
|
||||
from threading import Event
|
||||
|
||||
from cbb_refresh_verify import session_record as sessions
|
||||
|
||||
|
||||
def retain(monkeypatch, library):
|
||||
key = 'controlled-session'
|
||||
monkeypatch.setattr(sessions, '_retained_libraries', {key: {sessions._library_key(library)}})
|
||||
monkeypatch.setattr(sessions, '_retained_results', {key: dict(block='BlockedCBB', operation_id='test',
|
||||
library=str(library), status='UNCONFIRMED', detail='Close result unknown')})
|
||||
|
||||
|
||||
def test_cached_wait_reason_names_retained_block_without_file_io(tmp_path, monkeypatch):
|
||||
library = tmp_path/'lib.lmc'
|
||||
retain(monkeypatch, library)
|
||||
monkeypatch.setattr(Path, 'resolve', lambda *a, **kw: (_ for _ in ()).throw(AssertionError('queue filesystem I/O')))
|
||||
detail = sessions.library_wait_reason(library)
|
||||
assert 'BlockedCBB' in detail and '残留' in detail
|
||||
assert sessions.library_wait_reason(tmp_path/'other.lmc') == ''
|
||||
|
||||
|
||||
def test_queued_action_has_visible_release_entry_and_resumes_after_proof(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)
|
||||
window.show()
|
||||
library = window.mentor_lmc_path
|
||||
retain(monkeypatch, library)
|
||||
finished = Event()
|
||||
window._start(lambda: VerifyResult('PASS'), lambda _: finished.set())
|
||||
qtbot.waitUntil(lambda: 'BlockedCBB' in window.status_label.text())
|
||||
assert window.queue_release_button.isVisible() and window.queue_release_button.isEnabled()
|
||||
opened = []
|
||||
monkeypatch.setattr(window, 'check_library_release', lambda **kwargs: opened.append(kwargs))
|
||||
window.queue_release_button.click()
|
||||
assert opened == [{'queued': True}]
|
||||
sessions._retained_libraries.clear()
|
||||
window.native_queue.wake()
|
||||
qtbot.waitUntil(finished.is_set)
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert not window.queue_release_button.isVisible()
|
||||
|
||||
|
||||
def test_release_entry_does_not_clear_the_busy_state_of_a_waiting_ticket(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify import library_lock
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
library = window.mentor_lmc_path
|
||||
retain(monkeypatch, library)
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions',
|
||||
lambda _: dict(library=str(library), sessions=[]))
|
||||
window.busy = True
|
||||
window._queue_wait_library = str(library)
|
||||
window.check_library_release(queued=True)
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
window.release_dialog.close()
|
||||
qtbot.waitUntil(lambda: not window._queue_release_mode)
|
||||
assert window.busy
|
||||
window.busy = False
|
||||
|
||||
|
||||
def test_release_mapping_cleanup_finishes_before_waiting_ticket_resumes(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify import library_lock
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
cleaned, finished = Event(), Event()
|
||||
library = window.mentor_lmc_path
|
||||
retain(monkeypatch, library)
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions',
|
||||
lambda _: dict(library=str(library), sessions=[]))
|
||||
def backend_release(*a, **kw):
|
||||
sessions._retained_libraries.clear()
|
||||
return dict(status='RELEASE_CONFIRMED', sessions=[], proof=dict(status='RELEASE_CONFIRMED',
|
||||
library=str(library), evidence_path='controlled-proof.json'))
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', backend_release)
|
||||
def finalize(*a, **kw):
|
||||
assert window.native_queue.active, 'proof cleanup must complete inside serialized release'
|
||||
cleaned.set()
|
||||
monkeypatch.setattr('cbb_refresh_verify.network_path.release_retained_path_leases', finalize)
|
||||
def action():
|
||||
assert cleaned.is_set(), 'new native operation began before old mapping release completed'
|
||||
finished.set()
|
||||
window._start(action, lambda _: None)
|
||||
qtbot.waitUntil(lambda: window._queue_wait_library is not None)
|
||||
window.check_library_release(queued=True)
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
window.release_dialog.confirm_button.click()
|
||||
qtbot.waitUntil(finished.is_set)
|
||||
qtbot.waitUntil(lambda: not window.release_dialog.busy)
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
window.release_dialog.close()
|
||||
|
||||
|
||||
def test_wait_reason_updates_when_active_task_becomes_a_retained_session(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
library = window.mentor_lmc_path
|
||||
retain(monkeypatch, library)
|
||||
sessions._retained_libraries.clear()
|
||||
active = Event()
|
||||
release = Event()
|
||||
from threading import Thread
|
||||
first = Thread(target=lambda: window.native_queue.run(lambda: (active.set(), release.wait(5))))
|
||||
first.start()
|
||||
qtbot.waitUntil(active.is_set)
|
||||
try:
|
||||
window._start(lambda: None, lambda _: None)
|
||||
qtbot.waitUntil(lambda: '已排队' in window.status_label.text())
|
||||
assert window._queue_wait_library is None
|
||||
sessions._retained_libraries['controlled-session'] = {sessions._library_key(library)}
|
||||
release.set(); first.join(3)
|
||||
qtbot.waitUntil(lambda: 'BlockedCBB' in window.status_label.text())
|
||||
assert not window.queue_release_button.isHidden()
|
||||
finally:
|
||||
release.set(); first.join(3)
|
||||
sessions._retained_libraries.clear(); window.native_queue.wake()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
|
||||
|
||||
def test_management_wait_shows_same_block_and_emits_release_target(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
from cbb_refresh_verify.management import ManagementRequest
|
||||
from cbb_refresh_verify.operation_queue import NativeQueue
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
library = tmp_path/'lib.lmc'
|
||||
retain(monkeypatch, library)
|
||||
monkeypatch.setattr(QMessageBox, 'question', lambda *a, **kw: QMessageBox.Yes)
|
||||
dialog = ManagementDialog([ManagementRequest('remove', library, 'A')], runner=lambda *a, **kw: [])
|
||||
dialog.native_queue = NativeQueue()
|
||||
qtbot.addWidget(dialog); dialog.show()
|
||||
targets = []
|
||||
dialog.release_requested.connect(targets.append)
|
||||
dialog.execute_button.click()
|
||||
qtbot.waitUntil(lambda: 'BlockedCBB' in dialog.status_label.text())
|
||||
assert dialog.release_wait_button.isVisible()
|
||||
dialog.release_wait_button.click()
|
||||
assert targets == [library]
|
||||
dialog.stop.set()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
|
||||
|
||||
def test_close_waits_for_independent_release_worker(qtbot, tmp_path, monkeypatch):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.ui.workers import ServiceWorker
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
started, release = Event(), Event()
|
||||
worker = ServiceWorker(lambda: (started.set(), release.wait(5)))
|
||||
window.lifecycle_pool.start(worker)
|
||||
qtbot.waitUntil(started.is_set)
|
||||
try:
|
||||
window.close()
|
||||
qtbot.wait(40)
|
||||
assert window.isVisible(), 'window closed while independent release still owned callbacks'
|
||||
finally:
|
||||
release.set()
|
||||
qtbot.waitUntil(lambda: not window.isVisible())
|
||||
@@ -0,0 +1,168 @@
|
||||
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, **kwargs):
|
||||
assert kwargs.get('stop') is not None
|
||||
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(_, **kwargs):
|
||||
assert kwargs.get('stop') is not None
|
||||
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()
|
||||
@@ -0,0 +1,40 @@
|
||||
from cbb_refresh_verify import library_lock
|
||||
from cbb_refresh_verify.ui.residual_release_dialog import ResidualReleaseDialog
|
||||
|
||||
|
||||
def test_confirmed_scope_and_execution_divergence_are_visible(qtbot, tmp_path, monkeypatch):
|
||||
library = tmp_path/'lib.lmc'
|
||||
rows = [dict(name='ExpeditionPCB.exe', pid=pid, project=name, detail='可正常关闭')
|
||||
for pid, name in ((10, 'A'), (20, 'B'))]
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions',
|
||||
lambda *_: dict(library=str(library), sessions=rows))
|
||||
monkeypatch.setattr(library_lock, 'release_residual_sessions', lambda *a, **kw:
|
||||
dict(status='PARTIAL', sessions=[
|
||||
dict(rows[0], consent_allowed=True, release_status='RELEASED', detail='已退出'),
|
||||
dict(rows[1], consent_allowed=True, release_status='WAITING', detail='原生操作进行中')]))
|
||||
dialog = ResidualReleaseDialog(library, tmp_path/'evidence')
|
||||
qtbot.addWidget(dialog)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
dialog.confirm_button.click()
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
assert dialog.table.columnCount() == 8
|
||||
assert dialog.table.item(0, 6).text() == dialog.table.item(1, 6).text() == '允许'
|
||||
assert dialog.table.item(0, 7).text() == '已释放'
|
||||
assert dialog.table.item(1, 7).text() == '未释放'
|
||||
assert '原生操作进行中' in dialog.table.item(1, 3).text()
|
||||
assert '确认允许 2' in dialog.message.text() and '未释放 1' in dialog.message.text()
|
||||
|
||||
|
||||
def test_retiring_batch_summary_forgets_enabled_release_actions(qtbot, tmp_path):
|
||||
from cbb_refresh_verify.ui.main_window import MainWindow
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
from test_review345_ui_cli import flush_deletes
|
||||
window = MainWindow(data_root=tmp_path)
|
||||
qtbot.addWidget(window)
|
||||
window._batch_done(([VerifyResult('FAIL', safe_to_continue=False)], None))
|
||||
assert window._residual_release_action is not None
|
||||
window.summary.close(); flush_deletes()
|
||||
window._update()
|
||||
assert window._residual_release_action is None
|
||||
window._resume_batch = dict(library=tmp_path/'lib.lmc', released=True)
|
||||
window._release_dialog_finished()
|
||||
@@ -0,0 +1,241 @@
|
||||
"""Stale and repeated user actions around native queue admission."""
|
||||
from threading import Event
|
||||
from types import SimpleNamespace
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
from cbb_refresh_verify import session_record as sessions
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
from test_review326_queue_guidance import retain
|
||||
from test_ui_filters import load_window
|
||||
|
||||
|
||||
def test_verify_admission_hides_release_entry_before_action_finishes(qtbot, tmp_path, monkeypatch):
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
started, finish = Event(), Event()
|
||||
|
||||
def action():
|
||||
started.set()
|
||||
assert finish.wait(5)
|
||||
|
||||
try:
|
||||
# Hold admission until after the final waiting notification and proof.
|
||||
# Neither _start's update nor a second waiting event can hide the bug.
|
||||
with window.native_queue.condition:
|
||||
window._start(action, lambda _: None)
|
||||
window._progress(dict(stage='waiting_native_slot', library='test.lmc', retained=True))
|
||||
assert window.queue_release_button.isVisible()
|
||||
sessions._retained_libraries.clear()
|
||||
qtbot.waitUntil(started.is_set)
|
||||
qtbot.waitUntil(lambda: not window.queue_release_button.isVisible(), timeout=1000)
|
||||
assert window.busy, 'The entry must disappear before the running task ends'
|
||||
assert window._queue_wait_library is None
|
||||
assert '排队' not in window.status_label.text()
|
||||
finally:
|
||||
finish.set()
|
||||
sessions._retained_libraries.clear()
|
||||
window.native_queue.wake()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('stale_library', [None, 'test.lmc'])
|
||||
def test_delayed_queued_click_cannot_open_a_release_panel_after_proof(qtbot, tmp_path, monkeypatch, stale_library):
|
||||
from cbb_refresh_verify import library_lock
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
monkeypatch.setattr(sessions, '_retained_libraries', {})
|
||||
scans = []
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions', lambda library:
|
||||
(scans.append(library) or dict(library=str(library), sessions=[])))
|
||||
window.busy = True
|
||||
window._queue_wait_library = stale_library
|
||||
try:
|
||||
for _ in range(5):
|
||||
window.check_library_release(queued=True)
|
||||
qtbot.wait(50)
|
||||
assert getattr(window, 'release_dialog', None) is None
|
||||
assert scans == [], 'A stale click must not trigger a new native session scan'
|
||||
assert window.busy
|
||||
assert not window.queue_release_button.isVisible()
|
||||
finally:
|
||||
dialog = getattr(window, 'release_dialog', None)
|
||||
if dialog is not None:
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
dialog.close()
|
||||
window.busy = False
|
||||
|
||||
|
||||
def test_old_waiting_event_is_rechecked_against_current_release_state(qtbot, tmp_path, monkeypatch):
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
monkeypatch.setattr(sessions, '_retained_libraries', {})
|
||||
window._progress(dict(stage='waiting_native_slot', library='test.lmc', retained=True))
|
||||
assert not window.queue_release_button.isVisible()
|
||||
assert window._queue_wait_library is None
|
||||
|
||||
|
||||
def test_other_library_icdb_start_preserves_the_foreground_wait(qtbot, tmp_path, monkeypatch):
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
window._start(lambda: None, lambda _: None)
|
||||
try:
|
||||
qtbot.waitUntil(lambda: window.queue_release_button.isVisible())
|
||||
task = SimpleNamespace(requests=[SimpleNamespace(lmc_file='other.lmc')])
|
||||
window._icdb_event(task, dict(stage='icdb_check_start', block='OtherCBB'))
|
||||
assert window.queue_release_button.isVisible()
|
||||
assert window._queue_wait_library == 'test.lmc'
|
||||
finally:
|
||||
sessions._retained_libraries.clear()
|
||||
window.native_queue.wake()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('channel', ['verify', 'icdb'])
|
||||
def test_another_library_wait_without_retention_cannot_erase_a_live_reason(qtbot, tmp_path, monkeypatch, channel):
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
window._queue_wait_library = 'test.lmc'
|
||||
window._update()
|
||||
event = dict(stage='waiting_native_slot', library='other.lmc', retained=False)
|
||||
if channel == 'verify':
|
||||
window._progress(event)
|
||||
else:
|
||||
window._icdb_event(SimpleNamespace(), event)
|
||||
assert window.queue_release_button.isVisible()
|
||||
assert window._queue_wait_library == 'test.lmc'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('channel', ['verify', 'icdb'])
|
||||
def test_delayed_other_library_retention_does_not_replace_a_live_reason(qtbot, tmp_path, monkeypatch, channel):
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
window._queue_wait_library = 'test.lmc'
|
||||
event = dict(stage='waiting_native_slot', library='already-released.lmc', retained=True)
|
||||
if channel == 'verify':
|
||||
window._progress(event)
|
||||
else:
|
||||
window._icdb_event(SimpleNamespace(), event)
|
||||
assert window.queue_release_button.isVisible()
|
||||
assert window._queue_wait_library == 'test.lmc'
|
||||
|
||||
|
||||
def test_repeated_click_and_close_reuse_one_panel_without_unlocking_the_task(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
window.show()
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions',
|
||||
lambda library: dict(library=str(library), sessions=[]))
|
||||
window._start(lambda: None, lambda _: None)
|
||||
try:
|
||||
qtbot.waitUntil(lambda: window.queue_release_button.isVisible())
|
||||
qtbot.mouseClick(window.queue_release_button, Qt.LeftButton)
|
||||
original = window.release_dialog
|
||||
for _ in range(5):
|
||||
qtbot.mouseClick(window.queue_release_button, Qt.LeftButton)
|
||||
assert window.release_dialog is original
|
||||
qtbot.waitUntil(lambda: not original.busy)
|
||||
original.reject()
|
||||
assert window.busy, 'Closing a panel must not mark the queued task finished'
|
||||
qtbot.mouseClick(window.queue_release_button, Qt.LeftButton)
|
||||
reopened = window.release_dialog
|
||||
qtbot.waitUntil(lambda: not reopened.busy)
|
||||
reopened.close()
|
||||
assert window.busy
|
||||
finally:
|
||||
sessions._retained_libraries.clear()
|
||||
window.native_queue.wake()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
|
||||
|
||||
def test_repeat_verify_then_stop_then_delayed_release_click_never_starts_work(qtbot, tmp_path, monkeypatch):
|
||||
calls = []
|
||||
window = load_window(qtbot, tmp_path, monkeypatch, verifier=lambda request: calls.append(request.block_name))
|
||||
window.show()
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
window.search_edit.setText('Beta')
|
||||
window.verify_all()
|
||||
try:
|
||||
qtbot.waitUntil(lambda: window.queue_release_button.isVisible())
|
||||
for _ in range(5):
|
||||
qtbot.mouseClick(window.batch_button, Qt.LeftButton)
|
||||
window.verify_all()
|
||||
assert len(window.native_queue.pending) == 1
|
||||
qtbot.mouseClick(window.stop_button, Qt.LeftButton)
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
for _ in range(5):
|
||||
window.check_library_release(queued=True)
|
||||
assert calls == []
|
||||
assert not window.native_queue.pending
|
||||
assert getattr(window, 'release_dialog', None) is None
|
||||
finally:
|
||||
window.stop.set()
|
||||
sessions._retained_libraries.clear()
|
||||
window.native_queue.wake()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('foreground_finishes_first', [True, False])
|
||||
def test_foreground_completion_and_background_cancel_keep_only_live_waits(qtbot, tmp_path, monkeypatch,
|
||||
foreground_finishes_first):
|
||||
window = load_window(qtbot, tmp_path, monkeypatch,
|
||||
verifier=lambda _: pytest.fail('A retained library must not start a native check'))
|
||||
window.show()
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
window._run(['Beta'], maintenance=True)
|
||||
qtbot.waitUntil(lambda: window.queue_release_button.isVisible())
|
||||
window.mentor_lmc_path = Path('other.lmc')
|
||||
window.lmc_edit.setText('other.lmc')
|
||||
started, finish = Event(), Event()
|
||||
|
||||
def foreground():
|
||||
started.set()
|
||||
assert finish.wait(5)
|
||||
return VerifyResult('PASS')
|
||||
|
||||
window._start(foreground, lambda _: None)
|
||||
try:
|
||||
qtbot.waitUntil(started.is_set)
|
||||
if foreground_finishes_first:
|
||||
finish.set()
|
||||
qtbot.waitUntil(lambda: not window.busy)
|
||||
assert window.icdb_task.active
|
||||
assert window.queue_release_button.isVisible()
|
||||
assert window._queue_wait_library == 'test.lmc'
|
||||
window.icdb_task.cancel()
|
||||
qtbot.waitUntil(lambda: not window._icdb_active())
|
||||
assert not window.queue_release_button.isVisible()
|
||||
if not foreground_finishes_first:
|
||||
assert window.busy
|
||||
finally:
|
||||
finish.set()
|
||||
window.icdb_task.cancel()
|
||||
sessions._retained_libraries.clear()
|
||||
window.native_queue.wake()
|
||||
qtbot.waitUntil(lambda: not window.busy and not window._icdb_active())
|
||||
|
||||
|
||||
def test_delivered_click_during_window_close_does_not_open_a_panel(qtbot, tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify import library_lock
|
||||
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||
retain(monkeypatch, window.mentor_lmc_path)
|
||||
monkeypatch.setattr(library_lock, 'inspect_residual_sessions',
|
||||
lambda library: dict(library=str(library), sessions=[]))
|
||||
window._queue_wait_library = 'test.lmc'
|
||||
window._closing = True
|
||||
try:
|
||||
window.check_library_release(queued=True)
|
||||
assert getattr(window, 'release_dialog', None) is None
|
||||
finally:
|
||||
window._closing = False
|
||||
dialog = getattr(window, 'release_dialog', None)
|
||||
if dialog is not None:
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
dialog.close()
|
||||
@@ -0,0 +1,67 @@
|
||||
import logging
|
||||
import os
|
||||
from threading import Event, Thread
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.parametrize('damage', ['broken', 'missing', 'wrong_shape'])
|
||||
def test_unreadable_export_evidence_explains_why_exclusion_is_unavailable(tmp_path, monkeypatch, caplog, damage):
|
||||
import win32api, win32con
|
||||
from cbb_refresh_verify import native_engineering_identity as identity
|
||||
from cbb_refresh_verify.library_lock import LibraryBusy
|
||||
from cbb_refresh_verify.native_export_guard import assert_retained_exports_idle
|
||||
root=tmp_path/'analysis';root.mkdir()
|
||||
if damage=='broken':(root/'ascii-process.json').write_text('{broken','utf-8')
|
||||
if damage=='wrong_shape':(root/'ascii-process.json').write_text('[]','utf-8')
|
||||
library=tmp_path/'library/lib.lmc'
|
||||
handle=win32api.OpenProcess(win32con.SYNCHRONIZE,False,os.getpid())
|
||||
monkeypatch.setattr(identity,'_retained_exports',[(SimpleNamespace(pid=123456,poll=lambda:0),
|
||||
{os.getpid():handle},dict(library=str(library),analysis_root=str(root)))])
|
||||
try:
|
||||
with caplog.at_level(logging.WARNING),pytest.raises(LibraryBusy) as error:
|
||||
assert_retained_exports_idle(library)
|
||||
assert 'exclusion_unavailable' in str(error.value)
|
||||
assert str(root) in str(error.value)
|
||||
assert 'exclusion_unavailable' in caplog.text and str(root) in caplog.text
|
||||
assert ('123456' in caplog.text if damage=='missing' else 'ascii-process.json' in caplog.text)
|
||||
finally:handle.Close()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('after_result', ['refresh', 'close_summary', 'cancel_refresh'])
|
||||
def test_batch_result_is_visible_before_queued_refresh_and_survives_user_actions(
|
||||
qtbot,tmp_path,monkeypatch,after_result):
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
started,release,other_started,other_release,refreshed=(Event() for _ in range(5))
|
||||
def verify(request):
|
||||
started.set();release.wait(5)
|
||||
return VerifyResult('PASS',library_flag='GREEN')
|
||||
def refresh(names,library):
|
||||
refreshed.set()
|
||||
return {'Beta':'READY'}
|
||||
window=load_window(qtbot,tmp_path,monkeypatch,verifier=verify,status_refresher=refresh)
|
||||
window.search_edit.setText('Beta')
|
||||
window._run(['Beta'])
|
||||
qtbot.waitUntil(started.is_set)
|
||||
def other():
|
||||
other_started.set();other_release.wait(5)
|
||||
thread=Thread(target=lambda:window.native_queue.run(other));thread.start()
|
||||
try:
|
||||
qtbot.waitUntil(lambda:len(window.native_queue.pending)==1)
|
||||
release.set();qtbot.waitUntil(other_started.is_set)
|
||||
qtbot.waitUntil(lambda:getattr(window,'summary',None) is not None,timeout=1500)
|
||||
assert window.summary.isVisible() and window.busy
|
||||
assert not refreshed.is_set()
|
||||
assert window._records_by_name['Beta'].status=='PENDING'
|
||||
assert '已结束' in window.status_label.text()
|
||||
if after_result=='close_summary':window.summary.close()
|
||||
if after_result=='cancel_refresh':window.request_stop()
|
||||
finally:
|
||||
release.set();other_release.set();thread.join(6)
|
||||
qtbot.waitUntil(lambda:not window.busy,timeout=7000)
|
||||
assert window._records_by_name['Beta'].status==('UNKNOWN' if after_result=='cancel_refresh' else 'READY')
|
||||
if after_result=='close_summary':assert window.summary is None
|
||||
else:assert '成功 1' in window.summary.detailedText()
|
||||
assert refreshed.is_set() is (after_result!='cancel_refresh')
|
||||
@@ -0,0 +1,38 @@
|
||||
import json,os
|
||||
from types import SimpleNamespace
|
||||
import pytest
|
||||
from test_native_export_guard import export_case
|
||||
|
||||
|
||||
@pytest.mark.parametrize('in_memory',[False,True])
|
||||
def test_preexisting_exclusion_does_not_hide_a_changed_process_identity(export_case,monkeypatch,in_memory):
|
||||
import win32api,win32con
|
||||
from cbb_refresh_verify import native_engineering_identity as identity
|
||||
from cbb_refresh_verify.native_export_guard import prove_export_copies_released
|
||||
from cbb_refresh_verify.library_lock import LibraryBusy
|
||||
library,root,*_=export_case
|
||||
record=dict(pid=123456,observed_pids=[123456,os.getpid()],process_identities=[
|
||||
dict(pid=123456,created='20261112120000.000000+480',executable='native'),
|
||||
dict(pid=os.getpid(),created='20261111120000.000000+480',executable='old-client')])
|
||||
(root/'ascii-process.json').write_text(json.dumps(record),encoding='utf-8')
|
||||
monkeypatch.setattr(identity,'_process_snapshot',lambda:[dict(pid=os.getpid(),name='viewdraw.exe',parent=0,
|
||||
created='20261111120000.000000+480',executable='different-client',command='')])
|
||||
handle=win32api.OpenProcess(win32con.SYNCHRONIZE,False,os.getpid())
|
||||
try:
|
||||
if in_memory:
|
||||
monkeypatch.setattr(identity,'_retained_exports',[(SimpleNamespace(pid=123456,poll=lambda:0),
|
||||
{os.getpid():handle},dict(library=str(library),analysis_root=str(root)))])
|
||||
with pytest.raises(LibraryBusy):
|
||||
with prove_export_copies_released(library):pass
|
||||
finally:handle.Close()
|
||||
|
||||
|
||||
def test_noncheckpoint_lease_still_has_a_non_authoritative_disk_audit(tmp_path):
|
||||
from cbb_refresh_verify.library_lock import LibraryLock,blocker_path
|
||||
library=tmp_path/'lib.lmc';library.touch()
|
||||
lease=LibraryLock(library,checkpoint=False)
|
||||
with lease:
|
||||
assert not blocker_path(library).exists()
|
||||
text=lease.path.read_text(encoding='utf-8')
|
||||
assert f'pid={os.getpid()}' in text and str(library) in text and 'startedUtc=' in text
|
||||
assert not blocker_path(library).exists()
|
||||
@@ -0,0 +1,51 @@
|
||||
"""Review #414: native clicks and queue binding must outlive only their proofs."""
|
||||
from contextlib import contextmanager
|
||||
from types import SimpleNamespace
|
||||
|
||||
from test_post_repair_consent import snapshot
|
||||
|
||||
|
||||
def test_readwrite_click_can_open_files_after_exclusive_probe_closes(tmp_path, monkeypatch):
|
||||
import win32con, win32file
|
||||
from cbb_refresh_verify import pcb_open_consent as consent
|
||||
path=tmp_path/'icdb.dat'; path.write_bytes(b'database')
|
||||
monkeypatch.setattr(consent,'validate_owner',lambda *_: {'target':'owned'})
|
||||
@contextmanager
|
||||
def guard(*_):
|
||||
handle=win32file.CreateFile(str(path),win32con.GENERIC_READ,0,None,win32con.OPEN_EXISTING,0,None)
|
||||
try:yield
|
||||
finally:handle.Close()
|
||||
monkeypatch.setattr(consent,'resource_guard',guard)
|
||||
controller=consent.OpenController(dict(root=str(tmp_path),block_name='A',lmc_file='lib.lmc',
|
||||
project='A.prj',pcb='A.pcb',desktop='CbbVerify_test'))
|
||||
shown=[]; accepted=[]
|
||||
def perform(*_):
|
||||
handle=win32file.CreateFile(str(path),win32con.GENERIC_READ|win32con.GENERIC_WRITE,
|
||||
0,None,win32con.OPEN_EXISTING,0,None)
|
||||
handle.Close(); accepted.append(True)
|
||||
return SimpleNamespace(error_code='',accepted_controls=(6,),detail='',channel='win32_button_click')
|
||||
options=dict(target_pid=20,launcher_pid=10,worker_pid=5,show=shown.append,perform=perform)
|
||||
controller.handle(snapshot(),(snapshot(),),**options)
|
||||
shown[0].choose('continue')
|
||||
result=controller.handle(snapshot(),(snapshot(),),**options)
|
||||
assert not result.error_code,result.detail
|
||||
assert accepted==[True]
|
||||
|
||||
|
||||
def test_batch_queue_never_reads_library_widget_from_worker(qtbot, tmp_path, monkeypatch):
|
||||
from threading import get_ident
|
||||
from test_ui_filters import load_window
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
gui_thread=get_ident(); violations=[]; calls=[]
|
||||
window=load_window(qtbot,tmp_path,monkeypatch,
|
||||
verifier=lambda req: calls.append(req.lmc_file) or VerifyResult('FAIL',safe_to_continue=True))
|
||||
window.mentor_lmc_path=None
|
||||
original=window.lmc_edit.text
|
||||
def text():
|
||||
if get_ident()!=gui_thread:violations.append('lmc_edit.text')
|
||||
return original()
|
||||
monkeypatch.setattr(window.lmc_edit,'text',text)
|
||||
window._run(['Beta'])
|
||||
qtbot.waitUntil(lambda:not window.busy,timeout=10000)
|
||||
assert calls
|
||||
assert not violations
|
||||
@@ -0,0 +1,181 @@
|
||||
from pathlib import Path
|
||||
from threading import Event
|
||||
import pytest
|
||||
from test_backup_recovery import recovery_files
|
||||
|
||||
|
||||
def fixture_paths(tmp_path, monkeypatch):
|
||||
from test_management import project
|
||||
source=project(tmp_path/'source')
|
||||
library=tmp_path/'target/lib.lmc'; library.parent.mkdir(); library.touch()
|
||||
row=dict(pid=99111,name='viewdraw.exe',executable='viewdraw.exe',command='',parent=0)
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda names:[row])
|
||||
return library,source,source.parent/'PCB/main.pcb'
|
||||
|
||||
|
||||
def test_pathless_native_cannot_silently_authorize_a_write(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
paths=fixture_paths(tmp_path,monkeypatch)
|
||||
with pytest.raises(ValueError,match='TARGET_NATIVE_OWNER_UNCONFIRMED'):
|
||||
_idle_check(*paths)
|
||||
|
||||
|
||||
def test_explicit_batch_confirmation_is_bound_to_library_and_process_identity(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify.write_admission import WriteAdmission
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
paths=fixture_paths(tmp_path,monkeypatch)
|
||||
identity={'pid':99111,'created_handle':'one','image':'viewdraw.exe','owner_sid':'user','session_id':1}
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity',lambda pid:dict(identity))
|
||||
choices=[]
|
||||
def prompt(choice):choices.append(choice);choice.choose('continue')
|
||||
admission=WriteAdmission(prompt=prompt,stop=Event())
|
||||
check=lambda:_idle_check(*paths,confirmation=admission,evidence=tmp_path/'evidence',block='Block')
|
||||
check();check()
|
||||
assert len(choices)==1
|
||||
identity['created_handle']='reused-pid'
|
||||
check()
|
||||
assert len(choices)==2
|
||||
other=tmp_path/'other/lib.lmc';other.parent.mkdir();other.touch()
|
||||
_idle_check(other,*paths[1:],confirmation=admission,evidence=tmp_path/'other-evidence',block='Other')
|
||||
assert len(choices)==3
|
||||
|
||||
|
||||
@pytest.mark.parametrize('decision',['skip','cancel'])
|
||||
def test_decline_has_no_grant_and_only_cancel_stops_batch(tmp_path,monkeypatch,decision):
|
||||
from cbb_refresh_verify.write_admission import WriteAdmission,WriteAdmissionDeclined
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
paths=fixture_paths(tmp_path,monkeypatch);stop=Event()
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity',lambda pid:
|
||||
dict(pid=pid,created_handle='one',image='viewdraw.exe',owner_sid='user',session_id=1))
|
||||
admission=WriteAdmission(prompt=lambda choice:choice.choose(decision),stop=stop)
|
||||
with pytest.raises(WriteAdmissionDeclined):
|
||||
_idle_check(*paths,confirmation=admission,evidence=tmp_path/'evidence',block='Block')
|
||||
assert stop.is_set() is (decision=='cancel')
|
||||
|
||||
|
||||
def test_confirmation_cannot_override_actual_database_occupancy(tmp_path,monkeypatch):
|
||||
import win32con,win32file
|
||||
from cbb_refresh_verify.write_admission import WriteAdmission
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
paths=fixture_paths(tmp_path,monkeypatch);asked=[]
|
||||
admission=WriteAdmission(prompt=lambda choice:asked.append(choice),stop=Event())
|
||||
handle=win32file.CreateFile(str(paths[0]),win32con.GENERIC_READ,0,None,win32con.OPEN_EXISTING,0,None)
|
||||
try:
|
||||
with pytest.raises(Exception):
|
||||
_idle_check(*paths,confirmation=admission,evidence=tmp_path/'evidence',block='Block')
|
||||
assert not asked
|
||||
finally:handle.Close()
|
||||
|
||||
|
||||
def test_write_probe_batches_native_owner_queries(tmp_path,monkeypatch):
|
||||
from test_management import project
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
source=project(tmp_path/'source'); library=tmp_path/'lib.lmc';library.touch();queries=[]
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda names:
|
||||
queries.append(tuple(names)) or [])
|
||||
_idle_check(library,source,source.parent/'PCB/main.pcb')
|
||||
assert len(queries)==1
|
||||
assert all(len(names)==5 for names in queries)
|
||||
|
||||
|
||||
def test_user_can_close_unknown_client_before_confirming(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify import write_admission as admission_module
|
||||
from cbb_refresh_verify.write_admission import WriteAdmission
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
paths=fixture_paths(tmp_path,monkeypatch);ended=[]
|
||||
def identity(pid):
|
||||
if ended:
|
||||
error=OSError('already exited');error.winerror=87;raise error
|
||||
return dict(pid=pid,created_handle='one',image='viewdraw.exe',owner_sid='user',session_id=1)
|
||||
monkeypatch.setattr(admission_module,'process_identity',identity)
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda names: [] if ended else
|
||||
[dict(pid=99111,name='viewdraw.exe',executable='viewdraw.exe',command='',parent=0)])
|
||||
def prompt(choice):ended.append(True);choice.choose('continue')
|
||||
_idle_check(*paths,confirmation=WriteAdmission(prompt=prompt),evidence=tmp_path/'evidence',block='Block')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('first,expected',[('skip',['SKIPPED','UPLOADED']),('cancel',['CANCELLED'])])
|
||||
def test_batch_continues_only_after_skip_or_confirmed_release(tmp_path,monkeypatch,first,expected):
|
||||
from dataclasses import replace
|
||||
from test_management import FileAdapter,project
|
||||
from cbb_refresh_verify.management import ManagementRequest,run_management_batch
|
||||
library,source,_=fixture_paths(tmp_path,monkeypatch)
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity',lambda pid:
|
||||
dict(pid=pid,created_handle='one',image='viewdraw.exe',owner_sid='user',session_id=1))
|
||||
choices=[]
|
||||
def prompt(choice):choices.append(choice);choice.choose(first if len(choices)==1 else 'continue')
|
||||
request=ManagementRequest('add',library,'One',source=source,auto_verify=False,evidence_dir=tmp_path/'evidence')
|
||||
adapter=FileAdapter();stop=Event()
|
||||
results=run_management_batch([request,replace(request,name='Two')],adapter=adapter,stop=stop,version_prompt=prompt)
|
||||
assert [r.status for r in results]==expected
|
||||
assert all(r.safe_to_continue for r in results)
|
||||
assert len(adapter.calls)==(1 if first=='skip' else 0)
|
||||
|
||||
|
||||
def test_write_confirmation_dialog_defaults_cancel_and_cannot_overwrite_choice(qtbot):
|
||||
from cbb_refresh_verify.write_admission import WriteOwnerChoice
|
||||
from cbb_refresh_verify.ui.write_owner_dialog import WriteOwnerDialog
|
||||
choice=WriteOwnerChoice('Block','target.lmc',[dict(pid=12,name='viewdraw.exe',image='viewdraw.exe')])
|
||||
dialog=WriteOwnerDialog(choice);qtbot.addWidget(dialog)
|
||||
assert dialog.defaultButton() is dialog.cancel_button
|
||||
dialog.skip_button.click();dialog.reject()
|
||||
assert choice.decision=='skip'
|
||||
|
||||
|
||||
def test_restore_confirmation_evidence_does_not_collide_with_owned_recovery_directory(recovery_files,monkeypatch):
|
||||
from cbb_refresh_verify.backup_recovery import recover_from_backup
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
request,original,source=recovery_files
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda names:[
|
||||
dict(pid=99111,name='viewdraw.exe',executable='viewdraw.exe',command='',parent=0)])
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity',lambda pid:
|
||||
dict(pid=pid,created_handle='one',image='viewdraw.exe',owner_sid='user',session_id=1))
|
||||
result=recover_from_backup(request,source,version_prompt=lambda c:c.choose('continue'),
|
||||
verifier=lambda *_a,**_kw:VerifyResult('PASS',library_flag='GREEN'))
|
||||
assert result.status=='PASS',result.stderr
|
||||
assert (original.parent/'database/icdb.dat').read_bytes()==b'healthy'
|
||||
assert list(result.evidence_path.parent.glob('write-owner-consent-*.json'))
|
||||
|
||||
|
||||
def test_cancel_batch_also_stops_default_api_without_a_caller_event(tmp_path,monkeypatch):
|
||||
from dataclasses import replace
|
||||
from test_management import FileAdapter
|
||||
from cbb_refresh_verify.management import ManagementRequest,run_management_batch
|
||||
library,source,_=fixture_paths(tmp_path,monkeypatch)
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity',lambda pid:
|
||||
dict(pid=pid,created_handle='one',image='viewdraw.exe',owner_sid='user',session_id=1))
|
||||
choices=[]
|
||||
def prompt(choice):choices.append(choice);choice.choose('cancel' if len(choices)==1 else 'continue')
|
||||
request=ManagementRequest('add',library,'One',source=source,auto_verify=False,evidence_dir=tmp_path/'evidence')
|
||||
adapter=FileAdapter()
|
||||
results=run_management_batch([request,replace(request,name='Two')],adapter=adapter,version_prompt=prompt)
|
||||
assert [r.status for r in results]==['CANCELLED']
|
||||
assert len(choices)==1 and not adapter.calls
|
||||
|
||||
|
||||
def test_new_unknown_client_during_confirmation_requires_new_confirmation(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify.write_admission import WriteAdmission
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
paths=fixture_paths(tmp_path,monkeypatch);added=[]
|
||||
first=dict(pid=99111,name='viewdraw.exe',executable='viewdraw.exe',command='',parent=0)
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners',lambda names:
|
||||
[first,dict(first,pid=99112)] if added else [first])
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity',lambda pid:
|
||||
dict(pid=pid,created_handle='one',image='viewdraw.exe',owner_sid='user',session_id=1))
|
||||
def prompt(choice):added.append(True);choice.choose('continue')
|
||||
with pytest.raises(ValueError,match='出现新的未知进程'):
|
||||
_idle_check(*paths,confirmation=WriteAdmission(prompt=prompt),evidence=tmp_path/'evidence',block='Block')
|
||||
|
||||
|
||||
def test_evidence_write_failure_never_grants_future_writes(tmp_path,monkeypatch):
|
||||
from cbb_refresh_verify.write_admission import WriteAdmission
|
||||
paths=fixture_paths(tmp_path,monkeypatch)
|
||||
owner=dict(pid=99111,name='viewdraw.exe',executable='viewdraw.exe',command='',parent=0)
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity',lambda pid:
|
||||
dict(pid=pid,created_handle='one',image='viewdraw.exe',owner_sid='user',session_id=1))
|
||||
def fail(*args,**kwargs):raise OSError('disk full')
|
||||
monkeypatch.setattr('cbb_refresh_verify.management._write_json',fail)
|
||||
admission=WriteAdmission(prompt=lambda choice:choice.choose('continue'))
|
||||
with pytest.raises(OSError,match='disk full'):
|
||||
admission.confirm(paths[0],[owner],evidence=tmp_path/'evidence',block='Block')
|
||||
assert not admission.confirmed(paths[0],[owner])
|
||||
@@ -0,0 +1,154 @@
|
||||
"""Review 430: distinguish content evidence, native release and skipped work."""
|
||||
from dataclasses import replace
|
||||
import pytest
|
||||
|
||||
from test_backup_recovery import recovery_files
|
||||
from test_management_native_transaction import transaction
|
||||
from test_review414_write_admission import fixture_paths
|
||||
|
||||
|
||||
def unknown_identity(monkeypatch):
|
||||
monkeypatch.setattr('cbb_refresh_verify.write_admission.process_identity', lambda pid: dict(
|
||||
pid=pid, created_handle='one', image='viewdraw.exe', owner_sid='user', session_id=1))
|
||||
|
||||
|
||||
def test_headless_admission_skips_without_claiming_an_upload_attempt(tmp_path, monkeypatch):
|
||||
from test_management import FileAdapter
|
||||
from cbb_refresh_verify.management import ManagementRequest, run_management
|
||||
library, source, _ = fixture_paths(tmp_path, monkeypatch)
|
||||
unknown_identity(monkeypatch)
|
||||
adapter = FileAdapter()
|
||||
request = ManagementRequest('add', library, 'One', source=source, auto_verify=False,
|
||||
evidence_dir=tmp_path/'evidence')
|
||||
result = run_management(request, adapter=adapter)
|
||||
assert result.status == 'SKIPPED', result.detail
|
||||
assert result.safe_to_continue
|
||||
assert 'TARGET_NATIVE_OWNER_UNCONFIRMED' in result.detail
|
||||
assert not adapter.calls
|
||||
|
||||
|
||||
@pytest.mark.parametrize('prompt', [False, True])
|
||||
def test_restore_declined_before_install_is_skipped_and_leaves_work_intact(recovery_files, monkeypatch, prompt):
|
||||
from cbb_refresh_verify.backup_recovery import recover_from_backup
|
||||
request, original, source = recovery_files
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda names: [dict(
|
||||
pid=99111, name='viewdraw.exe', executable='viewdraw.exe', command='', parent=0)])
|
||||
unknown_identity(monkeypatch)
|
||||
result = recover_from_backup(request, source,
|
||||
version_prompt=(lambda choice: choice.choose('skip')) if prompt else None,
|
||||
verifier=lambda *_a, **_kw: pytest.fail('Declined work must not open Mentor'))
|
||||
assert result.status == 'SKIPPED', result.stderr
|
||||
assert result.safe_to_continue
|
||||
assert (original.parent/'database/icdb.dat').read_bytes() == b'damaged'
|
||||
assert not list(original.parent.parent.glob('Work.before-restore-*'))
|
||||
assert '未确认' in result.stderr or '无法确认' in result.stderr
|
||||
|
||||
|
||||
def test_idle_without_unknown_clients_probes_only_once(tmp_path, monkeypatch):
|
||||
import win32file
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
library, source, pcb = fixture_paths(tmp_path, monkeypatch)
|
||||
queries, opened = [], []
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda names: queries.append(names) or [])
|
||||
create = win32file.CreateFile
|
||||
def open_file(path, *args):
|
||||
opened.append(path)
|
||||
return create(path, *args)
|
||||
monkeypatch.setattr(win32file, 'CreateFile', open_file)
|
||||
_idle_check(library, source, pcb)
|
||||
assert len(queries) == 1
|
||||
assert opened and len(opened) == len(set(opened))
|
||||
|
||||
|
||||
def test_confirmation_rechecks_a_database_that_became_occupied(tmp_path, monkeypatch):
|
||||
import win32con, win32file
|
||||
from cbb_refresh_verify.backup_recovery import _idle_check
|
||||
from cbb_refresh_verify.write_admission import WriteAdmission
|
||||
library, source, pcb = fixture_paths(tmp_path, monkeypatch)
|
||||
unknown_identity(monkeypatch)
|
||||
handles = []
|
||||
def prompt(choice):
|
||||
handles.append(win32file.CreateFile(str(library), win32con.GENERIC_READ, 0,
|
||||
None, win32con.OPEN_EXISTING, 0, None))
|
||||
choice.choose('continue')
|
||||
try:
|
||||
with pytest.raises(Exception) as error:
|
||||
_idle_check(library, source, pcb, confirmation=WriteAdmission(prompt=prompt),
|
||||
evidence=tmp_path/'evidence', block='One')
|
||||
assert error.value.winerror == 32
|
||||
finally:
|
||||
for handle in handles:
|
||||
handle.Close()
|
||||
|
||||
|
||||
def test_file_proof_does_not_override_confirmed_native_release(transaction, monkeypatch):
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
from test_management_native_transaction import execute
|
||||
root, request, state = transaction
|
||||
capture = identity.capture_registration_identity
|
||||
def capture_file(source, evidence_root, **kwargs):
|
||||
if evidence_root.name == 'registered-identity':
|
||||
return identity.IdentityOutcome(None, False, 'file proof unavailable', evidence_root)
|
||||
return capture(source, evidence_root, **kwargs)
|
||||
monkeypatch.setattr(identity, 'capture_registration_identity', capture_file)
|
||||
result = execute(root, request)
|
||||
assert result.status == 'RECOVERY_REQUIRED'
|
||||
assert 'file proof unavailable' in result.detail
|
||||
assert result.safe_to_continue
|
||||
|
||||
|
||||
def test_real_file_error_preserves_failed_item_and_allows_an_independent_item(transaction, monkeypatch):
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
from cbb_refresh_verify.management import run_management_batch
|
||||
from cbb_refresh_verify.native_management import _OwnedFixtureManagementAdapter
|
||||
root, request, state = transaction
|
||||
assets = identity.asset_identity
|
||||
def read_assets(source, expected_library):
|
||||
if 'ReusableBlocksLP/Block/Work' in source.as_posix():
|
||||
raise PermissionError('registered file became unreadable')
|
||||
return assets(source, expected_library)
|
||||
monkeypatch.setattr(identity, 'asset_identity', read_assets)
|
||||
adapter = _OwnedFixtureManagementAdapter(root, 'owned')
|
||||
results = run_management_batch([request, replace(request, name='Other')], adapter=adapter,
|
||||
idle_check=lambda *_: None)
|
||||
assert [r.status for r in results] == ['RECOVERY_REQUIRED', 'UPLOADED']
|
||||
assert all(r.safe_to_continue for r in results)
|
||||
assert 'registered file became unreadable' in results[0].detail
|
||||
from test_management_native_transaction import execute
|
||||
replay = execute(root, request)
|
||||
assert replay.status == 'BLOCKED'
|
||||
|
||||
|
||||
def test_unreleased_native_owner_never_reaches_file_proof(transaction, monkeypatch):
|
||||
import cbb_refresh_verify.native_management as native
|
||||
import cbb_refresh_verify.native_engineering_identity as identity
|
||||
from test_management_native_transaction import execute
|
||||
root, request, state = transaction
|
||||
worker = native.NativeManagementAdapter._worker
|
||||
capture = identity.capture_registration_identity
|
||||
def native_worker(adapter, job, evidence):
|
||||
result = worker(adapter, job, evidence)
|
||||
if evidence.name == 'reopen-aligned':
|
||||
result['safe_to_continue'] = False
|
||||
return result
|
||||
def capture_file(source, evidence_root, **kwargs):
|
||||
if evidence_root.name == 'registered-identity':
|
||||
pytest.fail('Unreleased native owner cannot be replaced by a file-only proof')
|
||||
return capture(source, evidence_root, **kwargs)
|
||||
monkeypatch.setattr(native.NativeManagementAdapter, '_worker', native_worker)
|
||||
monkeypatch.setattr(identity, 'capture_registration_identity', capture_file)
|
||||
result = execute(root, request)
|
||||
assert result.status == 'RECOVERY_REQUIRED'
|
||||
assert not result.safe_to_continue
|
||||
|
||||
|
||||
@pytest.mark.parametrize('status,message', [('SKIPPED', '恢复已跳过'), ('CANCELLED', '恢复已取消')])
|
||||
def test_restore_dialog_reports_unexecuted_work_without_a_failure_label(qtbot, tmp_path, status, message):
|
||||
from cbb_refresh_verify.ui.backup_recovery_dialog import BackupRecoveryDialog
|
||||
from cbb_refresh_verify.verify_runner import VerifyResult
|
||||
dialog = BackupRecoveryDialog(['One'], lambda _: None)
|
||||
qtbot.addWidget(dialog)
|
||||
dialog._result('One', VerifyResult(status, stderr='reason retained'))
|
||||
assert message in dialog.status_label.text()
|
||||
assert 'reason retained' in dialog.status_label.text()
|
||||
assert '恢复未通过' not in dialog.status_label.text()
|
||||
@@ -87,6 +87,20 @@ def test_management_records_scoped_changes_without_hashing_unrelated_cbb(setup,
|
||||
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'] == 2
|
||||
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', '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):
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
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'] == []
|
||||
Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user