feat(practice): add "Walk me through it" walkthrough on a wrong drill answer (#11) - #32
Merged
Conversation
… answer (#11) After a wrong answer, StepTrace shows the right final values but not the arithmetic, so a learner can't tell which step they slipped on. Add an opt-in "Walk me through it" toggle that reveals the full engine-derived mnemonic walkthrough — century anchor → Odd+11 substeps → year's doomsday → month anchor → cast-out-sevens offset → answer — for the EXACT date just missed. - workedExample.ts: export walkthroughFor(y,m,d) wrapping datedExample('full',...); every value derives from explain(), so it's engine-correct for any proleptic date (incl. leap-Feb and BC/exotic centuries). - WorkedExample.tsx: extract the step card as the exported WorkedExampleCard (Learn's "Show another" flow unchanged). - components/Walkthrough.tsx: a shared button → card toggle. - QuickDrill + GuidedSolve: render <Walkthrough> only on a wrong answer, below StepTrace (additive — StepTrace still shows). Wrong-only; absent on correct. Tests: walkthroughFor matches the engine across normal/leap-Feb/BC/max-year dates; QuickDrill + GuidedSolve assert the control appears on a wrong answer and the card matches explain() for the missed date, and is absent on a correct answer. 301 tests, typecheck, lint, build all green. Adversarial review: 0 Critical/Important. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Cleanup from /simplify + /code-review on the "Walk me through it" PR: - Drop the in-JSX IIFE in Walkthrough; compute the example only when open. - Extract the shared borderless burgundy link-button style into linkButtonStyle (PrimaryButton), reused by Walkthrough and WorkedExample instead of two copies of the same inline style object. - Add resetTestDb to GuidedSolve.test.tsx: GuidedSolve persists attempts via useGuided -> recordAttempt, so reset between tests like the other DB suites. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Closes #11. Roadmap item 7/7 — the finale. 🎉
After a wrong answer,
StepTraceshows the right final values but not the arithmetic — so a learner can't tell which step they slipped on. This adds an opt-in "Walk me through it" toggle that reveals the full engine-derived mnemonic walkthrough for the exact date just missed: century anchor → Odd+11 substeps → year's doomsday → month anchor → cast-out-sevens offset → answer.Changes
workedExample.ts— exportwalkthroughFor(y, m, d)wrapping the existing privatedatedExample('full', …). Every value derives fromexplain(), so it's engine-correct for any proleptic date (leap-Feb, BC/exotic centuries, max year).WorkedExample.tsx— extract the step card as the exportedWorkedExampleCard; Learn's "Show another" flow is unchanged.components/Walkthrough.tsx— a shared button → card toggle.QuickDrill+GuidedSolve— render<Walkthrough>only on a wrong answer, belowStepTrace(additive — the trace still shows). Absent on a correct answer.Design notes (for review)
StepTrace'sdefaultOpen={!correct}philosophy. Easy to also offer it on correct answers if you want.Verification
typecheck ✓ · lint
--max-warnings 0✓ · 301 tests ✓ · build ✓.walkthroughForis asserted against the engine across normal/leap-Feb/BC/max-year dates; both drills assert the control appears on a wrong answer with the card matchingexplain()for the missed date, and is absent on a correct answer. Adversarial review of the diff: 0 Critical/Important (1 Minor — an asymmetric test assertion — fixed in this PR).🤖 Generated with Claude Code