Conversation
…isting The frontend sends the agents-page canvas-category multi-select as a comma-joined canvas_category value. The Python handler splits it and filters with IN, but the Go UserCanvasDAO compared the raw joined string for equality, so selecting more than one category matched zero canvases: the list showed the empty state, and in mixed mode only compilation template groups remained. Pass the already-split category list from AgentService.ListAgents into UserCanvasDAO.ListByTenantIDs and match with canvas_category IN (...), restoring parity with UserCanvasService.get_by_tenant_ids.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe DAO now accepts multiple canvas categories and filters with SQL ChangesCanvas category filtering
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Multi-category filtering is forwarded correctly while empty, groups-only, and merge-mode paths retain their prior behavior. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit sorts the canvas rows, Comment |
wangq8
left a comment
There was a problem hiding this comment.
This is an AI review comment.
Summary
Fixes the Go /agents listing so a multi-select canvas_category (comma-joined into a single query value) filters with IN (...) instead of an exact string match, mirroring Python UserCanvasService.get_by_tenant_ids. The change is small and correct: the DAO now takes []string, all call sites (service + tests) are updated, and both single- and multi-category semantics are covered by new tests.
Findings
- Correctly removes the buggy
strings.Join(agentCategories, ",")path;stringsis still used elsewhere in the file, so no unused-import issue. - The
len(canvasCategories) > 0guard preserves the unfiltered case, and merge/mixed pagination behavior is unchanged, as intended. - Tests (
TestUserCanvasDAOListByTenantIDsCategoryUnion,TestListAgents_MultiCategoryFilter) assert union semantics through the raw comma-joined query value — good coverage at the service level.
Minor:
- The doc comment above
ListByTenantIDsstill sayscanvasCategory; rename tocanvasCategoriesfor consistency. - The author notes there was no browser E2E this round. Given the user-visible symptom is exactly "multi-select returns an empty list", a quick manual check on the agents page with 2–3 categories selected before merge would be worthwhile.
Looks good to me once the minor items are addressed.
This is an AI review comment.
Supersedes #19553 (that PR was corrupted by the worktree-sweep delivery fault and cannot be reopened after the force-push; this is the same fix at proper paths).
Summary
On the agents list page, selecting a single "canvas category" filter (e.g. workflow, count 8) returned the right cards, but selecting two or three categories at once returned an empty list ("no agents yet"), or — when "compilation operator" was among the selections — left only the compilation template group cards while every agent card disappeared.
The page sends multi-select categories as one comma-joined
canvas_categoryquery value (dataflow_canvas,agent_canvas). The Python/v1/agentsimplementation (from #17843) splits that value and filters withcanvas_category IN (...). The Go mirror never got that update:UserCanvasDAO.ListByTenantIDscompared the raw joined string for equality (canvas_category = 'dataflow_canvas,agent_canvas'), which matches no row, so:compilation_template_group+ agent categories selected → agents query returns 0, only the caller's template groups survive the merge;Changes
internal/dao/user_canvas.go:ListByTenantIDsnow takescanvasCategories []stringand filters withcanvas_category IN ?, mirroring PythonUserCanvasService.get_by_tenant_ids.internal/service/agent.go:ListAgentspasses the already-splitagentCategorieslist straight to the DAO (the re-join into a comma string and the raw-string fallback are gone); merge/mixed-mode SQL-pagination disabling is unchanged.TestListAgents_MultiCategoryFilter(service level, through the raw comma-joined query value: 2 categories → union of 3/3, single category → 2/2) andTestUserCanvasDAOListByTenantIDsCategoryUnion(DAO union semantics); existing DAO call sites updated to the new slice parameter.Verification
bash build.sh --test ./internal/dao/... ./internal/service/...passes (unit tier, in-memory SQLite).api/apps/restful_apis/agent_api.pylist_agents +api/db/services/canvas_service.pyget_by_tenant_ids): split →INunion,None/empty → unfiltered, groups-only and merge modes untouched.