Repository navigation
Conversation
The role catalog counted nodes from platform generic templates (appended by CatalogRepo.Workflows) as project role references, so roles in a project with no SOP showed node counts and could not be deleted — while the backend DELETE check does not consider generic templates (Tencent#1496). Exclude template shadows from the reference count: a private template copy only binds in its own project. Real project workflow references still count. Test covers: generic-only reference shows 'unused' with delete enabled, while a real same-project workflow reference still counts. Scope: front-end role catalog count only; no backend/DELETE change. Coordination: open PR Tencent#1248 changes the same count line (to display workflow names). The changes are complementary — its agentWorkflowUsage helper does not exclude generic templates. If both land, merge by adding this exclusion inside agentWorkflowUsage. Part of Tencent#1496; does not close the issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(web): exclude generic template shadows from role reference counts
This is the #1496 slice: stop the role catalog from counting platform generic-template nodes as project role references.
Problem
CatalogRepo.Workflows()appends platform generic templates (generic: true) to the workflow list. The role catalog's reference count (web/app/agents.js) counted every node in that list, so a project with no SOP still showed "N nodes" for each role and disabled Delete ("role still referenced by a workflow") — while the backend DELETE check does not consider generic templates. Front-end and back-end used different algorithms (#1496).Change
web/app/agents.js— when counting references, build the set of agent IDs bound by generic templates and skip a node whose agent is a private template copy bound outside its own project. Real project workflow references still count.webtest/tests/assets-agents.test.mjs— test: a role referenced only by a generic template (and a foreign-project workflow) shows "unused" with Delete enabled; adding a real same-project workflow restores the count and disables Delete.Backend DELETE logic, other pages and schema are unchanged.
Verification
webtest/tests/assets-agents.test.mjs: 12/12 PASS (including the new case).Coordination with PR #1248
Open PR #1248 (Fix #1210) changes the same reference-count line to display referencing workflow names via a new
agentWorkflowUsage()helper. Its helper does not exclude generic templates, so the two changes are complementary, not duplicative. If both merge, combine by applying this exclusion insideagentWorkflowUsage().Issue timeline shows no linked PR and no claim for #1496. Part of #1496; does not close the issue.