Skip to content

feat(core): report the conversion formula from the engine - #50

Merged
Stanback merged 2 commits into
mainfrom
fix/colorado-formula-label
Oct 24, 2026
Merged

Stanback merged 2 commits into
mainfrom
fix/colorado-formula-label

Conversation

@Stanback

@Stanback Stanback commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

The web method comparison labelled every Colorado Timing row "fixed turn offset". That included the distance-freestyle rules, which only multiply: ×1.11 for yards to short-course meters, ×1.02 for 1650 to 1500, and ×0.8925 for 500/1000 to 400/800. Clients were inferring the arithmetic from the method name.

The engine now reports it.

  • Rust core: ConversionValue.formula is one of none, multiplier, multiplier-offset or equivalent. It's set where the engine computes the time, and exposed through Wasm/SDK types and UniFFI.
  • Web and MCP card: both render the label from formulaText(value.formula) in src/lib/calculation-copy.ts. The card resource becomes 0.3.0-r9.
  • Native: iOS and Android already show an offset only when it's non-zero, so they're unchanged.

Tests

  • The conformance fixture asserts formula for the same-course, NCAA, Colorado-with-offset and Colorado multiply-only cases, and adds a Turnmark Equivalence case. 8,702 cases match in native Rust, Wasm/Node and Wasm/Chromium.
  • A Playwright test covers the 1650 SCY → SCM mile ("flat multiplier", no offset) and the 100 free ("+ 1.60s · fixed turn offset") on desktop and mobile. It fails on the old label code.
  • test-mcp-ui asserts the card's labels. test-mcp now computes methodDifferenceSeconds the documented way (NCAA against Colorado, or against Equivalence when selected); the new Equivalence case exposed this.
  • Vitest (192), svelte-check, ci-changes (81), cargo fmt and cargo clippy -D warnings pass.

🤖 Generated with Claude Code

@Stanback Stanback changed the title fix(web): label Colorado as a turn offset only when it adds one feat(core): report the conversion formula from the engine Oct 24, 2026
Stanback and others added 2 commits October 24, 2026 13:57
The method comparison labelled every Colorado row "fixed turn offset", even
for the distance-freestyle rules that only multiply (×1.11 yards to short
course, ×1.02 1650 to 1500, ×0.8925 500/1000 to 400/800). Those rows now read
"flat multiplier"; rows whose formula adds seconds keep the offset label.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ConversionValue gains `formula`: none, multiplier, multiplier-offset or
equivalent. Clients now describe the arithmetic from the engine instead of
inferring it from the method, which is how the web labelled Colorado's
multiply-only distance rules as a "fixed turn offset". The web comparison and
the MCP card render the label from `formulaText` in the shared copy; the card
resource moves to 0.3.0-r9.

The conformance fixture asserts the formula for same-course, NCAA, Colorado
offset and multiply-only cases, and adds a Turnmark Equivalence conversion
case. That case exposed test-mcp comparing methodDifferenceSeconds against the
first two methods; it now follows the documented rule (NCAA against Colorado,
or against Equivalence when selected).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Stanback
Stanback force-pushed the fix/colorado-formula-label branch from dc712f6 to ff119d0 Compare October 24, 2026 20:57
@Stanback
Stanback merged commit 022e037 into main Oct 24, 2026
12 checks passed
@Stanback
Stanback deleted the fix/colorado-formula-label branch October 24, 2026 21:38
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