Skip to content

Fix SlicingArgumentDefaultValue within ListSizeAttribute #9369

Merged
glen-84 merged 10 commits intoChilliCream:mainfrom
N-Olbert:SlicingArgumentDefaultValue
Mar 19, 2026
Merged

Fix SlicingArgumentDefaultValue within ListSizeAttribute #9369
glen-84 merged 10 commits intoChilliCream:mainfrom
N-Olbert:SlicingArgumentDefaultValue

Conversation

@N-Olbert
Copy link
Contributor

  • Fixed compiler error CS0655 for ListSize(SlicingArgumentDefaultValue = Custom_Value)].
  • Considered SlicingArgumentDefaultValue within OnConfigure.
  • Added tests.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes ListSizeAttribute so SlicingArgumentDefaultValue can be set via attribute syntax without triggering CS0655, and ensures the value is forwarded into the applied @listSize directive so static cost analysis can use it. It also adds/updates tests and snapshots to validate default-value inference and precedence rules.

Changes:

  • Update ListSizeAttribute to support SlicingArgumentDefaultValue as an attribute argument and pass it through during OnConfigure.
  • Add tests verifying (1) inference from paging DefaultPageSize and (2) ListSizeAttribute precedence over paging defaults.
  • Add/refresh snapshots for the new/updated test cases.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeAttribute.cs Makes SlicingArgumentDefaultValue usable in attributes and forwards it into ListSizeDirective.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/StaticQueryAnalysisTests.cs Adds a new static query analysis test case for slicing default value behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/SlicingArgumentsTests.cs Adds schema snapshot tests for inferred default and precedence behavior.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/DescriptorExtensionTests.cs Extends assertions to include slicingArgumentDefaultValue when applying ListSize via descriptor extension.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/AttributeTests.cs Extends assertions to include SlicingArgumentDefaultValue when applying ListSize via attribute.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_9.md New snapshot for the added static query analysis scenario.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_Inferred_From_DefaultPageSize.graphql New schema snapshot validating inference from DefaultPageSize.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_ListSizeAttribute_HasPrecedenceOver_DefaultPageSize.graphql New schema snapshot validating attribute precedence over paging defaults.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added the 📚 documentation This issue is about working on our documentation. label Mar 15, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the CostAnalysis ListSizeAttribute so SlicingArgumentDefaultValue can be set via attribute named arguments (fixing CS0655) and is respected during directive configuration, with additional tests and snapshots to validate behavior and precedence vs paging defaults.

Changes:

  • Switched ListSizeAttribute.SlicingArgumentDefaultValue to a non-nullable int with an internal unset sentinel, and passed the value through in OnConfigure.
  • Expanded unit test coverage for @listSize default slicing argument behavior and precedence over paging defaults.
  • Added/updated snapshot artifacts for static query analysis and schema snapshots.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeAttribute.cs Implements unset sentinel + validates non-negative inputs; forwards SlicingArgumentDefaultValue into ListSizeDirective.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/StaticQueryAnalysisTests.cs Adds a theory data case covering slicingArgumentDefaultValue in @listSize.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/SlicingArgumentsTests.cs Adds schema snapshot tests for inferred/default slicing argument default values and precedence rules.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/DescriptorExtensionTests.cs Ensures descriptor extension ListSize(...) applies slicingArgumentDefaultValue correctly.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/AttributeTests.cs Verifies attribute-driven directive values including default slicing argument value and null behavior when omitted.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_9.md Snapshot for new static analysis test case (index 9).
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_Inferred_From_DefaultPageSize.graphql Schema snapshot validating inferred slicingArgumentDefaultValue from paging default.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_ListSizeAttribute_HasPrecedenceOver_DefaultPageSize.graphql Schema snapshot validating attribute-provided default takes precedence.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an attribute-usage compiler error around ListSizeAttribute.SlicingArgumentDefaultValue and ensures the value is correctly propagated into the configured @listSize directive during schema configuration, with additional regression tests/snapshots in the CostAnalysis test suite.

Changes:

  • Update ListSizeAttribute to support SlicingArgumentDefaultValue as an attribute argument and pass it through during OnConfigure.
  • Add/extend unit tests and snapshots covering precedence/inference of slicing-argument defaults (including paging defaults).
  • Extend existing directive application tests to validate slicingArgumentDefaultValue is present in the directive value.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/HotChocolate/CostAnalysis/src/CostAnalysis/Types/ListSizeAttribute.cs Adjusts attribute properties and forwards slicingArgumentDefaultValue into ListSizeDirective during configuration.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/StaticQueryAnalysisTests.cs Adds a new list-size scenario to the static query analysis theory data.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/StaticQueryAnalysisTests.Execute_ListQuery_ReturnsExpectedResult_9.md Snapshot for the new static analysis scenario including slicingArgumentDefaultValue.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/SlicingArgumentsTests.cs Adds schema snapshot tests for inferred vs explicit slicing-argument defaults.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_Inferred_From_DefaultPageSize.graphql Snapshot asserting inference of slicingArgumentDefaultValue from paging defaults.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/snapshots/SlicingArgumentsTests.SlicingArgumentDefaultValue_ListSizeAttribute_HasPrecedenceOver_DefaultPageSize.graphql Snapshot asserting attribute-provided default takes precedence over paging default.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/DescriptorExtensionTests.cs Extends descriptor extension test to assert SlicingArgumentDefaultValue is applied to the directive.
src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/AttributeTests.cs Extends attribute tests to assert SlicingArgumentDefaultValue is applied and null when not specified.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84 glen-84 merged commit d2b8249 into ChilliCream:main Mar 19, 2026
241 of 243 checks passed
@glen-84
Copy link
Member

glen-84 commented Mar 19, 2026

@N-Olbert Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants