fix(router): incorrect alias behavior for required fields#3101
Conversation
❌ Internal Query Planner CI checks failedThe Internal Query Planner CI checks failed in the celestial repository, and this is going to stop the merge of this PR. |
WalkthroughThe router and router-tests modules update Changes
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3101 +/- ##
==========================================
+ Coverage 61.83% 62.02% +0.19%
==========================================
Files 262 262
Lines 30810 30810
==========================================
+ Hits 19050 19111 +61
+ Misses 10232 10187 -45
+ Partials 1528 1512 -16 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@router-tests/protocol/grpc_subgraph_test.go`:
- Around line 415-419: Add a test case in the existing employee query coverage
using the aliased field `aliasedReviewReport: reviewReport`, and assert its
expected non-null value to exercise alias resolution. Retain the current
non-existent employee null-propagation case only if it is still required by the
test contract.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f34580ef-0c6b-4740-b80c-93dfc71feace
⛔ Files ignored due to path filters (2)
router-tests/go.sumis excluded by!**/*.sumrouter/go.sumis excluded by!**/*.sum
📒 Files selected for processing (3)
router-tests/go.modrouter-tests/protocol/grpc_subgraph_test.gorouter/go.mod
| { | ||
| name: "query non-existent employee with @requires and aliased fields returns null", | ||
| query: `{ employee(id: 999) { id workItemInfo reviewReport aliasedReviewReport: reviewReport } }`, | ||
| expected: `{"data":{"employee":null}}`, | ||
| }, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the file structure first, then inspect the relevant slice.
git ls-files 'router-tests/protocol/*' | sed -n '1,120p'
echo '--- outline ---'
ast-grep outline router-tests/protocol/grpc_subgraph_test.go --view expanded || true
echo '--- lines 360-470 ---'
sed -n '360,470p' router-tests/protocol/grpc_subgraph_test.go
echo '--- search for employee/reviewReport/aliasedReviewReport ---'
rg -n "reviewReport|aliasedReviewReport|`@requires`|employee\\(" router-tests/protocol/grpc_subgraph_test.goRepository: wundergraph/cosmo
Length of output: 18542
Add an aliased reviewReport case on an existing employee.
This null-only query doesn’t exercise alias resolution, so it can still pass if aliasedReviewReport is broken. Add a case with an existing employee and assert the aliased field value; keep the null-propagation case only if that behavior is required.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@router-tests/protocol/grpc_subgraph_test.go` around lines 415 - 419, Add a
test case in the existing employee query coverage using the aliased field
`aliasedReviewReport: reviewReport`, and assert its expected non-null value to
exercise alias resolution. Retain the current non-existent employee
null-propagation case only if it is still required by the test contract.
Summary by CodeRabbit
@requires.@requiresfields.Checklist
Open Source AI Manifesto
This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.