Skip to content

feat: rust backend api7 - #555

Merged
bzp2010 merged 17 commits into
rust-nextfrom
bzp/feat-rust-backend-api7
Aug 5, 2026
Merged

feat: rust backend api7#555
bzp2010 merged 17 commits into
rust-nextfrom
bzp/feat-rust-backend-api7

Conversation

@bzp2010

@bzp2010 bzp2010 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Description

Backend for API7.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible

Summary by CodeRabbit

  • New Features
    • Added API7 Enterprise support for configuration discovery, validation, synchronization, resource management, gateway groups, and version-aware defaults.
    • Added resource-type filtering and label selectors for local and remote configuration operations.
    • Added support for applying labels across supported configuration resources.
  • Bug Fixes
    • Improved numeric serialization so whole-number timeout and upstream values are represented consistently.
    • Improved handling of API7 validation errors, timeouts, and resource conversions.
  • Tests
    • Expanded API7 integration and end-to-end coverage across supported versions and resource types.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 62d365e3-ad21-4fdb-b146-5c35a2e9d721

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

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

@bzp2010 bzp2010 added the test/api7 Trigger the API7 test on the PR label Aug 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (12)
rust/crates/adc-backend-api7/src/typing.rs (1)

268-271: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Consider tolerating a missing list field.

ListResponse::list has no #[serde(default)]. If an API7 collection endpoint omits list for an empty collection, every Fetcher::list call fails with a deserialization error instead of returning an empty vector. A default keeps the dump path working in that case.

♻️ Proposed defensive change
 #[derive(Debug, Clone, Deserialize)]
 pub struct ListResponse<T> {
+    #[serde(default)]
     pub list: Vec<T>,
 }

Note: Vec<T>: Default holds for any T, so no extra bound is needed.

🤖 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 `@rust/crates/adc-backend-api7/src/typing.rs` around lines 268 - 271, Update
the list field in ListResponse<T> to use Serde’s default for missing fields, so
omitted collection responses deserialize with an empty Vec while preserving
existing behavior when list is present.
rust/crates/adc-backend-api7/src/operator.rs (1)

325-328: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Stamp the upstream id, as every other branch does.

Each other create/update branch sets the resource id from event.resource_id before conversion. The Upstream branch does not, so the body's id stays whatever the event payload carried, including None. Set it for consistency and to keep the body and the path in agreement.

♻️ Proposed change
         ResourceType::Upstream => {
-            let upstream: adc::Upstream = deserialize_event_value(new_value)?;
+            let mut upstream: adc::Upstream = deserialize_event_value(new_value)?;
+            upstream.id = Some(event.resource_id.clone());
             to_request_body(typing::Upstream::from(upstream))
         }
🤖 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 `@rust/crates/adc-backend-api7/src/operator.rs` around lines 325 - 328, Update
the ResourceType::Upstream branch to assign event.resource_id to the
deserialized upstream before converting it with typing::Upstream::from, matching
the id-stamping behavior of the other create/update branches and keeping the
request body id aligned with the path.
rust/crates/adc-backend-api7/src/transformer.rs (1)

420-445: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

An SSL with no certificates serializes as an empty cert/key pair.

If ssl.certificates is empty, first becomes an empty certificate and the wire body sends cert: "" and key: "". The dashboard then answers with a schema error that does not name the real cause. Consider omitting cert/key when no certificate exists, so the error stays closer to "certificate missing".

♻️ Proposed change
-        let mut certificates = ssl.certificates.into_iter();
-        let first = certificates.next().unwrap_or(adc::SSLCertificate {
-            certificate: String::new(),
-            key: String::new(),
-        });
+        let mut certificates = ssl.certificates.into_iter();
+        let first = certificates.next();
@@
-            cert: Some(first.certificate),
+            cert: first.as_ref().map(|c| c.certificate.clone()),
@@
-            key: Some(first.key),
+            key: first.map(|c| c.key),
🤖 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 `@rust/crates/adc-backend-api7/src/transformer.rs` around lines 420 - 445,
Update the From<adc::SSL> for typing::Ssl implementation to detect when
ssl.certificates is empty and omit the wire cert and key fields instead of
serializing empty strings. Preserve the existing first-certificate mapping and
certs/keys behavior when at least one certificate exists.
rust/crates/adc-backend-api7/src/validator.rs (1)

96-121: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

unwrap_err here depends on require_success rejecting every remaining status.

The _ arm reaches unwrap_err for all statuses outside 200-299 and 400. If require_success ever accepts a status in that set, this line panics instead of returning an error. Match on the result instead, and return a descriptive error for the unexpected Ok case.

🤖 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 `@rust/crates/adc-backend-api7/src/validator.rs` around lines 96 - 121, Update
the fallback status arm in the validator response match to handle
HttpClient::require_success without calling unwrap_err. Match on its Result,
return the existing error for Err, and construct a descriptive BackendError for
an unexpected Ok response so no status can cause a panic.
rust/crates/adc-backend-api7/src/default_value.rs (1)

47-63: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

The upstream patch misses a service schema declared through allOf.

patch_missing_upstream_schema runs before the allOf merge in fetch and reads service.properties.upstream directly. If a release declares the service schema as an allOf composition, properties is absent at the top level, the patch returns early, and upstream defaults stay empty on exactly the older versions this function targets. Consider merging allOf first, or falling back to the merged service schema here.

🤖 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 `@rust/crates/adc-backend-api7/src/default_value.rs` around lines 47 - 63,
Update patch_missing_upstream_schema to resolve the service schema after its
allOf composition is merged, or otherwise fall back to that merged
representation before reading service.properties.upstream. Preserve the existing
early return when upstream already exists and continue inserting the patched
object schema into the top-level schema.
rust/crates/adc-backend-api7/src/fetcher.rs (1)

71-75: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Bound the cascading fan-out concurrency.

Both calls pass None as the concurrency limit, so every service and every consumer issues its follow-up requests at once. A gateway group with thousands of services opens thousands of simultaneous connections against the dashboard during one dump. Pass a fixed cap, or thread the sync concurrency option through to the fetcher.

Also applies to: 126-132

🤖 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 `@rust/crates/adc-backend-api7/src/fetcher.rs` around lines 71 - 75, Update the
concurrent_map_until_err calls in the fetcher flows, including the service path
around with_upstreams_and_routes and the corresponding consumer path, to use a
bounded concurrency limit instead of None. Prefer threading the existing sync
concurrency option through the fetcher; otherwise use a fixed cap consistently
for both cascading request fan-outs.
rust/crates/adc-backend-api7/tests/common/mod.rs (1)

120-152: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Include the response body in the bootstrap failure messages.

put and post assert on the status only. A dashboard bootstrap failure then reports just the status code, which makes a broken login, license, or token step hard to diagnose. Read the body text before the assertion and add it to the panic message.

🤖 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 `@rust/crates/adc-backend-api7/tests/common/mod.rs` around lines 120 - 152,
Update the bootstrap helper methods put and post to read the response body text
before asserting success, and include that text in the assertion failure message
alongside the status. Preserve the existing request and JSON-decoding behavior,
ensuring body-read failures identify the corresponding PUT or POST path.
rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_2.rs (1)

27-28: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Assert the collection lengths before indexing.

The test indexes ssls[0], services[0], and services[1] without a length check. If the dump returns fewer entries, the failure is an index panic that does not name the missing resource. Add assert_eq! on the lengths first, as the other test files do.

🔧 Proposed fix
     let ssls = dump.ssls.as_ref().unwrap();
+    assert_eq!(ssls.len(), 1);
     let mut ssl0 = serde_json::to_value(&ssls[0]).unwrap();
@@
     let mut services = dump.services.take().unwrap();
+    assert_eq!(services.len(), 2);
     services.sort_by(|a, b| a.name.cmp(&b.name));

Also applies to: 44-45

🤖 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 `@rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_2.rs` around lines 27 -
28, In the e2e dump test, assert the expected lengths of the SSL and service
collections before indexing them: verify ssls has the required first entry and
services has at least two entries before accessing ssls[0], services[0], or
services[1]. Use assert_eq! with the expected counts and retain the existing
indexing logic afterward.
rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_1.rs (1)

208-211: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Sorting by id makes the expected order opaque.

The assertions expect route2 before route1 only because the generated ids happen to order that way. A reader cannot verify this without computing the ids. Sort by a field the test controls, for example server_port, and keep the expectations in that order.

♻️ Proposed change
-    stream_routes.sort_by(|a, b| a.id.cmp(&b.id));
+    stream_routes.sort_by_key(|r| r.server_port);
     assert_eq!(stream_routes.len(), 2);
-    assert_matches_object(&serde_json::to_value(&stream_routes[0]).unwrap(), &route2);
-    assert_matches_object(&serde_json::to_value(&stream_routes[1]).unwrap(), &route1);
+    assert_matches_object(&serde_json::to_value(&stream_routes[0]).unwrap(), &route2); // 3306
+    assert_matches_object(&serde_json::to_value(&stream_routes[1]).unwrap(), &route1); // 5432
🤖 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 `@rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_1.rs` around lines 208 -
211, Update the stream_routes sorting in the test to use the controlled
server_port field instead of id, then preserve the expected route2 and route1
assertions in the resulting server_port order.
.github/workflows/e2e.yaml (1)

192-223: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

The image/license setup duplicates the api7 job.

Lines 203-233 repeat lines 149-179 exactly, including the version matrix. A version or image change must then be applied in two places. Extract the shared steps into a composite action under .github/actions/, or define the matrix once and reuse it.

🤖 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 @.github/workflows/e2e.yaml around lines 192 - 223, Deduplicate the API7
image and license setup shared by the api7 and api7-rust jobs: extract the
repeated “Determine API7 image and license” steps into a composite action under
.github/actions/ and invoke it from both jobs, while preserving the existing
version matrix and dev-versus-release environment values.
rust/crates/adc-backend-api7/tests/e2e_resource_route.rs (1)

20-63: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Both tests repeat the same sync/dump/delete sequence.

The two tests differ only in the route payload and the version gate. Extract a helper that takes the route JSON, performs the sync, asserts the dump, and deletes the service. The cleanup also runs only on the success path. If an assertion panics, the test service stays in the dashboard and can affect later tests in the serial run. A shared helper with a guard that deletes the service on drop removes both problems.

Also applies to: 67-114

🤖 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 `@rust/crates/adc-backend-api7/tests/e2e_resource_route.rs` around lines 20 -
63, Extract the duplicated sync/dump/delete workflow from both route timeout
tests into a shared helper that accepts the route JSON and handles the
applicable version gate. Have the helper assert the dumped service and route
data, while using a drop guard to delete the test service even when an assertion
panics; update both tests to call this helper with their respective payloads.
rust/crates/adc-backend-api7/tests/e2e_default_value.rs (1)

27-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Version gates report success when they skip.

Each gated test prints to stderr and returns. A skipped test is reported as passing, so a misconfigured BACKEND_API7_VERSION hides all three tests silently. Consider asserting that at least one branch matched, for example by centralizing the gate in common and counting executed branches, or by failing when server_version() equals the fallback 0.0.0.

Also applies to: 76-79, 96-99

🤖 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 `@rust/crates/adc-backend-api7/tests/e2e_default_value.rs` around lines 27 -
30, Update the version gates in the three tests in e2e_default_value.rs so an
unrecognized or fallback server version cannot silently return as a passing
test. Centralize the gate through the existing common test utilities or
otherwise track whether a supported version branch executed, and fail when
server_version() is the fallback 0.0.0; preserve the intended skip behavior for
explicitly unsupported versions.
🤖 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 @.github/workflows/e2e.yaml:
- Line 225: Update the actions/checkout step in the workflow to disable
credential persistence while preserving the existing pinned action version and
read-only clone behavior; configure checkout with persist-credentials set to
false.

In `@rust/crates/adc-backend-api7/src/fetcher.rs`:
- Around line 188-239: The Fetcher::dump method currently attaches nested
service routes regardless of config::filter_resource_types. Apply the configured
resource-type filter before assigning service.routes, excluding HTTP routes and
stream routes when Route or StreamRoute is filtered out, and ensure other
excluded nested resources such as Upstream or ConsumerCredential are not
returned through services. Preserve service output when Service remains enabled.

In `@rust/crates/adc-backend-api7/src/gateway_group.rs`:
- Around line 55-66: Update GatewayGroupSummary to decode the gateway group
name, then change the lookup in the gateway-group resolution flow to select the
entry whose name exactly matches self.name rather than taking the first result.
Preserve the existing missing-group BackendError when no exact match is found,
and continue returning the matched group’s id.

In `@rust/crates/adc-backend-api7/src/transformer.rs`:
- Around line 363-377: Update transform_service to derive ty as "stream" when
either the upstream scheme is Tcp, Udp, or Tls, or the service routes are
ServiceRoutes::Stream; otherwise retain "http". Ensure stream routes without an
upstream are serialized with the stream type so downstream fetch logic preserves
them.

In `@rust/crates/adc-backend-api7/tests/common/mod.rs`:
- Around line 202-214: Update bootstrap_token to obtain the backend version by
reusing server_version() instead of independently parsing BACKEND_API7_VERSION
with a 0.0.0 fallback. Remove the duplicate environment parsing so unset and
invalid values follow the same default and validation behavior as
server_version(), while preserving the existing init_user call and license
handling.

In `@rust/crates/adc-backend-api7/tests/e2e_default_value.rs`:
- Around line 15-22: Update the default-value setup used by fetch and
core_default so schema defaults remain available when transform_default cannot
deserialize partial values such as Consumer’s empty object. Preserve these
entries as schema-only partial values without requiring identity fields, or
process them before typed conversion, and ensure core_default returns the
preserved default instead of panicking on an omitted resource.

In `@rust/crates/adc-backend-api7/tests/e2e_ping.rs`:
- Around line 24-44: Update the HttpClientConfig server value in
ping_fails_against_an_unreachable_server to use http://127.0.0.1:1 instead of
http://0.0.0.0, preserving the existing connection-error assertion and test
setup.

In `@rust/crates/adc-backend-api7/tests/e2e_resource_consumer.rs`:
- Around line 53-76: Update the consumer assertions in the test around
dump_configuration to select entries by their username rather than assuming list
indices. Preserve validation of both consumer1 and consumer2 before the update,
and locate the updated consumer1 by username before matching its contents.

In `@rust/crates/adc-backend-apisix/src/fetcher.rs`:
- Around line 157-160: Update the consumer fetch flow around
concurrent_map_until_err and self.with_credentials to check
self.filter.is_skip(ResourceType::ConsumerCredential) first; when credentials
are excluded, return consumers unchanged, otherwise preserve the existing
credential-fetch behavior.

In `@rust/crates/adc-cli/src/pipeline.rs`:
- Around line 136-140: Update the pipeline around config::fill_labels and
config::inject_managed_by_label so inject_managed_by_label runs first, allowing
the explicit managed-by selector value to remain authoritative. Preserve the
existing remote selector behavior and add a regression test covering
--managed-by-label together with --label-selector managed-by=<value>, verifying
local labels match the selector.

---

Nitpick comments:
In @.github/workflows/e2e.yaml:
- Around line 192-223: Deduplicate the API7 image and license setup shared by
the api7 and api7-rust jobs: extract the repeated “Determine API7 image and
license” steps into a composite action under .github/actions/ and invoke it from
both jobs, while preserving the existing version matrix and dev-versus-release
environment values.

In `@rust/crates/adc-backend-api7/src/default_value.rs`:
- Around line 47-63: Update patch_missing_upstream_schema to resolve the service
schema after its allOf composition is merged, or otherwise fall back to that
merged representation before reading service.properties.upstream. Preserve the
existing early return when upstream already exists and continue inserting the
patched object schema into the top-level schema.

In `@rust/crates/adc-backend-api7/src/fetcher.rs`:
- Around line 71-75: Update the concurrent_map_until_err calls in the fetcher
flows, including the service path around with_upstreams_and_routes and the
corresponding consumer path, to use a bounded concurrency limit instead of None.
Prefer threading the existing sync concurrency option through the fetcher;
otherwise use a fixed cap consistently for both cascading request fan-outs.

In `@rust/crates/adc-backend-api7/src/operator.rs`:
- Around line 325-328: Update the ResourceType::Upstream branch to assign
event.resource_id to the deserialized upstream before converting it with
typing::Upstream::from, matching the id-stamping behavior of the other
create/update branches and keeping the request body id aligned with the path.

In `@rust/crates/adc-backend-api7/src/transformer.rs`:
- Around line 420-445: Update the From<adc::SSL> for typing::Ssl implementation
to detect when ssl.certificates is empty and omit the wire cert and key fields
instead of serializing empty strings. Preserve the existing first-certificate
mapping and certs/keys behavior when at least one certificate exists.

In `@rust/crates/adc-backend-api7/src/typing.rs`:
- Around line 268-271: Update the list field in ListResponse<T> to use Serde’s
default for missing fields, so omitted collection responses deserialize with an
empty Vec while preserving existing behavior when list is present.

In `@rust/crates/adc-backend-api7/src/validator.rs`:
- Around line 96-121: Update the fallback status arm in the validator response
match to handle HttpClient::require_success without calling unwrap_err. Match on
its Result, return the existing error for Err, and construct a descriptive
BackendError for an unexpected Ok response so no status can cause a panic.

In `@rust/crates/adc-backend-api7/tests/common/mod.rs`:
- Around line 120-152: Update the bootstrap helper methods put and post to read
the response body text before asserting success, and include that text in the
assertion failure message alongside the status. Preserve the existing request
and JSON-decoding behavior, ensuring body-read failures identify the
corresponding PUT or POST path.

In `@rust/crates/adc-backend-api7/tests/e2e_default_value.rs`:
- Around line 27-30: Update the version gates in the three tests in
e2e_default_value.rs so an unrecognized or fallback server version cannot
silently return as a passing test. Centralize the gate through the existing
common test utilities or otherwise track whether a supported version branch
executed, and fail when server_version() is the fallback 0.0.0; preserve the
intended skip behavior for explicitly unsupported versions.

In `@rust/crates/adc-backend-api7/tests/e2e_resource_route.rs`:
- Around line 20-63: Extract the duplicated sync/dump/delete workflow from both
route timeout tests into a shared helper that accepts the route JSON and handles
the applicable version gate. Have the helper assert the dumped service and route
data, while using a drop guard to delete the test service even when an assertion
panics; update both tests to call this helper with their respective payloads.

In `@rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_1.rs`:
- Around line 208-211: Update the stream_routes sorting in the test to use the
controlled server_port field instead of id, then preserve the expected route2
and route1 assertions in the resulting server_port order.

In `@rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_2.rs`:
- Around line 27-28: In the e2e dump test, assert the expected lengths of the
SSL and service collections before indexing them: verify ssls has the required
first entry and services has at least two entries before accessing ssls[0],
services[0], or services[1]. Use assert_eq! with the expected counts and retain
the existing indexing logic afterward.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5d59f7b2-9dbb-438c-b2c9-c537d2a079f1

📥 Commits

Reviewing files that changed from the base of the PR and between d3bf181 and 75af71f.

⛔ Files ignored due to path filters (1)
  • rust/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (44)
  • .github/workflows/e2e.yaml
  • rust/Cargo.toml
  • rust/crates/adc-backend-api7/Cargo.toml
  • rust/crates/adc-backend-api7/src/backend.rs
  • rust/crates/adc-backend-api7/src/default_value.rs
  • rust/crates/adc-backend-api7/src/fetcher.rs
  • rust/crates/adc-backend-api7/src/gateway_group.rs
  • rust/crates/adc-backend-api7/src/lib.rs
  • rust/crates/adc-backend-api7/src/operator.rs
  • rust/crates/adc-backend-api7/src/transformer.rs
  • rust/crates/adc-backend-api7/src/typing.rs
  • rust/crates/adc-backend-api7/src/utils.rs
  • rust/crates/adc-backend-api7/src/validator.rs
  • rust/crates/adc-backend-api7/tests/common/mod.rs
  • rust/crates/adc-backend-api7/tests/e2e_default_value.rs
  • rust/crates/adc-backend-api7/tests/e2e_gateway_group.rs
  • rust/crates/adc-backend-api7/tests/e2e_misc.rs
  • rust/crates/adc-backend-api7/tests/e2e_ping.rs
  • rust/crates/adc-backend-api7/tests/e2e_resource_consumer.rs
  • rust/crates/adc-backend-api7/tests/e2e_resource_route.rs
  • rust/crates/adc-backend-api7/tests/e2e_resource_service_upstream.rs
  • rust/crates/adc-backend-api7/tests/e2e_stream_route_plugins.rs
  • rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_1.rs
  • rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_2.rs
  • rust/crates/adc-backend-api7/tests/e2e_validate.rs
  • rust/crates/adc-backend-api7/tests/timeout.rs
  • rust/crates/adc-backend-api7/tests/validator.rs
  • rust/crates/adc-backend-apisix/src/backend.rs
  • rust/crates/adc-backend-apisix/src/fetcher.rs
  • rust/crates/adc-backend-apisix/src/utils.rs
  • rust/crates/adc-backend-apisix/tests/common/mod.rs
  • rust/crates/adc-backend-apisix/tests/e2e_apisix.rs
  • rust/crates/adc-backend-apisix/tests/e2e_ping.rs
  • rust/crates/adc-backend-apisix/tests/e2e_resource_consumer.rs
  • rust/crates/adc-backend-apisix/tests/e2e_resource_service.rs
  • rust/crates/adc-backend-apisix/tests/e2e_validate.rs
  • rust/crates/adc-backend-core/src/client.rs
  • rust/crates/adc-backend-core/src/lib.rs
  • rust/crates/adc-backend-core/src/resource_filter.rs
  • rust/crates/adc-backend-core/src/resource_path.rs
  • rust/crates/adc-cli/Cargo.toml
  • rust/crates/adc-cli/src/config.rs
  • rust/crates/adc-cli/src/main.rs
  • rust/crates/adc-cli/src/pipeline.rs

Comment thread .github/workflows/e2e.yaml
Comment thread rust/crates/adc-backend-api7/src/fetcher.rs
Comment thread rust/crates/adc-backend-api7/src/gateway_group.rs Outdated
Comment thread rust/crates/adc-backend-api7/src/transformer.rs
Comment thread rust/crates/adc-backend-api7/tests/common/mod.rs
Comment thread rust/crates/adc-backend-api7/tests/e2e_default_value.rs
Comment thread rust/crates/adc-backend-api7/tests/e2e_ping.rs
Comment thread rust/crates/adc-backend-api7/tests/e2e_resource_consumer.rs
Comment thread rust/crates/adc-backend-apisix/src/fetcher.rs
Comment thread rust/crates/adc-cli/src/pipeline.rs
@bzp2010
bzp2010 force-pushed the bzp/feat-rust-backend-api7 branch from dc5fe56 to e2f0580 Compare August 5, 2026 14:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
rust/crates/adc-backend-apisix/tests/transformer.rs (1)

139-139: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the converted priority value.

The test changes priority, but the assertions only check host and port. Add assert_eq!(nodes[0].priority, 0); to verify that the integer value survives conversion.

🤖 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 `@rust/crates/adc-backend-apisix/tests/transformer.rs` at line 139, Update the
relevant transformer test assertions to validate the converted priority field as
well as host and port. In the test using typing::UpstreamNodes::List and
adc::UpstreamNode, assert that nodes[0].priority equals 0.
🤖 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 `@rust/crates/adc-backend-api7/src/default_value.rs`:
- Around line 222-245: The LenientSslClient conversion currently defaults an
omitted depth to 0 instead of the SDK default 1. Update LenientSslClient’s depth
deserialization to use a default function returning 1, and add coverage for
deserializing a client without depth to verify the converted adc::SslClient
preserves depth 1.

In `@rust/crates/adc-sdk/src/resources/common.rs`:
- Around line 41-44: Update the integer-conversion predicate in the visible
serializer branch to keep the lower bound inclusive while requiring the finite
value to be strictly less than 2^63, rather than comparing against i64::MAX as
f64. Add a regression test covering 2^63 to verify it is serialized as an f64
instead of being converted to i64.

In `@rust/crates/adc-sdk/src/resources/upstream.rs`:
- Around line 94-95: Update the resource deserialization around priority and
concurrency, including default_concurrency, to accept JSON integers and integral
decimal numbers such as 0.0 and 10.0 while preserving integer behavior; add and
apply suitable serde deserializers, then add regression coverage in
resources_from_fixtures.rs for both fields and numeric forms.

---

Nitpick comments:
In `@rust/crates/adc-backend-apisix/tests/transformer.rs`:
- Line 139: Update the relevant transformer test assertions to validate the
converted priority field as well as host and port. In the test using
typing::UpstreamNodes::List and adc::UpstreamNode, assert that nodes[0].priority
equals 0.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 310e476e-bd5d-4bce-af0b-e4c835c66548

📥 Commits

Reviewing files that changed from the base of the PR and between dd74507 and eca2d4a.

📒 Files selected for processing (22)
  • .github/workflows/e2e.yaml
  • rust/crates/adc-backend-api7/src/default_value.rs
  • rust/crates/adc-backend-api7/src/gateway_group.rs
  • rust/crates/adc-backend-api7/src/operator.rs
  • rust/crates/adc-backend-api7/src/typing.rs
  • rust/crates/adc-backend-api7/tests/common/mod.rs
  • rust/crates/adc-backend-api7/tests/e2e_init.rs
  • rust/crates/adc-backend-api7/tests/e2e_misc.rs
  • rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_1.rs
  • rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_2.rs
  • rust/crates/adc-backend-api7/tests/e2e_validate.rs
  • rust/crates/adc-backend-api7/tests/timeout.rs
  • rust/crates/adc-backend-api7/tests/validator.rs
  • rust/crates/adc-backend-apisix/src/transformer.rs
  • rust/crates/adc-backend-apisix/src/typing.rs
  • rust/crates/adc-backend-apisix/tests/transformer.rs
  • rust/crates/adc-cli/src/config.rs
  • rust/crates/adc-cli/src/pipeline.rs
  • rust/crates/adc-sdk/src/resources/common.rs
  • rust/crates/adc-sdk/src/resources/mod.rs
  • rust/crates/adc-sdk/src/resources/upstream.rs
  • rust/crates/adc-sdk/tests/resources_from_fixtures.rs
🚧 Files skipped from review as they are similar to previous changes (9)
  • rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_2.rs
  • rust/crates/adc-backend-api7/src/typing.rs
  • rust/crates/adc-backend-api7/tests/e2e_validate.rs
  • rust/crates/adc-backend-api7/tests/e2e_sync_and_dump_1.rs
  • rust/crates/adc-cli/src/pipeline.rs
  • rust/crates/adc-cli/src/config.rs
  • rust/crates/adc-backend-api7/tests/timeout.rs
  • rust/crates/adc-backend-api7/tests/validator.rs
  • rust/crates/adc-backend-api7/tests/common/mod.rs

Comment thread rust/crates/adc-backend-api7/src/default_value.rs
Comment thread rust/crates/adc-sdk/src/resources/common.rs Outdated
Comment thread rust/crates/adc-sdk/src/resources/upstream.rs
@bzp2010
bzp2010 merged commit b110bfa into rust-next Aug 5, 2026
38 of 39 checks passed
@bzp2010
bzp2010 deleted the bzp/feat-rust-backend-api7 branch August 5, 2026 19:39
@coderabbitai coderabbitai Bot mentioned this pull request Aug 6, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test/api7 Trigger the API7 test on the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant