Skip to content

refactor: select in 13 small service files#34371

Merged
asukaminato0721 merged 2 commits intolanggenius:mainfrom
RenzoMXD:refactor/select-services-small-batch1
Apr 1, 2026
Merged

refactor: select in 13 small service files#34371
asukaminato0721 merged 2 commits intolanggenius:mainfrom
RenzoMXD:refactor/select-services-small-batch1

Conversation

@RenzoMXD
Copy link
Copy Markdown
Contributor

@RenzoMXD RenzoMXD commented Apr 1, 2026

Summary

  • Migrate 19 db.session.query() calls to SQLAlchemy 2.0 select() style across 13 service files: workspace_service, workflow_converter, pipeline_generate_service, account_deletion_sync, credit_pool_service, billing_service, audio_service, webapp_auth_service, web_conversation_service, recommend_app/database_retrieval, pipeline_template/database_retrieval, pipeline_template/customized_retrieval, and conversation_service
  • Use session.get() for PK lookups, scalar(select(...).limit(1)) for non-PK filtered queries, and scalars(select(...)) for multi-row queries
  • Update test mock wiring in 3 test files (mock plumbing only — no test logic or assertion changes)

Test plan

  • make type-check passes for all 13 changed source files (basedpyright)
  • All 135 related unit tests pass (0 failures, matching clean main)

Part of #22668

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. refactor labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-04-01 03:28:36.347860493 +0000
+++ /tmp/pyrefly_pr.txt	2026-04-01 03:28:24.394912655 +0000
@@ -373,13 +373,13 @@
 ERROR Object of class `Tenant` has no attribute `role` [missing-attribute]
     --> services/account_service.py:1131:13
 ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Iterable[bytes]` [unsafe-overlap]
-   --> services/audio_service.py:143:41
+   --> services/audio_service.py:145:41
 ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
-   --> services/audio_service.py:144:56
+   --> services/audio_service.py:146:56
 ERROR Runtime checkable protocol `Generator` has an unsafe overlap with type `Iterable[bytes]` [unsafe-overlap]
-   --> services/audio_service.py:150:37
+   --> services/audio_service.py:152:37
 ERROR No matching overload found for function `flask.helpers.stream_with_context` called with arguments: (Generator[bytes]) [no-matching-overload]
-   --> services/audio_service.py:151:52
+   --> services/audio_service.py:153:52
 ERROR Argument `str | None` is not assignable to parameter `value` with type `SQLCoreOperations[str] | str` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> services/conversation_service.py:131:33
 ERROR `dict[str, bool | dict[str, Any] | str | None]` is not assignable to variable `data_source_info` with type `dict[str, bool | str]` [bad-assignment]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

Pyrefly Diff

No changes detected.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 1, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 1, 2026
Merged via the queue into langgenius:main with commit beda78e Apr 1, 2026
26 of 27 checks passed
@RenzoMXD
Copy link
Copy Markdown
Contributor Author

RenzoMXD commented Apr 1, 2026

Thanks.

@RenzoMXD RenzoMXD deleted the refactor/select-services-small-batch1 branch April 1, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants