fix: classify ICDB repair outcomes and gate released recovery

This commit is contained in:
阿白叔 committed 2026-11-02 18:14:38 +08:00
1 parent 44b808b8e2
commit aa760c2839
12 files changed
+751 -27

No files matched your search

@@ -78,3 +78,64 @@ error and historical-backup recovery, not the field lost-session auto-repair
trigger. The test does not change production handling of old-backup recovery.
READY filtering, hash-scope changes and CBB CRUD are outside this focused fix.
## Approved Task 1 follow-up: lifecycle and repair outcomes
The empty-PCB close path now receives the launcher process handle and waits for
its normal exit after PCB exits. It checks database addresses again during that
wait, so a late address record prevents a false `CLOSED` result. The startup
record includes PCB, launcher and address release state. A connected COM server
with no active document emits `pcb_document_wait`; it remains in startup and
continues reading the current native failure rather than implying identity.
Native Repair reads bounded Output text and records only the text appended after
this run's Repair invocation as operation evidence. Database logs are restricted
to the current native PID and start time. Output, native log copies, the complete
backup, native result and attempt record remain available under `native-repair`.
Detailed native evidence is preserved separately from its directory path.
The result distinguishes `MISSING_HEALTHY_BACKUP`, `NATIVE_REPAIR_FAILED`,
`DATABASE_BUSY`, `UNKNOWN_DIALOG`, and `TIMEOUT_UNRELEASED`. A failed tool receives
cooperative close only after a terminal native error, an enabled exact-project
main window, no other windows/prompts and no target database address. The worker
then waits for normal process exit. Unknown/custom prompts and incomplete native
operations receive no close action. A failure classification can coexist with
unreleased state; that state always stops the queue. A busy-project message in
this fresh native process's initial loading Output prevents Repair invocation
entirely; it is not hidden by the later invocation baseline.
Before reopening or continuing, the parent independently checks relevant PCB,
Library Manager, Repair, importer and close-helper processes, all known project/
PCB/shared-library addresses, and exclusive read access to every existing known
database. Process-observation errors and exclusive-access failures block reuse.
Only a conclusively failed, released, independently revalidated project-local
target may allow the next CBB. Shared or unknown scope, busy owners, timeouts,
unknown prompts and historical restores stop for review.
Native `REPAIRED` is retained as `native_status`; summaries count a repair only
after the same request reopens, completes Verify and returns authoritative
`PASS/GREEN` with confirmed release. A failed reopen becomes
`REPAIR_VALIDATION_FAILED`; an unconfirmed native release prevents reopening.
Historical restoration remains `RESTORED_REVIEW_REQUIRED`. The original error,
stage and evidence references, a `pre-repair-result.json` snapshot, native
evidence and validation evidence remain attached even if the retry raises.
`tests/fixtures/issue2-lost-session-sanitized.json` contains selected fields from
the actual issue attachment, with paths, machine and process identities
sanitized. Replay asserts `PCB_STARTING`, the selected PRJ/database, normal PCB
and launcher release before native Repair, and exactly one automatic repair and
one reopen even if the opening error repeats. Separate replays cover the actual
2026-10-28 missing-backup Output, delayed exits/addresses, unknown custom prompts,
successful native repair and historical restoration. These are nonnative tests.
The attachment contains logs only. No matching `1GPHY_8211` faulty project was
found in the sibling `Skyworth_CBB_Lib` collection. This host runs Windows 11;
Windows 10 behavior and recovery of the real field database remain unverified.
The coordinator's prepared `diagnostics/issue2-frozen-20261102` fixture damages a
copied database header; it does not reproduce field lost-server-session loss.
Candidate packaging and frozen/native tests remain coordinator work after review.
Task 1 checks: full suite once, 532 passed with the existing pywinauto COM warning;
after the final initial-busy gate regression, the related final suite passed all
234 tests. Compileall and `git diff --check` passed. The coordinator will run
candidate/frozen validation against the final implementation.