JournalEntry.flag in API response misreports receivable/revenue as PENDING #35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
The
JournalEntryresponse objects returned by some admin entry endpoints carryflag=PENDING, but the actual Beancount transaction written via Fava uses*(cleared) and is immediately reflected in BQL balances.Specifically
POST /api/v1/entries/receivable(views_api.py:1334+) returns:while the underlying entry is constructed by
format_receivable_entryinbeancount_format.pywith:Why it's confusing
A client reading the response would reasonably assume the entry needs an approval step (
POST /entries/{id}/approve). That call then 404s with "Pending entry not found in Beancount ledger" because there is no pending entry — the on-disk one is already*. Surfaced during integration-test development: a test that posted a receivable and then tried to approve it failed because the entry was already cleared.Fix
Return the actual flag the Beancount entry was written with. Either:
format_receivable_entryreturns the flag it used, the endpoint echoes it).flag=JournalEntryFlag.CLEAREDin the receivable and revenue endpoint responses to match whatformat_receivable_entry/format_revenue_entrywrite.Then audit the other admin entry endpoints (
/entries/revenue, possibly/entries) for the same pattern.Scope
views_api.py:1334+(receivable endpoint response)views_api.py:1541+(revenue endpoint response — already returns CLEARED; verify)flagis hardcoded rather than reflectingformat_*_entry's output.Small fix, but it's the kind of doc-vs-code drift that wastes test- and integration-author time.