Drill the generated ladder instead of one hard-coded sentence - #18
Merged
Merged
Conversation
The ladder, the text generator and the drill surface all existed but nothing joined them up, so the app drilled the same sample sentence whichever lesson you picked. The drill text now comes from the lesson's own key set, which is the thing the project is for: a learner is never shown a key the ladder has not given them yet. Setting nextLessonName exposed a bug this introduced. The continue button was wired straight to startDrill, so naming the next lesson on it made it promise a rung and then restart the current one. It now advances only when the result actually earned it and the caller supplied somewhere to go, and says "Drill this lesson again" otherwise. A button that names a lesson it will not open is worse than one that offers another go. The drill seed comes from the clock so each attempt differs, and ?seed= pins it. That makes a drill reproducible, which the end-to-end suite needs and which is the only way to compare two runs of the same text by hand. Tests that hard-coded the sample now derive what they need: the functional suite reads the rendered text back, and the end-to-end suite computes the same text the app will from the pinned seed, along with the finger, hand and description of whichever key it is about to assert on. Hard-coding "a" or "pinky" only held while one sentence was hard-coded too. Fills in the end-to-end journey for earning two stars and advancing, which could not be written until advancing existed. Brings docs/accessibility.md up to date: the ladder and statistics views are covered now, and the gaps that remain are named with the issues that own them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The ladder (#1), the text generator (#3) and the drill surface (#6) all landed separately, each leaving a marked seam. Nothing joined them up, so the app drilled the same sample sentence whichever lesson you chose. This is the join.
Drill text now comes from the lesson's own key set, so a learner is never shown a key the ladder has not given them yet.
A bug this introduced, and the fix
Setting
nextLessonNameexposed a real problem. The continue button was wired straight tostartDrill, so naming the next lesson on it made it promise a rung and then restart the current one. #9 had deliberately leftnextLessonNamenull for exactly this reason; wiring it up without wiring the advance would have shipped the lying button it was avoiding.It now advances only when the result actually earned it and the caller supplied somewhere to go, and reads "Drill this lesson again" otherwise.
Verified by hand rather than only by test: typed lesson one to three stars, the button read "Start The left thumb", taking it switched the drill to text containing
e— the key that lesson adds — and the ladder updated to ★★★ passed.?seed=The drill seed comes from the clock, so each attempt at a lesson differs.
?seed=pins it, which makes a drill reproducible — the end-to-end suite needs that, and it is the only way to compare two runs of the same text by hand.Tests that assumed one sentence
Both suites hard-coded the sample, and a good many hard-coded
a,pinkyandaskalong with it. They now derive what they need:That was the right fix rather than pinning new literals: an assertion that hard-codes
pinkyonly holds while one sentence is hard-coded too.Also
docs/accessibility.mdbrought up to date — the ladder and statistics views are covered now, and the remaining gaps are named with the issues that own them. The largest is that no person has yet heard this through a screen reader (Make the trainer usable with a screen reader #10).478 vitest, 122 Playwright, axe clean in both themes.
🤖 Generated with Claude Code