[PR #7834] [CLOSED] [WIP] Exclude hidden categories and groups from envelope budget totals #109689

Closed
opened 2026-06-02 18:41:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/7834
Author: @Wizarck
Created: 5/13/2026
Status: Closed

Base: masterHead: fix/envelope-hidden-categories-in-group-totals


📝 Commits (2)

  • 696f0ce Exclude hidden categories and groups from envelope budget totals
  • 9968641 [autofix.ci] apply automated fixes

📊 Changes

3 files changed (+128 additions, -23 deletions)

View changed files

📝 packages/loot-core/src/server/budget/base.test.ts (+36 -4)
📝 packages/loot-core/src/server/budget/envelope.ts (+86 -19)
upcoming-release-notes/fix-envelope-hidden.md (+6 -0)

📄 Description

Summary

Bring envelope / rollover budgets to parity with the fix already applied to tracking budgets in #4567. Hidden categories (and hidden groups) no longer leak into per-group totals or top-line aggregates, and toggling visibility live re-wires the relevant dependencies.

This fixes the envelope side of #2400 (closed duplicate #4730), which #4567 only addressed for tracking budgets.

What changed in envelope.ts

  • createCategoryGroup filters hidden categories out of group-sum-amount-*, group-budget-*, and group-leftover-* deps.
  • createSummary skips hidden groups in total-budgeted, total-spent, and total-leftover deps.
  • handleCategoryChange now treats oldValue.hidden !== newValue.hidden and wires/unwires the per-category deps (including the income buffered-auto deps); the tombstone→0 branch no longer adds deps for a category that re-emerges as hidden.
  • handleCategoryGroupChange treats group visibility toggles the same way and skips deps when a group is re-created hidden.

What changed in base.test.ts

The two envelope tests added in #4567 asserted that hidden items should be counted (locking in the bug). They are flipped here to assert exclusion and each one now exercises the toggle branch by un-hiding the category/group mid-test:

  • Includes hidden categories in group totals for Envelope BudgetExcludes hidden categories from group totals in Envelope Budget (asserts group-sum-amount-group1 = -1000 with hidden cat = -2000, then un-hides and expects -3000).
  • Includes hidden category groups in budget totals for Envelope BudgetExcludes hidden category groups from budget totals in Envelope Budget (asserts total-spent = -1000 with hidden group = -2000, then un-hides and expects -3000).

Why this matters in practice

I hit this while scripting a category re-org via @actual-app/api against a 26.5.2 server: hiding old categories that still had budgeted amounts left phantom contributions in the group totals, surfacing in the UI as a group "Padres" showing −5616 € budgeted when only one visible category had −2808 € assigned (two hidden duplicates were silently summed). The fix matches what tracking budgets already do, so behaviour is now consistent across budget types.

Test plan

  • yarn workspace loot-core test base.test.ts (need to run in CI — no local yarn available where I authored this).
  • CI green.
  • Manual: create envelope budget, add tx to visible + hidden cat in the same group, confirm group total only shows visible amount; unhide and confirm recomputes live.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/7834 **Author:** [@Wizarck](https://github.com/Wizarck) **Created:** 5/13/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix/envelope-hidden-categories-in-group-totals` --- ### 📝 Commits (2) - [`696f0ce`](https://github.com/actualbudget/actual/commit/696f0ce90dcddd1578fa760bc7fc55f2468d8e04) Exclude hidden categories and groups from envelope budget totals - [`9968641`](https://github.com/actualbudget/actual/commit/99686412bd42d13439363612af7b82cc8838d360) [autofix.ci] apply automated fixes ### 📊 Changes **3 files changed** (+128 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `packages/loot-core/src/server/budget/base.test.ts` (+36 -4) 📝 `packages/loot-core/src/server/budget/envelope.ts` (+86 -19) ➕ `upcoming-release-notes/fix-envelope-hidden.md` (+6 -0) </details> ### 📄 Description ## Summary Bring envelope / rollover budgets to parity with the fix already applied to tracking budgets in #4567. Hidden categories (and hidden groups) no longer leak into per-group totals or top-line aggregates, and toggling visibility live re-wires the relevant dependencies. This fixes the envelope side of #2400 (closed duplicate #4730), which #4567 only addressed for tracking budgets. ## What changed in `envelope.ts` - `createCategoryGroup` filters hidden categories out of `group-sum-amount-*`, `group-budget-*`, and `group-leftover-*` deps. - `createSummary` skips hidden groups in `total-budgeted`, `total-spent`, and `total-leftover` deps. - `handleCategoryChange` now treats `oldValue.hidden !== newValue.hidden` and wires/unwires the per-category deps (including the income `buffered-auto` deps); the tombstone→0 branch no longer adds deps for a category that re-emerges as hidden. - `handleCategoryGroupChange` treats group visibility toggles the same way and skips deps when a group is re-created hidden. ## What changed in `base.test.ts` The two envelope tests added in #4567 asserted that hidden items *should* be counted (locking in the bug). They are flipped here to assert exclusion and each one now exercises the toggle branch by un-hiding the category/group mid-test: - `Includes hidden categories in group totals for Envelope Budget` → `Excludes hidden categories from group totals in Envelope Budget` (asserts `group-sum-amount-group1` = -1000 with hidden cat = -2000, then un-hides and expects -3000). - `Includes hidden category groups in budget totals for Envelope Budget` → `Excludes hidden category groups from budget totals in Envelope Budget` (asserts `total-spent` = -1000 with hidden group = -2000, then un-hides and expects -3000). ## Why this matters in practice I hit this while scripting a category re-org via `@actual-app/api` against a 26.5.2 server: hiding old categories that still had budgeted amounts left phantom contributions in the group totals, surfacing in the UI as a group "Padres" showing −5616 € budgeted when only one visible category had −2808 € assigned (two hidden duplicates were silently summed). The fix matches what tracking budgets already do, so behaviour is now consistent across budget types. ## Test plan - [ ] `yarn workspace loot-core test base.test.ts` (need to run in CI — no local yarn available where I authored this). - [ ] CI green. - [ ] Manual: create envelope budget, add tx to visible + hidden cat in the same group, confirm group total only shows visible amount; unhide and confirm recomputes live. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-02 18:41:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#109689