Skip to content

feat(router): enhance GraphQL response handling with bytecode optimization#2867

Open
TheApeMachine wants to merge 4 commits into
wundergraph:mainfrom
TheApeMachine:feat/planbytecode
Open

feat(router): enhance GraphQL response handling with bytecode optimization#2867
TheApeMachine wants to merge 4 commits into
wundergraph:mainfrom
TheApeMachine:feat/planbytecode

Conversation

@TheApeMachine
Copy link
Copy Markdown

@TheApeMachine TheApeMachine commented May 13, 2026

Summary by CodeRabbit

  • Performance Improvements
    • GraphQL responses can take a faster bytecode-based execution path when available, reducing latency.
    • Operation planner now attempts to produce an optimized bytecode plan and attaches it when successful.
    • Bytecode compilation failures are logged as warnings but no longer abort planning, improving resilience.

Review Change Stack

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.

This is the router part of pr 1494

  • Introduced bytecode plan support in the operation planner for optimized GraphQL response resolution.
  • Updated ServeHTTP method to utilize bytecode plan when available, improving performance for certain requests.

…ation

- Introduced bytecode plan support in the operation planner for optimized GraphQL response resolution.
- Updated ServeHTTP method to utilize bytecode plan when available, improving performance for certain requests.
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ce581737-2af1-40f3-9d2a-1ee1c01b4f2a

📥 Commits

Reviewing files that changed from the base of the PR and between 4399bbf and 6b2a4be.

📒 Files selected for processing (1)
  • router/core/operation_planner.go

Walkthrough

The planner now attempts to compile prepared GraphQL plans into bytecode and stores the result in plan metadata. The synchronous GraphQL handler checks bytecode readiness and conditionally dispatches to a bytecode-optimized resolver, falling back to the original resolver when not available.

Changes

Bytecode compilation and fast-path resolution

Layer / File(s) Summary
Bytecode plan compilation in operation planner
router/core/operation_planner.go
Adds abstractlogger import, new bytecodePlan (*planbytecode.Program) in planWithMetaData, and calls compiler.Compile(preparedPlan) during planOperation, logging warnings on compilation failure and returning metadata with an optional bytecodePlan.
Bytecode-aware response resolution
router/core/graphql_handler.go
Synchronous response resolution now declares info, err once and conditionally calls ArenaResolveGraphQLResponseBytecode(...) when bytecodePlan.FastPathReady() or falls back to ArenaResolveGraphQLResponse(...), preserving the downstream handling of info/err.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding bytecode optimization to GraphQL response handling in the router, which is the primary purpose of both modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 `@router/core/operation_planner.go`:
- Around line 98-101: In planOperation, treat compiler.Compile as best-effort:
if compiler.Compile(preparedPlan) returns an error, do not return it from
planOperation; instead log the compilation error and leave bytecodePlan nil (so
FastPathReady() will be false and the handler falls back to the standard path);
ensure you still store the plan (with a nil *planbytecode.Program) so
ArenaResolveGraphQLResponse can resolve normally and confirm that
compiler.Compile's successful return yields a non-nil *planbytecode.Program
before assigning it to bytecodePlan.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 277836c6-769f-46f8-b78f-6204ebc89e6b

📥 Commits

Reviewing files that changed from the base of the PR and between f01cb6d and 4399bbf.

📒 Files selected for processing (2)
  • router/core/graphql_handler.go
  • router/core/operation_planner.go

Comment thread router/core/operation_planner.go Outdated
…on planner

- Added logging for failed bytecode compilation in the operation planner, allowing fallback to the standard resolver path.
- Improved error handling to ensure smoother operation during plan execution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant