Skip to content

chore: mark unsupported code paths with coverage:ignore#327

Open
AquibAquil wants to merge 3 commits into
google:masterfrom
AquibAquil:coverage-ignore-comments
Open

chore: mark unsupported code paths with coverage:ignore#327
AquibAquil wants to merge 3 commits into
google:masterfrom
AquibAquil:coverage-ignore-comments

Conversation

@AquibAquil

@AquibAquil AquibAquil commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Addresses part of #263.

What

Adds // coverage:ignore-* markers to code paths documented in-source as intentionally unsupported or unreachable:

Whole-file ignores — lib/src/impl_stub/ (14 files)

Marked with // coverage:ignore-file. This directory is loaded only via conditional import when neither dart.library.ffi nor dart.library.js_interop is available (see lib/src/webcrypto/webcrypto.dart:27). No real Dart runtime satisfies that condition, so every throw UnimplementedError('Not implemented') in the directory is unreachable at runtime by design.

Block ignores — 4 files in impl_ffi/, impl_js/, and boringssl/

Wrapped with // coverage:ignore-start / // coverage:ignore-end:

  • Three throw UnsupportedError('192-bit AES keys are not supported') sites in lib/src/impl_ffi/impl_ffi.aes_common.dart (documented in-source as intentionally unsupported, see https://crbug.com/533699).
  • The unsupported-platform fallback throw in lib/src/boringssl/lookup/utils.dart (fires only on operating systems outside {Windows, Linux, macOS}).
  • Five "This should never happen!" curve fallbacks in lib/src/impl_ffi/impl_ffi.ec_common.dart (×3), lib/src/impl_ffi/impl_ffi.ecdsa.dart, and lib/src/impl_js/impl_js.utils.dart — dead-code fallbacks after exhaustive enum switches.

Why

Per #263, these are candidates where "we don't want coverage" — code paths intentionally chosen not to test rather than defensively cover.

Skipped intentionally

  • requireSubtleCrypto (lib/src/crypto_subtle.dart:82) — the example cited in the issue. Now has tests at test/crypto_subtle_test.dart:128 and :141, so ignore markers would silence real coverage. Left alone.
  • throw UnimplementedError('Only supports 65537 and 3 for now') (lib/src/crypto_subtle.dart:44) — genuine TODO for future work, not an intentional gap. Left visible.

Verification

  • dart format --output none --set-exit-if-changed . passes.
  • dart analyze --fatal-warnings . passes.
  • Grep confirms no existing tests exercise the ignored throws (except requireSubtleCrypto, which is why it's excluded).
  • Local test run was not possible on Windows: the native asset build fails with CMake Error at CMakeLists.txt:19 (project): Generator Ninja does not support platform specification, but platform x64 was specified. Working around it locally was out of scope for this change; relying on CI to validate.

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.

1 participant