Skip to content

user_word: study_choice and unfit_reason replace user_preference - #906

Merged
mircealungu merged 1 commit into
masterfrom
wt/study-choice
Oct 25, 2026
Merged

mircealungu merged 1 commit into
masterfrom
wt/study-choice

Conversation

@mircealungu

Copy link
Copy Markdown
Member

Roadmap 0b, PR 2 of the series (after #905).

Columns

  • study_choice (study, skip, known): written only by learner actions:
    • the "+" button → study
    • "−", or the report dialog → skip
    • "I know this" → known
    • typed-in or audio-lesson words → study
    • OTHER_FEEDBACK in an exercise → skip
    • a learner's "bad translation" → skip, until reports exist (PR 3)
  • unfit_reason: why the system keeps a word out. Every place that makes a word unfit now gives one (set_unfit_for_study(session, reason)).
    • Quality heuristics (rare_for_beginner, same_as_translation, too_short, too_many_words, arbitrary_multi_word, bad_contexts) plus separated_mwe: worked out again at every update_fit_for_study. bad_quality_reason returns the first check that fails.
    • validator_gave_up and no_usable_context: last until the next recompute (a new look-up or a star), as today.
    • validator_invalid, replaced_by_fix (Validator fix: take the old word out of study when it survives #896's old word) and duplicate_meaning: stay.

Rule

fit_for_study is worked out from the two columns:

  • skip or known keeps a word out.
  • study lifts only the quality heuristics. The learner doesn't overrule the system.

fit_for_study stays a column, since the scheduler queries filter on it.

Deploy order

  1. Migration 26-10-25--user_word_study_choice.sql. It adds the columns and backfills them. Counts from prod on 25 Oct:

    From To Rows
    1 study 6,000 of 6,481. The 481 opt-ins Validator fix: being fit for study is not the learner's opt-in #895's bug forced are left out (roadmap item 0).
    -1 skip 1,458
    -6 known 266
    -100 replaced_by_fix 3
    -100 skip 89
    unfit with a validator "invalid" validator_invalid 26
  2. Deploy the API. The new code reads the new columns.

  3. tools/recompute_fit_after_study_choice.py judges the 481 again. It's a dry run by default; --apply writes.

The old user_preference column stays in the table, unused, until a later migration drops it. Anything the old code writes to it between steps 1 and 2 isn't carried over, so keep that gap short.

For review: 29 1 rows have no recorded learner action but aren't validator-fix targets either, e.g. l'enquête, 2021 → 2021, ergonomie → ergonomie. They may come from the edit dialog, which doesn't log the event, or from undo after a report. Following item 0, they keep study.

Tests

New test_study_choice.py covers the rule and which reasons stay and which are judged again. The full core and API suites pass (1299 passed).

🤖 Generated with Claude Code

Roadmap 0b. user_preference was one number for the learner's choice, a
countdown and validator writes, so a validator fix could pass for the
learner opting in (#895).

- study_choice (study / skip / known): written only by learner actions.
- unfit_reason: why the system keeps a word out. Quality heuristics are
  worked out again at every update_fit_for_study (bad_quality_reason gives
  the first failing check); the validator's give-up and "no usable context"
  last until then; validator_invalid, replaced_by_fix and duplicate_meaning
  stay. set_unfit_for_study now takes a reason.
- fit_for_study is worked out from the two: skip/known keep a word out; a
  study choice lifts only the quality heuristics (the learner doesn't
  overrule the system).
- A learner's "bad translation" is a skip until reports exist.

Migration 26-10-25--user_word_study_choice.sql adds the columns and
backfills them, leaving out the 481 opt-ins #895's bug forced (roadmap
item 0); tools/recompute_fit_after_study_choice.py then judges those again.
The user_preference column stays, unused, for a later migration to drop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ArchLens detected architectural changes in the following views:
diff

@mircealungu
mircealungu merged commit 003e2a9 into master Oct 25, 2026
2 checks passed
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.

1 participant