Skip to content

chore(grails-data-graphql): root-level cleanup (GraphQLEntityHelper, GraphQLServiceManager, Schema) - #16207

Open
borinquenkid wants to merge 3 commits into
test/grails-data-graphql-coveragefrom
chore/graphql-root-cleanup
Open

chore(grails-data-graphql): root-level cleanup (GraphQLEntityHelper, GraphQLServiceManager, Schema)#16207
borinquenkid wants to merge 3 commits into
test/grails-data-graphql-coveragefrom
chore/graphql-root-cleanup

Conversation

@borinquenkid

Copy link
Copy Markdown
Member

Summary

Stacked on #16201. Three small root-package fixes:

  • GraphQLEntityHelper#getMapping: consolidated a four-branch reassignment of mapping into single-return helper methods (findGraphqlProperty, toGraphQLMapping, buildMapping), fixing a false "assignment is not used" flag. Added direct unit coverage (previously only exercised indirectly via getDescription).
  • GraphQLServiceManager#getService: removed a redundant public modifier (Groovy methods are public by default).
  • Schema#generate(): made the implicit null return explicit when no entity contributes any query fields, satisfying "not all execution paths return a value" with no behavior change (already covered by DisableAllOpSpec).

Test plan

  • ./gradlew :grails-data-graphql-core:test :grails-data-graphql:test :grails-data-graphql-core:codeStyle :grails-data-graphql:codeStyle passes

🤖 Generated with Claude Code

borinquenkid and others added 3 commits August 23, 2026 10:27
mapping was declared null then conditionally reassigned across four
if/else-if branches before being read - the same shape flagged
elsewhere in this cleanup as a false "assignment is not used" warning
once IntelliJ's flow analysis loses track of a variable reassigned
across many branches. Extracted the reflection lookup
(findGraphqlProperty), the graphql-value-to-GraphQLMapping conversion
(toGraphQLMapping, with each branch returning directly), and the
overall build/verify sequence (buildMapping) into their own methods,
so getMapping itself is now a single containsKey-check plus a
single build+cache assignment.

Added direct unit coverage for getMapping via a Stub(PersistentEntity)
(no static graphql property, a Boolean true, an unsupported property
type that should throw IllegalMappingException, and cache identity
across repeated calls) - previously it was only exercised indirectly
through getDescription and other specs' Closure-based mappings.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Groovy methods are public by default; the explicit modifier was
redundant.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
When no entity contributes any query fields, the method fell off the
end without a return statement instead of explicitly returning null.
Behavior is unchanged (Groovy allows the implicit null under
CompileStatic), but the fall-through was ambiguous to both the reader
and the compiler's control-flow analysis. Already covered by
DisableAllOpSpec, which asserts generate() returns null when every
entity's operations are disabled.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 23, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (test/grails-data-graphql-coverage@36b7716). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@                          Coverage Diff                           @@
##             test/grails-data-graphql-coverage     #16207   +/-   ##
======================================================================
  Coverage                                     ?   53.4210%           
  Complexity                                   ?      19464           
======================================================================
  Files                                        ?       2081           
  Lines                                        ?      98993           
  Branches                                     ?      17361           
======================================================================
  Hits                                         ?      52883           
  Misses                                       ?      38561           
  Partials                                     ?       7549           
🚀 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.

@testlens-app

testlens-app Bot commented Aug 23, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: cc285e7
▶️ Tests: 47666 executed
⚪️ Checks: 70/70 completed


Learn more about TestLens at testlens.app/docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants