Skip to content

refactor: use sessionmaker().begin() in console auth controllers#33966

Merged
asukaminato0721 merged 4 commits intolanggenius:mainfrom
Desel72:refactor/use-sessionmaker-console-auth
Mar 24, 2026
Merged

refactor: use sessionmaker().begin() in console auth controllers#33966
asukaminato0721 merged 4 commits intolanggenius:mainfrom
Desel72:refactor/use-sessionmaker-console-auth

Conversation

@Desel72
Copy link
Copy Markdown
Contributor

@Desel72 Desel72 commented Mar 23, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Summary

Part of #24245
Refactor console auth controllers to use sessionmaker().begin() instead of Session() with explicit commit(), following SQLAlchemy best practices.

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods

@Desel72 Desel72 requested a review from QuantumGhost as a code owner March 23, 2026 15:52
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. refactor labels Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@Desel72 Desel72 requested a review from laipz8200 as a code owner March 23, 2026 18:05
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@asukaminato0721
Copy link
Copy Markdown
Contributor

I think update the mock is kind of meaningless.

Migrate to container, then update the sessionmaker makes sense.

@asukaminato0721
Copy link
Copy Markdown
Contributor

resolve conflicts

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@asukaminato0721
Copy link
Copy Markdown
Contributor

FAILED api/tests/test_containers_integration_tests/test_workflow_pause_integration.py::TestWorkflowPauseIntegration::test_large_state_file_handling - FileNotFoundError: File not found

@dosu how to fix

@dosubot
Copy link
Copy Markdown

dosubot bot commented Mar 24, 2026

The test_large_state_file_handling test creates a 1MB state file and verifies storage/retrieval via the workflow pause repository. The FileNotFoundError occurs when the storage.load() operation can't find the state file.

Most likely cause: The storage backend isn't properly initialized for the test environment.

To fix, ensure your test environment has the storage properly configured. Check:

  1. The test fixture (db_session_with_containers) initializes the storage backend correctly
  2. The storage mock (if using one) is set up to handle both save() and load() operations
  3. If you updated session handling but not the storage mock, the storage may not be receiving the saved file

Since this is in a container integration test, you may need to ensure the storage service container is running and accessible during the test.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor  Share on X

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 24, 2026
@asukaminato0721 asukaminato0721 merged commit ceb2e10 into langgenius:main Mar 24, 2026
14 checks passed
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:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants