Skip to content

fix: check join type when reusing joins in ConstraintTransformerJpaImpl#112

Open
javier-godoy wants to merge 1 commit intomasterfrom
fix-111
Open

fix: check join type when reusing joins in ConstraintTransformerJpaImpl#112
javier-godoy wants to merge 1 commit intomasterfrom
fix-111

Conversation

@javier-godoy
Copy link
Member

@javier-godoy javier-godoy commented Mar 20, 2026

Close #111

Summary by CodeRabbit

  • Bug Fixes

    • Improved join detection logic in persistence queries to ensure joins are correctly matched and reused based on both attribute matching and join type compatibility.
  • Tests

    • Added test coverage for complex filter scenarios involving null constraints combined with logical operators.

@javier-godoy javier-godoy requested a review from mlopezFC March 20, 2026 14:59
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

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: ee6e6d31-8bc3-4f5e-8eaa-e531fa3dfd61

📥 Commits

Reviewing files that changed from the base of the PR and between fa635b5 and 8b83816.

📒 Files selected for processing (2)
  • backend-core-data-impl/src/main/java/com/flowingcode/backendcore/dao/jpa/ConstraintTransformerJpaImpl.java
  • backend-core-data-impl/src/test/java/com/flowingcode/backendcore/dao/jpa/JpaDaoSupportTest.java

Walkthrough

This PR refines join reuse detection in ConstraintTransformerJpaImpl by adding an explicit join-type check. When reusing existing joins by attribute name, the code now verifies the join type matches currentJoinType. A test case validates that IS NULL constraints correctly exclude rows with absent associations when preceded by disjunction constraints on the same path.

Changes

Cohort / File(s) Summary
Join Type Matching
backend-core-data-impl/src/main/java/com/flowingcode/backendcore/dao/jpa/ConstraintTransformerJpaImpl.java
Updated join() helper to filter existing joins by both attribute name and join type, ensuring joins are only reused when types match. Prevents incorrect reuse of LEFT JOINs when INNER JOINs are needed.
IS NULL Constraint Test
backend-core-data-impl/src/test/java/com/flowingcode/backendcore/dao/jpa/JpaDaoSupportTest.java
Added testIsNullConstraintAfterOrDoesNotMatchAbsentCity() to verify IS NULL constraints correctly exclude rows with absent associations after disjunction branches.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • mlopezFC
🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: fixing join type checking when reusing joins in ConstraintTransformerJpaImpl.
Linked Issues check ✅ Passed The pull request directly addresses issue #111 by implementing the proposed fix: checking join type when reusing joins to prevent IS NULL constraints from incorrectly matching absent associations.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the join type reuse issue and adding a test case that validates the fix for issue #111; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-111
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes with custom instructions.

Set the reviews.auto_title_instructions setting to generate a title for your PR based on the changes in the PR with custom instructions.

@sonarqubecloud
Copy link

@javier-godoy javier-godoy marked this pull request as ready for review March 20, 2026 19:06
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.

IS NULL constraint incorrectly matches rows with absent association when preceded by a DisjunctionConstraint on the same path

1 participant