feat(config): edit the allocation tree in the web UI #6

Merged
rubenjr0 merged 4 commits from feat/config-ui into main 2026-10-18 17:46:04 +00:00
Owner

Add a /config page. It edits the allocation tree.

  • New budgit-config crate. It parses, validates, and stores the config.
  • New configs table (migration included).
  • The editor starts from the live tree. Link from the header.
  • A saved config applies at the next rollover.
  • config.yaml now uses the allocations: key.
  • Rollover and error mapping are simplified.
Add a /config page. It edits the allocation tree. - New budgit-config crate. It parses, validates, and stores the config. - New configs table (migration included). - The editor starts from the live tree. Link from the header. - A saved config applies at the next rollover. - config.yaml now uses the allocations: key. - Rollover and error mapping are simplified.
Phase 9a of PLAN.md.

- configs table: append-only config versions; the newest is current. Saves
  carry the base version and are refused when stale.
- crates/config (budgit-config): ConfigDoc parse/validate shared by web and
  CLI. The document is a map with a `tree:` key. Siblings must sum to 100,
  names must be unique, and an unknown `period` is an error (it used to
  fall back to monthly). YAML errors carry line and column.
- seed::plan_reconcile: pure preview of a tree change (added, moved,
  percentage and period changes, retired, money that would be lost).
- A save whose tree would lose money is refused; the rollover checks again.
  remap_carryover fails with a typed UnreplacedMoney.
- Rollovers (web and CLI) apply the saved config's tree. The rollover card
  lists pending tree changes.
- /config page (raw YAML editor, check, save, history/load), only with
  BUDGIT_CONFIG_EDIT=1.
- CLI: rollover --config saves the file first; seed on an existing tree only
  saves config.yaml.
- month::rollover takes an optional tree; rollover_with_tree is gone.
- NegativeIncome is its own error, so web maps errors by two flat lists
  (bad input -> 400, conflict -> 409).
- Procedures return Result<_, String> through one store::refused helper.
- StaleConfig is a unit struct; config::save reuses the history query.
- budgit_config::pending returns just the plan; seed reads config.yaml once.
- YearMonth from &MonthSummary; has_tree uses first().
- Tighter doc comments.
The gate protected nothing: the rest of the app (rollover, income,
transactions) is already open, and a tree change only applies at the next
rollover after the same checks.
- Header link to /config is a green button.
- With no saved config, the editor loads the live tree rendered as YAML
  (budgit_config::render_live) instead of starting empty; the caption says
  where the text came from and follows saves.
- The document's top-level key is allocations: (was tree:).
rubenjr0 changed title from WIP: feat(config): edit the allocation tree from the web, applied at the next rollover to feat(config): edit the allocation tree in the web UI 2026-10-18 17:45:18 +00:00
rubenjr0 deleted branch feat/config-ui 2026-10-18 17:46:07 +00:00
Sign in to join this conversation.
No reviewers
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
rubenjr0/budgit!6
No description provided.