---
id: "lib-2026-11-09-all-tests-passed-from-ai-closing-the-gaps-with"
type: "library"
title: "'All tests passed' from AI: closing the gaps with mutation testing (AI「テスト通りました」← これ､本当？ Stryker でテストの穴を塞いだ話)"
lang: "JA"
org: "Xincere (Qiita)"
source_type: "Practitioner post"
date: "2026-11-09"
week: "2026-W46"
url: "https://nosov.ai/library/lib-2026-11-09-all-tests-passed-from-ai-closing-the-gaps-with/"
original_url: "https://qiita.com/Dingu-suke/items/b5318ef2040a9f59224a"
tier: "B"
tier_name: "Useful, limited"
tier_reason: "A Qiita post from a developer at Sincere (Japan) with concrete mutation-testing runs, scores and timings on a real multi-tenant codebase; one team, one component, no comparison group."
summary_basis: "full-text"
original_minutes: "14"
tags: ["ai technology", "test quality", "multi tenant saas", "coding agents"]
---

# 'All tests passed' from AI: closing the gaps with mutation testing (AI「テスト通りました」← これ､本当？ Stryker でテストの穴を塞いだ話)

Tier B (Useful, limited): A Qiita post from a developer at Sincere (Japan) with concrete mutation-testing runs, scores and timings on a real multi-tenant codebase; one team, one component, no comparison group.

Summary based on the full text.

## In short

A Qiita post (9 November 2026, updated 11 November) from a developer at Sincere, a Japanese software firm, on using mutation testing with StrykerJS to check whether AI-written tests prove anything. The team built a Prisma client that adds each company's filter to every query in a multi-tenant SaaS app, because a forgotten tenant condition passes type checks and tests. All about 380 real-database tests passed, yet Stryker found surviving mutants that showed tests passing for the wrong reason. The author's main lesson: if a property must be guaranteed by machines, put the decision in one place and test that place hard.

## Key numbers

- 89.74% → 100%: mutation score of the tenant-scoping client before and after fixing the tests Stryker exposed
- about 380: real-database tests checking that company A sees its rows and company B's rows stay hidden
- 512 mutants, about 5 minutes: Stryker run over the four files of the scoping layer, score 99.61%
- 1,326 mutants, 24 minutes: run time once the layer had grown, the reason it is kept out of every-commit checks
- 131 models, about 190 routes: size of the SaaS app whose tenant filter was moved into one definition table

## What it reports

- Context: 131 models and about 190 routes; manual `where` filters per route had become hard to keep correct, especially for models without a `tenantId` column that reach the tenant through two parent hops.
- Design: a definition table typed as `Record<Prisma.ModelName, Rule>`, so adding a model without a row is a type error; every model must be scoped, unscoped (shared master data) or forbidden.
- Results: definition table alone 359 mutants, 2 min 6 s, 100%; table plus client 407 mutants, 3 min 30 s, client score 89.74% before fixes and 100% after; four files 512 mutants, about 5 minutes, 99.61%.
- Surviving mutants and causes: removing an existing AND condition survived because company A had only one row; removing `'delete'` from scoped operations survived because the delete failed on a foreign-key constraint, so the test saw "an error" and passed.
- A `bind` call an AI agent added after a plausible review comment turned out to be unnecessary: every mutant removing it survived, and it was deleted.
- Two mutants could not be killed because of a known Prisma bug where `disconnect: false` still disconnects.
- Planned harness use: real-database tests on every Claude Code session end via a hook; Stryker as a personal skill run once before a PR when the table or client changes.
- Checks scattered in individual routes rely on mocked Prisma tests and are out of reach of both real-database tests and Stryker.

## How they got it

First-hand engineering account. The author ran StrykerJS with the Jest runner restricted to the real-database tests (the default pulled in tests from about 170 importing routes), reports mutant counts, run times and scores, and walks through each surviving mutant with its cause and fix.

## Limits

- One component of one company's app; no comparison with other methods of checking test strength.
- The author has not yet built the harness integration; that section is a plan.
- A 100% score only shows the current tests detect the current mutants; it does not prove the specification is complete, as the author notes.
- Ends with a recruiting note for the company.

## Why it matters for companies

Coverage numbers rise easily when an agent writes tests, so they say little about whether tests catch faults. Mutation testing gives a measurable check, and its output (file, line, change, tests that passed) is a precise task to hand back to a coding agent. The delete-on-foreign-key case shows how a security test can stay green while the protection is gone. The design point travels beyond testing: concentrating a critical rule in one module is what makes it checkable by machines.

## Key passages in translation

> 会社の条件を書き忘れても、型チェックもテストも通ってしまう

Even if you forget to write the company condition, both the type check and the tests still pass.

> そのエラーは会社で絞られたからではなく、外部キー制約で落ちていただけだったのです。

That error came from a foreign-key constraint, not from the company filter.

> 機械で担保したいなら、判断を各所に散らさず 1 か所に集める

If you want machines to guarantee it, gather the decision in one place instead of scattering it.

Original: https://qiita.com/Dingu-suke/items/b5318ef2040a9f59224a
