Skip to content

Tutorial: Include#3025

Merged
rrayst merged 2 commits into
masterfrom
tutorial-include
Jun 28, 2026
Merged

Tutorial: Include#3025
rrayst merged 2 commits into
masterfrom
tutorial-include

Conversation

@predic8

@predic8 predic8 commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added a new tutorial showing how to split an API setup into multiple service-specific included files.
    • Added example endpoints for /customers and /orders, each returning JSON data with a 200 response.
    • Added a default fallback that returns 404 for unknown paths.
    • Responses now include an X-Gateway: Membrane header and request logging in the tutorial flow.
  • Tests

    • Added coverage for the customer, order, and unknown-path responses.

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@predic8, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 6 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 769e71b1-bae5-49b4-a2ca-6789a210ab29

📥 Commits

Reviewing files that changed from the base of the PR and between b636a43 and bc6c2d9.

📒 Files selected for processing (2)
  • distribution/src/test/java/com/predic8/membrane/tutorials/advanced/IncludeTutorialTest.java
  • distribution/tutorials/advanced/95-Include.yaml
📝 Walkthrough

Walkthrough

A new advanced tutorial (95-Include.yaml) is added, demonstrating Membrane's include directive by splitting configuration across apis/customers.yaml and apis/orders.yaml. A global interceptor sets X-Gateway: Membrane on all responses, and a fallback returns 404. A JUnit 5 test class verifies the tutorial's three behaviors.

Changes

Include Tutorial

Layer / File(s) Summary
Tutorial YAML and included API configs
distribution/tutorials/advanced/95-Include.yaml, distribution/tutorials/advanced/apis/customers.yaml, distribution/tutorials/advanced/apis/orders.yaml
95-Include.yaml uses include to import the two per-service files, adds global request logging and X-Gateway: Membrane response header, and defines a 404 fallback. Each included file configures an api on port 2000 serving static JSON for /customers or /orders.
IncludeTutorialTest
distribution/src/test/java/com/predic8/membrane/tutorials/advanced/IncludeTutorialTest.java
JUnit 5 class extending AbstractAdvancedTutorialTest, wired to 95-Include.yaml, with three tests asserting HTTP 200 plus X-Gateway header and body content for /customers and /orders, and HTTP 404 for an unknown path.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇 Hop, hop, through configs we go,
Customers here and orders below,
Include them all with a YAML flair,
X-Gateway headers float through the air,
404 for paths unknown — how fair!

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly reflects the new tutorial focused on include-based configuration.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tutorial-include

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
distribution/src/test/java/com/predic8/membrane/tutorials/advanced/IncludeTutorialTest.java (1)

56-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the global header on the 404 path too.

This tutorial is demonstrating a global response interceptor, but the fallback test only checks the status code. Adding the X-Gateway assertion here would catch regressions where the shared header stops applying to unmatched routes.

Suggested change
         given()
         .when()
             .get("http://localhost:2000/unknown")
         .then()
-            .statusCode(404);
+            .statusCode(404)
+            .header("X-Gateway", equalTo("Membrane"));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@distribution/src/test/java/com/predic8/membrane/tutorials/advanced/IncludeTutorialTest.java`
around lines 56 - 63, The fallback test in unknownPathReturns404 only verifies
the 404 status and misses the shared response header from the global
interceptor. Update the assertion in IncludeTutorialTest#unknownPathReturns404
to also check for the X-Gateway header, matching the coverage already used in
the matched-route test so regressions in the global interceptor are caught for
unmatched routes too.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@distribution/tutorials/advanced/95-Include.yaml`:
- Around line 23-26: The /unknown example in the tutorial is missing the
fallback response header, which makes the fallback flow look different from the
global interceptor behavior. Update the documented expected output for the
unknown-path curl example so it includes X-Gateway: Membrane, and make sure the
fallback API example matches the same header behavior as the global response
interceptor. Use the nearby interceptor/fallback sections in the tutorial to
keep the examples consistent.

---

Nitpick comments:
In
`@distribution/src/test/java/com/predic8/membrane/tutorials/advanced/IncludeTutorialTest.java`:
- Around line 56-63: The fallback test in unknownPathReturns404 only verifies
the 404 status and misses the shared response header from the global
interceptor. Update the assertion in IncludeTutorialTest#unknownPathReturns404
to also check for the X-Gateway header, matching the coverage already used in
the matched-route test so regressions in the global interceptor are caught for
unmatched routes too.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7080cf1d-9877-4a5b-a461-5e2d2abb2ac0

📥 Commits

Reviewing files that changed from the base of the PR and between d7e3dfa and b636a43.

📒 Files selected for processing (4)
  • distribution/src/test/java/com/predic8/membrane/tutorials/advanced/IncludeTutorialTest.java
  • distribution/tutorials/advanced/95-Include.yaml
  • distribution/tutorials/advanced/apis/customers.yaml
  • distribution/tutorials/advanced/apis/orders.yaml

Comment thread distribution/tutorials/advanced/95-Include.yaml Outdated
@predic8 predic8 requested a review from rrayst June 28, 2026 11:38
@predic8 predic8 added this to the 7.3.0 milestone Jun 28, 2026
@rrayst

rrayst commented Jun 28, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@rrayst rrayst merged commit 881eb66 into master Jun 28, 2026
5 checks passed
@rrayst rrayst deleted the tutorial-include branch June 28, 2026 13:59
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.

2 participants