Skip to content

test: migrate console conversation sessions and ORM models to SQLite - #40528

Open
asukaminato0721 wants to merge 1 commit into
langgenius:mainfrom
asukaminato0721:agent/sqlite-orm-console-conversations
Open

test: migrate console conversation sessions and ORM models to SQLite#40528
asukaminato0721 wants to merge 1 commit into
langgenius:mainfrom
asukaminato0721:agent/sqlite-orm-console-conversations

Conversation

@asukaminato0721

Copy link
Copy Markdown
Contributor

Summary

  • replace Account and App stand-ins in console conversation and message controller tests with real mapped instances
  • replace mocked Conversation, Message, MessageFeedback, MessageAnnotation, and annotation-history objects with persisted SQLite rows
  • verify nested response-source fields through real model queries, including account/end-user lookup, feedback aggregation, annotation lookup, workflow status counts, and empty thought/file collections
  • verify feedback updates through the real query and commit path

Motivation

The previous response-source tests only asserted calls against mocked model methods. Real persistence now covers the SQL-backed helper properties and nested serialization behavior that the controllers depend on.

Production changes

None.

Size

233 additions, 96 deletions (329 changed lines). This is a cohesive console conversation/message cluster.

Validation

  • PASS: combined targeted run for both changed modules (27 passed)
  • PASS: make lint
  • BLOCKED: make type-check reaches mypy 1.20.2 internal error at api/.venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/zipimport.pyi:17
  • PASS: focused audit found no mocked SQLAlchemy sessions or mapped-model stand-ins in the migrated modules; remaining MagicMock values are non-ORM controller helper collaborators
  • NOT RUN: full make test, per user instruction

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-08-11 20:06:24.432324466 +0000
+++ /tmp/pyrefly_pr.txt	2026-08-11 20:06:10.408213641 +0000
@@ -1956,18 +1956,8 @@
   --> tests/unit_tests/controllers/console/app/test_app_import_api.py:89:29
 ERROR Cannot index into `object` [bad-index]
    --> tests/unit_tests/controllers/console/app/test_audio.py:137:17
-ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.conversation._get_conversation` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_conversation_api.py:125:61
-ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.conversation._get_conversation` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_conversation_api.py:134:56
-ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:115:26
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:116:23
-ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_detail` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:138:19
 ERROR Argument `Literal['550e8400-e29b-41d4-a716-446655440000']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_detail` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_message_api.py:139:20
+   --> tests/unit_tests/controllers/console/app/test_message_api.py:179:20
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
   --> tests/unit_tests/controllers/console/app/test_model_config_api.py:88:51
 ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 58.89% 58.89% 0.00%
Strict coverage 58.47% 58.47% 0.00%
Typed symbols 38,906 38,906 0
Untyped symbols 27,352 27,352 0
Modules 3143 3143 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant