Skip to content

chore: fixate actual costs in tests - #1512

Merged
ysmolski merged 1 commit into
masterfrom
yury/fixate_actual_costs_in_tests
May 22, 2026
Merged

chore: fixate actual costs in tests#1512
ysmolski merged 1 commit into
masterfrom
yury/fixate_actual_costs_in_tests

Conversation

@ysmolski

@ysmolski ysmolski commented May 22, 2026

Copy link
Copy Markdown
Contributor

That way change in actual cost is checked everywhere.

@ysmolski
ysmolski requested a review from a team as a code owner May 22, 2026 14:10

@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 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates test expectations in the execution engine cost calculation tests to assert actual cost alongside estimated cost. The changes span foundational Star Wars schema tests, abstract type fragments, union scenarios, list slicing with multiple argument forms, and slicing validation cases, with expectedActualCost values reflecting runtime behavior using real response sizes rather than assumed list counts.

Changes

Execution Engine Actual Cost Assertions

Layer / File(s) Summary
Core cost calculation assertions
execution/engine/execution_engine_cost_test.go
Updates foundational Star Wars schema tests to assert expectedActualCost for weighted fields, negative-weight clamping, interface/concrete fragment behavior, and empty-list handling.
Abstract type and fragment cost assertions
execution/engine/execution_engine_cost_test.go
Adds expectedActualCost assertions for named fragment cost scenarios on abstract types and union member weighting/field counting.
List slicing and nested sizing cost assertions
execution/engine/execution_engine_cost_test.go
Extends list slicing coverage with expectedActualCost for literal/variable arguments, nested input paths, defaulting behavior, empty/nullable cases, and nested list multiplier compounding.
Slicing validation test assertions
execution/engine/execution_engine_cost_test.go
Adds expectedActualCost for requireOneSlicingArgument validation tests on concrete and abstract types, aligning actual cost with single-item response list execution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • wundergraph/graphql-go-tools#1493: Implements actual cost calculation in CostTreeNode.cost() that uses real parent list sizing logic, directly motivating these test assertion updates.
  • wundergraph/graphql-go-tools#1502: Updates empty-list actual cost handling to multiply by zero, aligning with this PR's expectedActualCost assertions for empty-list scenarios.
  • wundergraph/graphql-go-tools#1505: Switches cost calculation to use VariablesView with remapped variable values, affecting the actual costs these test assertions verify.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding actual cost assertions to test cases for cost-related functionality.
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.
Description check ✅ Passed The PR description directly relates to the changeset, which updates test cases to assert expectedActualCost values alongside expectedEstimatedCost.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yury/fixate_actual_costs_in_tests

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

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