Skip to content

Ensure proper await handling for database operations and updates#123

Merged
bitbacchus merged 6 commits into
ecomod-code:await-and-callfrom
bitbacchus:claude/audit-await-send-calls-Dv2QM
May 21, 2026
Merged

Ensure proper await handling for database operations and updates#123
bitbacchus merged 6 commits into
ecomod-code:await-and-callfrom
bitbacchus:claude/audit-await-send-calls-Dv2QM

Conversation

@bitbacchus
Copy link
Copy Markdown
Member

needs more review and testing before merging

claude added 6 commits May 21, 2026 13:08
DeleteQuestion sent the groups patch with fire-and-forget `send`
(the `await` was a no-op on void), so the question could be
removed from the QuestionActor before QuizActor had processed the
groups update, leaving dangling group references under load.

https://claude.ai/code/session_01DUUFUFpsvj4y6xU5172pX4
storeEntity was fire-and-forget: the MongoDB write could fail
silently while the caller already received a success reply.
On any write error or process restart the session was lost,
effectively logging the user out with no warning.

Also refactors the async-inside-create pattern out: getEntity
is now awaited before create(), and create() is synchronous,
which avoids nested create() races introduced by storeEntity's
own internal cache update.

https://claude.ai/code/session_01DUUFUFpsvj4y6xU5172pX4
The ask+send block inside a synchronous create() callback was
fire-and-forget: the admin got a success reply before the
session role was updated, leaving a window where a downgraded
user still held their old permissions.

Moves the session update after storeEntity completes, uses ask
for StoreSession (now that StoreSession awaits its own write),
and guards against users with no active session.

https://claude.ai/code/session_01DUUFUFpsvj4y6xU5172pX4
Block, Unblock, IncreaseCount, and StoreFingerprint all called
storeEntity without await inside synchronous .match() callbacks.
A MongoDB write failure was silently discarded, so a blocked
fingerprint could revert to unblocked after a process restart.

Restructures each handler to extract the fingerprint via
early-return rather than .match(), allowing storeEntity to be
properly awaited before notifying subscribers.

https://claude.ai/code/session_01DUUFUFpsvj4y6xU5172pX4
…csActor

Quiz answer statistics were broadcast to all subscribers and
returned to the caller before the MongoDB write completed.
A write failure was silently swallowed, leaving subscribers
with data that was never persisted.

https://claude.ai/code/session_01DUUFUFpsvj4y6xU5172pX4
ChangeNicknameModal: .ask().then() had no .catch(), so a
UserStore network error propagated as an unhandled rejection
and the uniqueness error was silently lost.

SharingActor.AddEntry: same pattern — a UserStore rejection
on teacher lookup left the sharing dialog with no feedback.
Now maps the rejection to a queryNotFound error entry so the
UI shows an explicit failure rather than silently doing nothing.

https://claude.ai/code/session_01DUUFUFpsvj4y6xU5172pX4
@bitbacchus bitbacchus merged commit eadd1af into ecomod-code:await-and-call May 21, 2026
1 check passed
@bitbacchus bitbacchus deleted the claude/audit-await-send-calls-Dv2QM branch May 21, 2026 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants