Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check accounts & check tags broken in 1.40 ? #2247

Open
PainFile opened this issue Sep 30, 2024 · 9 comments
Open

check accounts & check tags broken in 1.40 ? #2247

PainFile opened this issue Sep 30, 2024 · 9 comments

Comments

@PainFile
Copy link

Hello everyone, I currently use hledger to track my finances, I normally do Strick checks to my files once every month to make sure that everything is ok. With the release of 1.40 I notice that check accounts and check tags send some errors with my information (not present on 1.34 or lower).

This is the MRE I can come up with:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Start of Minimal, Reproducible Example (MRE).

; Commodities
commodity "CD200130"
  format 1,000.00000000 "CD200130"

commodity MXN
  format 1,000.00 MXN

; Accounts
account Assets:Investing:Bonds:CetesDirecto:Invested:Cetes
account Assets:Investing:Bonds:CetesDirecto:Wallet

2024/01/01 * Test transaction
    Assets:Investing:Bonds:CetesDirecto:Invested:Cetes     100 "CD200130" @ 9.94392220 MXN
    Assets:Investing:Bonds:CetesDirecto:Wallet

; End of MRE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I run on Windows 11. Under hledger 1.34-g7a83578ec-20240601, windows-x86_64 if I go with ".\bin\hledger.exe -f test.journal check -s" nothing comes out, i. e. everyting is OK.

If I change to hledger 1.40-g0f31974c5-20240909, windows-x86_64 still under Windows 11 and I run the same command I got the following error:

hledger.exe: Error: C:\Temp\test.journal:17:
17 | 2024-01-01 * Test transaction
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Assets:Investing:Bonds:CetesDirecto:Invested:Cetes 100 "CD200130" @ 9.94392220 MXN
| Assets:Investing:Bonds:CetesDirecto:Wallet -994.39222000 MXN

Strict account checking is enabled, and
account "equity:conversion:CD200130-MXN:CD200130" has not been declared.
Consider adding an account directive. Examples:

account equity:conversion:CD200130-MXN:CD200130
account equity:conversion:CD200130-MXN:CD200130 ; type:A ; (L,E,R,X,C,V)

When trying to troubleshoot, going by each strick test I see that .\bin\hledger.exe -f test.journal check accounts is sending that error.

Also, if I try .\bin\hledger.exe -f test.journal check tags I have another error:

hledger.exe: Error: C:\Temp\test.journal:17:
17 | 2024-01-01 * Test transaction
| Assets:Investing:Bonds:CetesDirecto:Invested:Cetes 100 "CD200130" @ 9.94392220 MXN
| equity:conversion:CD200130-MXN:CD200130 -100 "CD200130"
| equity:conversion:CD200130-MXN:MXN 994.39222000 MXN
| Assets:Investing:Bonds:CetesDirecto:Wallet -994.39222000 MXN

Strict tag checking is enabled, and
tag "_price-matched" has not been declared.
Consider adding a tag directive. Examples:

tag _price-matched

I hope this information is enough for you to replicate the behavior, if not please let me know. Keep up with this great project!

@simonmichael
Copy link
Owner

simonmichael commented Oct 1, 2024 via email

@simonmichael
Copy link
Owner

simonmichael commented Oct 1, 2024 via email

@PainFile
Copy link
Author

PainFile commented Oct 2, 2024

I see you're using an unreleased developer build, but that should be fine.

I just downloaded the 1.40 version again from the Official release binaries for Linux, Mac, Windows. (https://github.com/simonmichael/hledger/releases/tag/1.40) and it is the same version. It still throws the same error.

Maybe also you are able to try it on a non-windows computer ? Perhaps with the 1.40 release ? I don't have any other OS handy, will try to mount a VM on the weekend with Linux to try it.

@simonmichael
Copy link
Owner

simonmichael commented Oct 2, 2024 via email

@simonmichael
Copy link
Owner

Also the error message and the example file you've shown do not correspond to one another. Double check ?

@simonmichael simonmichael changed the title check accounts & check tags broken in 1.40 check accounts & check tags broken in 1.40 ? Oct 2, 2024
@PainFile
Copy link
Author

PainFile commented Oct 3, 2024

Thank you for bearing with me, I did more troubleshooting, and the error persist but I just found out it's only present when I use a config file (I missed to comment that I am using a hledger.conf since the beginning, my apologies):

PS C:\Temp> type .\mre.journal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Start of Minimal, Reproducible Example (MRE).

; Commodities
commodity "CD200130"
  format 1,000.00000000 "CD200130"

commodity MXN
  format 1,000.00 MXN

; Accounts
account Assets:Investing:Bonds:CetesDirecto:Invested:Cetes
account Assets:Investing:Bonds:CetesDirecto:Wallet

2024/01/01 * Test transaction
    Assets:Investing:Bonds:CetesDirecto:Invested:Cetes     100 "CD200130" @ 9.94392220 MXN
    Assets:Investing:Bonds:CetesDirecto:Wallet

; End of MRE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PS C:\Temp> .\hledger.exe -f .\mre.journal check -s
hledger.exe: Error: C:\Temp\.\mre.journal:15:
15 | 2024-01-01 * Test transaction
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     Assets:Investing:Bonds:CetesDirecto:Invested:Cetes    100 "CD200130" @ 9.94392220 MXN
   |     Assets:Investing:Bonds:CetesDirecto:Wallet                          -994.39222000 MXN

Strict account checking is enabled, and
account "equity:conversion:CD200130-MXN:CD200130" has not been declared.
Consider adding an account directive. Examples:

account equity:conversion:CD200130-MXN:CD200130
account equity:conversion:CD200130-MXN:CD200130    ; type:A  ; (L,E,R,X,C,V)

PS C:\Temp> type .\mre.journal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Start of Minimal, Reproducible Example (MRE).

; Commodities
commodity "CD200130"
  format 1,000.00000000 "CD200130"

commodity MXN
  format 1,000.00 MXN

; Accounts
account Assets:Investing:Bonds:CetesDirecto:Invested:Cetes
account Assets:Investing:Bonds:CetesDirecto:Wallet

2024/01/01 * Test transaction
    Assets:Investing:Bonds:CetesDirecto:Invested:Cetes     100 "CD200130" @ 9.94392220 MXN
    Assets:Investing:Bonds:CetesDirecto:Wallet

; End of MRE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PS C:\Temp> .\hledger.exe --version
hledger 1.40-g0f31974c5-20240909, windows-x86_64
PS C:\Temp> .\hledger.exe -f .\mre.journal check tags
hledger.exe: Error: C:\Temp\.\mre.journal:15:
15 | 2024-01-01 * Test transaction
   |     Assets:Investing:Bonds:CetesDirecto:Invested:Cetes    100 "CD200130" @ 9.94392220 MXN
   |     equity:conversion:CD200130-MXN:CD200130                               -100 "CD200130"
   |     equity:conversion:CD200130-MXN:MXN                                   994.39222000 MXN
   |     Assets:Investing:Bonds:CetesDirecto:Wallet                          -994.39222000 MXN

Strict tag checking is enabled, and
tag "_price-matched" has not been declared.
Consider adding a tag directive. Examples:

tag _price-matched

This is the config file that I am using (mostly a copy of your example file):

PS C:\Temp> type .\hledger.conf
# An example hledger config file for you to customise.
# This declares extra options/arguments to be added to your hledger commands.
# Save as ~/.hledger.conf, or ~/.config/hledger/hledger.conf, or hledger.conf
# in or above your current directory, and hledger will use it automatically.
# Or you can choose a config file with --conf.
# Or you can turn a config file like this one into a script, by adding
# a shebang line like `#!/usr/bin/env -S hledger --conf` at the top.
#
# Automatic config files are convenient, but have a cost: it's easy to confuse
# yourself, disrupt reports, or break scripts/applications which use hledger.
# If you choose to use one, be careful about what you put in it.
# If a command is not working as expected, run it with `--debug` to troubleshoot.
# To avoid using a config file, run with `-n` (short for `--no-conf`).

# 1. General options. These will be used with all commands which support them.

# Show prettier tables in reports.
# Recommended unless your font doesn't support box drawing characters.
--pretty

# Postpone balance assertions until you use -s or `hledger check assertions`.
# This means there's less need to add -I while piping or fixing problems.
#--ignore-assertions

# Always infer these things ? Why not.
--infer-costs
--infer-market-prices
--infer-equity

# 2. Command-specific options.

[print]
--explicit     # show inferred amounts
--show-costs   # show inferred costs

[help]
#--man          # if you prefer man over info

# Set your preferred options for the balance commands.
# You can override these by adding more options on the command line.
# [balance]            --tree --depth 3 --layout=bare
[balancesheet]                --depth 5 --layout=bare
# [balancesheetequity] --tree --depth 3 --layout=bare
# [cashflow]           --tree --depth 3 --layout=bare
# [incomestatement]    --tree --depth 3 --layout=bare

# You can also set options for add-on commands (run by `hledger ADDONCMD`).
# The -- argument needed at command line is not needed here.

# Some defaults for hledger-ui: start in the Cash accounts screen,
# watch for file changes, set a depth limit, hide zeros and equity accounts.
[ui] --cash --watch -3 -E not:type:e
# need to repeat this here
--ignore-assertions

[web] --port 5050 --allow edit
# and here
--ignore-assertions

[iadd] --date-format %Y-%m-%d

#[interest]
# --annual 0.05
# --30-360
# --source SRCACCT
# --target DSTACCT
# ACCT

I'm going to dowload some Linux ISO and will try to reproduce later.

@simonmichael
Copy link
Owner

simonmichael commented Oct 3, 2024 via email

@simonmichael
Copy link
Owner

simonmichael commented Oct 3, 2024 via email

@PainFile
Copy link
Author

PainFile commented Oct 6, 2024

Ok, with -n both issues are gone. The check tags error with --infer-equity is also expected?

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

No branches or pull requests

2 participants