Skip to content

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

Merged
mtrezza merged 2 commits into
parse-community:alphafrom
dblythy:fix/coverage-parsers-dual-instrumentation
Jul 24, 2026
Merged

refactor: Correct under-reported code coverage for Options/parsers#10559
mtrezza merged 2 commits 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 while keeping default-value parsing behavior unchanged.

@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 Plus

Run ID: 3f39bf27-ff96-4080-90f1-f729ed4df6bd

📥 Commits

Reviewing files that changed from the base of the PR and between 720da56 and 8c889c3.

📒 Files selected for processing (1)
  • resources/buildConfigDefinitions.js
🚧 Files skipped from review as they are similar to previous changes (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


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 warning, 1 inconclusive)

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.
Engage In Review Feedback ❓ Inconclusive No review-feedback thread is present here; only the fix commit and a review request are visible, so engagement can't be verified. Provide the PR review thread or timeline showing the author replied and either committed a fix or convinced the reviewer to retract the feedback.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required refactor: prefix and accurately summarizes the coverage-related refactor.
Description check ✅ Passed The description includes Issue, Approach, and Tasks, but it omits the template's opening Pull Request notice.
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 No new security-risky pattern found; the lazy require is internal-only, and touched runtime code hardens GraphQL error leakage and trigger context handling.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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 93.78%. Comparing base (5838c07) to head (8c889c3).
⚠️ Report is 1 commits behind head on alpha.

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha   #10559      +/-   ##
==========================================
+ Coverage   93.55%   93.78%   +0.23%     
==========================================
  Files         192      192              
  Lines       16832    16832              
  Branches      248      248              
==========================================
+ Hits        15747    15786      +39     
+ Misses       1064     1025      -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
@mtrezza
mtrezza merged commit 81bdeb8 into parse-community:alpha Jul 24, 2026
22 of 25 checks passed
@dblythy
dblythy deleted the fix/coverage-parsers-dual-instrumentation branch July 24, 2026 13:54
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 9.10.1-alpha.4

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants