Skip to content

feat: StepTrace — free step-by-step for equations + limits (roadmap #4)#79

Merged
ABCrimson merged 5 commits into
mainfrom
feat/wave1-steptrace
Jul 11, 2026
Merged

feat: StepTrace — free step-by-step for equations + limits (roadmap #4)#79
ABCrimson merged 5 commits into
mainfrom
feat/wave1-steptrace

Conversation

@ABCrimson

Copy link
Copy Markdown
Owner

Summary

  • math-engine: opt-in StepTrace layer threaded through 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)
  • web: solver panel Limit tab (approach point incl. ±∞, one-sided directions) and localized step rendering — 57 rule IDs × {title, detail} + limit-tab + category strings authored in en and translated into de/es/fr/ja/ru/uk/zh with correct math terminology and ICU select for limit direction
  • i18n coverage test imports DISPLAY_RULES from the engine, so any future rule without translations in all 8 locales fails CI

Verification

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

ABCrimson and others added 4 commits July 10, 2026 23:09
…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>
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nextcalc-pro Ready Ready Preview, Comment Jul 11, 2026 5:42pm

…ptrace

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ABCrimson
ABCrimson merged commit b29e231 into main Jul 11, 2026
7 checks passed
@ABCrimson
ABCrimson deleted the feat/wave1-steptrace branch July 11, 2026 19:10
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