Skip to content

ci: scope the coverage report to Source/MLX* and add per-target rows - #35

Merged
Gajesh2007 merged 2 commits into
mainfrom
ci/coverage-scope
Oct 2, 2026
Merged

Gajesh2007 merged 2 commits into
mainfrom
ci/coverage-scope

Conversation

@davidtai

@davidtai davidtai commented Sep 29, 2026 •

Copy link
Copy Markdown

Proposed changes

The coverage step of Fork Tests now says what its number measures. The ruling (David Tai, 2026-09-27 and 2026-09-29): the target is 80% line coverage, reported and never enforced, measured on host code only.

  • The job summary shows one table: Component, Lines, Regions, Functions, Target. One row covers all of Source/MLX*. One row each covers Source/MLX, Source/MLXNN and Source/MLXOptimizers, the targets that the test bundle links. The step runs llvm-cov report once for each row, with the directories as source paths.
  • Text under the table says what is in the denominator and what is left out and why: Tests/ and .build/; the Cmlx C and C++ core, which SwiftPM compiles without instrumentation; MLXFast, MLXFFT, MLXLinalg and MLXRandom, which the test bundle does not link (they are deprecated shims that forward to APIs in Source/MLX, and those APIs are measured in the Source/MLX row); Metal shader code, which no coverage tool can instrument. It says that Regions is the proxy for branch coverage because Swift emits no branch counters, and that the target is reported only.
  • The step reads each value from the TOTAL row by its column name in the header row, not by field position. The step fails when a value is missing, or when a directory does not exist (llvm-cov otherwise ignores the path and reports every file).

Nothing else in the job changes. .github/** is in the fork.yaml ignore list.

Checklist

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes (not applicable: only a workflow file changes; actionlint passes on it)
  • I have added tests that prove my fix is effective or that my feature works (not applicable: CI change; the Fork Tests run of this PR is the test)
  • I have updated the necessary documentation (if needed) (not applicable: the job summary text is the documentation; fork.yaml ignores .github/**)

Test plan

Job summary of that run, as the step wrote it (values checked against the TOTAL rows in the step log):

Line coverage

Component Lines Regions Functions Target
All of Source/MLX* 64.97% 62.35% 61.59% 80%
Source/MLX 65.45% 61.61% 59.91% 80%
Source/MLXNN 61.45% 62.06% 63.69% 80%
Source/MLXOptimizers 85.82% 82.54% 81.52% 80%

The denominator is the host Swift code under Source/MLX* that the test binary links: 14552 lines. It leaves out Tests/ and the dependencies in .build/.
SwiftPM compiles the Cmlx C and C++ core without instrumentation, so it is not measured. The test bundle does not link MLXFast, MLXFFT, MLXLinalg and MLXRandom. These are deprecated shims that forward to APIs in Source/MLX (MLXFast.swift, FFT.swift, Linalg.swift, Random.swift), and those APIs are measured in the Source/MLX row. Metal shader code is outside every coverage tool.
Swift emits no branch counters, so the Regions column is the proxy for branch coverage. The 80% target is reported only. The job does not fail below it.

Dependencies

None.

Authorship

Written by Claude (Opus 5.5) under David Tai's direction.

🤖 Generated with Claude Code

davidtai and others added 2 commits September 29, 2026 09:06
The job summary now shows one table with Lines, Regions and Functions for
all of Source/MLX* and for MLX, MLXNN and MLXOptimizers, each against the
80% target. The target is reported only. The text under the table names
what is not measured: the Cmlx core and the targets that the test bundle
does not link.

The step reads each value from the TOTAL row by its column name and fails
when a value is missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MLXFast, MLXFFT, MLXLinalg and MLXRandom are deprecated shims that forward
to APIs in Source/MLX. Those APIs are counted in the Source/MLX row, so the
text no longer reads as if FFT, linalg and random were unmeasured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Gajesh2007 Gajesh2007 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed head 8f208b4 against current main 2e765d9. Diff is restricted to the coverage-report step; the 80% target remains reporting-only, missing paths/values fail explicitly, and existing build/test gates are preserved. All current checks pass.

@Gajesh2007
Gajesh2007 merged commit dfea028 into main Oct 2, 2026
8 checks passed
@davidtai
davidtai deleted the ci/coverage-scope branch October 4, 2026 21:58
jonathan308 added a commit that referenced this pull request Oct 27, 2026
Source/Cmlx/mlx -> 424562b9 (core #35 with main 6bc9de5b merged); mlx-c stays 73720efb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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