Skip to content

Fix config migration and test sandbox behavior (v0.5.5)#76

Merged
umpire274 merged 2 commits intomainfrom
v0.5.5
Nov 6, 2025
Merged

Fix config migration and test sandbox behavior (v0.5.5)#76
umpire274 merged 2 commits intomainfrom
v0.5.5

Conversation

@umpire274
Copy link
Owner

  • Removed fallback behavior in config migration: default_file is now migrated to fortune_files as-is, without validating or rewriting paths. This preserves the original configuration intent and ensures deterministic behavior.
  • Introduced stable app_dir() override via OnceLock for test environments, preventing configuration and cache writes from affecting the user's system.
  • Updated loader and utils tests to use sandbox directories instead of system config locations.
  • Standardized canonical_key usage for cache read/write to ensure consistent no-repeat behavior across platforms (Linux / Windows / macOS).

This resolves test failures on Windows and ensures consistent behavior during migration and cache operations.

- Removed fallback behavior in config migration: default_file is now migrated
  to fortune_files as-is, without validating or rewriting paths. This preserves
  the original configuration intent and ensures deterministic behavior.
- Introduced stable app_dir() override via OnceLock for test environments,
  preventing configuration and cache writes from affecting the user's system.
- Updated loader and utils tests to use sandbox directories instead of
  system config locations.
- Standardized canonical_key usage for cache read/write to ensure consistent
  no-repeat behavior across platforms (Linux / Windows / macOS).

This resolves test failures on Windows and ensures consistent behavior during
migration and cache operations.
@umpire274 umpire274 self-assigned this Nov 6, 2025
@umpire274 umpire274 added the bug Something isn't working label Nov 6, 2025
…_dir() is unavailable

- Improved app_dir() to handle cases where dirs::data_dir() returns None (e.g. CI environments)
- Now falls back to $HOME/.local/share/rfortune on Linux and $HOME/Library/Application Support/rfortune on macOS
- Guarantees consistent behavior across all platforms, including GitHub Actions runners
- Added informational log message showing the active configuration directory
@umpire274 umpire274 merged commit 68f39c5 into main Nov 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant