Skip to content

feat: set operation name also with persistent queries#2480

Merged
alepane21 merged 8 commits intomainfrom
ale/eng-8484-analytics-for-persisted-queries
Feb 2, 2026
Merged

feat: set operation name also with persistent queries#2480
alepane21 merged 8 commits intomainfrom
ale/eng-8484-analytics-for-persisted-queries

Conversation

@alepane21
Copy link
Copy Markdown
Contributor

@alepane21 alepane21 commented Jan 29, 2026

When a client send a persisted query without the operation name, we should fetch the operation name from the query, to make the analytics more usable.
Before this PR, when the normalized cache is hit, the operation name is not properly set and the metrics and trace have only the operation id.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Persisted operations now correctly include operation names, preventing nil or empty values that could affect downstream processing.
  • Tests

    • Added test coverage for persisted operation name population.

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.
  • Documentation has been updated on https://github.com/wundergraph/cosmo-docs.
  • I have read the Contributors Guide.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 29, 2026

Walkthrough

A behavioral enhancement to handleFoundPersistedOperationEntry that extracts the operation name from the current document and assigns it to parsedOperation.Request.OperationName for persisted-cache hits. A corresponding test verifies this functionality works as expected.

Changes

Cohort / File(s) Summary
Persisted Operation Cache Operation Name
router/core/operation_processor.go, router/core/operation_processor_test.go
Implementation enhancement extracts operation name from the current document and assigns it to the parsed operation request. New test validates that persisted operation entries correctly populate the operation name field.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: setting operation names for persisted queries, which aligns with the primary modification in the code changes.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 29, 2026

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-27851e9385bbe6b39092e2979d40f57cb07d62fd

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.55%. Comparing base (b188b46) to head (39a21a2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##            main    #2480       +/-   ##
==========================================
+ Coverage   1.50%   61.55%   +60.05%     
==========================================
  Files        292      229       -63     
  Lines      46816    23883    -22933     
  Branches     431        0      -431     
==========================================
+ Hits         703    14702    +13999     
+ Misses     45830     7941    -37889     
- Partials     283     1240      +957     
Files with missing lines Coverage Δ
router/core/operation_processor.go 82.24% <100.00%> (ø)

... and 520 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.

@alepane21 alepane21 marked this pull request as ready for review February 2, 2026 11:02
@alepane21 alepane21 merged commit f3166dc into main Feb 2, 2026
44 of 45 checks passed
@alepane21 alepane21 deleted the ale/eng-8484-analytics-for-persisted-queries branch February 2, 2026 17:04
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.

2 participants