refactor: add missing @override decorators to agent composer API classes#36504
Open
guangyang1206 wants to merge 2 commits into
Open
refactor: add missing @override decorators to agent composer API classes#36504guangyang1206 wants to merge 2 commits into
guangyang1206 wants to merge 2 commits into
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-22 03:20:25.996829494 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-22 03:20:17.505763611 +0000
@@ -1,3 +1,13 @@
+ERROR Class member `WorkflowAgentComposerApi.get` is marked as an override, but no parent class has a matching attribute [bad-override]
+ --> controllers/console/agent/composer.py:25:9
+ERROR Class member `WorkflowAgentComposerCandidatesApi.get` is marked as an override, but no parent class has a matching attribute [bad-override]
+ --> controllers/console/agent/composer.py:73:9
+ERROR Class member `WorkflowAgentComposerImpactApi.post` is marked as an override, but no parent class has a matching attribute [bad-override]
+ --> controllers/console/agent/composer.py:84:9
+ERROR Class member `AgentAppComposerApi.get` is marked as an override, but no parent class has a matching attribute [bad-override]
+ --> controllers/console/agent/composer.py:121:9
+ERROR Class member `AgentAppComposerCandidatesApi.get` is marked as an override, but no parent class has a matching attribute [bad-override]
+ --> controllers/console/agent/composer.py:164:9
ERROR `str` is not assignable to `Literal['advanced-chat', 'agent-chat', 'all', 'channel', 'chat', 'completion', 'workflow']` [bad-assignment]
--> controllers/console/app/app.py:70:104
ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
|
Contributor
Pyrefly Type Coverage
|
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.
Important
Fixes #<issue number>.做了什么
为
api/controllers/console/agent/composer.py中的所有 Resource 子类的 HTTP 方法添加了@override装饰器。具体影响的类和方法:
WorkflowAgentComposerApi:get(),put()WorkflowAgentComposerValidateApi:post()WorkflowAgentComposerCandidatesApi:get()WorkflowAgentComposerImpactApi:post()WorkflowAgentComposerSaveToRosterApi:post()AgentAppComposerApi:get(),put()AgentAppComposerValidateApi:post()AgentAppComposerCandidatesApi:get()为什么这么做
@override装饰器明确标识了哪些方法是重写父类方法,提高代码可读性@override装饰器会帮助捕获这类问题改动文件
api/controllers/console/agent/composer.py: 为 8 个 Resource 子类的 11 个方法添加了@override装饰器,并添加了from typing import override导入测试
由于这是纯装饰器添加(不改变运行时行为),现有测试应该全部通过。建议运行:
关联
Follow-up to #36490, #36491, #36492, #36493, #36494, #36495, #36496