Skip to content

refactor: pass db.session explicitly in get_message_data (#37403)#38129

Open
EvanYao826 wants to merge 1 commit into
langgenius:mainfrom
EvanYao826:refactor/get-message-data-session-param
Open

refactor: pass db.session explicitly in get_message_data (#37403)#38129
EvanYao826 wants to merge 1 commit into
langgenius:mainfrom
EvanYao826:refactor/get-message-data-session-param

Conversation

@EvanYao826

Copy link
Copy Markdown
Contributor

Summary

Make session dependency explicit in get_message_data utility function, following the pattern from PR #37402.

Changes

api/core/ops/utils.py

  • get_message_data(message_id, session) — replaces internal db.session with explicit parameter
  • Remove from models.engine import db import (no longer needed)
  • Add from sqlalchemy.orm import scoped_session import

Callers updated:

  • api/core/ops/ops_trace_manager.py — pass db.session to get_message_data (5 call sites)

Tests updated:

  • test_utils.py — replace @patch("core.ops.utils.db") with mock session parameter

Related

Closes #37403 (partial)

Checklist

  • Tests pass
  • Lint clean (ruff)
  • Single atomic change

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. refactor labels Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.48% 51.48% +0.00%
Strict coverage 51.00% 51.00% +0.00%
Typed symbols 30,824 30,825 +1
Untyped symbols 29,325 29,324 -1
Modules 2931 2931 0

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

Labels

refactor size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make db.session pass from parameter.

1 participant