Files
fusion/packages/engine
gsxdsm 3681a9f9a5 test(U9): re-green merge-error-recovery.test.ts (10 stale tests deleted, replacement contract covered) (#2559)
**U9, PR8.** Test-only, two commits (deletion and new coverage
deliberately separate).

`merge-error-recovery.test.ts` has been **red on main: 10 failed / 23
passed**. Now **24 passed**.

## Commit 1 — the 10 failures test a feature that no longer exists

All 10 assert that `ProjectEngine` creates recovery follow-up **tasks**
and dedupes them by parent/branch. Evidence this was deliberate, not a
regression:

- `project-engine.ts` contains **zero** `createTask` calls.
- The string the dedupe tests assert on — `"follow-up already exists"` —
exists **only in the test file**; no production code emits it.
- `project-engine.ts:4801` documents it outright
(`FNXC:AutostashRecovery 2026-07-26`): *"This used to file an automated
recovery follow-up card via the shared follow-up engine; that engine was
deleted ... So the card is replaced by a durable log entry AND an
operator comment on the parent."*

Deleted rather than repaired — there is nothing left for them to assert.

## Commit 2 — cover the contract that replaced them

The production comment is explicit that `record.label` *"must never be
dropped from the message or truncated"* — it is the handle `git stash`
recovery needs, and the parent may already be `done`, so the notice is
the only trace of real uncommitted work.

**That invariant had no working assertion.** The file was red, so every
claim it made was inert.

The new test asserts one log entry + one comment for a `live` orphan (a
`subsumed` record stays silent), and that label, short sha, detecting
task and source phase all survive into the comment, with the label in
both the log message and its detail field.

| Mutation | Result |
|---|---|
| replace the label with `(omitted)` | 1 failed / 23 passed — this test
|
| notify on non-live orphans too | `NEW-failures=1` — this test |

## A tooling bug this uncovered, which matters beyond this PR

The new test originally reported **zero** new failures under mutation
while passing normally — i.e. it looked vacuous.

It was not. A thrown assertion left the engine running, which **crashed
the vitest worker**, and a crashed run emits no parseable `FAIL` lines —
so my mutation harness parsed zero failures and printed **NOT COVERED
for a guard that had just correctly failed**.

Two fixes:
- The test stops the engine in a `finally`, so a failure reports as an
assertion instead of killing the worker.
- The harness now treats *non-zero exit with zero parsed failures* as
**INCONCLUSIVE**, never as a coverage verdict, and prints the crash
signature.

This is the **second** time a blind spot in my own tooling manufactured
a false "uncovered" result — after the `|project|` regex that matched
nothing for `@fusion/core`. Both had the same shape: the measuring
instrument reported success without checking anything, which is
precisely the defect class this program is chasing. Worth stating
plainly rather than quietly fixing.

## Why this file matters to U9

Its 10 pre-existing failures are what corrupted my own safeguard
measurements in #2511 — an absolute-count mutation run credited them to
the mutation. **A red file in the merge lane does not merely lack
coverage; it poisons the measurement of everything near it.**

## Wider context, measured

`engine-default` on clean `main` is **283 failed / 9062 passed across 28
files**. This PR clears one of those files. I did not attempt the rest:
most are outside the merge/review lane and plausibly owned by other
workers on this program. Also measured and abandoned: extending
`check:mock-completeness` to relative intra-package mocks — the naive
rule flags **147** factories of which **146 are green**, so it would be
almost pure false positives; the barrel heuristic does not transfer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-29 09:54:04 -07:00
..
2026-07-26 18:11:47 -07:00