Repository navigation
Conversation
C++ Ledger now lets a commodity block's format sub-directive spell the block's symbol bare, as the commodity header does, although an amount must quote it (ledger/ledger#3312): `commodity N1` with `format 1,000.00 N1` declares the display precision of N1. This reader took the bare N1 for a malformed commodity and skipped the format line, so N1 kept the precision its postings had taught it. Before parseAmount reads the sample, quote a bare occurrence of the block's symbol at either end of it, under the C++ conditions: the symbol needs quotes by the C++ table (commodity.cc invalid_chars, which is not this reader's validCommodity), the sample quotes nothing itself, and the symbol does not run into the number between two characters of a number. The witness is regress/3312, whose N1 balance rounds to the format's two places only under this rule. Verified as follows. `nix build .#oracle` exits 0, so every proof checks. test/semantic/check_all.py, run with the fixed C++ build against this oracle over the whole C++ suite, reports 3800 PASS and 0 FAIL (491 negative, 77 without a journal, 2 with Python). The same run against f5d891e fails on exactly regress/3312, where the oracle keeps 1234.567 N1 and C++ rounds to 1234.57. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CBCCbSZ9jNESexSR5iwBDC
This was referenced Oct 21, 2026
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
formatsample may now spell the block's symbol bare, as thecommodityheader does, although an amount must quote it:commodity N1withformat 1,000.00 N1declares the display precision of N1. BeforeparseAmountreads the sample,quoteBareSymbolquotes a bare occurrence of the block's symbol at either end of it.unexpected characters '1' after commodity symbol in format directive). This reader took the bare N1 for a malformed commodity and skipped the line, so N1 kept the precision its postings had taught it.textual_directives.ccquote_bare_symbol). The symbol must need quotes by the C++ table (commodity.ccinvalid_chars, which is not this reader'svalidCommodity). The sample must quote nothing itself. The symbol must not run into the number between two characters of a number, as inN11,000.00, where nothing marks where it ends.test/regress/3312.testin ledger/ledger, whose N1 balance rounds to the format's two places only under this rule. The rule's comment cites it.ledger/ledger#3316, which fixes C++ for ledger/ledger#3312, moves both pins (the flake input and the
lean/submodule) to this branch's commit,1f4d113. Please merge this with a merge commit, as #1 and #2 were, so that the commit stays reachable frommain. ledger-semantics#3, #4 and #6 also start fromf5d891e. The four rules touch separate definitions, and a trial merge of #6 (the commodity header andaliascomment rules, for ledger/ledger#3313) into this branch applies cleanly.Test plan
nix build .#oracle -Lexits 0, so every proof checkstest/semantic/check_all.py): 3800 PASS, 0 FAIL, 0 out-of-scope, 0 cpp-parse (491 negative, 77 no-journal, 2 python)f5d891e, the same run fails on exactly3312.test(only_oracle: N1|1234.567|Assets:N1,only_cpp: N1|1234.57|Assets:N1)🤖 Generated with Claude Code
https://claude.ai/code/session_01CBCCbSZ9jNESexSR5iwBDC