Skip to content

Conversation

@ysmolski
Copy link
Contributor

@ysmolski ysmolski commented Jan 27, 2026

Integrate basic static cost calculation into the router.
Expose the static cost value in the modules.
Enable basic configuration of static cost via config options.

@coderabbitai summary

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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

@ysmolski ysmolski marked this pull request as draft January 27, 2026 10:14
@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-fc48a524c0387ee084b56ab5caca50db7fcb18c8

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 23.68421% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.71%. Comparing base (05dafc9) to head (f7eb41b).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
router/core/operation_processor.go 27.77% 13 Missing ⚠️
router/core/context.go 0.00% 9 Missing ⚠️
router/core/executor.go 0.00% 2 Missing and 1 partial ⚠️
router/core/graphql_prehandler.go 0.00% 1 Missing and 1 partial ⚠️
router/core/websocket.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            main    #2470       +/-   ##
==========================================
+ Coverage   1.49%   29.71%   +28.21%     
==========================================
  Files        292      212       -80     
  Lines      46968    23282    -23686     
  Branches     431        0      -431     
==========================================
+ Hits         703     6918     +6215     
+ Misses     45982    15460    -30522     
- Partials     283      904      +621     
Files with missing lines Coverage Δ
router/core/factoryresolver.go 57.41% <100.00%> (ø)
router/core/graph_server.go 57.86% <100.00%> (ø)
router/core/modules.go 5.26% <ø> (ø)
router/core/operation_planner.go 47.94% <100.00%> (ø)
router/pkg/config/config.go 7.79% <ø> (ø)
router/core/graphql_prehandler.go 41.04% <0.00%> (ø)
router/core/websocket.go 55.30% <0.00%> (ø)
router/core/executor.go 70.58% <0.00%> (ø)
router/core/context.go 34.02% <0.00%> (ø)
router/core/operation_processor.go 39.41% <27.77%> (ø)

... and 494 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

},
"static_limit": {
"type": "integer",
"description": "The maximum allowed static (estimated) cost for a query. Queries exceeding this limit will be rejected before execution. If the limit is 0, this limit isn't applied.",
Copy link
Contributor

Choose a reason for hiding this comment

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

We should work with modes here, enforce,measure to make it more explicit.

return qps, nil
}

func (o *operationContext) StaticCost() (int, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I recommend rethinking the interface we expose in the module for cost Operation().Cost(). To support more features in the future (dynamic costs), we should make it a struct.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants