Conversation
WalkthroughAdds Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
Router-nonroot image scan passed✅ No security vulnerabilities found in image: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@router-tests/observability/structured_logging_test.go`:
- Around line 4378-4390: The test is changing both the GraphQL operation name
and variable name so operation_hash may differ for unrelated reasons; keep the
operation name constant to isolate variable-remapping behavior by making both
requests use the same OperationName value and the same operation identifier
inside the Query string while still using different Variables; update the two
xEnv.MakeGraphQLRequestOK calls (GraphQLRequest.OperationName and the "query
EmployeeA"/"query EmployeeB" identifiers in Query) to the same name (e.g.,
"Employee") and leave Variables as {"myId":4} and {"eid":4} respectively.
🪄 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: 3b28bed1-5c0c-4d11-b8a0-02e33bfb51f5
📒 Files selected for processing (5)
router-tests/observability/structured_logging_test.gorouter/core/graphql_prehandler.gorouter/internal/expr/expr.gorouter/internal/expr/request_operation_bucket_visitor.gorouter/internal/expr/request_operation_bucket_visitor_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2738 +/- ##
===========================================
+ Coverage 45.74% 63.46% +17.72%
===========================================
Files 1035 251 -784
Lines 139075 26767 -112308
Branches 8631 0 -8631
===========================================
- Hits 63613 16987 -46626
+ Misses 73735 8414 -65321
+ Partials 1727 1366 -361
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@router/internal/expr/request_operation_bucket_visitor_test.go`:
- Around line 155-181: Update the stale inline comment that documents the bucket
priority chain to include the new NormalizedHash field; specifically, wherever
the priority list references hash/variables/hash variants, add NormalizedHash so
it reflects that request.operation.normalizedHash maps to BucketNormalizedHash
and request.operation.variablesHash maps to BucketHash (which shares priority
with hash); ensure the comment mentions both dot and bracket notation handling
consistent with the visitor's property extraction logic that produces
BucketNormalizedHash and BucketHash.
🪄 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: 6f37b328-050c-41a3-ade7-4fb9df98ab02
📒 Files selected for processing (3)
router/core/graphql_prehandler.gorouter/internal/expr/request_operation_bucket_visitor.gorouter/internal/expr/request_operation_bucket_visitor_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
- router/internal/expr/request_operation_bucket_visitor.go
- router/core/graphql_prehandler.go
There was a problem hiding this comment.
🧹 Nitpick comments (1)
docs-website/router/configuration/template-expressions.mdx (1)
67-69: Tighten hash-field descriptions into shorter reference sentences.These lines are clear but a bit dense. Splitting them improves scanability and aligns better with repo docs style.
✍️ Suggested wording
-- `request.operation.hash` - Hash of the normalized operation. Computed before variable remapping, so queries with different variable names produce different hashes. Identical queries with different skip/include variable values also produce different hashes because normalization inlines those directives. -- `request.operation.queryPlanHash` - The Hash used as the query plan cache key. Computed after variable remapping (e.g. `$myId` and `$eid` both become `$0`) and includes skip/include variable values. Two requests share the same `queryPlanHash` when they resolve to the same query plan. -- `request.operation.sha256Hash` - SHA-256 hash of the original operation query string sent by the client. Identical for all requests that send the same raw query body, regardless of variable values. +- `request.operation.hash` - Hash of the normalized operation. Computed before variable remapping. Different variable names produce different hashes. Different skip/include values also produce different hashes. +- `request.operation.queryPlanHash` - Hash used as the query plan cache key. Computed after variable remapping. Includes skip/include effects. Requests that resolve to the same plan share this value. +- `request.operation.sha256Hash` - SHA-256 hash of the raw operation query string sent by the client. Identical for requests with the same raw query body, regardless of variable values.As per coding guidelines: "Prefer short, declarative sentences. If a sentence has more than one comma-separated clause, consider splitting it."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs-website/router/configuration/template-expressions.mdx` around lines 67 - 69, The three long descriptions for request.operation.hash, request.operation.queryPlanHash, and request.operation.sha256Hash should be rewritten into shorter, declarative reference sentences; update the lines that define `request.operation.hash` to say it is the normalized-operation hash computed before variable remapping and that it treats different skip/include values as different hashes, update `request.operation.queryPlanHash` to state it is the query-plan cache key computed after variable remapping and includes skip/include values so identical plans share the same value, and update `request.operation.sha256Hash` to say it is the SHA‑256 of the raw query string sent by the client and is identical for identical raw queries regardless of variables.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@docs-website/router/configuration/template-expressions.mdx`:
- Around line 67-69: The three long descriptions for request.operation.hash,
request.operation.queryPlanHash, and request.operation.sha256Hash should be
rewritten into shorter, declarative reference sentences; update the lines that
define `request.operation.hash` to say it is the normalized-operation hash
computed before variable remapping and that it treats different skip/include
values as different hashes, update `request.operation.queryPlanHash` to state it
is the query-plan cache key computed after variable remapping and includes
skip/include values so identical plans share the same value, and update
`request.operation.sha256Hash` to say it is the SHA‑256 of the raw query string
sent by the client and is identical for identical raw queries regardless of
variables.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f1e3716c-3e6a-4a00-b989-2f481443e9a5
📒 Files selected for processing (6)
docs-website/router/configuration/template-expressions.mdxrouter-tests/observability/structured_logging_test.gorouter/core/graphql_prehandler.gorouter/internal/expr/expr.gorouter/internal/expr/request_operation_bucket_visitor.gorouter/internal/expr/request_operation_bucket_visitor_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
- router/core/graphql_prehandler.go
- router/internal/expr/request_operation_bucket_visitor_test.go
…ferentiate-between-skip-and
Right now we have sha256Hash and hash, the first is a hash on the raw query body, the second is a hash (number) on the normalized operation (BEFORE variable remapping).
Right now hash can be "good enough" but does not consider variable remapping. It is "good enough" because it only does not consider variable remapping, so unless the variable names do not change the hash would not change.
We would like to expose the hash of the fully normalized operation, the operation hash that is used for query plan caches. This is useful as it is a 1 to 1 mapping for the query plan cache key. Users can use this to cross check cache hit ratios, cache warmer performance, assign an id to normalized queries that are cached. We introduce the "QueryPlanHash" for this.
Summary by CodeRabbit
New Features
Telemetry
Tests
Checklist
Open Source AI Manifesto
This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.