Skip to content

fix: return an empty list for resources without buttons - #8491

Merged
Aias00 merged 1 commit into
apache:masterfrom
cloudbase-ai:fix/admin-empty-buttons-20261115
Nov 16, 2026
Merged

Aias00 merged 1 commit into
apache:masterfrom
cloudbase-ai:fix/admin-empty-buttons-20261115

Conversation

@cloudbase-ai

Copy link
Copy Markdown
Contributor

Problem and change

Fixes #8487.

GET /resource/button?id= returns HTTP 200 but application code 500 when the parent has no buttons. ResourceController.getButton treats an empty successful findByParentId result as QUERY_FAILED. Deleting the final button consequently leaves the dashboard showing a query error on refresh.

Return a successful empty list when a resource has no child buttons, including after its last button is deleted. Keep the existing permission annotations and other resource endpoints unchanged.

This branch is based directly on master e9345162a and has no dependency on the other Admin follow-up PRs or dashboard migration drafts.

IssueSpec

IssueSpec-Mode: lightweight
IssueSpec-Reason: Correct empty collection handling for the existing button-list endpoint without changing permissions, service queries or individual resource semantics.
IssueSpec-Validation: The named regression fails before the fix. The independent branch passes 25 focused tests plus reactor Checkstyle; the four-fix verification checkout passes 64 related tests and RAT; the added-code quality gate reports zero findings. Full repository clean install and browser testing of a rebuilt Admin are not run.

Production-fix lightweight classification remains subject to maintainer review under the repository policy.

Validation

  • ./mvnw -pl shenyu-admin -am test -Dtest=ResourceControllerTest,ResourceServiceTest -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.javadoc.skip=true -Djacoco.skip=true — PASS (25 tests, no failures/errors/skips).

  • python3 .github/scripts/check-new-code-quality.py --base origin/master --checkstyle-jar ../frontend-completion/checkstyle-9.3-all.jar — zero findings on this branch. The jar matches the workflow-pinned SHA-256.

  • ./mvnw -pl shenyu-admin -am apache-rat:check — PASS on the combined verification checkout containing the same four independent changes.

  • git diff --check origin/master...HEAD — PASS.

  • ResourceControllerTest.testGetButtonReturnsEmptyList fails on unmodified master. The MockMvc regression expects the existing success envelope containing an empty list; nonempty and missing-detail tests remain.

  • You have read the contribution guidelines.

  • You submit test cases (unit or integration tests) that back your changes.

  • New production code follows the code quality rules Q1-Q9 in AGENTS.md.

  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

@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

Fix returns an empty list instead of QUERY_FAILED when a resource has no buttons; test updated accordingly.

Evidence

  • Full diff read (has_more=false, 2283 chars): only ResourceController.java and ResourceControllerTest.java changed.
  • Head file ResourceController.java lines 106-110 confirms getButton now returns success with the list unconditionally.
  • CI passed: 74 checks including CodeQL and e2e cases all success; PR scope is WHOLE_PR with complete_diff=true.

Recommended next steps

Scope: captured diff and GitHub check metadata only; no local tests were executed.

Task: 4e900966-d162-47f7-823e-69e31436d27e · Commit: cd43403a4d2b74cc914d0ce360404571a97f11cc

Review verdict: PASS

Complete diff coverage of both changed files; minimal correct fix that returns an empty successful list when no child buttons exist, preserving permission annotations and other endpoints; passing CI with no concrete blocking defect.

Publication: COMMENT (DRAFT_PR)

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

Reviewed commit cd43403a4d2b74cc914d0ce360404571a97f11cc.

No blocking findings. findByParentId collects successful queries into a list, so zero child buttons is a valid empty collection. Permission annotations and missing individual-resource handling are unchanged. Both populated and empty response contracts remain covered.

Fresh local validation: ./mvnw -pl shenyu-admin -am test -Dtest=ResourceControllerTest,ResourceServiceTest -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.javadoc.skip=true -Djacoco.skip=true — 25 tests passed, zero failures/errors/skips; reactor Checkstyle ran. Independent code-quality and architecture reviews found no blocking issue. Full local repository install and rebuilt-Admin browser integration were not run.

@Aias00 Aias00 added this to the 2.7.3 milestone Nov 16, 2026
@Aias00
Aias00 marked this pull request as ready for review November 16, 2026 03:29
@Aias00
Aias00 merged commit 80559e8 into apache:master Nov 16, 2026
75 checks passed
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.

[BUG] Resource button queries report an error for an empty button list

2 participants