Skip to content

fix(parse): distribute minor-currency scale across bare range endpoints - #10

Open
kruschdev wants to merge 1 commit into
pascalorg:mainfrom
kruschdev:fix/minor-currency-ranges
Open

kruschdev wants to merge 1 commit into
pascalorg:mainfrom
kruschdev:fix/minor-currency-ranges

Conversation

@kruschdev

Copy link
Copy Markdown

Description

Fixes minor-currency range distribution in buildRange (plan 026, plan 004) when one endpoint is a bare number and the other uses a minor-currency idiom (cents, ¢, pence, p).

  • Previously, matchCurrencyMinor returned { kind: 'currency', headUnit: 'USD', base: 0.06 } for "6 cents" without recording its minor-unit scale (100). In buildRange, a bare endpoint ("5" in "5 to 6 cents", "5 or 6 cents", "5-6 cents", "between 5 and 6 cents", "5 to 6 pence") inherited the major currency unit ($5.00 / £5.00) instead of scaling by 100, then tripped aBase > bBase and returned 0.06–$5.00 with a false RANGE_REVERSED warning.
  • I propagated minorScale on QtyNode for standalone minor-currency hits so buildRange scales bare left or right endpoints by the paired minor scale (0.05–$0.06, 0.05–£0.06), while still flagging genuinely reversed minor ranges ("6 to 5 pence" -> 0.05–£0.06 + RANGE_REVERSED).
  • I also deduplicated the repeated implied-unit QuantityResult construction in singleResult (parse/range.ts) with identical semantics so ./core stays within its 27.1 kB min+gzip budget (27.07 kB).

Checklist

Gates

  • bun run check green (typecheck, tests, build, size budgets, corpus gate, zero-deps gate)
  • bun run lint green (Biome via Ultracite)
  • Corpus diff is ADDITIVE (+5 minor-currency range rows in tests/corpus/source.mjs and contract-v1.json, zero changes to existing rows)

API surface

  • Semver impact: patch (fixes silent major-unit misassignment and false RANGE_REVERSED on minor-currency ranges)

Knowledge layer

  • CHANGELOG updated under [Unreleased]
  • Removed resolved item from plans/backlog.md

@vercel

vercel Bot commented Nov 22, 2026

Copy link
Copy Markdown

@kruschdev is attempting to deploy a commit to the Pascal Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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