Skip to content

Make mutation checks faster and stricter - #1898

Merged
stefan-burke merged 6 commits into
mainfrom
improve-mutation-static-gates
Jul 23, 2026
Merged

Make mutation checks faster and stricter#1898
stefan-burke merged 6 commits into
mainfrom
improve-mutation-static-gates

Conversation

@stefan-burke

@stefan-burke stefan-burke commented Jul 23, 2026

Copy link
Copy Markdown
Member

Why

Mutation testing should spend time on changes that could compile and ship. The equivalent-mutant list must also stay accurate, and every direct test for changed source should take part in the mutation gate.

What changed

  • run each mutation through the pinned Biome and TypeScript checks before starting its tests
  • add mutation:audit-equivalents to reject stale, malformed, or statically invalid equivalent entries
  • run every direct test mapped to each changed source file
  • strengthen the affected tests until every detectable mutation is caught
  • share one Biome command between normal linting and mutation tooling

Validation

  • mise exec -- deno task precommit
  • mise exec -- deno task mutation:audit-equivalents: 428 entries checked, with no stale or statically invalid entries
  • mise exec -- deno task precommit:mutation: 753 mutations evaluated, 722 detectable mutations killed, 31 equivalents suppressed, and no survivors or timeouts
  • GitHub Test, Merge Check, and deploy/chobble/tickets-turso checks passed
  • CodeRabbit reviewed the PR and approved it after three review comments were addressed in commit b3b2e690 (exact CSV rows for servicing policy, curried #fp composition in attendee-edit and Square assertions, shared debugMessages test helper)

Remaining limitation

The deploy/chobble/tickets (Deno Deploy) status failed for commit b3b2e690, but the build logs require console access. The Test workflow and the Turso deploy both passed, and the failure was not reproducible locally — a re-run of the Deno Deploy workflow is the next thing to check on a real machine.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 206e08e0-d41f-4eb7-a4d5-8bfafd3ddcd4

📥 Commits

Reviewing files that changed from the base of the PR and between c3208eb and b3b2e69.

📒 Files selected for processing (6)
  • test/features/admin/attendees-edit.test.ts
  • test/features/admin/calendar-csv.test.ts
  • test/shared/payment-helpers/dispatch.test.ts
  • test/shared/square/client.test.ts
  • test/shared/square/payment-link.test.ts
  • test/test-utils/debug-log.ts

📝 Walkthrough

Walkthrough

This PR updates mutation-testing tooling and documentation, adds nullish type guards, refactors attendee payment lookup, revises payment-reference behavior, and expands exact-output and edge-case coverage across CSV, forms, Square, and UI tests.

Changes

Mutation Gate Tooling

Layer / File(s) Summary
Documentation and configuration
AGENTS.md, TODO.md, docs/importer-plan.md, biome.json, deno.json
Documents mutation-gate behavior, configures null-comparison linting, and adds the equivalent-mutant audit task.
Biome command resolution
scripts/biome-command.ts, scripts/biome.ts, scripts/mutation/execution.ts, test/scripts/biome-command.test.ts, test/scripts/mutation-execution.test.ts
Adds native Biome detection with pinned npm fallback and wires the resolved command into static lint gates.
Equivalent-mutant auditing
scripts/audit-equivalent-mutants.ts, scripts/mutation/equivalent-audit.ts, scripts/mutation/ignore.ts, test/scripts/mutation-equivalent-audit.test.ts
Adds catalog validation, mutant auditing, optional pruning, signal handling, and comprehensive tests.
Mutation catalog and test selection
scripts/mutation/equivalent-mutants.txt, scripts/mutation/test-map.ts, scripts/precommit-mutation.ts, scripts/precommit/mutation-step.ts, test/scripts/mutation-test-map.test.ts, test/scripts/mutation-step.test.ts
Revises equivalent-mutant entries and selects all direct tests plus changed integration tests.

Nullish Helper Adoption

Layer / File(s) Summary
Type guards and production usage
src/fp.ts, src/features/admin/*, src/shared/*
Adds isNullish/isNotNullish and replaces direct nullish comparisons across shared and admin code.
Test utilities
test/shared/rest/crud-api.test.ts, test/test-utils/*, test/fp/collections.test.ts
Applies and tests the new predicates in test support code.

Domain and Test Coverage

Layer / File(s) Summary
Attendee payment behavior
src/features/admin/attendees-edit.ts, src/shared/db/payment-references.ts, related tests
Uses a single-row booking lookup and verifies refund activity attribution and ordered session IDs.
CSV and form rendering
test/features/admin/calendar-csv.test.ts, test/ui/templates/admin/calendar.test.ts, test/shared/forms/rendering.test.ts
Replaces partial assertions with exact CSV and HTML output checks.
Square and UI coverage
test/shared/square/*, src/ui/client/*, test/ui/client/admin/*, related tests
Adds request, transport, webhook, logging, loader, DOM-typing, and integration-test coverage.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main intent: faster and stricter mutation checks.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-mutation-static-gates
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch improve-mutation-static-gates

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/features/admin/attendees-edit.test.ts`:
- Around line 180-184: Update the assertion around getAttendeeActivityLog to
replace the native filter/map chain with the repository’s curried collection
utilities from `#fp`, composed functionally. Preserve the existing predicates,
attendee_id/listing_id projection, and expected result.

In `@test/features/admin/calendar-csv.test.ts`:
- Around line 272-320: Strengthen both tests in the “servicing policy” describe
block by replacing broad toContain/not.toContain checks with exact CSV line
assertions using split("\n") and toEqual. Assert the complete header and row
contents, including column order, the service-event label, omitted servicing
ticket URL, retained attendee URL, and logistics columns; use the actual default
values produced by calAttendee/testAttendee.

In `@test/shared/square/client.test.ts`:
- Line 42: Replace each native Array.prototype.map in the debug-log assertions
with the repository’s curried `#fp` mapping utility, composing it with the
call-argument extraction. Apply this in test/shared/square/client.test.ts:42-42,
test/shared/square/payment-link.test.ts:102-105 for the final two calls, and
test/shared/square/payment-link.test.ts:184-187 for the final three calls;
preserve the existing expected values and assertion behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 930f3e79-2734-4925-a27e-a05e222465ad

📥 Commits

Reviewing files that changed from the base of the PR and between e6d32a7 and c3208eb.

⛔ Files ignored due to path filters (1)
  • deno.lock is excluded by !**/*.lock
📒 Files selected for processing (55)
  • AGENTS.md
  • TODO.md
  • biome.json
  • deno.json
  • docs/importer-plan.md
  • scripts/audit-equivalent-mutants.ts
  • scripts/biome-command.ts
  • scripts/biome.ts
  • scripts/mutation/equivalent-audit.ts
  • scripts/mutation/equivalent-mutants.txt
  • scripts/mutation/execution.ts
  • scripts/mutation/ignore.ts
  • scripts/mutation/test-map.ts
  • scripts/precommit-mutation.ts
  • scripts/precommit/mutation-step.ts
  • src/features/admin/api-groups.ts
  • src/features/admin/api-holidays.ts
  • src/features/admin/attendees-edit.ts
  • src/features/admin/calendar-csv.ts
  • src/fp.ts
  • src/shared/db/activityLog.ts
  • src/shared/db/payment-references.ts
  • src/shared/forms/rendering.tsx
  • src/shared/required-value.ts
  • src/shared/rest/crud-api.ts
  • src/shared/runtime.ts
  • src/shared/square.ts
  • src/ui/client/admin/bundle-loader.ts
  • src/ui/client/dom.ts
  • test/features/admin/attendees-edit.test.ts
  • test/features/admin/calendar-csv.test.ts
  • test/fp/collections.test.ts
  • test/lib/test-utils/error-paths.test.ts
  • test/scripts/biome-command.test.ts
  • test/scripts/mutation-equivalent-audit.test.ts
  • test/scripts/mutation-execution.test.ts
  • test/scripts/mutation-step.test.ts
  • test/scripts/mutation-test-map.test.ts
  • test/shared/db/activityLog.test.ts
  • test/shared/db/payment-references.test.ts
  • test/shared/forms/rendering.test.ts
  • test/shared/merge/attendee-merge/checkout-stage-cleanup.test.ts
  • test/shared/rest/crud-api.test.ts
  • test/shared/square/client.test.ts
  • test/shared/square/payment-link.test.ts
  • test/shared/square/request-init.test.ts
  • test/shared/square/rest-transport.test.ts
  • test/shared/square/retrieve-refund.test.ts
  • test/shared/square/webhook.test.ts
  • test/test-utils/db-helpers/listing-forms.ts
  • test/test-utils/form-values.ts
  • test/ui/client/admin/bundle-loader.test.ts
  • test/ui/client/admin/logistics-map-loader.test.ts
  • test/ui/client/admin/markdown-editor-loader.test.ts
  • test/ui/templates/admin/calendar.test.ts
💤 Files with no reviewable changes (4)
  • test/lib/test-utils/error-paths.test.ts
  • test/ui/client/admin/markdown-editor-loader.test.ts
  • test/ui/client/admin/logistics-map-loader.test.ts
  • TODO.md

Comment thread test/features/admin/attendees-edit.test.ts
Comment thread test/features/admin/calendar-csv.test.ts Outdated
Comment thread test/shared/square/client.test.ts Outdated
@stefan-burke stefan-burke changed the title Strengthen mutation testing with static checks Make mutation checks faster and stricter Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant