Skip to content

test: cover response-less PapyrusError branch in health checks#285

Merged
GeneralD merged 1 commit into
mainfrom
test/coverage-healthcheck-noresponse
Jun 14, 2026
Merged

test: cover response-less PapyrusError branch in health checks#285
GeneralD merged 1 commit into
mainfrom
test/coverage-healthcheck-noresponse

Conversation

@GeneralD

Copy link
Copy Markdown
Owner

type breaking scope diff files tests review

カバレッジ調査の一環で見つけた、未カバーかつクリーンに埋められる分岐を補う test-only PR。

背景

MusicBrainzHealthCheck.healthCheck() / LRCLibHealthCheck.healthCheck() は、response を持たない PapyrusError(HTTP レスポンス到達前の接続レベル失敗)を HealthCheckResult(.fail, detail: error.message) にマッピングする。既存テストは .pass / HTTP コード / HTTP -1 / 汎用 Error を網羅していたが、response なしの PapyrusError だけ抜けており、この分岐(各ファイル46行目)が未カバーだった。

変更

  • 両 suite に「response なし PapyrusErrorerror.message」ケースを追加
  • region coverage: 各ファイル 75.00% → 87.50%(missed regions 4 → 2)

残る2 region は live な init()URLSession クロージャ(実ネットワーク呼び出し)で、unit test では構造的にカバー不能。

調査メモ(カバレッジ全体)

ignore 対象(Domain/**DependencyInjection/**)を除いた全体は line 96.4% / region 91.1% で既に高い。残るギャップの大半は OS 依存で unit test 困難:

領域 未カバー理由
Views/Overlay/AppWindow.swift NSWindow / AVPlayerLayer の reconciliation(host-visual lane)
Views/Shared/DisplayLinkDriver.swift CVDisplayLink
health check の live init() 実ネットワーク呼び出し
WallpaperDataSource/FindExecutable.swiftwhich fallback Process spawn・PATH 依存(flaky)

→ この PR の health-check 分岐が、構造的でなく素直に埋められる数少ないケースだったため対応。

テスト

swift test 全 939 件 green(+2)。

バージョン

2.13.192.13.20(patch / test)

…ealth checks

`healthCheck()` maps a `PapyrusError` with no `response` to
`HealthCheckResult(.fail, detail: error.message)` (the connection-level
failure path, before any HTTP response). Existing tests covered `.pass`,
HTTP-code, HTTP-(-1), and generic `Error`, but never a response-less
`PapyrusError`, leaving that branch (line 46) uncovered.

Add the missing case to both suites — region coverage 75.00% -> 87.50%
on each file. The remaining gap is the live `init()` URLSession closure,
which is a real network call and structurally uncoverable in unit tests.
Copilot AI review requested due to automatic review settings June 14, 2026 13:41
@GeneralD GeneralD self-assigned this Jun 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@GeneralD, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 19 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bc7da16e-b861-4413-9eae-e0d61eeb9d2a

📥 Commits

Reviewing files that changed from the base of the PR and between c455ac4 and b84d524.

📒 Files selected for processing (3)
  • Sources/VersionHandler/Resources/version.txt
  • Tests/LyricsDataSourceTests/LRCLibHealthCheckTests.swift
  • Tests/MetadataDataSourceTests/MusicBrainzHealthCheckTests.swift
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/coverage-healthcheck-noresponse

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@GeneralD GeneralD merged commit c7a0d04 into main Jun 14, 2026
4 checks passed
@GeneralD GeneralD deleted the test/coverage-healthcheck-noresponse branch June 14, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants