Skip to content

[type:test] prefer prefixed swagger document when both api-docs URLs return 200 - #8512

Merged
Aias00 merged 1 commit into
apache:masterfrom
markjoin123:cursor/swagger-both-200-regression-be59
Nov 19, 2026
Merged

Aias00 merged 1 commit into
apache:masterfrom
markjoin123:cursor/swagger-both-200-regression-be59

Conversation

@markjoin123

Copy link
Copy Markdown
Contributor

Follow-up to #8480. Related to #8410.

Why

Merged #8480 keeps the prefixed-first order on purpose. When both http://ip:port{contextPath}/v3/api-docs and http://ip:port/v3/api-docs return 200, Admin should import the registered context-path document and should not request the root URL. This test locks that in.

Tests

./mvnw -pl shenyu-admin -am test -Dtest=SwaggerDocManagerImplTest -Dsurefire.failIfNoSpecifiedTests=false

SwaggerDocManagerImplTest: 13 tests, 0 failures. Checkstyle reported 0 violations. ./mvnw -pl shenyu-admin apache-rat:check passed (unapproved 0).

testPullApiDocumentPrefersPrefixedSwaggerWhenBothUrlsSucceed: both URLs answer 200 with different bodies, the only request is /mcp/v3/api-docs, and the imported body is the prefixed document.

This change was made with AI assistance and reviewed.

Follow-up test for merged apache#8480 / apache#8410. When the registered context path
and the backend root both serve /v3/api-docs, import the prefixed document
and do not request the root.

Co-authored-by: markxu <[email protected]>

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

Standards

  • No checkstyle concerns: the new method needs no imports and @Test methods are exempt from JavadocMethod.
  • Minor: the ROOT_SWAGGER_URL stub branch returns ROOT_DOC but is unreachable by construction, since the prefixed URL answers 200 first. A short comment stating that the root document must never be probed would make the intent obvious instead of looking like a copy of the 404-retry test.

Spec

  • The test locks in the merged #8480 order (prefixed first, root only after a 404), which is the opposite of the order proposed in the closed issue #8410. That is consistent with the PR description and with the contract documented in PullSwaggerDocServiceImpl.openSwaggerResponse ("the registered context path is requested first… the backend root is tried once only after HTTP 404"), so I read this as pinning a deliberate decision, not enshrining a defect. If the deviation from #8410 is intentional, one line of rationale in the test would stop the next reader from "fixing" it back.
  • Some assertions are not discriminating: assertTrue(tagVO.getTagExt().getRefreshTime() > 1000L) only proves that some pull happened, and verify(docManager, never()).addDocInfo(any(), eq(ROOT_DOC), ...) cannot fail once the positive PREFIXED_DOC verification passes. The urls assertion is the meaningful one and it is correct: it proves the root URL is never requested when the prefixed document answers 200.

Verdict

Merge. The test documents current, intentional behaviour and does not touch production code; the notes above are optional nits.

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

Stream Agent analysis

Test-only follow-up to #8480 adding one JUnit test (testPullApiDocumentPrefersPrefixedSwaggerWhenBothUrlsSucceed) to SwaggerDocManagerImplTest, asserting that when both the prefixed and root api-docs URLs return 200 only /mcp/v3/api-docs is requested and the prefixed document is imported. No production code changed and no blocking defect found; verdict is INCONCLUSIVE because CI is still pending.

Evidence: ["Attachment reports complete_diff=true: exactly one file changed, shenyu-admin/src/test/java/org/apache/shenyu/admin/service/manager/impl/SwaggerDocManagerImplTest.java (+22/-0), with the full added test method shown; no production code touched, no concrete defect identified.","CI metadata: 11 checks all status=queued with conclusion=null, failed_checks=[], passed=false, pending=true, diagnosis=CI_PENDING — no passing CI result available.","Coverage note states only captured patches/check metadata were supplied and no local tests were executed; the passing-test and checkstyle claims in the PR body are the author's, not independently verified here."]

Next steps: ["Wait for all 11 CI checks to finish and confirm a passing conclusion before issuing a PASS verdict.","Re-review if any newly completed CI check reports a failure tied to this test."]

Verdict: INCONCLUSIVE; publication: COMMENT (INCONCLUSIVE_REVIEW)

Findings: []

Scope: captured GitHub evidence only; no local tests were executed.

Task: 73cd10e7-b1ad-4701-a4db-1416346d441a Commit: f6945eed56a79c83883d9c9d992c979fe1a6bfaa

@Aias00
Aias00 merged commit 4a42de5 into apache:master Nov 19, 2026
74 checks passed
@Aias00 Aias00 added this to the 2.7.3 milestone Nov 19, 2026
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