Repository navigation
Keep the currency of an amount written as money text - #68
Merged
Merged
Conversation
amount: €12 was read as 12 USD and amount: 99.50 EUR was dropped. Event amounts and record prices now share one rule (moneyIn): a code with the number wins, a sign gives way to a named currency, otherwise the sign's. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XCVQuXXVJBEB4WExAcfQfD
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.
What this changes
Before: an event's
amount: €12was totalled as 12 USD, andamount: 99.50 EURwas left out of the ledger altogether. Only a bare number with a separatecurrency:field worked. Record prices handled money text, but$1,899withpriceCurrency: AUDwas read as USD.After: event amounts and record prices follow one rule, the new
moneyIninsrc/core/util.ts:99.50 EUR) wins.currencyorpriceCurrency, so$20withcurrency: CADis 20 CAD.Totals stay per currency and are never converted, as before.
Why
Jimmy asked whether GitRoll handles different currencies. Checking showed that money text in
amountlost its currency.How it was tested
make checkpasses (typecheck, tests, build,@gitroll/corebuild, audit): 415 pass, 0 fail, 1 skipped (the CI-only browser presence check), 0 vulnerabilities.test/ledger.test.tscovers €, £, ¥, a trailing code, a code against acurrencyfield,$withcurrency: CAD, bare numbers,priceCurrency: AUD, and a ledger total of two EUR amounts.Anything a reviewer should look at closely
Format of files in a Roll: SPEC.md's event field table now describes money text in
amountand howcurrencyinteracts with it. GitRoll itself still writesamountas a number pluscurrency, so existing Rolls read as before, except for hand-written money text, which was misread until now.🤖 Generated with Claude Code
https://claude.ai/code/session_01XCVQuXXVJBEB4WExAcfQfD
Generated by Claude Code