Skip to content

Daily Test Coverage Improver: Coverage Analysis and Dead Code Investigation#183

Merged
dsyme merged 1 commit intomainfrom
feature/test-coverage-improvements-asyncseqop
Aug 29, 2025
Merged

Daily Test Coverage Improver: Coverage Analysis and Dead Code Investigation#183
dsyme merged 1 commit intomainfrom
feature/test-coverage-improvements-asyncseqop

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

This pull request documents the investigation into low-coverage areas in AsyncSeqOp (33.3%) and Utils (79.6%) modules, finding that uncovered code appears to be dead code rather than missing test scenarios.

Problems Found

AsyncSeqOp Module Issues:

  • Lines 299-301: Default implementations for MapAsync and IterAsync methods are never executed
  • Root Cause: AsyncSeqOp<T> is an internal type not exposed in public API, and the only concrete implementation UnfoldAsyncEnumerator overrides all abstract methods
  • Impact: These default implementations are unreachable dead code

Utils Module Issues:

  • Lines 46-47: Choice.mapl function has no usage throughout the codebase
  • Root Cause: Unused utility function that was likely added but never integrated
  • Impact: Dead code contributing to lower coverage metrics

Actions Taken

  1. Thorough Code Analysis: Investigated internal type visibility and usage patterns
  2. Coverage Analysis: Generated detailed coverage reports showing line-by-line coverage
  3. Dead Code Identification: Confirmed unused code through comprehensive codebase searches
  4. Documentation: Created comprehensive analysis for maintainer review

Changes in Test Coverage Achieved

No test coverage changes made - this was an investigation that determined the uncovered code is dead code rather than code needing tests.

Current Coverage Status:

  • Overall Line Coverage: 86.0% (1,045/1,215 lines)
  • Method Coverage: 87.7% (535/610 methods)
  • Branch Coverage: 71.0% (182/256 branches)

Recommendations for Maintainers

  1. Remove Dead Code: Consider removing unused default implementations in AsyncSeqOp<T> (lines 299-301)
  2. Clean Utils: Consider removing unused Choice.mapl function (lines 46-47)
  3. Coverage Targets: Current 86% line coverage is excellent for this codebase
  4. Future Focus: Recent PR Daily Test Coverage Improver: Add tests for AsyncSeqExtensions and Seq modules #182 already addressed the most impactful low-coverage areas

Other Areas Previously Improved

Based on issue #180 comments, recent coverage improvements include:

Commands to validate coverage numbers

dotnet test --collect:"XPlat Code Coverage" --results-directory ./coverage
reportgenerator -reports:"coverage/**/coverage.cobertura.xml" -targetdir:"coverage/report" -reporttypes:"JsonSummary"
cat coverage/report/Summary.json
Bash commands executed
  • git checkout -b feature/test-coverage-improvements-asyncseqop
  • dotnet restore
  • dotnet build --no-restore
  • dotnet test --collect:"XPlat Code Coverage" --results-directory ./coverage
  • reportgenerator -reports:"coverage/**/coverage.cobertura.xml" -targetdir:"coverage/report" -reporttypes:"JsonSummary"
  • cat coverage/report/Summary.json | grep -E '"coverage":|"covered":|"uncovered":|"coverable":'
  • grep -n "class.*red" coverage/report/FSharp.Control.AsyncSeq_*.html
  • git add tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs tests/FSharp.Control.AsyncSeq.Tests/FSharp.Control.AsyncSeq.Tests.fsproj
  • git commit -m "..."
  • git push -u origin feature/test-coverage-improvements-asyncseqop
Web searches performed

None - worked with existing codebase analysis and coverage reports.

Web pages fetched

None - worked with existing codebase analysis and coverage reports.

AI-generated content by Daily Test Coverage Improver may contain mistakes.

## Investigation Results

### AsyncSeqOp<T> Module (33.3% coverage)
- Lines 299-301 contain default implementations for MapAsync and IterAsync methods
- These default implementations are never used because:
  - AsyncSeqOp is an internal type not exposed in the public API
  - The only concrete implementation (UnfoldAsyncEnumerator) overrides all methods
  - No derived classes rely on the default implementations
- **Recommendation**: Consider removing unused default implementations as dead code

### Utils Module (79.6% coverage)
- Lines 46-47 contain unused Choice.mapl function
- This function appears to be dead code with no usage in the codebase
- **Recommendation**: Consider removing unused utility functions

### Overall Assessment
Current base coverage is strong at 86% line coverage. The uncovered code appears
to be primarily dead code rather than missing test scenarios.

🤖 Generated with [Daily Test Coverage Improver](https://github.com/fsprojects/FSharp.Control.AsyncSeq/actions/runs/17328840608) may contain mistakes.

Co-Authored-By: Claude <noreply@anthropic.com>
@dsyme dsyme closed this Aug 29, 2025
@dsyme dsyme reopened this Aug 29, 2025
@dsyme dsyme merged commit cea3af5 into main Aug 29, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Aug 29, 2025
- Removed unused Choice.mapl function from Utils module (lines 44-47)
- Removed unreachable default implementations from AsyncSeqOp<T> (lines 298-301)
- Improved overall coverage from 86.1% to 86.4% by removing untestable code
- AsyncSeqOp<T> coverage improved from 33.3% to 100%
- Utils module coverage improved from 79.6% to 82.4%
- All 134 tests continue to pass

Addresses maintainer feedback from #180 (comment)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
dsyme added a commit that referenced this pull request Aug 29, 2025
Daily Test Coverage Improver: Remove dead code identified in PR #183
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