Repository navigation
fix: return an empty list for resources without buttons - #8491
Conversation
Aias00
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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
e9345162aand 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.