Skip to content

Fix predictor path synchronization and enhance thread safety#17

Merged
Shresht7 merged 8 commits intomainfrom
issue14
Mar 31, 2026
Merged

Fix predictor path synchronization and enhance thread safety#17
Shresht7 merged 8 commits intomainfrom
issue14

Conversation

@Shresht7
Copy link
Copy Markdown
Owner

This pull request introduces improvements to the PSFavorite module's configuration and initialization, especially around the handling and loading of the favorites file, and adds a new test for predictor initialization. The main changes enhance flexibility in specifying the favorites file path, ensure thread safety when accessing favorites, and improve robustness in file handling.

Configuration and Initialization Improvements:

  • Added a FavoritesFile parameter to Initialize-Configuration, allowing customization of the favorites file name (Module/Private/Initialize-Configuration.ps1).
  • Changed the logic for constructing the favorites file path to use the customizable file name and ensured the path is set in $Script:FavoritesPath (Module/Private/Initialize-Configuration.ps1).
  • On module import, the predictor is now explicitly initialized with the resolved favorites path, ensuring it loads favorites from the correct location (Module/PSFavorite.psm1).

Predictor Implementation Enhancements:

  • Refactored PSFavoritePredictor to allow dynamic initialization of the favorites file path, added thread safety for accessing the favorites list, and improved error handling when loading favorites (Predictor/PSFavoritePredictor.cs). [1] [2] [3] [4]

Testing:

  • Added a test to verify that initializing the module with a custom favorites path creates the favorites file as expected (Module/Tests/Public/PredictorInitialization.Tests.ps1).

Fixes #14

@Shresht7 Shresht7 self-assigned this Mar 31, 2026
@Shresht7 Shresht7 added the bug Something isn't working label Mar 31, 2026
@Shresht7 Shresht7 merged commit 8b70ff0 into main Mar 31, 2026
2 checks passed
@Shresht7 Shresht7 deleted the issue14 branch March 31, 2026 10:58
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.

[Bug] Predictor Path De-Synchronization between C# Module and PowerShell Module

1 participant