Skip to content

Adding missing fields to SSE#884

Merged
CarlosGamero merged 1 commit intomainfrom
feat/api-contracts_sse_metadata
Mar 4, 2026
Merged

Adding missing fields to SSE#884
CarlosGamero merged 1 commit intomainfrom
feat/api-contracts_sse_metadata

Conversation

@CarlosGamero
Copy link
Copy Markdown
Collaborator

@CarlosGamero CarlosGamero commented Mar 4, 2026

Changes

Checklist

  • Apply one of following labels; major, minor, patch or skip-release
  • I've updated the documentation, or no changes were necessary
  • I've updated the tests, or no changes were necessary

AI Assistance Tracking

We're running a metric to understand where AI assists our engineering work. Please select exactly one of the options below:

Mark "Yes" if AI helped in any part of this work, for example: generating code, refactoring, debugging support,
explaining something, reviewing an idea, or suggesting an approach.

  • Yes, AI assisted with this PR
  • No, AI did not assist with this PR

Summary by CodeRabbit

  • New Features

    • SSE route contracts now support optional metadata, description, summary, and tags fields, enabling richer route documentation.
  • Tests

    • Added comprehensive unit tests validating metadata augmentation across all SSE route configurations.

@CarlosGamero CarlosGamero self-assigned this Mar 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 4, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'tools'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: lokalise/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e6dbc9a0-b2b6-4f57-bc83-8ad5534189f8

📥 Commits

Reviewing files that changed from the base of the PR and between 74c0d8b and 1fa685b.

📒 Files selected for processing (4)
  • packages/app/api-contracts/src/sse/dualModeContracts.ts
  • packages/app/api-contracts/src/sse/sseContractBuilders.metadata.spec.ts
  • packages/app/api-contracts/src/sse/sseContractBuilders.ts
  • packages/app/api-contracts/src/sse/sseContracts.ts

Walkthrough

This change extends SSE contract definitions and builders with optional metadata, description, summary, and tags fields. Type definitions are updated across dual-mode and standard SSE contracts, contract builders are modified to propagate these properties, and comprehensive tests validate the metadata augmentation across all route modes.

Changes

Cohort / File(s) Summary
Contract Type Definitions
packages/app/api-contracts/src/sse/dualModeContracts.ts, packages/app/api-contracts/src/sse/sseContracts.ts
Extended DualModeContractDefinition, AnyDualModeContractDefinition, SSEContractDefinition, and AnySSEContractDefinition with optional metadata, description, summary, and tags fields. Updated imports to include CommonRouteDefinitionMetadata.
Builder Implementation
packages/app/api-contracts/src/sse/sseContractBuilders.ts
Added metadata, description, summary, and tags fields to SSEGetContractConfig, SSEPayloadContractConfig, DualModeGetContractConfig, and DualModePayloadContractConfig. Updated buildBaseFields to propagate these properties into generated contract definitions.
Builder Tests
packages/app/api-contracts/src/sse/sseContractBuilders.metadata.spec.ts
New comprehensive test suite validating metadata augmentation for all route modes (GET, POST, dual-mode GET, dual-mode POST), including module augmentation of CommonRouteDefinitionMetadata with test properties.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete, with only checklist items checked but no substantive content under the 'Changes' section explaining what fields were added or why. Fill out the 'Changes' section with details about which SSE types now include metadata, description, summary, and tags fields, and explain the purpose of these additions.
Title check ❓ Inconclusive The title 'Adding missing fields to SSE' is vague and generic, using non-descriptive language that doesn't convey which specific fields are being added or why. Replace with a more specific title like 'Add metadata, description, summary, and tags fields to SSE contract definitions' to clearly indicate the exact changes made.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/api-contracts_sse_metadata

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

Comment on lines 40 to +61
/** Sync response schema - use with `sync` handler */
successResponseBodySchema: SyncResponse
responseHeaderSchema?: ResponseHeaders
/**
* Alternative response schemas by HTTP status code.
* Used to define different response shapes for error cases (e.g., 400, 404, 500).
*
* @example
* ```ts
* responseBodySchemasByStatusCode: {
* 400: z.object({ error: z.string(), details: z.array(z.string()) }),
* 404: z.object({ error: z.string() }),
* }
* ```
*/
responseBodySchemasByStatusCode?: ResponseSchemasByStatusCode
serverSentEventSchemas: Events
isDualMode: true
metadata?: CommonRouteDefinitionMetadata
description?: string
summary?: string
tags?: readonly string[]
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I see we are defining pretty much the same type as we have for the rest contract in dual model and SSE. Should we try to reuse the existing one by extending it with SSE/dual-mode extra props?
@kibertoad If you agree, I can try to ask Claude to do it :D

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

let's try it!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Nice! if you don't mind, it will be a separate PR :D

@CarlosGamero CarlosGamero marked this pull request as ready for review March 4, 2026 10:26
@CarlosGamero CarlosGamero requested review from a team, dariacm and kibertoad as code owners March 4, 2026 10:26
@CarlosGamero CarlosGamero merged commit d321fed into main Mar 4, 2026
12 of 14 checks passed
@CarlosGamero CarlosGamero deleted the feat/api-contracts_sse_metadata branch March 4, 2026 10:30
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.

2 participants