Repository navigation
Commit 982fef4
committed
test(api): kill the surviving conditional mutant in completePrompt's catch
The mutation advisory on this head was 'src/api/providers/requesty.ts:342: Survived
ConditionalExpression mutant (replacement: false)'. Line 342 is the isRequestAborted guard
in completePrompt's catch, the statement the review row pointed at. Judging it:
It is not an equivalent mutant. The guard's condition is 'isRequestAborted(error,
requestAbortSignal)', and the shared helper resolveModelWithAbort runs the identical check
before it rethrows. A failure the helper judged non-abort can still meet an aborted signal at
the provider's catch, because a microtask boundary sits between the helper's catch and this
one: the helper rethrows the genuine failure, the caller's signal fires in that gap, and this
guard then converts the genuine failure into the Task.ts abort contract. Mutating the
condition to false propagates the genuine failure instead, which is an observable difference
in the name and message of the thrown error. The aggregate line
'fetchers/requesty.ts:107: 2 mutation test gaps; example: ...' and the NoCoverage
StringLiteral at :116 are advisory lines, not per-mutant results, and are not what this commit
addresses.
It was a real coverage gap, measured both ways: with the condition replaced by 'false' the
provider suite passed 61 of 61 and tsc reported no errors, so nothing in the suite
distinguished the guard from its own negation. The new test drives exactly the interleaving -
the model lookup rejects with a name-'Error' / message-'catalog request failed' failure, and
the caller's signal aborts from a Promise.resolve().then scheduled by the failure object's
first property read, which happens inside the helper's check and therefore after it and before
this catch resumes - and asserts name 'AbortError' and message 'The Requesty request was
aborted'. Measured: on the real code 62 passed; under the mutant 1 failed with
"AssertionError: expected 'Error' to be 'AbortError'". No Stryker directive was added and
src/eslint-suppressions.json is unchanged (git diff --numstat against HEAD is empty).
Package-level gate for the touched package, per the campaign rule: pnpm --dir src test. It
fails in this worktree for two pre-existing, environment-caused files that my change does not
touch: __tests__/dist_assets.spec.ts (no dist/ build in this worktree - the directory is
absent) and services/rules/__tests__/rules.spec.ts (EPERM: operation not permitted, symlink
...). Running those two files alone here, with my change present and inert for them, gives 45
failed of 56, so they fail without my change too. No api/providers file fails in the package
run.1 parent a93038b commit 982fef4
1 file changed
Lines changed: 43 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1444 | 1444 | | |
1445 | 1445 | | |
1446 | 1446 | | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
1447 | 1488 | | |
1448 | 1489 | | |
1449 | 1490 | | |
| |||
1601 | 1642 | | |
1602 | 1643 | | |
1603 | 1644 | | |
1604 | | - | |
| 1645 | + | |
1605 | 1646 | | |
1606 | 1647 | | |
1607 | 1648 | | |
| |||
1612 | 1653 | | |
1613 | 1654 | | |
1614 | 1655 | | |
1615 | | - | |
| 1656 | + | |
1616 | 1657 | | |
1617 | 1658 | | |
1618 | 1659 | | |
| |||
0 commit comments