[Chore] Require changed-code mutation tests before review - #1479
[Chore] Require changed-code mutation tests before review#1479zoomote[bot] wants to merge 5 commits into
Conversation
Review processThis PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.
Current step: Ready for human maintainer review and approval. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@CodeRabbit review |
Action performedReview triggered.
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Essentials Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request adds changed-code mutation testing with Stryker. It selects executable changed lines, discovers related Vitest tests, evaluates mutation reports, emits GitHub annotations and summaries, and runs the gate in pull-request workflows. ChangesChanged-code mutation testing
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant PullRequest
participant GitHubActions
participant stryker-diff
participant Vitest
participant Stryker
participant MutationReport
PullRequest->>GitHubActions: trigger mutation workflow
GitHubActions->>stryker-diff: pass base and head SHAs
stryker-diff->>Vitest: discover related test files
stryker-diff->>Stryker: run mutations for changed executable lines
Stryker-->>MutationReport: write mutation results
stryker-diff->>MutationReport: evaluate mutant outcomes
stryker-diff-->>GitHubActions: publish status, annotations, and summary
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Related GitHub Issue
Closes: N/A - requested from the linked Discord discussion.
Description
Adds a fork-safe
mutation-diffpull-request check that derives executable TypeScript/JavaScript line ranges from the PR merge base and runs StrykerJS only against those ranges. The gate covers focused Vitest suites in core, cloud, telemetry, vscode-shim, webview-ui, and the extension; unsupported or non-executable changes return an explicit not-applicable success.Any surviving or uncovered changed-code mutant fails with bounded line annotations. Each package fails closed above 500 changed executable lines or 400 generated/valid mutants, and broad or unreasoned Stryker exclusions are rejected. Mutation results are never cached, and every selected run uses
--force.Webview and extension changes use Vitest's dependency graph to discover affected tests, then prefer directly named unit specs when available before passing exact test files to Stryker. This keeps the new surfaces practical without including VS Code e2e tests. The lockfile also pins patched
qs@6.15.2, and the Stryker config remains safely importable by Knip.Test Procedure
pnpm test:mutation-cito exercise merge-base selection, executable ranges, caps, report evaluation, and exclusion policy.pnpm testfor the complete workspace suite.actionlint .github/workflows/mutation-testing.yml.Pre-Submission Checklist
Visual Snapshots
Not applicable.
Videos (interaction / animation only)
Not applicable.
Documentation Updates
Additional Notes
After this workflow lands on
main, a repository administrator must add the stablemutation-diffcontext to the required-status-check ruleset. Requiring it before the workflow exists on the default branch could leave unrelated pull requests permanently pending.CLI, types, and VS Code e2e surfaces remain explicit not-applicable paths. Webview and extension mutation runs are bounded by the existing 12-minute per-process and 30-minute workflow timeouts; multi-package PRs can therefore fail on runtime before reaching the numeric mutant cap and may need to be split.
Merge-group runs continue to record prior PR enforcement without rerunning PR diff mutation; later applicable PRs run the real changed-line gate.
Get in Touch
Continue in the originating Discord thread or mention
@roomoteon the pull request.