Skip to content

test: coverage elevation & Stryker stabilization#126

Merged
qnbs merged 6 commits into
mainfrom
feat/test-coverage-stryker-fix
Jun 13, 2026
Merged

test: coverage elevation & Stryker stabilization#126
qnbs merged 6 commits into
mainfrom
feat/test-coverage-stryker-fix

Conversation

@qnbs

@qnbs qnbs commented Jun 13, 2026

Copy link
Copy Markdown
Owner

User description

Summary

Comprehensive test expansion in Tier-1 high-risk areas and stabilization of the Stryker mutation testing workflow.

Goals

  • Raise meaningful unit-test coverage for AI services, Copilot v2, voice pipeline, error boundaries, and complex state.
  • Fix Stryker configuration and GitHub Actions workflow so mutation testing runs reliably with a hard break threshold of ≥ 75 %.

Quality gates

  • lint / typecheck / i18n:check
  • targeted Vitest runs for changed test files
  • Stryker CI runs dispatched via cloud only

Notes

  • No full local test suites or Stryker runs (low-end hardware / CI-only by policy).
  • CodeAnt review will be triggered after the initial Stryker config fixes.

CodeAnt-AI Description

Expand AI test coverage and stabilize mutation test runs

What Changed

  • Added coverage for AI retry delays, Retry-After handling, retry behavior, model recommendations, and local-only AI rules.
  • Added checks that cloud AI is blocked in local-only mode and that local LoRA models are accepted while cloud-hosted IDs are rejected.
  • Made AI tests leave timers, spies, and AI mode in a clean state after each run so one failure does not affect later tests.
  • Adjusted mutation testing to run with lower concurrency, a longer timeout, HTML reports, and the correct module split so jobs complete more reliably.

Impact

✅ Fewer flaky AI test failures
✅ Clearer AI policy checks
✅ Fewer mutation test timeouts

💡 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.

- Disable Vitest related-test detection so every mutant runs against the full suite.
- Remove Typescript checker to reduce runtime and timeouts.
- Fix services-core matrix glob (help/helpDocRetrieval).
- Split services-ai into core/providers, add copilot module.
- Enforce --breakAt 75 and lower per-job concurrency to 2.
@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
storycraft-studio Ready Ready Preview, Comment Jun 13, 2026 10:11pm

@qnbs

qnbs commented Jun 13, 2026

Copy link
Copy Markdown
Owner Author

@CodeAnt-AI: review

@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI is running the review.


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:S This PR changes 10-29 lines, ignoring generated files label Jun 13, 2026
@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Sequence Diagram

This PR stabilizes the Stryker setup by adjusting its configuration and GitHub Actions workflow so each module runs full-suite mutation tests with a fixed break threshold and richer reports.

sequenceDiagram
    participant Dev as Developer
    participant CI as GitHub Actions
    participant Stryker as Stryker CLI
    participant Tests as Vitest suite
    participant Reports as Mutation reports

    Dev->>CI: Push or dispatch mutation workflow
    CI->>CI: Build matrix of modules and mutate patterns
    loop For each module job
        CI->>Stryker: Run Stryker with module pattern, concurrency 2, breakAt 75
        Stryker->>Tests: Run full test suite for all mutants
        Tests-->>Stryker: Return test results and coverage
        Stryker-->>Reports: Generate json and html mutation reports
        CI-->>Dev: Upload module mutation reports as artifacts
    end
Loading

Generated by CodeAnt AI

@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI finished running the review.


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

qnbs added 4 commits June 13, 2026 23:10
The break threshold is already enforced by stryker.conf.json.
Also drop the unused break_threshold workflow input.
- Add dedicated aiRetry tests for delay, Retry-After parsing, retry orchestration.
- Add modelRecommendations tests for task-based selection and Ollama speed probe.
- Extend aiPolicy tests with LoRA local-only gate and AI-mode local gating.
…currency defaults

- coverageAnalysis: all is incompatible with ignoreStatic; switch to perTest.
- Keep disableRelatedTests: true to avoid Vitest related-test detection failures.
- Align workflow default/summary concurrency to 2.
@qnbs

qnbs commented Jun 13, 2026

Copy link
Copy Markdown
Owner Author

@CodeAnt-AI: review

@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI is running the review.


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 removed the size:S This PR changes 10-29 lines, ignoring generated files label Jun 13, 2026
@qnbs
qnbs marked this pull request as ready for review June 13, 2026 21:49
@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jun 13, 2026
@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Sequence Diagram

This PR stabilizes the mutation testing pipeline by running Stryker across module-specific jobs with lower concurrency, full Vitest suites, and HTML/JSON reporting, while enforcing thresholds from the shared Stryker config.

sequenceDiagram
    participant Developer
    participant MutationWorkflow
    participant Stryker
    participant Vitest
    participant Reports

    Developer->>MutationWorkflow: Trigger Mutation Tests with mode and per job concurrency
    MutationWorkflow->>Stryker: Start module run with mutate pattern and concurrency 2
    Stryker->>Vitest: Run full Vitest suite with perTest coverage
    Vitest-->>Stryker: Return test results for all mutants
    Stryker->>Reports: Write HTML and JSON mutation reports and update incremental state
    MutationWorkflow->>Reports: Collect module reports and build aggregate summary with thresholds
Loading

Generated by CodeAnt AI

Comment thread tests/unit/ai/aiPolicy.test.ts
Comment thread tests/unit/ai/aiRetry.test.ts Outdated
Comment thread tests/unit/ai/modelRecommendations.test.ts Outdated
Comment thread tests/unit/ai/aiPolicy.test.ts Outdated
Comment thread tests/unit/ai/modelRecommendations.test.ts Outdated
@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI finished running the review.


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

- aiPolicy.test.ts: reset the singleton AI mode to 'hybrid' via afterEach instead
  of an inline restore, so an early-failing assertion can't leak the wrong mode
  into later tests.
- aiRetry.test.ts: retry-path tests now use fake timers (vi.useFakeTimers +
  runAllTimersAsync) and restore real timers via afterEach — no real wall-clock
  waits, no timer leakage.
- modelRecommendations.test.ts: getProviderSpeedEstimate suite fakes performance.now
  for a deterministic latency assertion and unstubs globals/spies via afterEach so
  the fetch stub can never leak past a failing test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.


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

@qnbs

qnbs commented Jun 13, 2026

Copy link
Copy Markdown
Owner Author

@CodeAnt-AI review

@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI is running the review.


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 size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Jun 13, 2026
@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Sequence Diagram

This PR refines the Stryker mutation testing workflow by splitting modules into smaller matrix jobs, standardizing concurrency and thresholds, and generating HTML and JSON reports for each run.

sequenceDiagram
    participant Developer
    participant GitHubActions
    participant Stryker
    participant Vitest
    participant Reports

    Developer->>GitHubActions: Dispatch mutation workflow with mode and concurrency
    GitHubActions->>GitHubActions: Start matrix jobs per module with mutate pattern
    GitHubActions->>GitHubActions: Restore or create incremental cache per module
    GitHubActions->>Stryker: Run Stryker with concurrency 2 and perTest coverage
    Stryker->>Vitest: Execute full test suite for mutated files
    Vitest-->>Stryker: Return test results and coverage data
    Stryker-->>GitHubActions: Return mutation score and JSON or HTML reports
    GitHubActions->>Reports: Upload artifacts and write summary with thresholds
Loading

Generated by CodeAnt AI

@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI finished running the review.


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 commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@qnbs
qnbs enabled auto-merge (squash) June 13, 2026 22:35
@qnbs
qnbs merged commit ca392b9 into main Jun 13, 2026
17 checks passed
@qnbs
qnbs deleted the feat/test-coverage-stryker-fix branch June 13, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant