Skip to content

fix(backend-api7): include plugins when dumping stream_route#452

Merged
bzp2010 merged 2 commits into
mainfrom
fix/api7-stream-route-plugins-dump
Jun 12, 2026
Merged

fix(backend-api7): include plugins when dumping stream_route#452
bzp2010 merged 2 commits into
mainfrom
fix/api7-stream-route-plugins-dump

Conversation

@AlinsRan

@AlinsRan AlinsRan commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Problem

ToADC.transformStreamRoute (the dump / read direction) drops the plugins
field, while FromADC.transformStreamRoute (the write direction) keeps it.
So dumping a stream route from the API7 backend always returns it without
plugins.

The differ relies on the dumped remote state to know the current plugins. With
plugins missing from the dump:

  • Adding plugins is detected (local has them, remote appears empty) ✓
  • Removing the last plugins is not detected (local empty == remote
    empty), so stale stream-route plugins are left on the gateway ✗

Fix

Map plugins in ToADC.transformStreamRoute, mirroring transformRoute and
the write-direction FromADC.transformStreamRoute.

Verification

Added libs/backend-api7/test/transformer.spec.ts. Confirmed by running it both
ways:

  • without the fix: ToADC.transformStreamRoute preserves plugins fails
    (Received: undefined)
  • with the fix: passes

Full backend-api7 (20) and differ (31) unit suites pass.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed loss of stream route plugins during transformation so plugin configurations are preserved.
  • Tests

    • Added unit tests to cover stream route plugin round-trips and prevent regressions.
    • Added end-to-end tests validating plugin lifecycle (sync, dump, removal, delete).

@AlinsRan AlinsRan requested a review from bzp2010 as a code owner June 11, 2026 06:50
@CLAassistant

CLAassistant commented Jun 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

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: 234cfcda-eee2-43aa-a228-bb145e24a2da

📥 Commits

Reviewing files that changed from the base of the PR and between 528dfcd and 27491a0.

📒 Files selected for processing (3)
  • libs/backend-api7/e2e/stream-route-plugins.e2e-spec.ts
  • libs/backend-api7/src/transformer.ts
  • libs/backend-api7/test/transformer.spec.ts
✅ Files skipped from review due to trivial changes (1)
  • libs/backend-api7/e2e/stream-route-plugins.e2e-spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • libs/backend-api7/test/transformer.spec.ts
  • libs/backend-api7/src/transformer.ts

📝 Walkthrough

Walkthrough

ToADC.transformStreamRoute now preserves the plugins field when converting stream routes; unit tests and an end-to-end spec validate plugin persistence, removal, and dump round-trips.

Changes

Stream Route Plugins Fix

Layer / File(s) Summary
Transformer passthrough implementation
libs/backend-api7/src/transformer.ts
ToADC.transformStreamRoute now includes route.plugins in the returned ADCSDK.StreamRoute.
Transformer unit tests
libs/backend-api7/test/transformer.spec.ts
Adds tests asserting FromADC.transformStreamRoute and ToADC.transformStreamRoute preserve plugins, including a regression case preventing plugin loss.
E2E plugin lifecycle test
libs/backend-api7/e2e/stream-route-plugins.e2e-spec.ts
New Jest E2E spec that syncs a stream service/route with an ip-restriction plugin, verifies dump preserves plugins, removes plugins and verifies dump reflects removal, then deletes resources.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: including the plugins field in the dump/write path for stream routes, which matches the core change in the changeset.
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.
E2e Test Quality Review ✅ Passed E2E test covers create → dump preserves plugins → remove last plugins → dump reflects removal → delete, using real BackendAPI7 with clear assertions and structure.
Security Check ✅ Passed Scanned changed files (transformer.ts, transformer.spec.ts, stream-route-plugins.e2e-spec.ts): no secret/token logging, plaintext secret DB writes, authz bypass, or ownership/TLS misconfig patterns...

✏️ 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 fix/api7-stream-route-plugins-dump

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

AlinsRan added 2 commits June 12, 2026 09:30
ToADC.transformStreamRoute dropped the plugins field, so dumping/fetching
a stream_route from the API7 backend always returned it without plugins.
The differ then saw the remote stream_route as plugin-less: adding plugins
was detected (local has, remote empty) but REMOVING the last plugins was
not (local empty == remote empty), leaving stale stream-route plugins on
the gateway. FromADC.transformStreamRoute already writes plugins, so the
read path was asymmetric.

Map plugins in the dump direction too, mirroring transformRoute.
Adds an e2e spec that syncs a stream service + stream route carrying an
ip-restriction plugin, dumps, and asserts the plugin survives the
round-trip (this fails without the transformer fix), then removes the
plugin and asserts the dump reflects it. Covers the full sync -> dump ->
verify flow against a real backend.
@AlinsRan AlinsRan force-pushed the fix/api7-stream-route-plugins-dump branch from 528dfcd to 27491a0 Compare June 12, 2026 01:35
@bzp2010 bzp2010 merged commit 2ac582c into main Jun 12, 2026
29 checks passed
@bzp2010 bzp2010 deleted the fix/api7-stream-route-plugins-dump branch June 12, 2026 03:09
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.

3 participants