fix: handle default values for slicingArguments - #1499
Conversation
This PR adds support of fields defaults specified in the schema for the field arguments/paths specified in slicingArgument. That includes nested InputObjects.
There was a problem hiding this comment.
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR derives Int defaults for configured slicing-argument paths from the upstream SDL, exposes them on FieldListSize.SlicingArgumentDefaults, uses them when resolving slicing args for list-size multiplier calculation and RequireOneSlicingArgument validation, adds unit tests for default extraction, and wires default backfilling into data source configuration and execution tests. ChangesSlicing argument defaults support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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 `@v2/pkg/engine/plan/cost.go`:
- Around line 116-123: The current logic around resolveSlicingArgIntValue treats
any non-success as "missing" and therefore applies SlicingArgumentDefaults even
when the user explicitly provided a null or non-int value; change
resolveSlicingArgIntValue (and its call sites in the dot-path branch inside the
slicing resolution code) to return a tri-state result (e.g., found | missing |
explicit_invalid) instead of a boolean, then update the dot-path handling (the
if strings.Contains(slicingArg, ".") block) so that defaultValue is applied only
when the result is missing, not when explicit_invalid; update any downstream
checks that rely on presence (e.g., RequireOneSlicingArgument logic) to treat
explicit_invalid as provided-but-unusable rather than omitted so defaults and
multiplier calculations only use SlicingArgumentDefaults for truly missing
paths.
🪄 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: 7fbfa39e-b446-422e-8022-6abb05fae0c7
📒 Files selected for processing (5)
execution/engine/execution_engine_cost_test.gov2/pkg/engine/plan/cost.gov2/pkg/engine/plan/cost_defaults.gov2/pkg/engine/plan/cost_defaults_test.gov2/pkg/engine/plan/datasource_configuration.go
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 `@v2/pkg/engine/plan/cost.go`:
- Around line 129-142: The current branch in cost.go that handles flat slicing
args (the block around args[slicingArg] and the hasVariable check) returns false
when the variable is present but set to nil, preventing falling back to
SlicingArgumentDefaults; update the logic in that branch so that if
arg.hasVariable is true and vars != nil but vars.Get(arg.varName) is nil (or not
a number), it should fall through to use the defaultValue when hasDefault is
true (instead of immediately returning 0,false). Concretely: in the args lookup
path for slicingArg in the function containing this snippet, only return
vars.GetInt(...) when the variable exists and is a number; otherwise, if
hasDefault is true return defaultValue,true; keep the final return 0,false
otherwise. Also add a regression test for the case items(first: $limit) with
empty variables and an SDL default to ensure SlicingArgumentDefaults and
RequireOneSlicingArgument behave correctly.
🪄 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: c00d7d20-5cde-43b6-97f7-a8d85547d192
📒 Files selected for processing (3)
execution/engine/execution_engine_cost_test.gov2/pkg/engine/plan/cost.gov2/pkg/engine/plan/cost_defaults_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- v2/pkg/engine/plan/cost_defaults_test.go
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 `@v2/pkg/engine/plan/cost.go`:
- Around line 137-146: The current branch inside the argument resolution block
treats a nil vars pointer as "no default" and falls through; update the logic in
the function handling slicing args so that when arg.hasVariable is true and vars
== nil it is treated as the variable being omitted (so if hasDefault is true
return defaultValue, true). Concretely, in the block that references
arg.hasVariable, vars, arg.varName, hasDefault and defaultValue, restructure the
checks to first test if vars == nil and return the default if available,
otherwise keep the existing path that calls vars.Get(arg.varName) and
vars.GetInt(arg.varName); this ensures behavior for omitted variables matches
SlicingArgumentDefaults and RequireOneSlicingArgument.
🪄 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: 6bd180b7-b727-44b9-bda0-4ef0f5f5bc02
📒 Files selected for processing (2)
execution/engine/execution_engine_cost_test.gov2/pkg/engine/plan/cost.go
🤖 I have created a release *beep* *boop* --- ## [2.3.1](v2.3.0...v2.3.1) (2026-05-20) ### Bug Fixes * handle default values for slicingArguments ([#1499](#1499)) ([f3afd10](f3afd10)) * multiply with 0 for empty lists in actual costs ([#1502](#1502)) ([1cb6bde](1cb6bde)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- ## [1.15.1](execution/v1.15.0...execution/v1.15.1) (2026-05-21) ### Bug Fixes * handle default values for slicingArguments ([#1499](#1499)) ([f3afd10](f3afd10)) * multiply with 0 for empty lists in actual costs ([#1502](#1502)) ([1cb6bde](1cb6bde)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This PR adds support of fields defaults specified in the schema for the field arguments/paths specified in slicingArgument. That includes nested InputObjects.