Skip to content

fix(controlplane): upgrade fastify to v5 - #3193

Open
gausie wants to merge 2 commits into
mainfrom
sam/cosmo-381-fastify-v5
Open

fix(controlplane): upgrade fastify to v5#3193
gausie wants to merge 2 commits into
mainfrom
sam/cosmo-381-fastify-v5

Conversation

@gausie

@gausie gausie commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Closes find-my-way #843 (CVE-2026-47219), the last alert behind COSMO-381 and the one #3190 left out. There is no 8.x fix — find-my-way 9.7.0 only ships with fastify 5 — so closing it meant moving controlplane off fastify 4. The alert was dismissed as not_used (the DDoS path is HTTP/2-only, we serve HTTP/1.1); this is the upgrade that dismissal promised.

Almost none of the v5 breaking-change list applies. The only forced change is loggerloggerInstance at three constructor sites. Bumping the catalog pino to 9 surfaced two logger.error('msg', { error }) calls that were silently dropping the error object.

Full suite: 1776 passed, 2 failed — both confirmed pre-existing by re-running against unmodified main.

Summary by CodeRabbit

  • Bug Fixes

    • Improved error logging for schema-version failures, making diagnostic details clearer.
    • Updated server logging configuration for compatibility with newer platform versions.
  • Chores

    • Updated server framework, logging, and related plugin dependencies.
    • Improved internal type compatibility for metrics and test server configurations.

Closes dependabot #843 (find-my-way <= 9.6.0, CVE-2026-47219), the one
alert #3190 couldn't clear. There's no 8.x fix; find-my-way 9.7.0 only
ships with fastify 5. This takes controlplane to fastify 5.12.1, which
pulls in find-my-way 9.9.0.

Almost none of the v5 breaking-change list applies here: no route JSON
schemas, no decorateRequest/decorateReply, no request.routerPath or
routeConfig, no reply.sent, no hasRoute, no route version constraints.
listen() was already object-form and every reply.redirect() call passes
a single argument. @connectrpc/connect-fastify already accepted ^5.1.0.

The only forced API change is logger -> loggerInstance: v5 splits the
option so that a pre-built pino instance has to arrive under the new
name. Three constructor sites needed it.

Also bumps the catalog pino to 9, which fastify 5 depends on internally.
That surfaced two logger.error('msg', { error }) calls in the analytics
bufservices. Those match pino's (msg, ...args) overload, so the error
object was being treated as an interpolation argument and dropped -
the error was never actually logged. Swapped to the object-first form
used elsewhere in the package.

The metrics plugin no longer reaches into fastify/types/instance.js;
both types it wanted are re-exported from the package root.
@gausie
gausie requested review from a team as code owners August 26, 2026 17:55

@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 for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 857f77d6-006a-4041-8204-c89e15a4e730

📥 Commits

Reviewing files that changed from the base of the PR and between 6a8da18 and c1d39ab.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • controlplane/package.json
  • controlplane/src/core/bufservices/analytics/getOperationDeprecatedFields.ts
  • controlplane/src/core/bufservices/analytics/getOperations.ts
  • controlplane/src/core/build-server.ts
  • controlplane/src/core/plugins/metrics.ts
  • controlplane/test/test-util.ts
  • pnpm-workspace.yaml

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The control plane updates Fastify-related dependencies and Pino to newer major versions. Fastify instances now use loggerInstance. Metrics type imports use main package exports. Analytics error logs use error-first arguments.

Changes

Fastify and Pino upgrade

Layer / File(s) Summary
Dependency and logger wiring
controlplane/package.json, pnpm-workspace.yaml, controlplane/src/core/build-server.ts, controlplane/src/core/plugins/metrics.ts, controlplane/test/test-util.ts
Fastify-related packages, pino, and pino-pretty use newer versions. Fastify configurations pass Pino through loggerInstance. Metrics types use the main Fastify exports.
Error logging API updates
controlplane/src/core/bufservices/analytics/getOperationDeprecatedFields.ts, controlplane/src/core/bufservices/analytics/getOperations.ts
Analytics error handlers pass caught errors as the first logger argument and messages as the second argument.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c1d39

This localized dependency upgrade and compatibility update is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: upgrading the controlplane from Fastify 4 to Fastify 5.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.20%. Comparing base (6a8da18) to head (6199d32).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...services/analytics/getOperationDeprecatedFields.ts 0.00% 1 Missing ⚠️
...ne/src/core/bufservices/analytics/getOperations.ts 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (60.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3193       +/-   ##
===========================================
+ Coverage   38.83%   50.20%   +11.36%     
===========================================
  Files         815     1159      +344     
  Lines      109765   163126    +53361     
  Branches     7475    12005     +4530     
===========================================
+ Hits        42627    81895    +39268     
- Misses      66794    79327    +12533     
- Partials      344     1904     +1560     
Files with missing lines Coverage Δ
controlplane/src/core/build-server.ts 75.82% <100.00%> (ø)
controlplane/src/core/plugins/metrics.ts 90.32% <100.00%> (ø)
...services/analytics/getOperationDeprecatedFields.ts 98.01% <0.00%> (ø)
...ne/src/core/bufservices/analytics/getOperations.ts 93.86% <0.00%> (ø)

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

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Router-nonroot image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-e46e7aa327fdb4215f65d04b98c4c45579c34013-nonroot

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.

1 participant