Skip to content

refactor: Correct under-reported code coverage for Options/parsers#10559

Open
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/coverage-parsers-dual-instrumentation
Open

refactor: Correct under-reported code coverage for Options/parsers#10559
dblythy wants to merge 1 commit into
parse-community:alphafrom
dblythy:fix/coverage-parsers-dual-instrumentation

Conversation

@dblythy

@dblythy dblythy commented Jul 5, 2026

Copy link
Copy Markdown
Member

Issue

src/Options/parsers.js reports ~2.5% coverage on Codecov even though spec/parsers.spec.js fully covers it.

Approach

Turns out it's a coverage measurement artifact, not missing tests. resources/buildConfigDefinitions.js imported parsers from ../src/Options/parsers at module scope. When the spec loads that tooling, nyc instruments the real src/ file a second time (only the top level runs, the parser functions are never called on that path), and that collides with the sourcemap-remapped lib/ coverage coming from parsers.spec.js, clobbering it down to ~2.5%.

mapperFor (the only thing the spec imports) doesn't use parsers anyway - only parseDefaultValue does. Moving the require in there drops the module-scope src instrumentation, so the file reports its true 100% and the generator still works.

Verified by loading parsers.spec.js + buildConfigDefinitions.spec.js together: 40/40 lines with the change, 1/40 without.

Tasks

  • Tests already exist (spec/parsers.spec.js)

Summary by CodeRabbit

  • Bug Fixes
    • Improved test instrumentation reliability without changing default-value parsing behavior.

@parse-github-assistant

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f08c1c63-aabd-44fb-ab36-b9be0ed968cf

📥 Commits

Reviewing files that changed from the base of the PR and between 7e9d53a and 720da56.

📒 Files selected for processing (1)
  • resources/buildConfigDefinitions.js

📝 Walkthrough

Walkthrough

buildConfigDefinitions.js now loads the options parsers lazily inside parseDefaultValue, avoiding module-load-time instrumentation while preserving existing parsing behavior.

Changes

Config parser loading

Layer / File(s) Summary
Lazy default-value parsing
resources/buildConfigDefinitions.js
Moves the parsers import from module scope into parseDefaultValue and adds an Istanbul ignore directive.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: moumouls, mtrezza

🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title uses an allowed prefix and clearly describes the parser-loading refactor.
Description check ✅ Passed The description includes the required Issue, Approach, and Tasks sections and is mostly complete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed Changed code only defers a static require in a build script; no tainted input, eval, path handling, or other advisory-class pattern appears.
Engage In Review Feedback ✅ Passed The PR addresses the review concern via a follow-up code change, and the summary shows the author requested CodeRabbit review—no sign of ignored feedback.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.89%. Comparing base (cce91e5) to head (720da56).
⚠️ Report is 38 commits behind head on alpha.

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha   #10559      +/-   ##
==========================================
+ Coverage   92.66%   92.89%   +0.22%     
==========================================
  Files         193      193              
  Lines       16981    16980       -1     
  Branches      248      248              
==========================================
+ Hits        15736    15774      +38     
+ Misses       1224     1185      -39     
  Partials       21       21              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

buildConfigDefinitions imported parsers from ../src/Options/parsers at
module scope. Loading it in a spec instruments the real src file a
second time (top level only), colliding with the sourcemap-remapped lib
coverage from parsers.spec.js and clobbering it down to ~2.5%. Move the
require into parseDefaultValue, its only consumer, so the module reports
its true 100%.
@dblythy
dblythy force-pushed the fix/coverage-parsers-dual-instrumentation branch from d114402 to 720da56 Compare July 5, 2026 12:32
@dblythy
dblythy requested review from a team and Moumouls July 20, 2026 09:53
@mtrezza

mtrezza commented Jul 20, 2026

Copy link
Copy Markdown
Member

@dblythy Please let CR review first before requesting a human review, thanks.

@mtrezza
mtrezza removed the request for review from a team July 20, 2026 10:51
@dblythy

dblythy commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dblythy
dblythy requested a review from a team July 20, 2026 10:58
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