Chart-of-accounts: rename / mark closed #31

Open
opened 2026-06-06 13:16:04 +00:00 by padreug · 0 comments
Owner

Follow-up to the chart-edit admin UI (libra#30-ish). These ops are intentionally harder than "add" — capturing the design questions here so they don't get attempted under the assumption they're just symmetric to add.

Mark closed

Beancount-native: append a YYYY-MM-DD close <account> directive. Once closed, fava UI hides the account from new-entry flows but preserves historical postings. This is safe.

  • Add DELETE /api/v1/admin/accounts/{name} that appends a close directive to accounts/chart.beancount
  • Refuse if account has postings dated after the proposed close date (Beancount validation will already fail on that, but a polite pre-check is nicer)
  • UI: "Close account" action on each row

Rename

Hard. Beancount has no rename API. Two options:

  1. Mechanical rewrite: walk every posting in transactions.beancount (and any include) and string-substitute the account name. Idempotent if the rename is unique. Risky — touches every historical record.
  2. Aliasing: append YYYY-MM-DD note "renamed to X" Account + close, then open NewAccount. Posting history not rewritten. Reports get noisier (two accounts to sum).

Recommendation: pick (1) only via a one-off operator-driven CLI; don't expose it as a UI button. Or just don't support it.

  • Decide: do we ship rename at all? Or punt to "delete + recreate by hand if absolutely needed"?

Acceptance

Decision documented; either close-only implemented OR both implemented per chosen design.

Out of v1 scope for the chart-edit work; this issue exists to capture the design question.

Follow-up to the chart-edit admin UI (`libra#30`-ish). These ops are intentionally harder than "add" — capturing the design questions here so they don't get attempted under the assumption they're just symmetric to add. ## Mark closed Beancount-native: append a `YYYY-MM-DD close <account>` directive. Once closed, fava UI hides the account from new-entry flows but preserves historical postings. This is safe. - [ ] Add `DELETE /api/v1/admin/accounts/{name}` that appends a `close` directive to `accounts/chart.beancount` - [ ] Refuse if account has postings dated after the proposed close date (Beancount validation will already fail on that, but a polite pre-check is nicer) - [ ] UI: "Close account" action on each row ## Rename Hard. Beancount has no rename API. Two options: 1. **Mechanical rewrite**: walk every posting in `transactions.beancount` (and any include) and string-substitute the account name. Idempotent if the rename is unique. Risky — touches every historical record. 2. **Aliasing**: append `YYYY-MM-DD note "renamed to X" Account` + close, then `open NewAccount`. Posting history not rewritten. Reports get noisier (two accounts to sum). Recommendation: pick (1) only via a one-off operator-driven CLI; don't expose it as a UI button. Or just don't support it. - [ ] Decide: do we ship rename at all? Or punt to "delete + recreate by hand if absolutely needed"? ## Acceptance Decision documented; either close-only implemented OR both implemented per chosen design. Out of v1 scope for the chart-edit work; this issue exists to capture the design question.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/libra#31
No description provided.