Skip to content

Conversation

@satyakigh
Copy link
Collaborator

@satyakigh satyakigh commented Dec 9, 2025

Summary for Reviewers

This PR refactors the EncryptedFileStore to improve reliability and fix potential data loss issues during concurrent access across multiple processes.

Key Changes

  1. File locking mechanism replaced: Switched from async-mutex (in-process only) to proper-lockfile (cross-process file locking) to properly handle concurrent access from multiple language server instances.

  2. Eager file creation on startup: The store now creates encrypted files immediately on construction rather than lazily on first write. This ensures the lock file target exists before any operations.

  3. Corrupted file recovery: Added automatic recovery when decryption fails - the store recreates itself with empty content instead of crashing.

  4. Store initialization moved to factory constructor: FileStoreFactory now pre-creates all stores at startup with a configurable list of store names, and get() throws if requesting an unknown store (fail-fast behavior).

  5. Simplified content management: Removed nullable content field - it's now always initialized. Each write operation re-reads the file under lock to ensure it has the latest data from other processes.

  6. Replaced error stack parsing with simply adding the full stack (since these are not metric dimensions anymore)

@satyakigh satyakigh force-pushed the filebd branch 3 times, most recently from 1f52363 to bc9dbda Compare December 11, 2025 20:21
@satyakigh satyakigh changed the title Update filedb startup behaviour to create files on startup Replace in-process mutex with cross-process file locking for FileStore Dec 11, 2025
@satyakigh satyakigh force-pushed the filebd branch 2 times, most recently from b7333cd to 3bebeef Compare December 11, 2025 20:37
@satyakigh satyakigh marked this pull request as ready for review December 11, 2025 20:39
@satyakigh satyakigh requested a review from a team as a code owner December 11, 2025 20:39
@satyakigh satyakigh merged commit d1465d6 into main Dec 12, 2025
16 checks passed
@satyakigh satyakigh deleted the filebd branch December 12, 2025 19:40
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.

3 participants