Skip to content

test: strengthen mutation coverage for github.ts and doctor.ts (#96, #98)#109

Merged
jmcte merged 1 commit into
mainfrom
claude/mutation-coverage
May 15, 2026
Merged

test: strengthen mutation coverage for github.ts and doctor.ts (#96, #98)#109
jmcte merged 1 commit into
mainfrom
claude/mutation-coverage

Conversation

@jmcte
Copy link
Copy Markdown
Contributor

@jmcte jmcte commented May 15, 2026

Closes #98, closes #96.

Summary

Strengthens Stryker mutation coverage for the two weakest configured targets by adding focused, fully-mocked behavioral tests (no live GitHub/Synology credentials, no network).

github.ts (#98) — 61.89% → 84.14% (covered 72.05% → 88.22%)

  • Header/URL construction: exact header object, bearer auth, empty-token handling, trailing-slash trimming.
  • Pagination boundaries: explicit "exactly 100 → fetch page 2", "short page → stop", page/per_page assertions across runners, group-runners, repositories, workflow runs, and jobs (incl. ?/& separator).
  • Malformed-payload validation: non-array payloads and invalid entries throw the exact documented messages; label filtering of non-strings; runner-group-id fallback.
  • Non-ok responses surface status + body; runner deletion 404→false vs other→throw.
  • Queued-job runner-group matching: group-name match/mismatch, label fallback only when group name absent, empty-label guard.
  • GHCR ref parsing/lookup: invalid ref, version pagination + URL-encoding, missing-tag (sorted) detail, not-found across both scopes, non-ok detail.
  • Token-fetch duration metric emitted with the supplied/unknown plane, including on request failure.

doctor.ts (#96) — 54.09% → 65.97% (covered 59.12% → 69.54%)

  • Exact summary/detail strings and singular/plural noun selection.
  • Missing-env detail, no-PAT skip details, runner-group/image verification failure surfaces.
  • Lume artifact handling (missing vs unhealthy), missing env-file warning, missing Windows host-field detail.
  • Pool-slot / doctor-check metric emission and log-level mapping.

Remaining survivors (documented, intentionally deferred)

Concentrated in the duplicated string-literal summaries of the parallel linux-docker doctor path (mirrors the now-locked-down synology path) and defensive type-guard internals in poolSlotMetricsForCheck. These are low-value formatting mutants. Both files remain well above the Stryker break threshold (50).

Test plan

  • pnpm test -- test/github.test.ts passes (53 tests)
  • pnpm test -- test/doctor.test.ts passes (15 tests)
  • pnpm test full suite green (45 files / 247 tests), pnpm lint clean (Node 24.14.1)
  • pnpm exec stryker run --mutate src/lib/github.ts → 84.14%
  • pnpm exec stryker run --mutate src/lib/doctor.ts → 65.97%

https://claude.ai/code/session_01QxQ71Yrf2Cn6zVfM4LY7AR


Generated by Claude Code

github.ts: add behavioral tests for header/URL construction,
pagination boundaries, malformed-payload validation, runner deletion
semantics, queued-job runner-group matching, GHCR parsing/lookup, and
token-fetch metric emission. Mutation score 61.89% -> 84.14%
(covered 72.05% -> 88.22%).

doctor.ts: add exact summary/detail/pluralization assertions, skip
and failure-surface checks, Lume artifact handling, missing
host-field detail, and pool-slot metric emission. Mutation score
54.09% -> 65.97% (covered 59.12% -> 69.54%).

Remaining survivors are concentrated in the duplicated string-literal
summaries of the parallel linux-docker doctor path and defensive
type-guard internals in poolSlotMetricsForCheck; these are low-value
formatting mutants and are intentionally deferred. Both files remain
well above the Stryker break threshold of 50.

Closes #96
Closes #98

https://claude.ai/code/session_01QxQ71Yrf2Cn6zVfM4LY7AR
@jmcte jmcte merged commit 922ab03 into main May 15, 2026
11 of 12 checks passed
@jmcte jmcte deleted the claude/mutation-coverage branch May 15, 2026 19:22
jmcte pushed a commit that referenced this pull request May 16, 2026
#108 merged main after #109 landed without the env-isolation fix, so
its doctor.test.ts missing-env/missing-host assertions failed on the
self-hosted runner (GITHUB_PAT is exported there). Wrap those cases in
withEnv to clear the relevant variables, matching the existing
missing-env test pattern. Mirrors PR #110.

https://claude.ai/code/session_01QxQ71Yrf2Cn6zVfM4LY7AR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve github.ts mutation coverage Improve doctor.ts mutation coverage

4 participants