Skip to content

user_preference read as text: two missed conversions; recompute fit after a validator fix - #903

Merged
mircealungu merged 3 commits into
masterfrom
preference-as-text
Oct 25, 2026
Merged

mircealungu merged 3 commits into
masterfrom
preference-as-text

Conversation

@mircealungu

Copy link
Copy Markdown
Member

Three small bugs found by the code review of #895. #895 didn't cause them; they sit next to it.

user_word.user_preference is TEXT in prod while the model says Integer, so it comes back as "-6" or "0". #895 added UserWordExPreference.of() to turn it into an int; two places didn't use it yet.

  1. Looking up a word declared known again raised a TypeError (bookmark.py): the "known" mark is meant to wear off (-6 → -4 → -2 → 0), but "-6" += 2 raises.
  2. An audio lesson didn't add a word with no preference (add_word_to_study.py): a stored "0" != 0, so the word looked like the learner had a preference and was left alone.
  3. After a validator fix, the new word's fit_for_study wasn't recomputed (validation_service.py): it kept the value worked out when the word was created (before its sentence was attached), or long before if the learner already had that word. Now recomputed after the sentence is attached; if the word is unfit, its schedule is cleared.

Tests: test_user_preference_as_text.py, one per bug; all three fail on master (including the real TypeError) and pass here. Related core and API tests pass.

The root cause (TEXT column) goes away with roadmap 0b, which replaces user_preference.

🤖 Generated with Claude Code

mircealungu and others added 2 commits October 25, 2026 17:18
… after a validator fix

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

Copy link
Copy Markdown

ArchLens - No architecturally relevant changes to the existing views

… fit is recomputed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mircealungu
mircealungu merged commit fb2b1e1 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