Skip to content

Add profile-local config.yaml (to store categories and other stuff) and global config.yaml (for application global config options)#35

Merged
wesm merged 12 commits intomainfrom
profile-specific-config
Nov 8, 2025
Merged

Add profile-local config.yaml (to store categories and other stuff) and global config.yaml (for application global config options)#35
wesm merged 12 commits intomainfrom
profile-specific-config

Conversation

@wesm
Copy link
Owner

@wesm wesm commented Nov 8, 2025

No description provided.

wesm and others added 12 commits November 8, 2025 08:17
Implemented profile-aware category system with smart inheritance:

- Add save_categories_to_profile() for profile-local storage
- Add load_categories_from_profile() for profile-local loading
- Add get_profile_category_groups() with Amazon inheritance logic
- Update DataManager to accept profile_dir and backend_type
- Monarch/YNAB profiles sync categories to their own config.yaml
- Amazon profiles inherit from single other profile or use defaults
- Support amazon_categories_source in global config for explicit control

Category priority:
- Monarch/YNAB: Profile config (synced from API) → Defaults
- Amazon: Profile config → amazon_categories_source → Auto-inherit → Defaults

All 983 tests pass with backward compatibility maintained.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Amazon backend now uses profile-aware category loading with smart
inheritance. Pass profile_dir to AmazonBackend constructor to enable
profile-local config.yaml and automatic category inheritance from
other profiles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Added 14 new tests covering:
- Profile-local category save/load
- Amazon category inheritance (explicit source, auto-detect, defaults)
- Profile isolation (no cross-contamination)
- Config preservation
- Global config amazon_categories_source option

All 997 tests pass (39 category tests total).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Implemented automatic migration to move fetched_categories from global
config.yaml to profile-local configs on startup:

- Add migrate_global_categories_to_profiles() function
- Migrates categories to all non-Amazon profiles
- Removes fetched_categories from global config after migration
- Preserves other global config settings
- Runs automatically on app startup
- Added 8 comprehensive migration tests (98% coverage on migration.py)

Amazon profiles skip migration and inherit from other profiles instead.

All 1005 tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Completely rewrote category documentation to explain:
- Profile-local category storage and isolation
- Amazon smart inheritance (auto-detect, explicit source, defaults)
- Global vs profile config separation
- Multi-account category independence
- Updated troubleshooting for new system

All 1005 tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…tion

- Pass profile_dir when creating Amazon backend via CLI command
- Update Amazon.update_transaction() to use profile-aware categories
- Ensures category inheritance works in both UI and CLI paths

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed Amazon CLI mode to properly pass profile_dir to DataManager:
- Add profile_dir and backend_type params to MoneyflowApp.__init__
- Store as _preconfigured_profile_dir and _preconfigured_backend_type
- Use preconfigured values when initializing managers for CLI mode
- Add logging to show when profile_dir is being used

This ensures 'moneyflow amazon' command inherits categories correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
When backend is pre-configured (Amazon via CLI), use the preconfigured
profile_dir instead of leaving it as None. This ensures DataManager
receives the profile_dir and can load inherited categories.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Added debug logs to trace profile_dir and backend_type flow through
DataManager initialization to diagnose category inheritance issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Changed Amazon backend to require config_dir with a sensible default
(~/.moneyflow) instead of Optional[str]. This prevents config_dir from
being None which breaks category inheritance logic.

Also ensures config_dir is set in CLI before creating Amazon backend.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removed temporary debug logs now that Amazon category inheritance
is working correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@wesm wesm merged commit 2998c9c into main Nov 8, 2025
6 checks passed
@wesm wesm deleted the profile-specific-config branch November 8, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant