Skip to content

test: close critical test coverage gaps (+72 tests)#86

Merged
pasrom merged 15 commits intomainfrom
test/coverage-gaps
Apr 4, 2026
Merged

test: close critical test coverage gaps (+72 tests)#86
pasrom merged 15 commits intomainfrom
test/coverage-gaps

Conversation

@pasrom
Copy link
Copy Markdown
Owner

@pasrom pasrom commented Apr 4, 2026

Summary

  • Add 80+ new tests closing critical coverage gaps identified by systematic codebase analysis
  • App tests: 828 → 877, AudioTapLib tests: 23 → 26, total: 851 → 903
  • Make OpenAIProtocolGenerator testable via injectable URLSession + MockURLProtocol
  • Extract FluidDiarizer.normalizeSpeakerId and buildResult from private to internal for testability
  • Overall line coverage: 66.1% → estimated ~70%

Changes

BadgeKind.compute() — 21 exhaustive tests covering all state combinations (watchLoop priority, transcriberState branches, activeJobState dispatch, updateAvailable fallback)

mergeConsecutiveSpeakers() — boundary tests for gap threshold, overlapping segments, rapid speaker alternation

AudioTapLib Helpers — new test file for machTicksToSeconds (zero, positive, monotonicity) and speechSampleRate constant

VadSegmentMap — boundary conditions: past-end mapping, empty segments, segment clamping, remap with speaker/text preservation

AppPaths.migrateIfNeeded() — idempotency tests (no crash on repeated calls)

AudioMixer delay alignment — positive, negative, and zero micDelay via shared mixWithDelay() helper

DualSourceRecorder — RecorderError descriptions, multiple tmp file cleanup, empty directory cleanup, 4-channel downmix

FluidDiarizer — expose normalizeSpeakerId/buildResult as internal, test normalization patterns, result sorting, speaking times, empty segments

Workflow integration — app-only and mic-only fallback paths (single-source pipeline)

WatchLoop — manual recording enqueue and double-start guard

PipelineQueue — completedJobs filter, cancel/update with nonexistent ID, error state transition, corrupt snapshot resilience

OpenAIProtocolGenerator — injectable URLSession, MockURLProtocol-based tests for SSE streaming, auth headers, HTTP errors, empty response, testConnection() success/error

AudioCaptureResult — field initialization and nil mic URL tests

SpeakerMatcher — corrupt DB resilience, empty file, missing embeddings, three-speakers-two-stored matching, greedy assignment determinism

Test plan

  • swift test in app/MeetingTranscriber — 877 tests, 0 unexpected failures
  • swift test in tools/audiotap — 26 tests, 0 failures
  • ./scripts/lint.sh — 0 violations

@github-actions github-actions bot added the chore Maintenance or non-functional changes label Apr 4, 2026
pasrom added 14 commits April 4, 2026 22:22
Cover all state combinations: watchLoop recording priority,
transcriberState branches, activeJobState dispatch, updateAvailable
fallback, and priority ordering between tiers.
Test gap just over threshold, overlapping segments, rapid speaker
alternation, and threshold constant value assertion.
New test file for Helpers.swift pure functions: zero ticks, positive
range, monotonicity, and constant value verification.
VadSegmentMap: past-end mapping, empty segments, segment clamping,
remap with speaker/text preservation. NotificationContent: cover
recordingDone state.
Test mix() with positive, negative, and zero micDelay using shared
mixWithDelay() helper for DRY temp file management.
RecorderError description assertions, multiple tmp file cleanup,
empty directory cleanup, and 4-channel downmix edge case.
…Result

Change visibility from private to internal for @testable access.
Test normalization patterns, result sorting, speaking time computation,
empty segments, and nil embeddings.
Verify pipeline completes when one audio source is missing,
exercising single-source fallback paths.
Verify stopManualRecording enqueues a PipelineJob and second
startManualRecording is no-op while already recording.
Cover completedJobs filter, cancel/update with nonexistent ID,
error state transition, and corrupt snapshot resilience.
Cover emptyProtocol, httpError, connectionFailed error descriptions,
multi-line SSE content joining, and language substitution.
Verify all fields stored correctly, nil mic URL handling, and
mono channel count.
Cover corrupt JSON resilience, empty file handling, missing embedding
no-op, three-speakers-two-stored matching, and greedy assignment
determinism by sorted key.
@pasrom pasrom force-pushed the test/coverage-gaps branch from e660f41 to f0a38d5 Compare April 4, 2026 20:24
…) tests

Make URLSession injectable (default .shared) for mock-based testing.
Cover: successful SSE streaming, auth header presence/absence,
diarized mode, HTTP 503 error, empty response, testConnection success,
testConnection HTTP error, and invalid endpoint.
@pasrom pasrom force-pushed the test/coverage-gaps branch from 9e78425 to 46fd783 Compare April 4, 2026 20:41
@pasrom pasrom merged commit e1a8b50 into main Apr 4, 2026
7 checks passed
@pasrom pasrom deleted the test/coverage-gaps branch April 4, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance or non-functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant