Repository navigation
fix(convex): a work pool's completion handler writes through the app's triggers - #1618
Merged
Merged
Conversation
…s triggers From the cross-family review of #1617. `defineOnComplete` builds its handler with Convex's own mutation builder, so its writes skipped every trigger: a model's reading that came back left its vote counted as waiting in the screening counts kept since #1616, and the pool's other completions skipped the cards and list counts the same way. - `withAppWrites` (lib/functions.ts) runs such a handler with the writes the app's builders give a mutation: through the triggers and the caps, its counts queued when it ends. The three completion handlers use it. - A model's vote is cast before the bookkeeping works out its decision: until then it counts as `cast`, so every vote cast is counted. - migrations/screeningFacets:readVotes takes out the waiting counts such readings left, and counts each vote as it stands; `verify` now finds those stale counts too. - facets.test.ts: a model's readings coming back failed or read keep its counts (fails without the wrapper), and the repair takes out what was left (verify 0).
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
…tes that have waited again too From the cross-family review of #1618: a vote left counted as waiting can wait again later (a new criterion asks the model to read its paper once more), by when its paper may stand elsewhere, and then it counts twice. The repair and verify skipped waiting votes. Both now look at every vote, and keep only the waiting count it should have.
sickerine
added a commit
that referenced
this pull request
Nov 28, 2026
…a model's vote not yet decided As the old count did: a model's vote is cast before the bookkeeping works out its decision, and is counted under `cast` until then (#1618).
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.
Found by the cross-family review of #1617. This needs to merge, and its repair needs to run on dev, before #1617 switches Papers' counts to read the aggregate.
defineOnCompletebuilds its handler with Convex's own mutation builder, so its writes skip every trigger inconvex/lib/triggers.ts. Three things go stale as a result:Changes
withAppWritesinlib/functions.tsgives such a handler the same writes the app's builders give a mutation: through the triggers and the caps, with its counts queued when it ends. The threedefineOnCompletehandlers use it:screening/readings:donescreening/files:donescreening/mutations:handleScreeningCompletecastkey, so the total of cast votes includes it, as the old query's did.migrations/screeningFacets:readVotesremoves the waiting counts such readings left and counts each vote as it stands.verifynow finds those stale counts as well as missing ones.After merging: push, then run
npx convex run migrations/screeningFacets:run. OnlyreadVotesis new; the earlier steps are already done. Wait forverifyto return 0, then merge #1617 rebased on this.Checks
tsc,check:convex-rules,check:module-weightandcheck:user-actionspass.convex/screening/facets.test.ts:recountVote, after whichverifyfinds nothing.