Conversation
…'s dependencies properly detect implicit provides to skip adding required fields
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughRefactors provided-field tracking from slice structs to keyed maps, adds a visitor to check that Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
…en-all-fields-provided
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@v2/pkg/engine/plan/required_fields_provided_visitor_test.go`:
- Around line 160-161: areRequiredFieldsProvided returns two values (bool,
*operationreport.Report) but the test only captures one; update the test to
receive both returns from areRequiredFieldsProvided (e.g., result, report :=
areRequiredFieldsProvided(input)), then use result in the existing assert and,
if relevant, assert on report (or explicitly ignore it) so the compilation error
is resolved; refer to areRequiredFieldsProvided and the local variables result
and report in your change.
🧹 Nitpick comments (3)
v2/pkg/engine/plan/provides_fields_visitor_test.go (1)
89-94: Note:metavariable is unused in the test.The
DataSourceMetadatais initialized at lines 63-88 but never used in the test. This appears to be leftover from the previous implementation.♻️ Proposed cleanup
for _, c := range cases { t.Run(keySDL, func(t *testing.T) { - report := &operationreport.Report{} - - meta := &DataSourceMetadata{ - RootNodes: []TypeField{ - { - TypeName: "Query", - FieldNames: []string{"me"}, - }, - { - TypeName: "User", - FieldNames: []string{"address"}, - ExternalFieldNames: []string{"name", "info"}, - }, - - { - TypeName: "Address", - ExternalFieldNames: []string{"street", "zip"}, - }, - }, - ChildNodes: []TypeField{ - { - TypeName: "Info", - ExternalFieldNames: []string{"age"}, - }, - }, - } - meta.InitNodesIndex() - input := &providesInput{v2/pkg/engine/datasource/graphql_datasource/graphql_datasource_federation_provides_test.go (2)
230-299: Consider removing or documenting the commented-out code more explicitly.The commented-out block showing the "nested fetch" variant is valuable documentation of what the plan would look like without the fix. However, for long-term maintainability, consider either:
- Converting this to a proper doc comment explaining the expected behavior difference
- Creating a separate test case that explicitly demonstrates when a nested fetch should occur (e.g., when fields are NOT provided)
This would make the test suite more self-documenting and prevent confusion about whether this code was accidentally commented out.
191-201: Consider disabling debug printing for committed tests.The debug configuration enables
PrintQueryPlansandPrintPlanningPaths, which can produce verbose output during test runs. Unless this is intentionally kept for debugging federation issues in CI, consider disabling these flags for cleaner test output.🔧 Suggested change
planConfiguration := plan.Configuration{ DisableResolveFieldPositions: true, - Debug: plan.DebugConfiguration{ - PrintQueryPlans: true, - PrintPlanningPaths: true, - }, + Debug: plan.DebugConfiguration{}, DataSources: []plan.DataSource{ service1DataSourceConfig, service2DataSourceConfig, }, }
🤖 I have created a release *beep* *boop* --- ## [2.0.0-rc.248](v2.0.0-rc.247...v2.0.0-rc.248) (2026-02-11) ### Bug Fixes * requires is not ignored when all fields provided ([#1380](#1380)) ([31d9d45](31d9d45)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed an issue where the "requires" field was incorrectly ignored when all fields were provided. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Tests
Improvements
Refactor
Checklist