Skip to content

Add hybrid controller support for mocking#893

Merged
kibertoad merged 5 commits intomainfrom
feat/hybrid-support
Mar 19, 2026
Merged

Add hybrid controller support for mocking#893
kibertoad merged 5 commits intomainfrom
feat/hybrid-support

Conversation

@kibertoad
Copy link
Copy Markdown
Collaborator

Changes

Fix REST+SSE

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

@kibertoad kibertoad requested a review from leonaves March 19, 2026 12:44
@kibertoad kibertoad requested review from a team, CarlosGamero and dariacm as code owners March 19, 2026 12:44
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 19, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 7d5f5926-f28c-4313-affd-fba41c51553f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull request expands the universal-testing-utils mocking library to support dual-mode contracts that serve either JSON or Server-Sent Events (SSE) responses based on the client's Accept header. Changes include updates to MockttpHelper and MswHelper to accept DualModeContractDefinition contracts, conditional response routing based on the incoming request's Accept header (returning 503 when the header doesn't match the mock's mode), new test contracts with path parameters, comprehensive test coverage for the dual-mode routing behavior, and documentation clarifying the Accept header matching rules and simultaneous use of both response types on the same endpoint.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description 'Fix REST+SSE' is extremely vague and does not adequately explain the changes made or the purpose of the dual-mode mocking support being added. Expand the description to clearly explain what is being fixed, what dual-mode behavior means, and how the Accept header routing improves test mocking for hybrid REST+SSE endpoints.
Title check ❓ Inconclusive The title mentions 'hybrid controller support' but the actual changes focus on dual-mode SSE/JSON response routing with Accept header handling for test mocking utilities, which are distinct concepts. Clarify whether 'hybrid controller' is the intended term for dual-mode behavior, or revise the title to better reflect the Accept-header-driven response routing implementation.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/hybrid-support
📝 Coding Plan
  • Generate coding plan for human review comments

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 `@packages/app/universal-testing-utils/README.md`:
- Around line 488-493: Update the README to clarify that MockttpHelper and
MswHelper differ: explain that mockValidResponse and mockSseResponse handlers in
MswHelper "pass through" by returning undefined (allowing other handlers), while
MockttpHelper returns HTTP 503 when the Accept header doesn't match; mention the
practical implication that mocks do not fully "coexist" under MockttpHelper
unless tests explicitly handle the 503 behavior, and suggest either documenting
the difference or instructing consumers to use the matching helper for
consistent behavior (reference MockttpHelper, MswHelper, mockValidResponse,
mockSseResponse).

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 71cf03e8-51fe-4e7c-b22b-a37a839308a0

📥 Commits

Reviewing files that changed from the base of the PR and between 1a992bb and ffd12c2.

📒 Files selected for processing (6)
  • packages/app/universal-testing-utils/README.md
  • packages/app/universal-testing-utils/src/MockttpHelper.spec.ts
  • packages/app/universal-testing-utils/src/MockttpHelper.ts
  • packages/app/universal-testing-utils/src/MswHelper.spec.ts
  • packages/app/universal-testing-utils/src/MswHelper.ts
  • packages/app/universal-testing-utils/test/testContracts.ts

@kibertoad kibertoad merged commit 69d2ba6 into main Mar 19, 2026
6 checks passed
@kibertoad kibertoad deleted the feat/hybrid-support branch March 19, 2026 13:26
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