feat(scheduler): Allow bypassing queue logic via CardAnswer flag #3976
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.
Problem
Currently, the backend scheduler assumes all card answers processed via the
answer_card
endpoint originate from the standard review queue (from_queue
is implicitly true). This doesn't accurately represent scenarios like card previews or potentially some custom study sessions where answering a card should not affect the main queue counts or state.Solution
This PR introduces an optional boolean field
from_queue
to theCardAnswer
protobuf message definition (proto/anki/scheduler.proto
).When
from_queue
is set tofalse
by the client, the backend service (rslib/src/scheduler/service/answering.rs
) will now set the internalfrom_queue
flag tofalse
for that specific answer. This allows the scheduler to correctly handle answers that should not modify the standard queue state.If
from_queue
is omitted or set totrue
, the behavior remains unchanged (the answer is consideredfrom_queue = true
).Impact
This change provides more flexibility for clients interacting with the scheduler, enabling them to distinguish between answers that are part of the normal review flow and those that occur outside of it (e.g., previews), ensuring queue metrics remain accurate.