fix: clear verified queue blockers and exit idle orphan workers

This commit is contained in:
阿白叔 committed 2026-11-09 10:11:36 +08:00
1 parent 96e179ba65
commit ca39fb3517
16 files changed
+537 -70

No files matched your search

@@ -0,0 +1,53 @@
{
"date": "2026-11-09",
"review_url": "https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-319",
"base_commit": "96e179ba6529eefd1401a012155cd7b7cbc0ffc3",
"environment": {
"python": "3.12.10",
"windows": "10.0.26200"
},
"full_suite": {
"tests": 1732,
"failures": 0,
"errors": 0,
"skipped": 0,
"duration_seconds": 501.166,
"xml": "F:\\Sync Tool Skyworth\\Work Maps\\cbb-refresh-verify-795\\diagnostics\\cbb-refresh-verify-795-review-stack-fixes-full.xml",
"xml_sha256": "578dd4b01db5c18ce657430ce3b2cd2dba8516d8191bdd31bf4e0df78187b3ba",
"warnings": [
"Existing pywinauto Revert to STA COM threading mode warning"
]
},
"focused_suite": {
"passed": 79
},
"compileall": "passed",
"diff_check": "passed",
"independent_review": "No remaining important findings in the scoped diff; durable completion feedback addressed",
"tested_files_sha256": {
"src/cbb_refresh_verify/desktop_worker.py": "173a951d510e78e088c439768ecfe31ab198723e7717b314b4a74a9d590a1fe0",
"src/cbb_refresh_verify/library_lock.py": "391fb2f0b25f400676ba230472fb3bbd4a0d994ed5a8dfee46f8f32c7f198219",
"src/cbb_refresh_verify/mentor_adapter.py": "1fc8c98d5508120e03bf001a42dd3e0da7b165eb18c90f1aed83147d17db8638",
"src/cbb_refresh_verify/native_management.py": "96c2fe613a657d110302c8f7cc033b91ef256e168036f4794eb39be475e69de8",
"src/cbb_refresh_verify/residual_sessions.py": "a19622be3e959a7e64bf9de953450203499fb82618da8537307e5f61ef4d793b",
"src/cbb_refresh_verify/session_record.py": "c4c5771d11d7469980c02f2fb264b26e5ee26634a37daae008dbb65097ab4e0c",
"src/cbb_refresh_verify/ui/main_window.py": "e46096ce784933f3ab47e4c316f3c84e3e5cf07242489323f6234b61aeb22f80",
"src/cbb_refresh_verify/ui/residual_release_dialog.py": "ec7566bac6d92845f98933bffd4c06f31eeec42946e69699aff94e31f9a8baef",
"tests/test_incident_safety.py": "52f3ccb04db8971bf38628c2bd334d4fd79795e97de6538f6f66cb35f7123ece",
"tests/test_integration.py": "9e9d30692607c889e1e3744a63c79c68e3af7d4c86804e0bcebe48e68765086c",
"tests/test_management_supervision.py": "107196ce8a00dd76e7e3e83fb47ae2e67c857fa234492ba593bf71a7d7e1c5e5",
"tests/test_residual_release_dialog.py": "7d2bf95afc2f9112b9433c7d2fefde3b35b5e85a70a6bd506471c039e2505509",
"tests/test_review_319.py": "831fd34d426abb4436b9132bfb7ed754994155a34ac60a59378dee0964b54d28"
},
"not_verified": [
"Frozen execution of this revision",
"Real Mentor native writes/save/close during supervisor loss",
"Windows 10",
"Shared network/cross-machine release",
"ICDB field recovery"
],
"automatic_icdb_repair": false,
"candidate_rebuilt": false,
"merged": false,
"issue_closed": false
}
@@ -0,0 +1,33 @@
# PR #13 review 319 validation
Review: https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-319
Baseline: `96e179ba6529eefd1401a012155cd7b7cbc0ffc3`.
## Changes
- Successful explicit resource proof acknowledges the retained queue entries captured before proof. The alias-set identity is a generation token: unrelated libraries and newer handoffs remain retained. Scoped proof acknowledges only the matching block.
- Final observer outcomes remain available in the residual dialog after its observer ends. The existing refresh/confirm actions provide a running-session retry path. Successful release records a matching operation's RELEASED observation, so history refresh does not resurrect it as unconfirmed. Journal failure is reported separately from the established release fact.
- Discovery observes process identities only. It never opens production databases exclusively, deletes coordination checkpoints, closes clients, or replays operations. Startup observers use the same read-only mode; only explicit release or already-authorized task reconciliation can establish resource release.
- Supervisor loss sets cancellation independently of evidence-write success. An idle worker exits with code 75 only when its matching journal and synchronized in-memory phase both confirm no pending native write and every registered helper has exited. Missing/unknown/stale-active state retains the worker. The watchdog rechecks returned calls and cannot authorize a subsequent native write/helper. Native children are never terminated by this exit; worker exit is not database-release or Save-success evidence.
- Worker phase persistence and watchdog journal reads share a gate to avoid a Windows sharing violation between reading the JSON and atomically replacing it. The dead `_terminate_pid` function is removed; cleanup tests observe actual process-termination boundaries.
## Verification
Commands run through the existing test wrapper with a dedicated mutex namespace and Qt offscreen; no user/native Mentor process is part of these fixtures.
```
python -u -X utf8 diagnostics/run_review_fixes.py "F:/Sync Tool Skyworth/Work Maps/cbb-refresh-verify-795-review-stack"
python -X utf8 -m compileall -q src tests
git diff --check
```
The focused session/watchdog/management/dialog/lease regression run passed 79 tests. The initial regressions were observed failing before the corresponding fixes: explicit proof left a library unavailable, history scan attempted release, orphan idle workers stayed alive, residual refresh omitted runtime records, and successful release reappeared as unconfirmed. Real harmless Windows subprocess fixtures cover PRECALL/POSTCALL, NATIVE_CALL/CLOSING, unknown/missing/stale journals, failed cancel/evidence writes, and rechecking after return.
Full-suite result is recorded in `2026-11-09-review-319-validation.json`. Independent review found no remaining P1/P2 in this scoped diff; its observation about durable completion was addressed and regression-tested.
## Limits
This is source/PR validation. The earlier `0.2.4b2-iconfix-44bb734` executable has not been rebuilt with these changes and must not be used as evidence for this revision. Its icon assets are preserved.
Not validated here: frozen execution of this revision, real Mentor Save/Close or library writes during supervisor loss, Windows 10, shared/network or cross-machine release. ICDB automatic Repair remains disabled. No field-recovery acceptance, merge, formal publication or issue closure is implied.
@@ -0,0 +1,32 @@
# PR #13 comment 319: residual lifecycle fixes
**Goal:** Fix the P2 and three P3 findings against head `96e179b` without interrupting an in-flight native writer.
**Scope:** https://git.simgreek.com/Skyworth_Digital_Hardware/cbb-refresh-verify-795/pulls/13#issuecomment-319
**Constraints:** Python 3.12/PySide6/pywin32, no new dependencies; existing isolated worktree and icon retained; no automatic ICDB Repair, native process termination, merge, release or issue closure. Real Mentor and shared-network acceptance remains outstanding.
## 1. Release proof and queue state
- [x] Reproduce an ended UNCONFIRMED observer leaving its library unavailable after explicit successful release.
- [x] Snapshot retained entries before proof; acknowledge only those entries, for the matching library, while proof handles are still held. Failed proof and newer handoffs remain blocked. Test independent libraries and queue resumption.
- [x] Retain final observer states for the existing residual panel, including unreadable journals; expose fresh recheck through that panel.
## 2. Passive discovery
- [x] Test that discovery of an exited session never calls release proof or modifies library checkpoints.
- [x] Separate process observation from explicit reconciliation; startup observation stays read-only, reports ACTIVE/UNCONFIRMED and cannot claim RELEASED without proof.
- [x] Refresh journal/status information from the running residual dialog, keeping all I/O off the Qt thread.
## 3. Supervisor loss
- [x] Use harmless real subprocesses to test PRECALL/POSTCALL exit, NATIVE_CALL/CLOSING retention, missing/unreadable journals and failed cancellation/journal writes.
- [x] Synchronize phase transitions and helper registration with watchdog shutdown. Only matching durable and in-memory non-pending state allows worker-only exit; preserve active helpers and unknown states. Prevent subsequent calls after supervisor loss.
- [x] Recheck after retained calls return; do not kill a native child or interpret worker exit as release proof.
## 4. Dead code and validation
- [x] Delete unused `_terminate_pid`; replace obsolete test hooks with assertions at actual process termination boundaries.
- [x] Run focused regressions, full Python suite, compileall and diff checks. Record results and field-validation limits, then commit scoped changes. Do not rebuild or publish a candidate without documenting its source and validation.
Execution: implement inline in the existing isolated worktree; red/green tests per task. The user has authorized these fixes, so no further plan confirmation is needed.