Files
dxdesigner-part-replacement/docs/testing/2026-11-06-project-health.md
T

7.8 KiB

Affirmative per-component failure health — 2026-11-06

This follow-up closes the admission gap where proof_intact({}) and an ordinary failed receipt allowed the next UID. Generic legacy success/import proof behavior is preserved. Component failure admission now requires an explicit, nonempty, durable health certificate.

Production path

quick_run.execute_step records the logical journal attempt before dispatch. For a native failed result, an immutable dispatch certificate binds the frozen command and its journal task/round/operation/job/attempt/generation to the actual runtime session/attempt/generation and native attempt file. A later health proof from another native session or retry cannot certify that dispatch, even if the job ID is reused.

After a safe component failure, batch.execute_batch asks reset_project_after_safe_failure(..., job_id=metric['job_id']) for the owned generation's release proof, then calls journal.certify_safe_failure(task_id, row, health) before another UID can be claimed. Certification only updates the already-failed, exact current SQL operation. It verifies native no-mutation state, the physical released generation record, matching project-close/worker-close checkpoint, session/generation/job identities, and all artifact hashes. Evidence is copied into immutable execution-proof files rather than relying on mutable active handoff or session files.

A native current-attempt no-mutation proof can continue when the full source fingerprint is unchanged. When a retained worker's initial source fingerprint predates legitimate earlier successful steps, continuation additionally requires the intact last verified semantic baseline for the exact failed project's sheet. A baseline from another sheet, empty evidence, a changed baseline, missing release evidence, a different native dispatch, or a possibly mutated current native attempt cannot authorize continuation. A rollback marker's text alone is not upgraded to healthy execution; existing explicit rollback/recovery protections remain in effect.

Custom synchronous process_runner adapters use the same production gate. The preparer captures a full source fingerprint before dispatch. A correlated terminal failure gets a durable certificate only after a matching nonempty after-failure fingerprint and proof that the related runtime/retained CAD resources are absent. The certificate includes the frozen command, failed outcome, exact journal identity, source digest, no-mutation flag, and completion/release flags. A source change or retained owned resource becomes uncertainty and blocks remaining UIDs. This behavior applies to all synchronous adapters, without detecting tests or granting them an exception. Code 2/3 rejection receipts accept captured evidence; native rejection receipts carry the actual native dispatch binding.

journal.independent_continuation_ready(task_id) provides the UI/DSH with a read-only answer for the first pending item in frozen plan order. It uses the same affirmative gate, returns false on missing or changed evidence and unresolved attempts, and never chooses a later UID to skip a blocked first pending item.

Red/green evidence

All commands use Python 3.12, pytest, short unique F:/dx-nb-health-* basetemp paths, and the existing short test cache.

The first four tests were run before implementation and failed for the intended defects:

  • A bare journal.finish(..., 'batch_failed', proof=None) let another UID claim execution.
  • Empty proof passed the existing generic integrity function and was incorrectly treated as admission evidence. The fix is local to affirmative component health; legacy success/import compatibility remains intact.
  • An actual controlled synchronous runner changed the project source after R1 failed and R2 still ran.
  • Failed receipts had no immutable failure-health artifact to protect or validate on resume.

Additional tests verify actual runtime reset proof and native/journal binding using the real runtime/journal logic with an injected CAD/desktop boundary:

  • Matching current prewrite native health permits the next UID.
  • A hashed release record containing only a released label without release evidence is rejected. This first reproduced as a failure, then passed after structural physical proof validation was added.
  • A changed source with no verified sheet baseline and a mismatched native job are rejected.
  • The exact intact last verified sheet baseline supports a current prewrite failure; tampering with that baseline revokes readiness.
  • Reusing old native health for a new journal/native dispatch is rejected. The immutable dispatch-binding implementation was added after a red test exposed its absence.
  • A safely paused R1 failure reports independent continuation readiness; certificate tampering and a bare failed receipt report false. These readiness tests failed before the API existed, then passed.

Focused acceptance and necessary adjacent regressions:

test_project_session_health.py, test_nonblocking_items.py, test_deferred_problem_pass.py, test_component_scope.py, test_nonblocking_acceptance.py, test_execution_journal.py, and test_execution_proof.py: 54 passed in 24.21 seconds after the native dispatch binding changes. After adding readable frozen command fields to the certificates, all 8 health tests passed in 4.41 seconds. The five affected modules parse successfully and git diff --check passes. No broad repository suite was run.

Limits

These checks exercise real SQLite receipts, actual handoff/status parsing, controlled synchronous dispatch, source fingerprint changes, immutable evidence files, and the actual runtime health/reset code. CAD/desktop boundaries in these health tests are injected; no real CAD/PCB, AI, or network operation was performed. Native health certificates authorize only affirmative current-attempt no-mutation. Possible native mutation remains held for the established verified rollback/recovery path rather than being inferred from a terminal error or a marker's text.

Parent-owned service/DSH wiring and the separate review fixes for retained process cleanup require their own integration checks. No commit or index change was made.

Stale-source follow-up from independent review

Review found that immutable certificate integrity alone did not establish the current source: after a safely failed UID and pause, a later edit to another project file still left readiness true. The actual pause/failure/edit regression was run first and failed. A second new case showed the same bypass after a later successful semantic baseline.

Certificates now record source_digest_algorithm, the exact source_project_path, and source_excluded_root. Every component continuation readiness/claim compares the current full project fingerprint with certified source. A newer successful same-sheet semantic baseline may supersede an older failure certificate only through an immutable source checkpoint that explicitly names that exact failure identity and certificate SHA. Its current full-source digest must match too. A pre-existing baseline or a certificate from another sheet cannot waive a source change.

Actual controlled-runner tests demonstrate that a legal verified R2 save creates the newer checkpoint and R3 remains executable, while an unrelated edit after that checkpoint revokes readiness. Native post-failure success gracefully finishes the retained worker and releases its verified generation before source checkpoint publication. The checkpoint reuses the released native source digest bound to the matching native attempt and release snapshot, avoiding a second full hash; the dedicated test rejects any duplicate source fingerprint call.

The focused health set now has 12 passing tests. The earlier 54-test set was not repeated for this narrow review fix. Tests still use injected CAD boundaries and controlled local files; real CAD was not run.