fix: type object 'str' has no attribute 'LLM'#33899
fix: type object 'str' has no attribute 'LLM'#33899asukaminato0721 merged 1 commit intolanggenius:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a type error where Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a TypeError by replacing the incorrect NodeType with BuiltinNodeTypes in the test files. However, it also introduces a new dependency, pypandoc, which appears to be unrelated to the primary fix. To adhere to the principle of atomic changes, it would be best to move the dependency addition to a separate pull request unless it is a prerequisite for this fix.
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-23 05:39:38.930033499 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-23 05:39:29.554041321 +0000
@@ -4388,8 +4388,6 @@
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_execution_repository.py:214:33
ERROR `None` is not assignable to attribute `_creator_user_role` with type `CreatorUserRole` [bad-assignment]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_execution_repository.py:219:35
-ERROR Class `str` has no class attribute `LLM` [missing-attribute]
- --> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:70:19
ERROR Argument `object` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown]` in function `core.repositories.sqlalchemy_workflow_node_execution_repository.SQLAlchemyWorkflowNodeExecutionRepository.__init__` [bad-argument-type]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:133:29
ERROR Attribute `current_tenant_id` of class `Account` is a read-only property and cannot be set [read-only]
@@ -4400,16 +4398,12 @@
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:245:31
ERROR Argument `None` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:267:83
-ERROR Class `str` has no class attribute `LLM` [missing-attribute]
- --> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:390:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `value` with type `SQLCoreOperations[UploadFile | None] | UploadFile | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:405:19
ERROR Argument `SimpleNamespace` is not assignable to parameter `value` with type `SQLCoreOperations[UploadFile | None] | UploadFile | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:406:20
ERROR Argument `SimpleNamespace` is not assignable to parameter `value` with type `SQLCoreOperations[UploadFile | None] | UploadFile | None` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:407:21
-ERROR Class `str` has no class attribute `LLM` [missing-attribute]
- --> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:444:26
ERROR Argument `None` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
--> tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py:619:61
ERROR Cannot index into `dict[str, WorkflowNodeExecutionModel]` [bad-index]
|
There was a problem hiding this comment.
Pull request overview
Fixes a unit-test failure caused by treating NodeType (a str type alias) as an enum with members like .LLM, and adds an explicit runtime dependency for pypandoc which is imported by extractors/nodes.
Changes:
- Update workflow node execution repository unit tests to use
BuiltinNodeTypes.LLMinstead ofNodeType.LLM. - Add
pypandocto the API Python dependencies and lockfile.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| api/tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py | Switches test node type constants from NodeType.LLM to BuiltinNodeTypes.LLM to avoid AttributeError. |
| api/pyproject.toml | Adds pypandoc as an explicit dependency. |
| api/uv.lock | Locks pypandoc and wires it into the resolved dependency set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
api/tests/unit_tests/core/repositories/test_sqlalchemy_workflow_node_execution_repository.py
Show resolved
Hide resolved
|
Why the |
Important
Fixes #<issue number>.Summary
fix #33891
Screenshots
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods