Daily audio cron: extract decide_generation — table as code#651
Open
mircealungu wants to merge 1 commit into
Open
Daily audio cron: extract decide_generation — table as code#651mircealungu wants to merge 1 commit into
mircealungu wants to merge 1 commit into
Conversation
…-table row The per-user generation decision (not-subscribed | invalid-type | not-due | exists | paused | ready) was a cascade of guards spread across the loop body and generate_for_user, with the dry-run branch re-checking the same gates as the real-run branch. Lift it into decide_generation(user, language, …): one read-only function with one return per row of the decision table. The main loop becomes a dispatch on the kind, and generate_for_user does only the heavy work (it's no longer the place where gates re-live). Behavior unchanged; dry-run buckets match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
ArchLens - No architecturally relevant changes to the existing views |
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.
Summary
Lifts the per-user generation decision (the table I keep drawing in chat
diagrams) into a single read-only function — one return per row.
The cron's main loop becomes a dispatch on
kind, andgenerate_for_userdoesonly the heavy work (it no longer re-checks the gates —
prepare_lesson_generationstill has its own existing-lesson check as belt-and-suspenders). Both dry-run
and real-run share the same decision, so the buckets can't drift between them.
Test plan
python -m tools.generate_daily_audio_lessons --dry-run --days 30— same buckets as before.--user-id <yours>real run still generates / skips as before.Pairs with web#TBD (Today view's
selectTodayViewprojection — same pattern on the client).🤖 Generated with Claude Code