Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -1397,19 +1397,9 @@ reorganisation. Starting point: move the two phone-index describe blocks into
`storedPhoneIndex` helpers in whichever file needs them (or lift to `#test-utils`
if both do). The webhook test file drops to ~380 lines.

## Mutation survivor in `src/features/api/folded-booking.ts` (direct tests)
## Mutation coverage of `src/features/api/folded-booking.ts` (direct tests)

Direct tests at `test/features/api/folded-booking.test.ts` and
`test/features/api/folded-booking/parent-booking.test.ts` kill all but one mutant on the unchanged `folded-booking.ts`;
four equivalents (lines 87, 118, 176, 301) are recorded in
`scripts/mutation/equivalent-mutants.txt`. One survivor remains, noted here
because it is a deliberate non-kill (testing it would assert an
implementation detail, not a user-visible contract):

- `src/features/api/folded-booking.ts:381:17 1 → 0` —
`dayCount: 1` in the `FoldBase` `processParentApiBooking` builds. The fold
computes its own `fold.dayCount` (e.g. `3` for a customisable child) which
the intent carries, so the base value does not surface in any observable
output of the parent flow. Killing it would require asserting on the
intermediate `parentResolvedDuration(parent.listing, base.dayCount)` value,
which is an implementation detail rather than a user-visible contract.
`test/features/api/folded-booking/parent-booking.test.ts` kill every non-equivalent mutant on the unchanged `folded-booking.ts`.
Five equivalents (lines 87, 118, 176, 301, 381) are recorded in
`scripts/mutation/equivalent-mutants.txt` with proofs — no unsuppressed survivors remain.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
1 change: 1 addition & 0 deletions scripts/mutation/equivalent-mutants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -908,3 +908,4 @@ src/features/api/folded-booking.ts:87:42 ?? → || # childrenByParentId is Ma
src/features/api/folded-booking.ts:118:31 ?? → || # qtyByChild accumulates ApiQuantitySchema values (positive integers >= 1) or is unset; it is never 0 or NaN for validated inputs, so ?? 0 and || 0 agree
src/features/api/folded-booking.ts:176:53 1 → 0 # the thankYouUrl guard checks fold.listings.length > 1 only when parentThankYouUrl is truthy (parent flow), which always folds parent + >= 1 child (length >= 2); package callers pass no parentThankYouUrl, so the && short-circuits and the check never runs
src/features/api/folded-booking.ts:301:70 0 → 1 # feeSubtotal flows into priceCheckout → owedOrderForLedger, which drops all extras and sets total to 0; bookingFactsFromOrder reads extras (empty) → bookingFee: 0 regardless. The feeSubtotal value never reaches any observable output.
src/features/api/folded-booking.ts:381:17 1 → 0 # base.dayCount is read only by parentResolvedDuration → childDaysFromParent(parent, dayCount, 1), which uses its first argument (dayCount) only in the parent.customisable_days branch; processParentApiBooking rejects customisable parents at line 335 before reaching the fold, so that branch is unreachable. For daily parents the function returns clampDurationDays(parent.duration_days), and for standard parents it returns 1 (the standardValue) — neither reads dayCount, so 1 and 0 produce the same duration and thus the same fold output for every reachable input.