Repository navigation
Write slim IPA and pronunciation URL back on vocab miss - #21
Merged
Merged
Conversation
Persist IPA and PRONOUNCED_LINK only when a true miss returns both, with rank 0 so random practice skips the row. Add a unique WORD constraint at startup and refuse if duplicate words already exist.
UK_PHONETIC_QUESTION_WORD is already on the UAT database. Hibernate still declares the constraint so H2 tests reject a duplicate word.
thcathy
commented
Nov 4, 2026
thcathy
commented
Nov 4, 2026
writeBackSlimQuestion is now persistEnrichedQuestion.
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
On an exact-word miss of
phonetic_question, a successful dictionary result that has both a non-blank IPA and a pronunciation URL is inserted as a slim row. The next lookup is a local hit and does not call web-parser.Plan: https://app.notion.com/p/40acda9bbfa68178b872ccf065025df1
Timmy locks (2026-11-03)
picsFullPaths/PIC_FILE_NAMEhide stayssetPicsFullPaths({""}). Picture cleanup is a follow-up.hit && !enriched) are returned as-is and are never filled.WORD, same client key. No new normalization. The client already sends the vocab string unchanged (VocabPracticeService.getQuestion→encodeURIComponent(word)), andPhoneticQuestionDAOlooks that string up withWORD = :word.Behavior
PhoneticQuestionService.buildQuestionByWebAPI, which runs only aftergetQuestionFromDBmisses.enriched()is true (both IPA andPRONOUNCED_LINK). Exact-word guard infillQuestionByDictionaryResultis unchanged.RANKis 0, below everyVocabDifficultyrange, sogeneratePractice/getRandomQuestionWithinRanknever returns a write-back.WORDfor a concurrent double-miss. A duplicate-key failure is logged and the pronunciation is still returned.InterpretationService, and Replicate are untouched. Stale audio URLs are stored as-is.Unique
WORDApplied directly on the UAT database at 8:23pm HKT on 3 Nov 2026, after a re-check found 0 duplicate
WORDgroups (4,061 rows, no null or blankWORD):No rows were deleted. The existing non-unique index
PHONETIC_QUESTION_WORDis unchanged. The entity still declares the same constraint so H2 tests reject a second insert. The app does not run schema changes on startup.Prod was not updated. SSH to the prod host is not available from this machine. Collation on UAT is
utf8mb3_unicode_ci, so the unique key matches the existing case-insensitive lookup.Tests
./gradlew test --tests com.esl.service.PhoneticQuestionWriteBackTest --tests com.esl.service.PhoneticQuestionServiceTestis green:PRONOUNCED_LINKonly,RANK = 0; second request is a DB hit and does not callqueryDictionarygeneratePracticefor everyVocabDifficultynever returns the rank-0 wordWORDspicsFullPathsstays{""}for both a write-back and an existing bank row (apple)Not done: no esl-ionic changes, no web-parser changes, no app deploy. Prod database was not changed.