Store the new instance in FileSystem and Temp RetrieveOrCreateAsync - #59
Conversation
Both providers declared their own RetrieveOrCreateAsync that returned a default without storing it, so the call persisted on InMemory, ConfigHome and DataHome but not on these two. Store it as the interface documents. Fixes #55 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VPis8BNX5ETFM2XytgJCz7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VPis8BNX5ETFM2XytgJCz7
Both providers declare the member publicly, which hides the interface default, and had each restated it. Move the body to a linked Shared helper so the two cannot drift apart again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VPis8BNX5ETFM2XytgJCz7
|
|
SonarCloud Code Analysis is still red: 4.7% duplication on new code (limit 3%). This comes from duplication already on The first push duplicated the new method body across the two providers (37.9%). 05ac144 moved that body into I haven't widened this PR to remove that duplication. The fix I'd propose is a follow-up that makes Two ways forward:
The tests pass on all three OSes, and the new regression test fails without the fix. The only open question is which of the two options to take. Generated by Claude Code |


Fixes #55
What changed
IPersistenceProvider.RetrieveOrCreateAsyncis documented to create and store a new instance when the key is missing. The interface default does this.FileSystemPersistenceProviderandTempPersistenceProviderdeclared their own public override that returnednew T()without storing it. As a result, "first call creates the record" worked on InMemory, ConfigHome and DataHome but never persisted on these two.Both overrides now store the new instance before returning it, the same way the default does. I kept the methods rather than deleting them, as the triage suggested, because deleting them would remove public members that the package-validation baseline covers.
Tests
RetrieveOrCreate_Stores_The_New_Instance_On_Every_Provider. It calls throughIPersistenceProvider<string>on the default (InMemory), FileSystem and Temp providers and assertsExistsAsyncafterwards.Essentials.Testssuite passes: 917/917. The Temp and FileSystem providers build cleanly in Release.The triage also mentions #56 (GetAllKeysAsync omitting some key types) on the same providers. That is left for its own PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01VPis8BNX5ETFM2XytgJCz7
Generated by Claude Code