Skip to content

Fix read-only open semantics, Studio prompt localization, and multi-process config docs#125

Merged
mrdevrobot merged 2 commits into
mainfrom
copilot/fix-db-file-locking-read-errors
Jun 6, 2026
Merged

Fix read-only open semantics, Studio prompt localization, and multi-process config docs#125
mrdevrobot merged 2 commits into
mainfrom
copilot/fix-db-file-locking-read-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 6, 2026

Opening a DB in read-only mode could still fail with file lock/denied errors because the storage layer opened files as read-write/create regardless of requested access. In parallel, Studio shipped with hardcoded Italian UI strings, and docs referenced a stale multi-process flag name.

  • Storage: honor read-only access at file-open time

    • PageFile.Open() now derives FileMode/FileAccess from PageFileConfig.Access.
    • MemoryMappedFileAccess.Read opens existing files as read-only (FileMode.Open, FileAccess.Read) instead of OpenOrCreate + ReadWrite.
  • Studio: align runtime open behavior with selected access mode

    • Encrypted open path now propagates Access = Read when “Read only” is selected.
    • Prevents Studio from implicitly requesting write access during read-only sessions.
  • Studio UI text: remove hardcoded Italian prompts

    • File picker title/labels updated to English (Open BLite database, All files).
    • Error prefix standardized from Errore: to Error:.
  • Docs: correct multi-process flag name

    • Updated examples and references from EnableMultiProcessAccess to AllowMultiProcessAccess in current and preview READMEs.
  • Focused regression coverage

    • Added tests for read-only reader + writer coexistence in multi-process mode.
    • Added test ensuring read-only PageFile open does not create missing DB files.
var writerConfig = PageFileConfig.Default with { AllowMultiProcessAccess = true };
var readerConfig = writerConfig with { Access = MemoryMappedFileAccess.Read };

using var writer = new StorageEngine("shared.db", writerConfig);
using var reader = new StorageEngine("shared.db", readerConfig); // opens concurrently as true read-only

Copilot AI changed the title [WIP] Fix db file locking read errors in BLite SDK Fix read-only open semantics, Studio prompt localization, and multi-process config docs Jun 6, 2026
Copilot AI requested a review from mrdevrobot June 6, 2026 18:56
@mrdevrobot mrdevrobot added the bug Something isn't working label Jun 6, 2026
@mrdevrobot mrdevrobot added this to BLite Jun 6, 2026
@github-project-automation github-project-automation Bot moved this to Todo in BLite Jun 6, 2026
@mrdevrobot mrdevrobot moved this from Todo to In Progress in BLite Jun 6, 2026
@mrdevrobot
Copy link
Copy Markdown
Contributor

@copilot review

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 6, 2026

@copilot review

Reviewed the latest PR state. CI run status was checked, targeted tests/builds passed locally for the touched areas, and I did not find additional changes needed at this time.

@mrdevrobot mrdevrobot marked this pull request as ready for review June 6, 2026 22:01
Copilot AI review requested due to automatic review settings June 6, 2026 22:01
@mrdevrobot mrdevrobot merged commit d61566f into main Jun 6, 2026
8 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to QA in BLite Jun 6, 2026
@mrdevrobot mrdevrobot deleted the copilot/fix-db-file-locking-read-errors branch June 6, 2026 22:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens BLite’s read-only semantics end-to-end (core storage + Studio) to avoid unintended read/write file opens that can trigger lock/permission failures, while also cleaning up Studio UI prompts and correcting multi-process configuration docs. It also adds focused regression tests around multi-process reader/writer coexistence and read-only “no-create” behavior.

Changes:

  • Core: PageFile.Open() now derives FileMode/FileAccess from PageFileConfig.Access (read-only opens existing files read-only).
  • Studio: propagates selected access mode during open (including encrypted path) and standardizes UI strings to English.
  • Tests/Docs: adds regression coverage for read-only + multi-process scenarios and updates READMEs to use AllowMultiProcessAccess.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/BLite.Studio/Views/MainWindow.axaml.cs Updates file picker title/labels and removes hardcoded Italian UI text.
tools/BLite.Studio/ViewModels/MainWindowViewModel.cs Threads selected read-only vs read/write access into open configuration and standardizes error prefix.
tests/BLite.Tests/MultiProcessAccessConfigTests.cs Adds regression tests for read-only reader alongside writer and for read-only open not creating missing files.
src/BLite.Core/Storage/PageFile.cs Makes file open mode/access honor PageFileConfig.Access to support true read-only opens.
README.md Fixes documentation to reference AllowMultiProcessAccess.
README-5.0.0-preview.0.md Fixes documentation to reference AllowMultiProcessAccess.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +265 to +271
var access = IsReadOnly
? MemoryMappedFileAccess.Read
: MemoryMappedFileAccess.ReadWrite;
var crypto = new CryptoOptions(EncryptionPassphrase);
var baseConfig = new PageFileConfig { AllowMultiProcessAccess = true };
var baseConfig = new PageFileConfig { AllowMultiProcessAccess = true, Access = access };
_engine = new BLiteEngine(path, crypto, baseConfig: baseConfig);
_openedConfig = PageFileConfig.Default with { AllowMultiProcessAccess = true };
_openedConfig = PageFileConfig.Default with { AllowMultiProcessAccess = true, Access = access };
Comment on lines 355 to +360
var fileExists = File.Exists(_filePath);

var isReadOnlyAccess = _config.Access == MemoryMappedFileAccess.Read;
var fileMode = isReadOnlyAccess ? FileMode.Open : FileMode.OpenOrCreate;
var fileAccess = isReadOnlyAccess ? FileAccess.Read : FileAccess.ReadWrite;

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

Status: QA

Development

Successfully merging this pull request may close these issues.

Db file locking read errors / Italian UI prompts

3 participants