Skip to content

chore: add tests for enums for required fields#1439

Merged
Noroth merged 1 commit intomasterfrom
ludwig/eng-9155-ensure-enum-support-for-the-required-fields-selection
Mar 10, 2026
Merged

chore: add tests for enums for required fields#1439
Noroth merged 1 commit intomasterfrom
ludwig/eng-9155-ensure-enum-support-for-the-required-fields-selection

Conversation

@Noroth
Copy link
Copy Markdown
Contributor

@Noroth Noroth commented Mar 10, 2026

This PR just adds some more tests to verify that also enums are supported in the selection set of required fields

Summary by CodeRabbit

Release Notes

  • New Features

    • Added federation support for enumeration-based fields, enabling resolution of direct and nested enum data.
  • Tests

    • Expanded test coverage for enumeration federation scenarios with new test cases validating field resolution.
  • Chores

    • Added RPC endpoints and updated field mappings to support enumeration-based federation.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

This PR extends federation @requires support in the gRPC datasource to handle enum and nested enum fields. It adds new RPC methods, proto message definitions, GraphQL schema fields, test coverage, and mock service implementations for resolving enum-based Storage fields (kindSummary and categoryInfoSummary).

Changes

Cohort / File(s) Summary
Proto and Service Definitions
v2/pkg/grpctest/product.proto
Added two new RPC endpoints (RequireStorageKindSummaryById, RequireStorageCategoryInfoSummaryById) and supporting message types (Context, Request, Response, Result, Fields) for enum and nested enum require resolution.
GraphQL Schema
v2/pkg/grpctest/testdata/products.graphqls
Added StorageCategoryInfo type and four new Storage fields: storageKind, categoryInfo (marked @external), and kindSummary, categoryInfoSummary (marked @requires with corresponding field selections).
Configuration and Mappings
v2/pkg/engine/datasource/grpc_datasource/mapping_test_helper.go, v2/pkg/grpctest/mapping/mapping.go
Extended Storage entity field mappings with storageKind, categoryInfo, kindSummary, and categoryInfoSummary, along with corresponding RPC and response configurations for the new require fields.
Mock Service Implementation
v2/pkg/grpctest/mockservice_requires.go
Implemented two new server methods (RequireStorageKindSummaryById, RequireStorageCategoryInfoSummaryById) that extract nested fields and format summary strings; added fmt import.
Test Coverage
v2/pkg/engine/datasource/grpc_datasource/execution_plan_requires_test.go, v2/pkg/engine/datasource/grpc_datasource/grpc_datasource_federation_test.go
Added comprehensive test cases verifying execution plans and federation behavior for enum and nested enum require fields, including GraphQL queries, field configurations, RPC plan assertions, and result validations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: add tests for enums for required fields' accurately describes the primary change: adding test coverage for enum support in required field selections across multiple test files.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ludwig/eng-9155-ensure-enum-support-for-the-required-fields-selection

Comment @coderabbitai help to get the list of available commands and usage tips.

@Noroth Noroth merged commit 5396c66 into master Mar 10, 2026
11 checks passed
@Noroth Noroth deleted the ludwig/eng-9155-ensure-enum-support-for-the-required-fields-selection branch March 10, 2026 16:52
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.

2 participants