feat: StepTrace — free step-by-step for equations + limits (roadmap #4)#79
Merged
Conversation
…lver and limits - New trace module: TraceCollector (zero cost when off — every emission is trace?.emit behind a single undefined check), const-derived TraceRuleId union, DISPLAY_RULES whitelist, curateTrace (whitelist filter, no-op drop, consecutive-simplify merge) - solve(): optional trace option threaded through linear/quadratic/numerical paths, emitting coefficient/formula/root events with before/after ASTs and ICU-safe plain params (incl. Newton iteration counts) - limits(): LimitConfig.trace instrumentation across pattern/direct/ simplify/L'Hopital/series/numerical strategies; trace flows through the post-simplification recursion; legacy string steps untouched - step-solver: SolutionStep gains optional ruleId/params (i18n-addressable); every equation step tagged; new rational-equation path (domain restrictions, multiply-by-LCD, delegate to linear/quadratic/cubic, extraneous-root exclusion); StepCategory.Limit + limitWithSteps() mapping curated limit traces to textbook-shaped StepSolutions - ./trace subpath export; tests: trace curation, ruleId sequences for linear/quadratic(factor+formula)/rational/limits, ICU-safety guard, traced-vs-untraced parity Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds solver.stepRules.<ruleId>.{title,detail}, solver.limitTab.*, and
solver.stepCategories.* to all 8 locale files, covering every display
ruleId the math-engine's curateTrace() emits (equation/linear/quadratic/
cubic/trig/rational/numeric/answer/limit) plus the Limit tab's UI copy
and step-category badge labels. Genuine per-language math terminology,
not English placeholders; ICU placeholder names match the engine's
emitted param names exactly, verified end to end against a real ICU
MessageFormat parser across all 8 locales (including the direction
select block in limit.setup).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wires the previously-uncommitted Limit mode tab (approach point +
direction controls, parseLimitPoint/parseLimitDirection) and the
localizeStep() mapper that resolves ruleId-tagged solution steps
through solver.stepRules.<ruleId>.{title,detail} with the engine's
plain-value params, falling back to the engine's English text for
untagged steps. Depends on the i18n keys added in the previous commit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- __tests__/i18n/solver-step-rules.test.ts: asserts every ruleId in
math-engine's DISPLAY_RULES resolves solver.stepRules.<ruleId>.{title,
detail} in all 8 locales, plus full solver.limitTab.* and
solver.stepCategories.* coverage — guards against future drift between
the engine's rule ids and the web translations.
- solver-panel.test.tsx: Limit tab reveals approach-point/direction
controls; parseLimitPoint accepts 3/inf/∞/-infinity and rejects
garbage via the invalidPoint alert; localizeStep resolves a
ruleId-tagged step through the real translation vs. falls back to the
engine's English text when untranslated; the category badge falls
back to the generic "Step" label for an unrecognized category.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ptrace Co-Authored-By: Claude Fable 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.
Summary
solve()/limits()—ruleId+ params tagged on every step,limitWithSteps()maps curated limit traces to textbook-shaped solutions; zero cost when tracing is off (traced-vs-untraced parity tested)selectfor limit directionDISPLAY_RULESfrom the engine, so any future rule without translations in all 8 locales fails CIVerification
math-engine 2230 tests, web 359 tests — green; every ICU template in every locale round-tripped through the real
createTranslator/intl-messageformat; typecheck + biome clean. Wave-1 roadmap item #4 (equations → limits; ODE phase deliberately deferred).🤖 Generated with Claude Code