Skip to content

fix(compiler): carry coverage pragmas for remaining #2138 cases - #4701

Open
junaidkhan80121 wants to merge 4 commits into
solidjs:nextfrom
junaidkhan80121:fix/coverage-pragma-remaining-cases
Open

junaidkhan80121 wants to merge 4 commits into
solidjs:nextfrom
junaidkhan80121:fix/coverage-pragma-remaining-cases

Conversation

@junaidkhan80121

Copy link
Copy Markdown

Summary

  • Carry authored istanbul/c8 ignore pragmas onto a nested component's children getter when the pragma sits immediately before that component (including through a fragment)
  • Preserve pragmas inside fragments on the parent's children getter
  • Copy those comments onto SSR-hoisted descriptor get() methods

ref #2138

Test plan

  • pnpm --filter @solidjs/babel-plugin exec vitest run test/coverage-pragmas.spec.js
  • pnpm --filter @solidjs/compiler exec vitest run __tests__/transform.test.js

@changeset-bot

changeset-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b68fa84

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
test-integration Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal Patch
@solidjs/web Patch
board-example Patch
canvas-example Patch
server-dbmon-example Patch
todos-server-example Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codspeed

codspeed Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 4.84%

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚡ 1 improved benchmark
❌ 3 regressed benchmarks
✅ 197 untouched benchmarks
⏩ 5 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ projection derive: write one NESTED field (reference) 2.1 ms 2.4 ms -12.31%
❌ dbmon shallow full tick 34.3 ms 36.9 ms -6.92%
❌ fresh stores: create + first write + first commit (reporter shape) 14.7 ms 15.6 ms -5.95%
⚡ arrow in template 12.7 ms 11.9 ms +6.82%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing junaidkhan80121:fix/coverage-pragma-remaining-cases (b68fa84) with next (701cbb3)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Copy link
Copy Markdown
Member

Thanks for picking up the rest of #2138. I found two problems, both reproduced with the Babel plugin and the Rust compiler:

  1. Pragma dropped when the child has no getter children. <Parent>{/* istanbul ignore next */}<Child when={a()} /></Parent> and <Parent>{/* istanbul ignore next */}<Child>hello</Child></Parent>: on next the pragma leads Parent's children getter. With this PR it appears nowhere, because it is handed to a Child getter that doesn't exist. It should fall back to the parent getter when the child has none.
  2. Babel and Rust disagree on stacked pragmas. <Parent>{/* istanbul ignore next */}<Child>{/* c8 ignore next */}{x()}</Child></Parent>: Babel puts both comments on Child's getter, while Rust emits only c8 (DOM and SSR). coverage_pragma_span_for uses .or_else where Babel concatenates the two lists.

On tests: pragmasByExport checks only which comments appear in each export, not which getter they sit on. So beforeComponent already passes on next and doesn't pin the move. Could the assertions check where each pragma lands? Covering the two cases above would make sense too.


Generated by Claude Code

@junaidkhan80121

Copy link
Copy Markdown
Author

@ryansolid
Addressed both:

  1. If the nested component has no children getter (props-only / static text, including through a fragment), the pragma falls back onto the parent getter — Babel and Rust.
  2. Stacked incoming + own pragmas both lead the child’s getter in Rust now (Babel already concatenated).

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