Skip to content

inferred_tolerance_default option not honored #308

Closed

Description

@robcohen

Description

The option "inferred_tolerance_default" "*:0.01" beancount option is parsed but not actually used in validation/tolerance calculations.

Steps to Reproduce

  1. Add option "inferred_tolerance_default" "*:0.01" to a beancount file
  2. The option shows as {} in the Fava options view
  3. Python beancount shows {'*': Decimal('0.01')}

Expected Behavior

The inferred_tolerance_default option should:

  1. Be parsed and stored correctly
  2. Be used when calculating tolerances for balance assertions and transaction validation

Context

References

  • Python beancount implementation: beancount/parser/options.py
  • Tolerance calculation: beancount/ops/validation.py

Activity

  1. robcohen commented on Feb 7, 2026

    @robcohen
    MemberAuthor

    Root Cause Analysis

    The option IS parsed correctly by rustledger-loader, and the validation logic in rustledger-validate does use inferred_tolerance_default. However, the FFI layer drops the field when returning options to Fava.

    Missing in FFI layer:

    1. LedgerOptions struct (crates/rustledger-ffi-wasi/src/types/output.rs:280-292) - missing the inferred_tolerance_default field
    2. load_source (helpers.rs:97-110) - doesn't parse inferred_tolerance_default
    3. cmd_load_full (load.rs:198-210) - doesn't copy inferred_tolerance_default to output

    Fix needed:

    Add to LedgerOptions:

    pub inferred_tolerance_default: HashMap<String, String>, // Store as String for JSON serialization

    And update the option parsing/copying in both helpers.rs and load.rs.

    Note: The tolerance calculation in calculate_tolerances() (transaction.rs:316-344) already implements the correct behavior - it's just not visible to Fava because the FFI output omits the field.

  2. added a commit that references this issue on Feb 7, 2026
    ab542ef
  3. robcohen commented on Feb 8, 2026

    @robcohen
    MemberAuthor

    Fixed in v0.8.5 (PR #311). The inferred_tolerance_default option is now properly passed through the FFI layer.

    Rustfava PR to upgrade to v0.8.5: rustledger/rustfava#80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions