fix(FN-4811): persist done-task integrity warnings across engine restarts

The periodic self-healing sweep at
SelfHealingManager.reconcileDoneTaskIntegrity() emits a single
'Integrity warning: done-task finalize evidence is unproven (<reason>)' log
entry per task when the task is in 'done' but has no provable on-main
evidence. Dedup was via an in-memory finalizeUnprovenWarned Set per manager
instance, so every engine restart resurfaced the same warning on the next
sweep — significant noise on done tasks that legitimately lack evidence,
typically residue of FN-4811 contamination (FN-4771/FN-4778 in production).

Adds an optional MergeDetails.integrityWarning = { warnedAt, reason } field
and persists it on the first warning. Both warning sites in
reconcileDoneTaskIntegrity() (the unproven-and-still-mergeable branch and
the unproven-final branch) now consult the persisted record:

  - Same reason as persisted → skip re-emitting, just rehydrate the in-memory
    Set for in-process consistency.
  - Different reason → re-warn (so a *new* classification problem still
    surfaces) and update the persisted record.

Tests added under
packages/engine/src/__tests__/reliability-interactions/integrity-warning-persisted-dedup.test.ts
(real-git, 4 cases):

  - First sweep: emits warning + persists record.
  - Second sweep, same instance: in-memory Set dedupes (existing contract).
  - Fresh manager (simulated engine restart) + pre-persisted record:
    persisted dedup suppresses re-emission.
  - Fresh manager + persisted record with different reason: must re-warn
    and overwrite the persisted reason.

Full engine suite: 308 files, 5041 tests pass, 1 skipped. Lint clean.

Fusion-Task-Id: FN-4811
This commit is contained in:
Fusion
2026-05-16 16:51:43 -07:00
parent ba8e912aa8
commit f4aa6d7b8b
4 changed files with 293 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
---
"@runfusion/fusion": patch
---
fix(FN-4811): persist done-task integrity warnings across engine restarts
`SelfHealingManager.reconcileDoneTaskIntegrity()` previously deduped its
"Integrity warning: done-task finalize evidence is unproven" emissions via an
in-memory `Set<string>` per manager instance. Every engine restart created a
fresh manager, so the periodic sweep re-emitted the same warning for the same
task on every cycle — producing significant log noise on done tasks legitimately
lacking on-main evidence (often FN-4811 contamination residue).
Adds an optional `integrityWarning: { warnedAt, reason }` field on
`MergeDetails` and persists it on the first warning. Subsequent sweeps (within
the same process or after restart) check the persisted reason and skip
re-emitting an identical warning. A different classification reason still
re-warns and updates the persisted record.