Skip to content

feat: support dot-path in slicingArguments - #1485

Merged
ysmolski merged 9 commits into
masterfrom
yury/eng-9338-router-support-dot-path-in-slicingarguments
May 15, 2026
Merged

feat: support dot-path in slicingArguments#1485
ysmolski merged 9 commits into
masterfrom
yury/eng-9338-router-support-dot-path-in-slicingarguments

Conversation

@ysmolski

@ysmolski ysmolski commented May 5, 2026

Copy link
Copy Markdown
Contributor

This PR enables the use of dot-path slicing arguments in a listSize directives. If an operation uses deeply nested input objects, then user can specify the deeply nested int value to be used as an estimation of the returned list size:

input PaginationInput {
  first: Int
  after: String
}

input SearchInput {
  pagination: PaginationInput
  query: String
}

type Query {
  search(input: SearchInput!): [Book]
       @listSize(slicingArguments: ["input.pagination.first"])
}

This PR enables the use of dot-path slicing arguments in a listSize
directives. If an operation uses deeply nested input objects, then user
can specify the deeply nested int value to be used as an estimation of
the returned list size:

    input PaginationInput {
      first: Int
      after: String
    }

    input SearchInput {
      pagination: PaginationInput
      query: String
    }

    type Query {
      search(input: SearchInput!): [Book]
	@listsize(slicingArguments: ["input.pagination.first"])
    }

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0f25eaa6-d811-4211-b809-4a2d47c859c4

📥 Commits

Reviewing files that changed from the base of the PR and between 910cb9b and e1aabc5.

📒 Files selected for processing (2)
  • execution/engine/execution_engine_cost_test.go
  • v2/pkg/engine/plan/cost.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • v2/pkg/engine/plan/cost.go

📝 Walkthrough

Walkthrough

Adds dot-path slicing argument support so the cost calculator can extract integer slice sizes from nested input-object variables; implements a resolver for dot-paths, updates multiplier and validation logic, and expands tests for literals, nested variables, null/missing cases, and RequireOneSlicingArgument enforcement.

Changes

Dot-Path Slicing Argument Support

Layer / File(s) Summary
Cost docs update
v2/pkg/engine/plan/cost.go
Documents that FieldListSize.SlicingArguments may include dot-path names like pagination.limit.first.
Multiplier & resolver
v2/pkg/engine/plan/cost.go
Adds resolveSlicingArgIntValue and refactors FieldListSize.multiplier to resolve dot-paths by reading a root argument from arguments and traversing variables JSON to extract an integer leaf; preserves simple-arg behavior and fallback order (AssumedSize → defaultListSize).
Validation wiring
v2/pkg/engine/plan/cost.go
Updates CostTreeNode.validateSliceArguments to count dot-path slicing args as satisfied when the resolver returns a numeric value; simple args count only for JSON number variables.
Test schema
execution/engine/execution_engine_cost_test.go
Adds SInput/PInput input types and Query.search(input: SInput): [Item!]; updates rootNodes and field wiring to exercise dot-path slicing.
Tests / assertions
execution/engine/execution_engine_cost_test.go
Adds tests covering dot-path slicing as literals and nested variables, nested-input null/missing-leaf/mid/root behaviors with fallback/AssumedSize expectations, and RequireOneSlicingArgument enforcement with exact error-message assertions.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • wundergraph/graphql-go-tools#1461: Touches cost-calculation and ArgumentInfo handling for nested/input-object argument values; closely related to the dot-path and recursive input traversal changes.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: support dot-path in slicingArguments' accurately and concisely describes the main feature being added—support for dot-path syntax in slicing arguments for listSize directives.
Description check ✅ Passed The description explains the feature with a concrete use case showing how deeply nested input objects can now use dot-paths in slicingArguments to estimate list sizes, directly corresponding to the PR's objective.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 yury/eng-9338-router-support-dot-path-in-slicingarguments

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
execution/engine/execution_engine_cost_test.go (1)

1477-1565: ⚡ Quick win

Add a regression for omitted $input variable (empty variables object).

Current required dot-path invalid tests cover missing intermediate and null leaf, but not the root variable being absent ({}), which is a distinct path worth locking down.

🧪 Suggested test addition
+		t.Run("required dot-path slicing argument with omitted root variable is invalid", runWithAndCompareError(
+			ExecutionEngineTestCase{
+				schema: schemaSlicing,
+				operation: func(t *testing.T) graphql.Request {
+					return graphql.Request{
+						Query: `query NestedInput($input: SInput) {
+							  search(input: $input) { id }
+							}`,
+						Variables: []byte(`{}`),
+					}
+				},
+				dataSources: []plan.DataSource{
+					// same datasource setup as other required-dot-path invalid cases
+				},
+				fields: fieldConfig,
+			},
+			"external: field 'Query.search' requires exactly one slicing argument, but none was provided, locations: [], path: [search]",
+			computeCosts(),
+		))
🤖 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 `@execution/engine/execution_engine_cost_test.go` around lines 1477 - 1565, Add
a regression test that mirrors the two existing "required dot-path slicing
argument missing" cases but uses an empty variables object (Variables:
[]byte(`{}`)) so the root $input variable is omitted; update the suite by adding
a new t.Run using runWithAndCompareError with ExecutionEngineTestCase
referencing schemaSlicing, the same mustGraphqlDataSourceConfiguration and
DataSourceCostConfig (SlicingArguments: []string{"input.pagination.first"},
RequireOneSlicingArgument: true) and assert the same error string "external:
field 'Query.search' requires exactly one slicing argument, but none was
provided, locations: [], path: [search]" while keeping computeCosts() as the
executor.
🤖 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.

Nitpick comments:
In `@execution/engine/execution_engine_cost_test.go`:
- Around line 1477-1565: Add a regression test that mirrors the two existing
"required dot-path slicing argument missing" cases but uses an empty variables
object (Variables: []byte(`{}`)) so the root $input variable is omitted; update
the suite by adding a new t.Run using runWithAndCompareError with
ExecutionEngineTestCase referencing schemaSlicing, the same
mustGraphqlDataSourceConfiguration and DataSourceCostConfig (SlicingArguments:
[]string{"input.pagination.first"}, RequireOneSlicingArgument: true) and assert
the same error string "external: field 'Query.search' requires exactly one
slicing argument, but none was provided, locations: [], path: [search]" while
keeping computeCosts() as the executor.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a41d237b-36e1-4494-bb19-7192b052eb64

📥 Commits

Reviewing files that changed from the base of the PR and between cc65e4e and 3cdb077.

📒 Files selected for processing (2)
  • execution/engine/execution_engine_cost_test.go
  • v2/pkg/engine/plan/cost.go

@coderabbitai coderabbitai Bot 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.

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 `@execution/engine/execution_engine_cost_test.go`:
- Around line 1431-1609: The failing test "required dot-path slicing argument
missing leaf is invalid" currently sends Variables with
`"pagination":{"first":null}` which doesn't exercise a truly absent leaf; update
the operation function for that test (the graphql.Request Variables payload in
the test case inside t.Run "required dot-path slicing argument missing leaf is
invalid") to use an omitted leaf such as `"pagination":{}` (e.g.
`{"input":{"pagination":{},"query":"abc"}}`) so the dot-path walker sees the key
missing rather than null; keep the rest of the test (dataSources, CostConfig,
expected error) unchanged.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 08057027-7aaf-4581-a204-78b5d7a39297

📥 Commits

Reviewing files that changed from the base of the PR and between 3cdb077 and 3fd9856.

📒 Files selected for processing (1)
  • execution/engine/execution_engine_cost_test.go

Comment thread execution/engine/execution_engine_cost_test.go
ysmolski added 2 commits May 6, 2026 15:42
Comment thread v2/pkg/engine/plan/cost.go Outdated
Comment thread execution/engine/execution_engine_cost_test.go

@coderabbitai coderabbitai Bot 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.

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 `@v2/pkg/engine/plan/cost.go`:
- Around line 135-139: The code assumes vars.Get(arg.varName) returns non-nil
before traversing dot-paths and will panic when the root variable is missing;
update the traversal in the function that uses vars.Get(arg.varName)
(referencing vars.Get, arg.varName, path, and value.Get) to check whether value
is nil immediately after the initial vars.Get and return 0,false (or the
existing nil-handling result) before entering the for _, key := range path[1:]
loop so value.Get is never called on a nil receiver.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6e454d62-305d-4963-9af6-c8ddfdad54ab

📥 Commits

Reviewing files that changed from the base of the PR and between 3fd9856 and ef058dc.

📒 Files selected for processing (1)
  • v2/pkg/engine/plan/cost.go

Comment thread v2/pkg/engine/plan/cost.go
@ysmolski
ysmolski requested a review from devsergiy May 13, 2026 15:28
@ysmolski
ysmolski merged commit 2cb8d5e into master May 15, 2026
10 checks passed
@ysmolski
ysmolski deleted the yury/eng-9338-router-support-dot-path-in-slicingarguments branch May 15, 2026 07:07
ysmolski pushed a commit that referenced this pull request May 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.3.0](v2.2.0...v2.3.0)
(2026-05-15)


### Features

* support dot-path in slicingArguments
([#1485](#1485))
([2cb8d5e](2cb8d5e))


### Bug Fixes

* find proper parent when sizedFields parent is a non-list wrapper
([#1493](#1493))
([6b96976](6b96976)),
closes
[#1492](#1492)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
ysmolski pushed a commit that referenced this pull request May 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.15.0](execution/v1.14.0...execution/v1.15.0)
(2026-05-15)


### Features

* support dot-path in slicingArguments
([#1485](#1485))
([2cb8d5e](2cb8d5e))


### Bug Fixes

* find proper parent when sizedFields parent is a non-list wrapper
([#1493](#1493))
([6b96976](6b96976)),
closes
[#1492](#1492)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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