-
Notifications
You must be signed in to change notification settings - Fork 79
[async 4/7] refactor: move operation DB resolution out of __init__ into _resolve()#478
Draft
somethingnew2-0 wants to merge 1 commit into
Draft
[async 4/7] refactor: move operation DB resolution out of __init__ into _resolve() #478somethingnew2-0 wants to merge 1 commit into
somethingnew2-0 wants to merge 1 commit into
Conversation
This was referenced Jun 12, 2026
@somethingnew2-0
somethingnew2-0
changed the title
(削除) refactor: move operation DB resolution out of __init__ into _resolve() (削除ここまで)
(追記) [async 4/7] refactor: move operation DB resolution out of __init__ into _resolve() (追記ここまで)
Jun 12, 2026
@somethingnew2-0
somethingnew2-0
changed the title
(削除) [async 4/7] refactor: move operation DB resolution out of __init__ into _resolve() (削除ここまで)
(追記) [async 4/8] refactor: move operation DB resolution out of __init__ into _resolve() (追記ここまで)
Jun 12, 2026
@somethingnew2-0
somethingnew2-0
force-pushed
the
pcollins/async-1d-op-restructure
branch
from
June 12, 2026 17:08
de54299 to
540493e
Compare
@somethingnew2-0
somethingnew2-0
changed the title
(削除) [async 4/8] refactor: move operation DB resolution out of __init__ into _resolve() (削除ここまで)
(追記) [async 4/7] refactor: move operation DB resolution out of __init__ into _resolve() (追記ここまで)
Jun 12, 2026
Every operation class now stores raw constructor arguments and resolves them (queries, row locks, id lookups) in a _resolve() method invoked as the first statement of execute() / execute_for_group() / execute_for_role(). __init__ signatures and public attribute names are unchanged, and every call site already chains .execute() immediately, so behavior is identical - resolution just happens at execute time. Async SQLAlchemy prep: __init__ cannot be async, so all session work must live behind execute() before the flip makes it awaitable. For the four operations whose execute() wraps asyncio.run(self._execute()), _resolve() runs before asyncio.run on the calling thread. Side benefit: the with_for_update row locks in the approve/reject operations now begin at execute time rather than construction time, which narrows the lock window to the actual mutation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@somethingnew2-0
somethingnew2-0
force-pushed
the
pcollins/async-1d-op-restructure
branch
from
June 12, 2026 17:59
540493e to
3bf1f83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Part of the async-SQLAlchemy migration stack (stacked on #477).
Every operation class now stores raw constructor arguments and resolves them (queries, row locks, id lookups) in a
_resolve()method invoked as the first statement ofexecute()/execute_for_group()/execute_for_role().__init__signatures and public attribute names are unchanged, and every call site already chains.execute()immediately, so behavior is identical — resolution just happens at execute time.Async prep:
__init__cannot be async, so all session work must live behindexecute()before the flip makes it awaitable. For the four operations whoseexecute()wrapsasyncio.run(self._execute()),_resolve()runs beforeasyncio.runon the calling thread.Side benefit: the
with_for_updaterow locks in the approve/reject operations now begin at execute time rather than construction time, narrowing the lock window to the actual mutation.Full suite green (515 tests), ruff + mypy clean.
PR stack
Merge bottom-up; each PR is based on the branch of the one before it (retarget to
mainas predecessors merge).__init__into_resolve()⬅️ this PRdb.sessionaccess out of spawned notification tasks🤖 Generated with Claude Code