Skip to content

fix(mutation): reject zero-test survivor evidence - #799

Merged
qnbs merged 3 commits into
mainfrom
fix/764-stryker-vitest5-zero-test-20260920
Sep 20, 2026
Merged

qnbs merged 3 commits into
mainfrom
fix/764-stryker-vitest5-zero-test-20260920

Conversation

@qnbs

@qnbs qnbs commented Sep 20, 2026

Copy link
Copy Markdown
Owner

User description

Bootstrap draft for the bounded #764 Stryker/Vitest 5 mutation-evidence qualification. The PR number is reserved so CHANGELOG.md can receive its real release-note reference before governance checks and review.

Summary by Sourcery

Fail closed on zero-test survived mutation evidence during Stryker report aggregation.

Bug Fixes:

  • Reject mutation reports that mark mutants as Survived without at least one completed test, preventing empty per-test selections from producing false mutation results.

Documentation:

  • Update README testing metrics and Vitest version references to reflect the current test count and Vitest 5.

Tests:

  • Add coverage for invalid zero-test survivor evidence while retaining valid mutation aggregation coverage.

Chores:

  • Add the mutation-evidence fix to the changelog.

Summary by cubic

Rejects zero-test survived mutants in Stryker aggregation so empty Vitest filter results no longer count as valid mutation evidence.

Written for commit 66d7254. Summary will update on new commits.

Review in cubic


CodeAnt-AI Description

Reject invalid zero-test mutation survivors

What Changed

  • Mutation reports now fail instead of counting a survived mutant when no tests completed, preventing empty test selections from being treated as valid mutation evidence
  • Added coverage for invalid zero-test survivor reports while preserving valid metrics-only reports
  • Updated the documented test count and changelog entry

Impact

✅ Prevented false mutation results
✅ Clearer mutation report failures
✅ Updated test coverage documentation

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Bug Fixes

    • Mutation testing results now fail safely when reports indicate survived mutants without any completed tests, preventing empty test selections from influencing reported results.
    • Invalid or incomplete mutation report data is rejected instead of producing potentially misleading metrics.
  • Documentation

    • Updated project documentation to reflect the latest test count: 8,102+ tests across 616 test files.
    • Updated documented tooling information to reflect Vitest 5.x.

Stryker 9.6.1's Vitest runner can complete a per-test mutant run with zero selected tests when a test-name filter resolves empty. The aggregator previously accepted that result as a Survived mutant, which could inflate mutation evidence and hide broken test selection.

Validate raw file reports before trusting metrics and require every Survived mutant to report at least one completed test. Keep metrics-only fixtures valid for the aggregate test contract; existing status and metric relationship validation remain unchanged.

This is a bounded qualification guard. It does not upgrade Stryker, change mutation thresholds, alter workflow mode, or change production test selection.

Validation:
- pnpm exec vitest run tests/unit/tooling/strykerAggregation.test.ts tests/unit/tooling/strykerWorkflowPolicy.test.ts
- pnpm exec biome check scripts/aggregate-stryker-reports.mjs tests/unit/tooling/strykerAggregation.test.ts
- git diff --check
- pnpm run signing:doctor
- pnpm run hooks:install
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

Changes

Mutation aggregation now validates survived-mutant execution evidence before reading or deriving metrics. Tests cover valid and zero-test cases. The changelog documents the fix. README metrics and Vitest references now reflect the updated repository values.

Mutation evidence validation

Layer / File(s) Summary
Validate mutation execution evidence
scripts/aggregate-stryker-reports.mjs, tests/unit/tooling/strykerAggregation.test.ts, CHANGELOG.md
The aggregator rejects survived mutants without completed tests. Tests cover valid evidence and the rejection error. The changelog records the fix.

Repository test metrics

Layer / File(s) Summary
Update documented test metrics
README.md, scripts/check-doc-metrics.mjs, scripts/sync-readme-metrics.mjs
README metrics now report 8,102+ tests across 616 files and Vitest 5.x. Metric validation and synchronization recognize the Vitest 5.x label.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: 🔵 Low · up to 66d72

The current README remains valid, but future grouped test counts could become stale without detection. This is a bounded, straightforward documentation-check fix.


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

@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
worldscript-studio Ready Ready Preview Sep 20, 2026 8:15pm UTC

@sourcery-ai

sourcery-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

This draft reserves PR #764 while introducing a guard in Stryker report aggregation that prevents survived mutants without completed-test evidence from being treated as valid mutation results, with corresponding unit-test coverage and README test-count updates.

Flow diagram for Stryker mutation-evidence validation

flowchart TD
    A[Read Stryker report] --> B[validateMutationExecutionEvidence]
    B --> C{Survived mutant has testsCompleted >= 1?}
    C -->|Yes| D[readReportMetrics]
    C -->|No| E[Throw validation error]
    D --> F[Aggregate mutation metrics]
Loading

File-Level Changes

Change Details Files
Add validation that mutation reports contain executable evidence for survived mutants.
  • Reject survived mutants when testsCompleted is missing, non-integer, or below one.
  • Run evidence validation before consuming either report metrics or derived mutant metrics.
  • Update aggregation fixtures and add coverage for zero-test survivors.
scripts/aggregate-stryker-reports.mjs
tests/unit/tooling/strykerAggregation.test.ts
Synchronize documented test-count metrics with the added test.
  • Increase the documented test total from 8101+ to 8102+ in badges, testing documentation, repository layout, and metrics sections.
README.md

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codeant-ai

codeant-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: 66d72547
Scan Time: 2026-09-20 20:41:44 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED No IAC issues

View Full Results

codescene-access[bot]

This comment was marked as outdated.

Record the actual GitHub PR number in the Unreleased mutation-tooling note so the PR CHANGELOG Reference Guard can validate the release note.

This bootstrap correction intentionally changes CHANGELOG.md only; no source, test, workflow, or governance behavior is included.

Validation:
- git diff --check
- PR budget prospective check against origin/main
codescene-access[bot]

This comment was marked as outdated.

@qnbs qnbs changed the title chore(meta): reserve PR number fix(mutation): reject zero-test survivor evidence Sep 20, 2026
@qnbs
qnbs marked this pull request as ready for review September 20, 2026 19:42

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @qnbs, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 4 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@codeant-ai

codeant-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 011f152 Sep 20, 2026 · 19:43 19:44

@codeant-ai

codeant-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Sep 20, 2026
@codeant-ai

codeant-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. The README claims Vitest 4.x, but package.json declares Vitest ^5.0.0; the metrics sync script also preserves this incorrect version.

Inconsistent naming · README.md:812

@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

CodeScene identified nested conditional logic in the new mutation-evidence validator, while CodeAnt identified stale Vitest 4.x documentation that conflicted with the repository's Vitest 5 toolchain.

Split report, file, and mutant validation into bounded helpers without changing fail-closed semantics. Update the README and both source-derived metric parsers to recognize and report Vitest 5.x.

The zero-test survivor guard, existing metric invariants, mutation thresholds, Stryker version, and workflow policy remain unchanged. This is the single bounded correction wave for the exact current review findings.

Validation:\n- focused Vitest aggregation and workflow-policy tests: 11 passed\n- docs:check: OK\n- Biome: clean\n- git diff --check: clean\n- PR budget: 4 files, 60 meaningful lines, 2 commits; NORMAL

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Absence of Expected Change Pattern

  • WorldScript-Studio/scripts/check-doc-metrics.mjs is usually changed with: WorldScript-Studio/tests/unit/checkDocMetrics.test.ts

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: qnbs/WorldScript-Studio/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 9800b1dd-634e-4955-96cd-cbbd3a0ea215

📥 Commits

Reviewing files that changed from the base of the PR and between 011f152 and 66d7254.

📒 Files selected for processing (4)
  • README.md
  • scripts/aggregate-stryker-reports.mjs
  • scripts/check-doc-metrics.mjs
  • scripts/sync-readme-metrics.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

Included review availability: 3 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Comment thread scripts/check-doc-metrics.mjs
@qnbs

qnbs commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

CodeAnt Nitpick validated and addressed in corrective commit 66d72547. README.md now says Vitest 5.x, and both source-derived documentation metric paths (scripts/sync-readme-metrics.mjs and scripts/check-doc-metrics.mjs) use the Vitest 5.x label. Focused tests, docs:check, ci:prepush, and the exact-head CI/CD + CodeQL gates are green. The separate minor grouped-number guard gap raised by CodeRabbit is tracked as FOLLOW_UP in #800 and did not reopen this converged PR.

@qnbs
qnbs merged commit 8e2a687 into main Sep 20, 2026
48 checks passed
@qnbs
qnbs deleted the fix/764-stryker-vitest5-zero-test-20260920 branch September 20, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant