feat(core): align schema and backend health check config - #557
Conversation
📝 WalkthroughWalkthroughThe change updates health-check schemas and backend types, adds explicit bidirectional header mappings for API7 and APISIX, and adds transformation coverage. It also updates selected package and workspace dependency versions. ChangesHealth-check mapping
Tooling updates
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@libs/backend-api7/src/transformer.ts`:
- Around line 261-280: Update FromADC.transformService to pass inline
service.upstream through this.transformUpstream instead of casting it directly,
ensuring active check fields such as http_req_headers map to req_headers
consistently. Add a service-level regression test covering an inline upstream
with active check request headers and verify the transformed API7 output.
In `@libs/backend-apisix-standalone/src/operator.ts`:
- Around line 483-504: Validate the `opts.server` URL in the operator
initialization or `sync()` path before constructing or sending `newConfig` to
`${server}${ENDPOINT_CONFIG}`. Reject any server URL whose protocol is not
HTTPS, and do not send the configuration when validation fails; leave redirect
behavior unchanged.
🪄 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: 822bc74e-12b0-4ced-bca7-da10cf4af402
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (16)
libs/backend-api7/src/transformer.tslibs/backend-api7/src/typing.tslibs/backend-api7/test/transformer.spec.tslibs/backend-apisix-standalone/src/operator.tslibs/backend-apisix-standalone/src/transformer.tslibs/backend-apisix-standalone/src/typing.tslibs/backend-apisix-standalone/test/operator.spec.tslibs/backend-apisix-standalone/test/transformer.spec.tslibs/backend-apisix/src/transformer.tslibs/backend-apisix/src/typing.tslibs/backend-apisix/test/transformer.spec.tslibs/converter-openapi/package.jsonlibs/sdk/src/core/schema.tspackage.jsonpnpm-workspace.yamlschema.json
There was a problem hiding this comment.
🧹 Nitpick comments (1)
libs/backend-api7/test/transformer.spec.ts (1)
90-104: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a meaningful result variable.
Rename
outtotransformedService. The current name does not identify the value under test.As per coding guidelines, test variable names must be meaningful.
Proposed change
- const out = new FromADC().transformService({ + const transformedService = new FromADC().transformService({ ... - expect(out.upstream?.checks).toEqual({ + expect(transformedService.upstream?.checks).toEqual({🤖 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 `@libs/backend-api7/test/transformer.spec.ts` around lines 90 - 104, Rename the result variable `out` in the `FromADC().transformService` test to `transformedService`, and update the subsequent `expect` reference to use the new meaningful name.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@libs/backend-api7/test/transformer.spec.ts`:
- Around line 90-104: Rename the result variable `out` in the
`FromADC().transformService` test to `transformedService`, and update the
subsequent `expect` reference to use the new meaningful name.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: e3691550-b8be-47bb-8c88-3031b72aa38f
📒 Files selected for processing (2)
libs/backend-api7/src/transformer.tslibs/backend-api7/test/transformer.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- libs/backend-api7/src/transformer.ts
Description
ADC uses a rigid schema definition that doesn’t align well with the APISIX schema, and since the backend passes these through without conversion, some fields are incorrectly configured in the backend.
This PR aligns with the new fields in the APISIX health checker, such as
http_req_bodyandhttp_method; it also updates the transformers on the backend so that field names are correctly converted to the names required by the backend.The #541 implemented a fix, but it only covers
req_headersand does not include other new configuration items; moreover, it takes the approach of having the ADC adapt to the APISIX schema, which is not ideal.The ADC determines its own schema and will never be forced to modify the schema due to external changes. The schema it defines is converted to the various backends on a best-effort basis.
We consider transform errors to be bugs, but schema inconsistencies are not.
Checklist
Note:
upstream.checks.active.http_request_headers=>upstream.checks.active.http_req_headers, since it never worked before anyway, it's no big problem.Summary by CodeRabbit
New Features
PURGEHTTP method where applicable.Bug Fixes