Skip to content

Reinstate EnsureIndexAsync implementation with CREATE INDEX logic - #9

Merged
mrdevrobot merged 3 commits into
feature/snapshotsfrom
copilot/sub-pr-5-yet-again
Jan 26, 2026
Merged

Reinstate EnsureIndexAsync implementation with CREATE INDEX logic#9
mrdevrobot merged 3 commits into
feature/snapshotsfrom
copilot/sub-pr-5-yet-again

Conversation

Copilot AI commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Description

The EnsureIndexAsync method in SqlitePeerStore was reduced to a no-op placeholder, breaking the IPeerStore contract and the existing test EnsureIndexAsync_ShouldCreateIndexWithoutError. This method is expected to create SQLite indexes to optimize queries on document properties.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Changes

Restored Index Creation Logic

  • Reinstated full EnsureIndexAsync implementation that creates SQLite indexes using CREATE INDEX IF NOT EXISTS
  • Supports both per-collection table mode and legacy single-table mode
  • Sanitizes collection names and property paths to prevent SQL injection
  • Logs index creation for observability

Security Fix

  • Fixed SQL injection vulnerability in legacy mode WHERE clause by using sanitized collection name instead of raw parameter

Compilation Fix

  • Fixed GetCollectionsAsync to use _options?.UsePerCollectionTables == true instead of non-existent UsePerCollectionTables property

How Has This Been Tested?

  • EnsureIndexAsync_ShouldCreateIndexWithoutError - verifies indexes can be created without errors
  • CodeQL security scan - no alerts found

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 26, 2026 22:10
Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues in snapshot persistence feature based on review feedback Reinstate EnsureIndexAsync implementation with CREATE INDEX logic Jan 26, 2026
Copilot AI requested a review from mrdevrobot January 26, 2026 22:15
@mrdevrobot
mrdevrobot marked this pull request as ready for review January 26, 2026 22:45
@mrdevrobot
mrdevrobot merged commit 8a16dc7 into feature/snapshots Jan 26, 2026
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.

2 participants