Repository navigation
fix(ag-rledger): restore the panic envelope, repeated flags and short-flag echo after agcli 0.19 - #2859
Merged
Conversation
…-flag echo after agcli 0.19 Three regressions from the agcli 0.19 port (#2846): - A handler panic was answered for the wrong command: the fallback parsed argv with `Invocation::parse` after skipping the program name, so the command word became the program (`check f.beancount` gave exit 2 UNKNOWN_COMMAND "Valid commands: f.beancount."). The fallback is now the real command tree (`build_cli_with`) with every handler replaced, so agcli resolves the command, redacts and picks its next actions as in the run that panicked, whatever precedes the command word. The envelope is HANDLER_PANIC, exit 1, with agcli 0.17's fix text. - agcli 0.18 refuses any repeated flag (PARSE_ERROR), but rledger's list flags (--plugin, --native-plugin, --include-rules, --exclude-rules, --investments/-i, --income/-n, --wasm-importer, --wasm-importer-dir, --mapping/-m) take repeats. A repeated one is merged into one comma-joined flag before dispatch (`merge_repeated_value_flags`), which `flag_values` already splits on commas. Short forms merge only for the command that owns them; a flag given once and repeated switches are left as written. - agcli masks the value of an undeclared flag in `command`, and reads `--account/-a <ACCOUNT>` as declaring --account only, so every short value flag echoed `<redacted>`. Short forms are now their own usage tokens, in the report flags and the command usage strings. config -f, read as both --format and --force, is left as it was. Also moves usage_for's doc comment off with_globals. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
✅ Compatibility Test Results
What's tested
Full results available in workflow artifacts |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Contributor
📊 Benchmark Results
vs base, measured in this run
A difference counts only when it clears the combined spread of the two measurements, per shape (2σ: What do these numbers mean?
|
…ry flag a handler reads Review of #2859: - The command word was the first non-flag argument after the global value flags, so a value flag before it hid it: `--format json report l returns -i A -i B` merged no short forms and failed as "given twice". It is now the first argument that names a registered command (COMMAND_NAMES, checked against the root tree) or a config alias, as agcli finds it; expand_config_aliases and the merge use that rule. - agcli 0.19 never takes a command's name as a bare flag's value, so `-P x check l.beancount` ran the `x` alias (extract) on `check`. Declaring -P does not change that rule, so a global value flag before the command word is now passed with its value attached (`-P=x`). - Value flags the handlers read but the usage did not declare still echoed `<redacted>`: check --plugin, --include-rules, --exclude-rules, --cache-filename, --lint-min-confidence, --file, --show-summary; extract --wasm-importer, --wasm-importer-dir, --delimiter, --importers-config and its column, format and ledger flags; price --source-meta; add -q. All are declared now, and a unit test fails when a handler reads a flag its command's usage does not declare. Co-Authored-By: Claude Opus 5.5 <[email protected]>
10 of 14 tasks
robcohen
added a commit
to MoTechnicalities/rustledger
that referenced
this pull request
Nov 7, 2026
Since agcli 0.19 (rustledger#2859) a flag given twice is refused unless it is in MULTI_VALUE_FLAGS, so lint linked-transit --account A --account B failed with PARSE_ERROR. --account takes one value on report and extract, so it cannot join the global list. MULTI_VALUE_COMMAND_FLAGS scopes a long list flag to the commands that own it, as MULTI_VALUE_SHORTS does for short flags, and lists account for lint only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
added a commit
to MoTechnicalities/rustledger
that referenced
this pull request
Nov 7, 2026
…ated Since agcli 0.19 (rustledger#2859) a flag given twice is refused unless merge_repeated_value_flags merges it, and nothing checked that the tables kept up with rledger. The new guard walks every rledger command definition ag-rledger runs (and fails if one is missing from the list) and asserts that each clap Vec flag taking one value per occurrence is in MULTI_VALUE_FLAGS or, for its command, MULTI_VALUE_COMMAND_FLAGS, with its short form in MULTI_VALUE_SHORTS; that no single-value flag is merged where it applies (report and extract --account); and that no entry is stale. It found one gap, fixed here: check --lint is repeatable in rledger but ag-rledger read one value, so a repeat was a PARSE_ERROR. It is now scoped in MULTI_VALUE_COMMAND_FLAGS and read as a list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
added a commit
that referenced
this pull request
Nov 7, 2026
* feat: add linked transit transfer lint Inspect explicitly linked transit legs without rewriting source or changing default validation. Co-authored-by: Copilot <[email protected]> * fix(lint): read the booked ledger in linked-transit The lint read Loader::load output, so an elided transit amount always came out ambiguous and any plugin line refused the whole ledger. It now follows lint closed-nonempty: refuse on load errors, then run rustledger_loader::process with plugins and the plugin budget, and read the booked directives with ledger.source_map for locations. The inferred-amount branch and the plugin refusal are gone. A processing error refuses the input rather than being reported as a finding: a transaction booking rejects is left out of the booked stream, so its link would otherwise read as missing. Fees, prices, costs and several scoped links stay ambiguous. Transit amounts are rustledger_core::Amount. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ag-rledger): accept a repeated --account in lint Since agcli 0.19 (#2859) a flag given twice is refused unless it is in MULTI_VALUE_FLAGS, so lint linked-transit --account A --account B failed with PARSE_ERROR. --account takes one value on report and extract, so it cannot join the global list. MULTI_VALUE_COMMAND_FLAGS scopes a long list flag to the commands that own it, as MULTI_VALUE_SHORTS does for short flags, and lists account for lint only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(lint): diagnose a linked-transit configuration that matches nothing A typo in --account or --link-prefix printed "No linked transit transfers found." and exited 0. Now: - each --account must pass rustledger_parser::is_valid_account_name, or the lint refuses with the name; - a leading ^ on --link-prefix is dropped with a LINK_PREFIX_CARET note, since links are matched without it; - a configured account the ledger never opens or posts to (ACCOUNT_NOT_IN_LEDGER) and a prefix no link starts with (NO_LINK_MATCHES_PREFIX) are warnings, as are processing warnings. Warnings go through Messages: warning: lines on stderr in rledger, and records in the ag-rledger envelope's warnings (lint now runs under run_buffered_with_warnings). Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): add rledger lint linked-transit (#2818) Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(lint): validate linked-transit legs, and refuse only what can mislead With validation off, a leg rledger check rejects could still be matched (an unbalanced leg, an unopened account, a closed transit account), while a plugin finding such as check_commodity or leafonly refused the whole file. The lint now runs validation, as check does, and sorts what processing reports by what it can do to the answer: - a booking failure or a plugin failure refuses the input: either drops or alters transactions; - any other error located on a linked transaction makes that link ambiguous, with the error as the reason; - everything else (errors elsewhere, errors with no transaction location such as check_commodity, warnings) is passed through as a warning. Advisory-only codes stay silent, as in check. A plugin finding and a plugin that failed to run are both PLUGIN errors, so rustledger-loader marks the latter: LedgerError::is_plugin_failure is set for a plugin that could not be resolved, failed while running, or whose output was discarded. The test ledgers now open their accounts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(lint): mark plugin-inserted linked-transit legs ambiguous A transaction a plugin inserted with no source location failed the whole run ("linked transaction has no source location"). One inserted at a location another transaction already has was merged into it by the dedup key, which is meant for a file read twice: two forecast copies of one leg merged into one and matched the receiving leg. An unlocated transaction now gets its own key and makes its link ambiguous. A location shared by several transactions in one ledger (forecast copies, effective_date splits) makes the link ambiguous too, so a dedup merge can never produce a match. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(ag-rledger): keep a passed-through ledger error's file and line linked-transit passes a ledger error that is not on a linked leg through as a warning. The terminal line said where it was; the envelope's warnings entry kept only the code and message. Diagnostic gains file and line fields, which the lint fills from the error's location and the envelope carries as "file" and "line". The struct literals that named every field now fill the rest from Diagnostic::message. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(lint): a Status enum for linked-transit findings The four statuses were string literals compared in several places. A Status enum, serialized lowercase, replaces them; the JSON and text output are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(lint): say what differs in a linked-transit mismatch "transit account, currency, amount, or direction differs" left the user to work out which. A mismatch now names it: "account: A vs B", "currency: 100 USD vs -100 EUR", "zero transit amount: 0 USD vs 0 USD", "direction: 100 USD vs 100 USD (same sign)" or "amount: 100.00 USD vs -90.00 USD". Each location in the JSON carries its transit postings, with the booked number as a string and the currency. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(lint): list only unmatched links in linked-transit text output On a ledger with hundreds of transfers, listing every matched pair hid the few problems. The text output now lists the links that did not match, then a count line ("312 matched, 2 mismatch, 1 missing, 0 ambiguous"). The JSON keeps every finding and gains the same counts. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(lint): print linked-transit paths as the other lints do linked-transit canonicalized each source path itself, for both the printed location and the dedup key, while the other lints print the source map's path (the file's identity, symlinks already resolved). It now uses that path for both, which drops a second resolution that could fail on its own, and a test pins its locations to closed-nonempty's on a ledger reached through a symlink. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(lint): --fail-on for linked-transit, in rledger and ag-rledger #2818 asks for an explicit way to make findings fail a CI job or a pre-commit hook. --fail-on mismatch,missing,ambiguous (comma-separated or repeated, any of the four statuses) exits 1 when a link ends in a listed status, as check exits 1 on an error; without it findings still exit 0, like the other lints. ag-rledger reads it with the same names, refuses an unknown status as INVALID_VALUE, and merges a repeated --fail-on in lint (MULTI_VALUE_COMMAND_FLAGS). Its envelope is the one check gives: ok true, exit_code and result.exit_status 1. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(lint): name and split the linked-transit tests The tests follow test_<function>_<scenario>. The table-driven pair test and the grab-bag dedup test are split by what they check, every assertion names its link, and the 79228162514264337593543950335 case, which mostly tested rust_decimal, is gone. The mismatch kinds it covered are in test_run_with_writer_mismatch_names_what_differs. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: move the linked-transit docs to docs/commands/lint.md The section was in check.md, but linked-transit is a lint subcommand. docs/commands/lint.md lists the four lints and documents linked-transit in full: options, statuses and reasons, the JSON shape, how processing errors are handled, configuration warnings and --fail-on. The commands index links it, and check.md keeps a pointer. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(ag-rledger): guard that every rledger list flag merges when repeated Since agcli 0.19 (#2859) a flag given twice is refused unless merge_repeated_value_flags merges it, and nothing checked that the tables kept up with rledger. The new guard walks every rledger command definition ag-rledger runs (and fails if one is missing from the list) and asserts that each clap Vec flag taking one value per occurrence is in MULTI_VALUE_FLAGS or, for its command, MULTI_VALUE_COMMAND_FLAGS, with its short form in MULTI_VALUE_SHORTS; that no single-value flag is merged where it applies (report and extract --account); and that no entry is stale. It found one gap, fixed here: check --lint is repeatable in rledger but ag-rledger read one value, so a repeat was a PARSE_ERROR. It is now scoped in MULTI_VALUE_COMMAND_FLAGS and read as a list. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): update the linked-transit entry Covers validation and how processing errors are handled, plugin-inserted legs, mismatch reasons, the quieter text output, --fail-on, the docs page, LedgerError::is_plugin_failure, and ag-rledger check accepting a repeated --lint. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(lint): satisfy clippy in linked-transit An if-let for the source lookup (single_match_else) and backticks on the plugin names in the module docs (doc_markdown). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(plugin): report a native plugin that cannot use its config as failed A native plugin that cannot use its config (rename_accounts with a bad pattern, zerosum with none, effective_date, the check_* "skipping" configs, ...) returns every directive unchanged and one unlocated PLUGIN error. The loader read that as a finding, so linked-transit reported two legs as matched where the rename the config meant makes them ambiguous, and exited 0 even under --fail-on. PluginError gains failed, set with mark_failed() at every site where a native plugin gives up without doing its work: an unusable config in capital_gains (long_short, gain_loss, through unchanged()), check_average_cost, check_commodity, check_option_expiry, commodity_attr, document_discovery, effective_date, onecommodity, rename_accounts and zerosum; a pattern it cannot evaluate (capital_gains, check_commodity, onecommodity); and a documents directory it could not scan. Errors a plugin reports on one directive it leaves as written (valuation, effective_date) stay findings: they are located, so the lint attributes them to the leg. The loader maps failed to LedgerError::with_plugin_failure. failed is serde(skip): the MessagePack array a WASM guest sends is unchanged, so the ABI stays 3, and a WASM or Python plugin's errors remain findings. Tests: the rename_accounts repro (refused, and ambiguous once the pattern is fixed), every marked config site, a finding left unmarked, the wire shape, and one each for the loader's run-error, op-coverage and invalid-entry sites. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(loader): say plainly why is_plugin_failure exists "Not readable from the code" read as a remark about the source; it meant the error code. Reworded. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(lint): exit 2 when linked-transit cannot answer With --fail-on, a finding exits 1, and so did a run that could not answer (a missing file, load errors, a processing failure, a refused configuration), so a CI job could not tell "found something" from "never looked". rledger lint linked-transit now exits 2 for the latter, as rledger check exits 2 on a file it cannot read. The other lints keep exiting 1. ag-rledger is unchanged: a run that could not answer is already an error envelope ("ok": false, FILE_NOT_FOUND exit 3 or COMMAND_FAILED exit 1), and 2 means a usage error there. Both are documented in lint.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(lint): attribute a plugin error on a posting line to its transaction A plugin error is matched to a linked transaction by file and line, and only the header line counted, so an error a plugin located at one of the leg's postings was passed through as a warning and the link could still match. Any line from the header to the last posting now counts. No native plugin locates an error at a posting today (a Python plugin can), so the lookup is a function with its own test. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): linked-transit plugin failures and exit 2 Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(plugin): exact error counts in the failed-marker tests The plugin-test-quality policy refuses a bare non-empty check: each unusable config gives exactly one error, marked failed, and the finding test exactly one, unmarked. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(plugin): zerosum refuses a config it cannot read, as beancount does zerosum found its settings by matching regexes against the config text, so parse_config never failed: a malformed config such as {'zerosum_accounts': {'Assets:Transit' ('Assets:Transit-Matched', 30)}} matched nothing and the plugin did nothing without a word. check exited 0, and lint linked-transit reported legs the plugin should have moved as matched. Beancount's literal_eval raises on it. The config is now read with the shared py_literal parser, as effective_date and check_commodity read theirs. Anything other than a dict, a zerosum_accounts that is not a dict of (target, days), an account_name_replace that is not (from, to), or a tolerance that is not a number is an error, marked failed. Every key stays optional and the last of a repeated key wins, as in Python. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): PluginError's new field breaks struct literals PluginError is not non_exhaustive, so code building one with a struct literal must add failed. Said under Breaking, as for NoteData. The wire test also pins the encoded shape: a four-element fixarray. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(lint): pin the posting-line lookup to a real transaction span errors_within's doc and test spoke of a transaction's header and postings, but a directive's span runs up to the next directive, blank and comment lines included. The range now comes from span_lines, whose doc says so, and a test builds it from a parsed ledger: header to the comment line before the next transaction, with an error at a posting attributed to its own transaction only. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(plugin): cover every site that marks a plugin failure, and guard findings The marked-site tests covered the config errors only. They now cover the other sites too: rename_accounts and check_commodity, onecommodity, long_short and gain_loss on a pattern they cannot match (a word boundary on a character Python and rledger disagree on), gain_loss's second rule after a rewrite, check_commodity's pattern it cannot compile (whose finding stays unmarked), the documents directory document_discovery cannot scan, and zerosum's non-dict config. A drift guard the other way pins that per-directive findings stay unmarked: leafonly, no_unused, unique_prices, and valuation's zero-unit total price. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(lint): exit cleanly when the reader closes the pipe rledger lint | head reported "error: Broken pipe" and exited non-zero (2 for linked-transit since the last change). The Lint arm now treats a closed pipe as the Check arm does: exit 0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * style(plugin): let rustfmt format onecommodity's refusal The format! call was too long for rustfmt to fit in the match arm, so it left the block indented by hand, and wrongly. The message is now built first. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(plugin): read zerosum configs as the Python zerosum plugin does zerosum comes from beancount_reds_plugins (0.4.0), whose config is literal_eval'd, each key popped with a default, and each entry unpacked, with no type checks. The previous change refused more than it does. Now, as there: - days may be a float (rounded down, as timedelta(days=x) added to a date is), an int in any literal form (3_0, 0x1e), or a bool (True is 1); - a None target is an empty one, derived with account_name_replace; - a two-character string unpacks into account_name_replace's pair; - flag_unmatched, match_metadata, match_metadata_name, link_transactions and link_prefix are accepted and, like any other key, ignored. It still refuses what the Python plugin refuses: a config that is not a literal or not a dict, a zerosum_accounts that is not a dict, and an entry or account_name_replace that does not unpack into two. A days value or tolerance that is not a number is refused up front, a deliberate strictness (the Python plugin fails, or matches nothing, only once a zerosum posting is reached), commented and tested. Checked against the Python plugin with bean-check and bean-query: the accepted forms move the same postings, and every refused config fails there too. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: a zerosum example that works The reference showed plugin "beancount.plugins.zerosum" "Assets:Reimbursable 30", which never worked: before, the plugin silently did nothing (so the comment that the postings match was false), and now the config is a plugin error. The example is now the dict form the Python zerosum plugin (beancount_reds_plugins) reads, with the accounts opened, and its options are listed. Checked with rledger check and query, and with bean-check and bean-query with beancount_reds_plugins 0.4.0: the same two postings move to Assets:Reimbursable-Matched. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): credit zerosum's behavior to the Python zerosum plugin zerosum is beancount_reds_plugins', not beancount's, and literal_eval is only the first of its failures: pop and the unpacking after it fail on the others. Also notes the forms now read as it reads them, the deliberate strictness on a non-number days or tolerance, and the fixed reference example. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(plugin): correct what zerosum says about the Python plugin - py_days: a negative range matches nothing across two transactions, as in Python, but rledger's same-transaction branch skips the date check, so two postings in one transaction still match. Noted as a known difference; behavior unchanged. - A None tolerance raises TypeError in the Python plugin; it does not match nothing. - CHANGELOG: only a config the Python plugin cannot read is now a plugin error. Days too large for timedelta (an overflow there) and an empty target with no account_name_replace (a hang there) still run here. - plugins.md: with no account_name_replace, an empty target is <account>-Matched. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Rob Cohen <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Follow-up to #2846, which auto-merged before its review finished. Fixes the three regressions the review found, plus a misplaced doc comment.
What changed
Invocation::parseafter skipping the program name, so the command word became the program: a panic incheck f.beancountgave exit 2UNKNOWN_COMMAND"Valid commands: f.beancount.", and barecheckgave "Valid commands: ag-rledger.".build_cliis nowbuild_cli_with(wrap), and the fallback is the real command tree with every handler replaced, since a command's lasthandlerwins. agcli resolves the command, redacts and picks next actions exactly as in the run that panicked, whatever precedes the command word. The envelope isHANDLER_PANIC, exit 1,handler panicked: <message>, with agcli 0.17's fix text and the command's own next actions.PARSE_ERROR, no opt-out), butrledger's list flags take repeats:--plugin,--native-plugin,--include-rules,--exclude-rules,--investments/-i,--income/-n,--wasm-importer,--wasm-importer-dir,--mapping/-m.mainnow merges a repeated one into one comma-joined--flag=a,bbefore dispatch.flag_valuesalready split each of these values on commas, so the handler reads exactly what it read before; a value containing a comma was split before too. Short forms merge only for the command that owns them (format -iis--in-place). A flag given once and repeated switches (--json --json) are left as written, and merging stops at--.<redacted>echo. agcli masks the value of an undeclared flag incommand, and reads--account/-a <ACCOUNT>as declaring--accountonly. Short forms are now their own usage tokens: inreport_flag_usageand in the check, query, format, report, doctor, extract, price, add and lint usage strings.config -fis left as it was, since its handler reads-fas both--formatand--force.usage_for's doc comment had been inserted underwith_globals's; each now has its own.Main vs this branch (separate builds and target dirs)
check f --native-plugin auto_accounts --native-plugin noduplicates--native-plugin=auto_accounts,noduplicatesreport f returns --investments A --investments B(and-i A -i B)--investments=A,Bprice --mapping A:B --mapping C:D --list-sources--mapping=A:B,C:Dreport f balances -a Assets,journal -l 5,check f -f json,query f "SELECT 1" -f json<redacted>check f --json --json,format f -i -i, plaincheck f,c f,--account=AssetsHow to test
cargo test -p rustledger --all-features --bin ag-rledger --test ag_rledger_test. New unit tests:check f.beancount,--json check f.beancount, barecheck, and an alias with a short flag;cargo test -p rustledger --all-features: 47 test results, 0 failed;-D warnings --all-features --all-targetsand rustdoc-Dwarningsare clean;cargo fmt --checkis clean.Review round 1 (
e2e8617391)Command word. It is now the first argument that names a registered command (
COMMAND_NAMES, which a test checks against the root command tree) or a config alias, as agcli finds it. Before, a value flag before the command hid it:--format json report l returns -i A -i Band-f json price -m A:B -m C:Dmerged nothing and failed as "given twice".expand_config_aliasesand the merge share the rule.-P x check l.beancount. agcli 0.19 never takes a command's name as a bare flag's value, so this ran thexalias (extract) on the filecheck. Declaring-Pdoes not change that rule, so a global value flag (-P,--profile, the plugin budget) before the command word is now passed with its value attached (-P=x).Every flag a handler reads is declared. Still undeclared were:
check--plugin,--include-rules,--exclude-rules,--cache-filename,--lint-min-confidence,--file,--show-summary;extract--wasm-importer,--wasm-importer-dir,--delimiter,--importers-configand its column, format,--skip-rows,--balance-date,--use-merchant-dict,--forceand--ledgerflags;price--source-meta;add-q.A new unit test,
usage_declares_every_flag_the_handler_reads, runs every builder and fails when one reads a flag its command's usage does not declare.Tests. Unit tests cover a value flag before the command word and
attach_global_values. Integration tests cover--format json report ... -i A -i B,-f json price -m ... -m ...,-P x check(runs check, exit 0) and the echo of--plugin=a.wasm,b.wasm,--cache-filename,--include-rulesand--delimiter.Verification.
cargo test -p rustledger --all-features: 47 test results, 0 failed. The ag-rledger suites had 23 unit and 48 integration tests passing.-D warningsand rustdoc-Dwarningsare clean, and so iscargo fmt --check.🤖 Generated with Claude Code