Skip to content

feat(metrics): expose the res FastifyReply object in AuroraPortalContext#966

Merged
ArtieReus merged 1 commit into
mainfrom
arite-extend-contex-response-cookie
Jun 25, 2026
Merged

feat(metrics): expose the res FastifyReply object in AuroraPortalContext#966
ArtieReus merged 1 commit into
mainfrom
arite-extend-contex-response-cookie

Conversation

@ArtieReus

@ArtieReus ArtieReus commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Expose the res (FastifyReply) object in AuroraPortalContext to allow consumer tRPC procedures to set response headers and cookies.

Changes Made

  • Added res: FastifyReply to the AuroraPortalContext interface in context.ts
  • Added FastifyReply import from "fastify" in context.ts
  • Updated createContext to include res: opts.res in the returned context
  • Updated related test files

Related Issues

  • Enables consumers to implement user behavior analytics with HttpOnly cookies

Screenshots (if applicable)

N/A - Backend change only.

Testing Instructions

  1. pnpm i
  2. pnpm run test
  3. pnpm run typecheck

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.

Summary by CodeRabbit

  • New Features
    • Added access to the HTTP response in portal context, enabling procedures to set response headers and cookies.
  • Bug Fixes
    • Improved test coverage for cookie-related behavior to better validate response handling.

Signed-off-by: Arturo Reuschenbach Puncernau <reuschenbach@gmail.com>
@ArtieReus ArtieReus requested a review from a team as a code owner June 24, 2026 15:31
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

AuroraPortalContext is extended with a res: FastifyReply field. createContext now assigns opts.res to this field. The flavor router test is updated to import FastifyReply and include a setCookie stub in createMockContext. A patch changeset is added.

Changes

Expose FastifyReply on AuroraPortalContext

Layer / File(s) Summary
Add res: FastifyReply to context interface, factory, and tests
packages/aurora/src/server/context.ts, packages/aurora/src/server/Compute/routers/flavorRouter.test.ts, .changeset/chilly-guests-design.md
FastifyReply is imported in context.ts; the res field is added to the AuroraPortalContext interface and wired from opts.res in createContext. The flavor router test adds FastifyReply import and a setCookie stub to createMockContext. The patch changeset documents the addition.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

metrics

Suggested reviewers

  • andypf

Poem

🐇 A cookie to set, a header to write,
res hops into context with pure delight.
FastifyReply now rides along for the trip,
no more missing handles, no slip or skip.
The rabbit has wired what tRPC needs — hooray!

🚥 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: exposing FastifyReply on AuroraPortalContext.
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 The PR description follows the required template closely and includes all major sections, with only minor omissions like an issue link.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch arite-extend-contex-response-cookie

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR exposes the Fastify reply object (res: FastifyReply) on AuroraPortalContext, enabling downstream tRPC procedures to set response headers/cookies.

Changes:

  • Added res: FastifyReply to AuroraPortalContext and returned it from createContext.
  • Updated one router test’s mock context to include a mock res.
  • Added a changeset to release the update as a patch.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/aurora/src/server/context.ts Extends the tRPC context with res: FastifyReply and includes it in the created context object.
packages/aurora/src/server/Compute/routers/flavorRouter.test.ts Updates the mock context to provide a mock res to satisfy the new context shape.
.changeset/chilly-guests-design.md Adds a patch changeset documenting the new context capability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/aurora/src/server/context.ts
@ArtieReus ArtieReus merged commit 2182bff into main Jun 25, 2026
25 checks passed
@ArtieReus ArtieReus deleted the arite-extend-contex-response-cookie branch June 25, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants