Skip to content

[Docs][Zeta] Add OpenAPI contract for two REST v2 read endpoints - #12856

Merged
davidzollo merged 6 commits into
apache:devfrom
goutamadwant:improve/rest-v2-openapi
Nov 6, 2026
Merged

davidzollo merged 6 commits into
apache:devfrom
goutamadwant:improve/rest-v2-openapi

Conversation

@goutamadwant

Copy link
Copy Markdown
Collaborator

Purpose of this pull request

This contribution adds an initial OpenAPI 3.1 contract for the existing GET /overview and GET /resource/workers Zeta REST v2 endpoints.
It addresses the first-delivery scope discussed in #11072; the issue remains open for the other endpoints and any later client-generation work.

The contract describes the current response field types, free-form worker-tag query keys, optional Basic authentication, and the unavailable worker snapshot. A test keeps these two documented paths and methods aligned with RestConstant, JettyService, their GET handlers, and serialized response fields. The existing HTTP integration test also exercises both routes through Jetty. English and Chinese REST v2 documentation links point to the same maintained YAML file.

The only added dependency is the already version-managed Jackson YAML parser in test scope, so the contract check can parse the document structurally. No production REST handler, response, or runtime dependency changes.

Does this PR introduce any user-facing change?

Yes. Consumers can download a machine-readable contract for these two read-only operations from the REST v2 documentation and use it with OpenAPI tooling. The existing endpoints and their wire behavior are unchanged. The contract does not claim coverage of other REST v2 routes.

How was this patch tested?

  • RestApiHttpBasicTest, TestOpenApiV2RouteSync, and WorkerResourceServletTest: 9 tests passed on JDK 11 and 9 on JDK 17. The live Jetty test checks response shapes, tag filtering, and Basic-auth behavior.
  • The touched module's JDK 17 verify build passed with tests skipped; the focused tests above were run separately.
  • The YAML passed OpenAPI 3.1 schema validation and OpenAPI Generator 7.26.0 validation. A generated Python client smoke check passed for both operations, tag-query serialization, and representative response parsing.
  • The SeaTunnel website sync and English/Chinese production builds passed. Each rendered documentation link resolves to a YAML asset identical to the source file.

Repository-wide offline verify could not complete because the local Maven cache lacks the Debezium DB2 artifact. The full test suite, other language generators, and upstream CI have not been run.

Check list

  • If any new Jar binary package adding in your PR, please add License Notice according to the New License Guide. Not applicable; no binary JAR was added.
  • If necessary, please update the documentation to describe the new feature. Updated the English and Chinese REST v2 documentation.
  • If necessary, please update incompatible-changes.md to describe the incompatibility caused by this PR. Not applicable; no existing behavior changes.
  • If you are contributing the connector code, please check that the following files are updated. Not applicable; no connector code changes.
    1. Update plugin-mapping.properties and add new connector information in it.
    2. Update the pom file of seatunnel-dist.
    3. Add ci label in label-scope-conf.
    4. Add e2e testcase in seatunnel-e2e.
    5. Update connector plugin_config.

@DanielLeens DanielLeens 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.

Review Report

Scope

Yes — this review covers the Apache SeaTunnel Zeta REST v2 OpenAPI contract, its route-synchronization tests, and the accompanying documentation changes.

Verification

  • Reviewed the PR head 52cce86e7c8e0ee537bfb0c9b04ae8419cb89edb against the current dev base.
  • Inspected the changed Java, Maven, English and Chinese documentation files.
  • The required Build check is failing. Its Code style job rejects two unshaded Jackson imports, and its Dead links job rejects the newly added Chinese documentation link.
  • No local build was run; the failure details are reproduced from the PR's CI logs and corroborated by source inspection.

Findings

High

  1. Use the shaded Jackson classes in RestApiHttpBasicTest.
    seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/rest/RestApiHttpBasicTest.java:39-40 imports com.fasterxml.jackson.databind.JsonNode and ObjectMapper. The repository's ImportClassCheckTest rejects those imports and explicitly requires the org.apache.seatunnel.shade. prefix, so the Code style job fails. Replace both imports with org.apache.seatunnel.shade.com.fasterxml.jackson.databind.* and rerun the style check.

  2. Use a repository-relative link in the Chinese REST v2 page.
    docs/zh/engines/zeta/rest-api-v2.md:88 links to @site/docs/engines/zeta/openapi-v2.yaml. The Dead links job reports this URL as HTTP 400 on both attempts, which keeps the Build check red. The English page's sibling link, (openapi-v2.yaml), resolves correctly; use that relative link (or another form accepted by the repository's link checker) in the Chinese page as well.

Medium

  1. Limit the newly added Jackson dependency to test scope.
    seatunnel-engine/seatunnel-engine-server/pom.xml:59-62 adds seatunnel-shade-jackson without a scope even though the new use is confined to test sources. Adding <scope>test</scope> avoids needlessly changing the server module's runtime dependency and packaging surface.

Low

No additional low-severity concerns found.

Required Fixes

  1. Replace the two unshaded Jackson imports with the SeaTunnel-shaded imports.
  2. Correct the Chinese OpenAPI link so the dead-link check passes.
  3. Declare the newly introduced Jackson dependency with test scope.

Suggested Tests

  • Run the Code style check that includes ImportClassCheckTest.
  • Run the dead-link check for both REST v2 Markdown pages.
  • Run the focused server REST test suite covering RestApiHttpBasicTest and TestOpenApiV2RouteSync.

Runtime Before/After

Before: the advertised OpenAPI artifact and new response assertions are present, but the PR cannot pass mandatory CI because it imports unshaded Jackson classes and introduces an invalid Chinese documentation link.

After: the tests use SeaTunnel's shaded Jackson API, both localized documentation links resolve, and the dependency remains test-only; the OpenAPI contract can then be validated by the existing synchronization tests without widening the server runtime surface.

Backward Compatibility

The proposed corrections preserve the public REST endpoints and documentation contract. Restricting the dependency to test scope avoids an unnecessary production classpath change.

Risks

Without these fixes, the required Build check remains red and the server module gains an unnecessary runtime dependency. Using unshaded Jackson also violates the repository's shading rule.

Review Status

Changes requested — please address the two CI-blocking High findings and the test-scope dependency before merge.

Remaining Concerns

After the fixes, rerun the required Build workflow and verify the OpenAPI synchronization and REST authentication tests on the updated head.

@goutamadwant goutamadwant self-assigned this Oct 18, 2026
@goutamadwant

Copy link
Copy Markdown
Collaborator Author

Thanks @DanielLeens I missed those imports and they are fixed now, the checker resolves the @site link, and I removed the redundant Jackson dependency since the server already inherits it. Pls have another look at this.

@DanielLeens DanielLeens 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.

Thanks for the quick update, @goutamadwant, and for the clear reply. I re-reviewed the latest head (49e867e2, three commits on top of dev) against my earlier review and I can confirm all three of my earlier findings are resolved.

What Problem Does This PR Solve?

Issue #11072 asks for a machine-readable contract for the Zeta REST v2 API. This PR delivers the first slice: an OpenAPI 3.1 file for GET /overview and GET /resource/workers, English/Chinese doc links to it, and tests that keep the spec aligned with the real servlet registrations and serialized responses. No production code changes.

1. Code Change Review

1.1 Core logic

  • docs/en/engines/zeta/openapi-v2.yaml describes the two operations. I cross-checked it against the source: RestConstant.REST_URL_OVERVIEW = "/overview" and REST_URL_WORKER_RESOURCES = "/resource/workers" (RestConstant.java:85,99), and OverviewServlet.doGet writes count fields as strings (matching the DecimalCountString schema) and takes free-form tag filters through getParameterMap(req), which matches the documented style: form / explode: true tag query.
  • TestOpenApiV2RouteSync parses the YAML and checks it against RestConstant, JettyService servlet registration and real Gson/JsonUtils serialization of OverviewInfo, WorkerResourceSnapshot and WorkerResourceDiagnostic. If someone adds, renames or retypes a response field, this test turns red, which is exactly the drift protection a hand-written contract needs.
  • RestApiHttpBasicTest#testDocumentedReadOnlyEndpoints exercises both routes through Jetty (401 + WWW-Authenticate: Basic, 200 JSON shapes, tag filtering, snapshot availability via Awaitility). WorkerResourceServletTest adds the unavailable-snapshot case.
  • .dlc.json adds a @site/docs/ replacement so the dead-link checker resolves the Chinese page link.

Verified on the previous findings:

  1. Shaded Jackson: RestApiHttpBasicTest and TestOpenApiV2RouteSync now import org.apache.seatunnel.shade.com.fasterxml.jackson... (fixed).
  2. Chinese dead link: fixed via the .dlc.json replacement; the Dead links job is green on the fork run.
  3. Dependency scope: the pom.xml change was dropped entirely (git diff origin/dev...HEAD shows no pom changes), so there is no new runtime dependency (fixed, and a cleaner solution than the one I suggested).

1.2 Compatibility

Fully compatible. Only docs and test sources change; no REST handler, response format or dependency changes.

1.3 Performance / side effects

None at runtime. The new IT test adds one Jetty round trip set plus an Awaitility wait of at most 30 s, which is acceptable.

1.4 Error handling / logging

Nothing to raise. Assertions carry the path or field name as the message, which makes failures easy to diagnose.

No blocking issues found.

2. Code Quality Assessment

2.1 Coding standards

Apache headers are present on the new files, no wildcard imports, shaded Jackson is used, and the test class has a clear purpose. Comments are adequate for test code.

2.2 Test coverage

Good and meaningful: contract-vs-source sync plus live HTTP behavior. Stability rating: Stable (no existing assertion was weakened; changes are additive).

2.3 Docs

docs/en and docs/zh REST v2 pages both link to the spec and state clearly that only two endpoints are covered.

3. Architectural Soundness

Keeping the spec next to the docs with a source-driven sync test is a sensible incremental start for #11072, and it does not touch runtime code.

4. Issue Summary

# Severity Status
Unshaded Jackson imports High Fixed
Chinese dead link High Fixed
Dependency scope Medium Fixed (dependency removed)

5. Merge Recommendation

CI state of head 49e867e2: Code style, Dead links and all four unit-test jobs pass on the fork run. The remaining red jobs are integration-test containers that this PR cannot influence (it only touches docs and engine-server test sources): SplitClusterFaultToleranceIT in engine-v2-it, TestSparkDateTimeTransformIT, HbaseIT, FlinkMetricsIT and the mysql-cdc group (container/precondition failures). Please re-run the failed jobs; no change to this PR should be needed.

Conclusion: Ready to merge

Blocking: none from the code side (only the unrelated CI re-run above). Non-blocking: none. Thank you for the thorough work!

Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>

@DanielLeens DanielLeens 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.

Thanks for keeping the branch current, @goutamadwant. I re-reviewed the PR from scratch at head 49bd43dc3. The new commit is a merge of dev (9ab97e15f) into the branch; the PR's own diff against dev is still the same 7 files (+537, no deletions) that I reviewed at 49e867e2, and the merge brings in only upstream changes. I also re-checked the contract against the newer dev code it now builds on (#12595 for Basic-auth comparison and the Application Mode work in #12460): BasicAuthFilter still sets WWW-Authenticate: Basic before the 401, and JettyService still registers OverviewServlet and WorkerResourceServlet under REST_URL_OVERVIEW / REST_URL_WORKER_RESOURCES, so the spec and the tests still describe current behavior.

Sorry for missing this in the last review: on a fresh pass I found one small, non-blocking maintainability point in TestOpenApiV2RouteSync (Issue 1 below). It is a carryover from the earlier head, not something introduced by this push.

What Problem Does This PR Solve?

  • User pain point: Zeta REST v2 has no machine-readable contract, so clients for it are hand-written (#11072).
  • Fix approach: add an OpenAPI 3.1 file for GET /overview and GET /resource/workers, link it from the en/zh REST v2 pages, and add tests that keep the spec in sync with the route registrations and the real serialized responses.
  • One-sentence summary: a first, test-guarded OpenAPI slice for two read-only REST v2 endpoints, with no production code change.

1. Code Change Review

1.1 Core Logic Analysis

Changed files: docs/en/engines/zeta/openapi-v2.yaml (new), docs/en|zh/engines/zeta/rest-api-v2.md (one paragraph each), .dlc.json (@site/docs/ replacement for the link checker), TestOpenApiV2RouteSync (new), RestApiHttpBasicTest#testDocumentedReadOnlyEndpoints (new case), WorkerResourceServletTest (unavailable-snapshot case).

TestOpenApiV2RouteSync
  -> parse openapi-v2.yaml (shaded YAMLMapper)
  -> regex over RestConstant.java / JettyService.java source text -> path constant -> servlet class
  -> serialize OverviewInfo (JsonUtils) and WorkerResourceSnapshot (Gson) -> compare field names, required, JSON types
RestApiHttpBasicTest#testDocumentedReadOnlyEndpoints
  -> real Jetty: 401 + WWW-Authenticate for both routes, 200 JSON shapes, tag filter, snapshot via Awaitility (max 30 s)

The normal request path is not changed at all; the tests read it. Adding, renaming or retyping a response field turns responseSchemasMatchCurrentSerializedFields red, which is the right drift protection for a hand-written spec.

1.2 Compatibility Impact

Fully compatible. Only docs, link-checker configuration and test sources change; no REST handler, response format, config or dependency changes (the earlier pom.xml change was removed).

1.3 Performance / Side-Effect Analysis

No runtime impact. The new IT case adds a few local HTTP round trips with explicit 10 s connect/read timeouts and one Awaitility wait of at most 30 s. The .dlc.json replacement is global, but no other @site/docs/ link exists in docs/ today, so it affects only the new Chinese link.

1.4 Error Handling and Logging

Assertions carry the path or field name as the message. Nothing to raise here.

Issue 1: Route-sync test depends on the exact source-text shape of JettyService and on the working directory

  • Location: seatunnel-engine/seatunnel-engine-server/src/test/java/org/apache/seatunnel/engine/server/rest/TestOpenApiV2RouteSync.java:52-63, :97
  • Problem: the test finds route registrations by applying regexes to the text of JettyService.java (new ServletHolder(new X( assigned to a local, then context.addServlet(holder, convertUrlToPath(REST_URL_...))), and it opens src/main/java/... and ../../docs/en/... relative to the current working directory.
  • Risk: a harmless refactor of JettyService (for example registering through a helper method or a loop) makes the test fail with a generic assertEquals map mismatch that does not explain why, and running the test from an IDE whose working directory is not the module root fails with a missing-file error. Neither affects production; it is a maintenance cost for future REST changes.
  • Best improvement: add an assertion message that tells the reader what to update (for example "update TestOpenApiV2RouteSync patterns or openapi-v2.yaml when JettyService registration changes"), and resolve the paths from the basedir system property that Surefire sets, falling back to the current directory. Optional; the live RestApiHttpBasicTest case already covers the routes at runtime.
  • Severity: Low
  • Raised by another reviewer: No

2. Code Quality Assessment

2.1 Coding Standards

ASF headers on the new files, shaded Jackson imports (as @nzw921rx suggested and you applied), no wildcard imports, and the spec's description fields explain scope and auth clearly.

2.2 Test Coverage and Test Stability

Good and meaningful: spec-vs-source sync plus live HTTP behavior, and the unavailable-snapshot case in WorkerResourceServletTest. No existing assertion was weakened; all changes are additive. Stability rating: Stable. The new case lives in a class that already uses the fixed port 18081 (pre-existing), and it bounds every HTTP call with explicit timeouts and the snapshot wait with Awaitility, so it does not add hang risk.

2.3 Documentation Updates

Both docs/en and docs/zh REST v2 pages link to the spec and state clearly that only two endpoints are covered. The Chinese page uses @site/docs/... because the YAML exists only under docs/en, and the .dlc.json replacement makes the dead-link check resolve it.

3. Architectural Soundness

3.1 Elegance

Precise, incremental first step for #11072.

3.2 Maintainability

Keeping the spec next to the docs with a source-driven sync test is sound; Issue 1 is the only maintainability note.

3.3 Extensibility

Further endpoints can be added by extending COVERED_ROUTES and the schema checks.

3.4 Historical-Version Compatibility

Not applicable: no wire behavior, config or persisted format changes.

4. Issue Summary

Number Issue Location Severity
1 Route-sync test is coupled to JettyService source-text shape and working directory TestOpenApiV2RouteSync.java:52-63, :97 Low

5. Merge Recommendation

CI for head 49bd43dc3: the apache-side Build pointer is in progress. In your fork run (run 40064259416), changes, Code style, Dead links and License header are green, and the remaining jobs (including unit-test, where the new tests run) have not started yet. The branch is 0 commits behind dev and has no conflicts.

Conclusion: Ready to merge

  1. Blockers - must be fixed
    • None on the code side. Please let Build finish green on this head; unit-test is the key evidence for the new tests.
  2. Recommended fixes - non-blocking
    • Issue 1 (Low), at your discretion.

Overall assessment: No blocking issues found. Residual risk is limited to the pending CI result and the small test-maintenance point above. Thank you for the careful, well-scoped contribution!

Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>

@davidzollo davidzollo 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.

+1 if CI passes.
LGTM, thanks for your work and keep up the good effort!

@DanielLeens DanielLeens 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.

Thanks for the quick follow-up, @goutamadwant, and for acting on the one open note from my last pass. I re-reviewed the full diff at head 6fb24efe4 (6 PR commits on top of dev). Compared with 49bd43dc3, which I reviewed last, the only new change is one commit touching TestOpenApiV2RouteSync.java; I re-verified the call chain against that head. Review is by code reading only, nothing was executed locally.

What Problem Does This PR Solve?

  • User pain point: Zeta REST v2 has no machine-readable contract, so clients are hand-written (#11072).
  • Fix approach: add an OpenAPI 3.1 file for GET /overview and GET /resource/workers, link it from the EN/ZH REST v2 pages, and add tests that keep the spec aligned with the real servlet registrations and serialized responses.
  • One-sentence summary: a first, test-guarded OpenAPI slice for two read-only REST v2 endpoints with no production code change.

1. Code Change Review

1.1 Core Logic Analysis

Changed files: docs/en/engines/zeta/openapi-v2.yaml (new), EN/ZH rest-api-v2.md (one paragraph each), .dlc.json (@site/docs/ replacement for the link checker), TestOpenApiV2RouteSync (new), RestApiHttpBasicTest#testDocumentedReadOnlyEndpoints, and WorkerResourceServletTest (unavailable-snapshot case).

What the new commit changes (this resolves my previous Issue 1):

// before
private static final Path SOURCE = Path.of("src/main/java/org/apache/seatunnel/engine/server");
private static final Path SPEC = Path.of("../../docs/en/engines/zeta/openapi-v2.yaml");
assertEquals(COVERED_ROUTES, registeredClasses);
// after
private static final Path MODULE_DIR = Path.of(System.getProperty("basedir", ".")).toAbsolutePath().normalize();
private static final Path SOURCE = MODULE_DIR.resolve("src/main/java/...");
private static final Path SPEC = MODULE_DIR.resolve("../../docs/en/engines/zeta/openapi-v2.yaml").normalize();
assertEquals(COVERED_ROUTES, registeredClasses, "JettyService route registrations changed: update TestOpenApiV2RouteSync patterns or openapi-v2.yaml ...");

Surefire exports basedir to the forked JVM, and the fallback . keeps the previous behavior, so running from the module root and from an IDE both resolve the same files. The assertion message now tells the next maintainer what to update.

Runtime path (tests only, production path untouched):

TestOpenApiV2RouteSync
  -> parse openapi-v2.yaml (shaded YAMLMapper)
  -> regex over RestConstant.java / JettyService.java text -> path constant -> servlet class
  -> serialize OverviewInfo / WorkerResourceSnapshot -> compare field names, required, JSON types
RestApiHttpBasicTest#testDocumentedReadOnlyEndpoints
  -> real Jetty: 401 + WWW-Authenticate for both routes, 200 JSON shapes, tag filter, snapshot via Awaitility

I re-checked on the current head that JettyService still registers OverviewServlet and WorkerResourceServlet under REST_URL_OVERVIEW / REST_URL_WORKER_RESOURCES, so the spec and tests still describe real behavior.

1.2 Compatibility Impact

Fully compatible. Only docs, link-checker configuration and test sources change; there is no REST handler, response format, config or dependency change.

1.3 Performance / Side-Effect Analysis

No runtime impact. The new IT case adds a few local HTTP round trips with explicit timeouts and one Awaitility wait of at most 30 s. The .dlc.json replacement is global, but no other @site/docs/ link exists in docs/ today.

1.4 Error Handling and Logging

No blocking issues. Assertions carry the path or field name, and the route-sync failure message is now actionable.

Issue 1 (Low): PR description is stale about the dependency

  • Location: PR description, "Purpose" section
  • Problem: it still says a Jackson YAML parser is added in test scope, but the PR has no pom.xml change (the test uses the shaded Jackson already inherited by the module).
  • Risk: confuses reviewers and release-note readers.
  • Best fix: delete that sentence from the description. Non-blocking.
  • Raised by another reviewer: No

2. Code Quality Assessment

2.1 Coding Standards

ASF headers on new files, shaded Jackson imports (as @nzw921rx suggested), no wildcard imports. Comments are adequate for test code.

2.2 Test Coverage and Test Stability

Spec-vs-source sync plus live HTTP behavior; all changes are additive and no existing assertion was weakened. Stability rating: Stable. The new case lives in a class that already uses a fixed port (pre-existing), and every HTTP call and the snapshot wait are bounded.

2.3 Documentation Updates

Both docs/en and docs/zh REST v2 pages link to the spec and say that only two endpoints are covered.

3. Architectural Soundness

3.1 Elegance

Precise, incremental first step for #11072.

3.2 Maintainability

A source-driven sync test next to the docs is sound, and the path/message hardening in this commit removes the main maintenance sharp edge.

3.3 Extensibility

More endpoints can be added by extending COVERED_ROUTES and the schema checks.

3.4 Historical-Version Compatibility

Not applicable: no wire behavior, config or persisted-format changes.

4. Issue Summary

Number Issue Location Severity
1 PR description still mentions a test-scope YAML dependency that is no longer in the diff PR description Low

Previous Issue 1 (route-sync test coupled to working directory / opaque failure message): fixed in 6fb24efe4.

5. Merge Recommendation

Conclusion: Ready to merge

Blockers (must fix): none from the code side.
Recommended fixes (non-blocking): Issue 1 (description wording).

Overall assessment: no blocking issue is left. @davidzollo has already approved this head ("+1 if CI passes"). CI for 6fb24efe4: the apache-side Build check is pending and the fork run (40160824244) is still queued, so the new commit has not run unit-test yet. The only remaining gate is a green Build on this head; the branch has no conflicts, and no sync is needed unless an unrelated failure shows up.

Thanks again for the careful, well-scoped contribution!

@DanielLeens DanielLeens 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.

Thanks for the update, @goutamadwant. I re-reviewed all seven changed files at 6fb24efe4b0019c031830b6947f6f322c33873ed against the actual servlet, service, authentication, and serialization paths. The earlier route-test path/message suggestion is addressed. I found no blocking issue; current-head Build is queued.

What problem this PR solves

  • User pain: REST v2 consumers lack a machine-readable contract for even the basic overview/resource reads.
  • Fix approach: Describe two existing GET endpoints in OpenAPI 3.1, link the contract in both languages, and guard routes/response shapes with tests.
  • One-line summary: Add an incremental, implementation-backed contract without changing server behavior.

Example: the overview returns counts as JSON strings, while the resource snapshot uses numeric slot counts. A generated client must model those existing wire types differently; the spec does so.

1. Code-change review

1.1 Core logic analysis

The full diff is +545/-0, with no production Java or POM changes. Before there was no OpenAPI file; after, the new contract describes only /overview and /resource/workers, explicitly leaving other endpoints outside its scope.

HTTP request with configured context path
  -> JettyService route registration and optional BasicAuthFilter
      -> unauthorized: 401 plus WWW-Authenticate
      -> OverviewServlet.doGet():49 onward
          -> all query keys/values become worker-tag filters
          -> OverviewService / GetOverviewOperation
          -> OverviewInfo -> JsonUtils map -> Hazelcast JsonObject -> JSON strings
      -> WorkerResourceServlet.doGet():49 onward
          -> WorkerResourceService: local master or forwarded master read
          -> transient master absence/failure: available=false, empty workers
          -> BaseServlet.writeJson(Object):49-52 -> Gson numeric/boolean fields

Key findings:

  1. The specification follows the ordinary existing request paths; it introduces no new endpoint or task lifecycle.
  2. The exploded form object for tags describes flat region=west&team=data keys, not a literal tags parameter. Job totals remain cluster-wide.
  3. Overview count strings and worker primitive/optional boxed-number fields match their distinct serializers. Gson omits null optional resource fields.
  4. An unavailable resource projection remains a delivered HTTP 200 snapshot with available=false; 401 and variable 500 bodies are described separately.
  5. Optional Basic authentication and configurable scheme/host/port/context path are stated accurately. The example listener is not presented as a universal deployment address.

1.2 Compatibility impact

Fully compatible. API responses, configuration/defaults, protocols, serialized job/checkpoint state, and existing client behavior are unchanged. No migration or incompatible-change entry is needed. This documents existing semantics rather than redesigning status codes or adding pagination.

1.3 Performance and side effects

No production CPU, memory/GC, network, lock, concurrency, retry, idempotency, or resource ownership change. Tests add bounded local HTTP requests and a conditional snapshot wait. The global link-checker replacement maps the new @site/docs reference into the English source tree; its scope deserves retention when other such links are added.

1.4 Error handling, logging, and formal issues

The new tests check 401 challenges, authenticated 200/content type, field types, tag filtering, and successful delivery of an unavailable snapshot. They do not suppress failures or log credentials. The OpenAPI error descriptions avoid promising a uniform body the server does not provide.

No blocking issue found. Earlier Issue 1 is resolved: TestOpenApiV2RouteSync.java:52-56 uses Surefire's basedir with a fallback, and its registration-map assertion now names the patterns/spec that need updating. Regex/source-shape coupling remains an explicit maintenance tradeoff, backed by the live HTTP test; it is not an API defect.

2. Code quality assessment

2.1 Coding conventions

New files have ASF headers and the tests use shaded Jackson/YAML classes. +1 to @nzw921rx's earlier dependency point: the redundant POM addition is absent, and this head reuses the existing shaded dependency. No production core method or field is introduced. Static git diff --check upstream/dev...HEAD is clean; no local formatter, compiler, tests, server, or HTTP execution was run.

2.2 Test coverage and stability

TestOpenApiV2RouteSync checks both registered servlet classes and exact documented paths, then compares actual serialization fields, required entries, and basic JSON types. It is a targeted drift guard, not a complete OpenAPI schema validator or a generated-client interoperability test.

The existing RestApiHttpBasicTest.java:136-224 exercises both real routes, 401/authenticated responses, tag filtering, and a resource snapshot via Awaitility. WorkerResourceServletTest.java:61-76 adds the unavailable case. Existing assertions are retained.

Stability rating: Stable for the changed structure. File reads resolve from the module base, collection comparisons ignore ordering, fixtures use fixed serialization values, HTTP calls have 10-second connect/read bounds, and snapshot readiness uses a condition with a 30-second limit. The existing fixture's fixed HTTP port 18081 remains an environmental limitation; this change neither adds another listener nor proves that collision risk disappears. Connections are disconnected in finally blocks.

The exact-head fork Build 40160824244 is queued. Current-head unit-test execution is still required for the new tests; queued is not passed.

2.3 Documentation

Both REST pages identify the two-endpoint scope and deployment/authentication configuration. The Chinese page links to the single English-tree YAML with the @site alias; .dlc.json supplies the checker mapping. A separate duplicate YAML in the Chinese tree is unnecessary. No undocumented write-operation or security guarantee is added.

3. Architectural assessment

3.1 Solution quality

A focused first contract slice, preserving the existing wire behavior.

3.2 Maintainability

Source/serialization checks plus live servlet tests provide complementary drift protection. Future route refactors must update the explicit source patterns when necessary.

3.3 Extensibility

Additional endpoints can extend COVERED_ROUTES and schemas incrementally; current coverage is deliberately not advertised as complete REST v2 coverage.

3.4 Historical compatibility

No historical runtime or persisted-format change. Existing clients continue to receive the same response types.

4. Issue summary

Number Issue Location Severity
— No remaining formal issue; earlier path/diagnostic suggestion addressed TestOpenApiV2RouteSync.java:52-56,102-106 —

5. Merge conclusion

Conclusion: Can merge after the remaining CI and approval gates pass

  1. Blocking items: No source/contract correction required from Daniel's review. Obtain a successful exact-head Build, including the new unit/HTTP tests.
  2. Suggested fixes, non-blocking: None added; retain the documented source-pattern maintenance boundary.

I agree with @davidzollo's existing CI-conditioned approval after this independent contract review, and the earlier shaded-dependency request is satisfied. The branch is ahead by 5 and behind by 8 (diverged) with no conflict. A queued current-head Build and branch drift do not establish an unrelated upstream failure, so another sync-first request is unwarranted.

Overall this is ready for maintainer review once CI is usable. No larger API redesign is needed for the two documented reads. Daniel's READ permission means this COMMENT records technical clearance and cannot substitute for a write-capable maintainer's effective approval/dismissal. Thank you for keeping the contract aligned with the actual serializers.

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks for the contribution. The CI fact cited in my previous conclusion has changed; this follow-up updates that gate on the unchanged reviewed head, without issuing another full source review.

Gate snapshot (2026-10-28T15:54:14+00:00), head 6fb24efe4b0019c031830b6947f6f322c33873ed: Build is FAILURE.

The blocking jobs are Run / engine-v2-it (11, ubuntu-latest) failure.

Observed log evidence: BackpressureSlowSinkIT.testCheckpointsKeepCompletingUnderSustainedBackpressure:247 expected at least 3 additional checkpoints to complete during the 90s sustained backpressure window, only observed 2 (samples=[1, 2, 2, 3, 3, 3, 3, 3, 3]) ==> expected: <true> but was: <false> Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.22.2:verify (default) on project connector-seatunnel-e2e-base: There are test failures.

Please inspect or rerun only the named failed job where a rerun is appropriate. The logs establish the failing stage, but do not alone establish whether the current PR caused it. No matching upstream cure has been proved by this follow-up; a base sync alone is not a verified resolution, so no unrelated module/dependency patch is requested.

My previous source conclusion remains clear for the reviewed scope. CI is not being passed by inference, and this follow-up is not an effective approval.

Comparison recorded in this scan: base dev, diverged, ahead 5 / behind 54, no merge conflict. Branch drift is metadata here and is not an additional sync request.

Signed-off-by: Goutam Adwant <workwithgoutam@gmail.com>

@DanielLeens DanielLeens 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.

Thanks for keeping the contract explicitly limited to the two read endpoints. The rebased head remains aligned with the registered routes and current serializers, and current-head CI is successful.

What Problem Does This PR Solve?

User pain point: Clients lack a machine-readable description of the overview and worker resource reads, including their different count representations and unavailable-snapshot behavior.

Fix approach: Add one OpenAPI 3.1 YAML, bilingual documentation links, source/serialization drift checks and assertions in the existing authenticated HTTP tests.

One-sentence summary and example: Overview counts are JSON strings such as "2"; worker slot counts are JSON integers, and an unavailable worker snapshot is still delivered with HTTP 200 and available=false.

1. Code Change Review

1.1 Core Logic Analysis

JettyService registers OverviewServlet and WorkerResourceServlet at the documented constants under the configured context path. Overview uses the existing JsonUtils map -> Hazelcast JsonObject conversion and writeJson overload; worker snapshots use the Gson object overload. Overview passes arbitrary query key/value pairs as worker tags. WorkerResourceService serves locally on the master or forwards there and returns an unavailable snapshot for the defined transition failures. No production Java code changes.

Before:

// Existing read endpoints have human-readable documentation only.

After:

// Same routes and wire responses, plus OpenAPI YAML and drift/HTTP assertions.

Key Findings

  • The contract covers only GET /overview and GET /resource/workers.
  • String overview counts and typed worker resource fields match their distinct serialization paths.
  • Authentication is deployment-dependent; the example server is explicitly configurable.
  • Optional worker resource fields match nullable DTO fields omitted by Gson.
  • The route test is a targeted drift guard, not full schema or generated-client certification.

Complete runtime path

HTTP -> configured Jetty context/authentication -> registered GET servlet
Overview -> query tag map -> OverviewService/GetOverviewOperation -> JsonObject -> JSON
Workers -> WorkerResourceService -> local or master-forwarded snapshot -> Gson -> JSON
Tests -> source route/constant patterns + real DTO serialization + live HTTP response assertions

The form/explode object parameter represents free-form tag query keys rather than a literal tags key. Worker/slot counts are tag-filtered while job counts are cluster-wide. The YAML distinguishes unavailable content from transport failure and avoids a false uniform error-body promise.

1.2 Compatibility Impact

Fully compatible. This documents existing behavior. No route, response, option/default, authentication policy, public Java API or checkpoint format changes. No migration is needed.

1.3 Performance / Side-Effect Analysis

No production execution cost. Tests add bounded local requests, YAML/source reads and fixed DTO serialization.

1.4 Error Handling and Logging

The contract lists 401 and 500 without inventing a common error envelope. HTTP tests close connections in finally and have connect/read timeouts. Unavailable snapshot serialization is directly asserted.
No blocking source issues found. No numbered source findings remain for this head.

2. Code Quality Assessment

2.1 Coding Standards

ASF headers and existing shaded Jackson/YAML dependencies are used. Source regexes are explicit and report a useful registration-drift diagnostic. basedir resolves the module-relative source/spec paths.

2.2 Test Coverage and Test Stability

Test stability: Stable for the added structure. Fixed DTO values and set comparisons avoid ordering assumptions. Existing authenticated HTTP tests assert 401 challenges, JSON field types, tag filtering and condition-based resource readiness with a 30-second bound; requests have 10-second network bounds. The fixture's existing fixed port 18081 remains an environmental collision risk, not a newly added listener. Source-pattern coupling is a maintenance limitation backed by the live-route assertions. The checks do not execute a generated client or fully validate all OpenAPI constraints.

Local analysis: fetched the head, created independent branch seatunnel-review-12856, read the complete 7-file diff and traced affected callers with git show/git grep. No local compilation, unit tests, integration tests, E2E, containers, or job execution was performed, as requested. These are source-analysis conclusions; execution evidence is the current-head CI below.

2.3 Documentation Updates

Both REST pages identify the limited scope, configurable listener/context and optional authentication. The Chinese page links to the single canonical YAML via @site; .dlc.json maps that alias to the English source tree for link checking. Duplicating the YAML would create avoidable drift.

3. Architectural Soundness

3.1 Elegance of the Solution

Precise fix. The contract belongs beside the servlet documentation and actual response tests. The smallest safe slice and best approach coincide; broad endpoint generation or response normalization would change scope and compatibility.

3.2 Maintainability

Maintain explicit covered routes, actual serialization fields and live HTTP assertions together. Route-source refactors may require updating the regex guard.

3.3 Extensibility

Additional endpoints can extend the route/schema set without claiming that this initial subset covers the entire API.

3.4 Historical-Version Compatibility

No runtime or persisted-format change; current clients retain their existing wire contract.

4. Issue Summary

Number Issue Location Severity
— No formal issues found Complete changed-file set —

5. Merge Recommendation

Conclusion: Ready to merge

  1. Blockers — must be fixed
    • No source blocker identified. No source/contract blocker; current-head Build is successful. Effective maintainer approval remains required.
  2. Recommended fixes — non-blocking
    • No additional unrelated changes requested.

Overall assessment: The earlier module-path and diagnostic concern is resolved, and the rebased contract preserves the existing wire semantics.

Existing-review reconciliation: The prior dependency request from @nzw921rx remains addressed: no redundant POM dependency is added. The existing CI-conditioned approval from @davidzollo is consistent with this source conclusion, while final review ownership remains with the maintainer. Author replies have been incorporated into this single full review.

Head 70d19e1c31d713bba192640f79dd99b62dacf899. Live base dev at 3ac2d1cec6aa7b3741c4dacdd23020f778e23c02; comparison ahead, ahead 6 / behind 0; merge state CLEAN. Behind/diverged alone is recorded metadata, not a request to synchronize upstream. Checks: Signal pull request update = SUCCESS; Build = SUCCESS

Signal and Build are successful on the reviewed head. No previous-head result is substituted for these checks.

Daniel has READ repository permission. This COMMENT records the technical conclusion; it is not an effective maintainer approval or a dismissal of any historical requested-changes entry. A write-capable maintainer owns the final repository approval gate.

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks again. One repository-gate statement in my previous source review is outdated: GitHub now reports reviewDecision=APPROVED, while Build is successful on this unchanged head. The earlier statement that effective reviewer approval was still missing should no longer guide contributor action.

I also read the current dev branch rules: they require one approving review, Build, and the merge queue. The PR currently has no mergeQueueEntry. The next action belongs to a write-capable maintainer: reconcile the current mergeability/required checks and enqueue it when eligible. The API has returned UNSTABLE and UNKNOWN mergeability snapshots, so I am not converting those into a claim of final merge acceptance. No extra contributor commit, base sync or CI rerun is requested solely because the branch is behind.

The source-clear conclusion and optional recommendations in my preceding full review are unchanged. This comment corrects gate metadata; it is not a new full source review or an approval/dismissal action by Daniel.

Checked 2026-11-01T11:26:52.332195+00:00; unchanged head 70d19e1c31d713bba192640f79dd99b62dacf899. Current checks: Build=SUCCESS. Base dev, compare diverged, ahead 6 / behind 9; merge UNSTABLE / APPROVED. Drift is recorded independently; it does not itself request synchronization. Daniel has READ permission. This is a CI/merge-gate clarification, not another full source review, effective approval or dismissal.

@goutamadwant

Copy link
Copy Markdown
Collaborator Author

@davidzollo thanks for the approval. All checks pass on the current head and the remaining thread was outdated and is now resolved. Could you merge when convenient?

@DanielLeens

Copy link
Copy Markdown
Contributor

Thanks @goutamadwant. Build remains green and GitHub reports an approved review decision on this unchanged head. My technical conclusion is unchanged. A write-capable maintainer can reconcile the remaining merge-queue/required-check state and enqueue it when eligible; I cannot merge with this identity. No extra contributor commit or drift-only sync is requested.

This is an unchanged-head discussion/CI update, not a second full source review. No local tests were run. Daniel has READ permission; any approval records my technical conclusion, while effective maintainer approval, dismissal and merge remain separate.

@davidzollo
davidzollo added this pull request to the merge queue Nov 6, 2026
Merged via the queue into apache:dev with commit 6191598 Nov 6, 2026
2 checks passed
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.

4 participants