Skip to content

feat(indexing): support definition storage#414

Merged
yordis merged 2 commits into
masterfrom
yordis/feat-index-definition-store
Jun 30, 2026
Merged

feat(indexing): support definition storage#414
yordis merged 2 commits into
masterfrom
yordis/feat-index-definition-store

Conversation

@yordis

@yordis yordis commented Jun 30, 2026

Copy link
Copy Markdown
Member
  • Keep index lifecycle state behind a focused core boundary before transport wiring is introduced.
  • Preserve idempotent create and list semantics where later lifecycle code can depend on them.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented Jun 30, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
New isolated core types and in-memory store with no production wiring or persistence yet; behavior is fully covered by unit tests.

Overview
Introduces a core storage boundary for index definitions before any transport wiring: IIndexDefinitionStore with create, read, list, and delete, plus an in-memory implementation.

Create is idempotent when the same or equivalent IndexDefinition is submitted (AlreadyExists); a different definition under the same name returns Conflicts without overwriting. List returns definitions sorted by name; tests assert snapshot semantics on the returned collection.

Adds IndexName (lowercase alphanumeric, _, -) and StoredIndexDefinition. IndexDefinition gains value equality and GetHashCode so duplicate creates can be detected reliably.

Coverage includes store behavior, name validation, and definition equality tests.

Reviewed by Cursor Bugbot for commit fadc1be. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@yordis, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7634a374-0cff-471d-928b-6cddd85cfe78

📥 Commits

Reviewing files that changed from the base of the PR and between f662b88 and fadc1be.

📒 Files selected for processing (5)
  • src/EventStore.Core.XUnit.Tests/Services/Storage/Indexing/InMemoryIndexDefinitionStoreTests.cs
  • src/EventStore.Core.XUnit.Tests/Services/Storage/Indexing/IndexDefinitionTests.cs
  • src/EventStore.Core/Services/Storage/Indexing/IIndexDefinitionStore.cs
  • src/EventStore.Core/Services/Storage/Indexing/InMemoryIndexDefinitionStore.cs
  • src/EventStore.Core/Services/Storage/Indexing/IndexDefinition.cs

Walkthrough

Adds IndexName (a validated value object), IIndexDefinitionStore interface with IndexDefinitionCreateResult enum and StoredIndexDefinition record, InMemoryIndexDefinitionStore (lock-guarded dictionary implementation), and full xUnit test coverage for both IndexName and the store.

Changes

Index Definition Store

Layer / File(s) Summary
IndexName and store contracts
src/EventStore.Core/Services/Storage/Indexing/IndexName.cs, src/EventStore.Core/Services/Storage/Indexing/IIndexDefinitionStore.cs
IndexName sealed record validates input (lowercase alphanumeric, underscore, dash only). IIndexDefinitionStore defines async Create, Read, List, Delete; IndexDefinitionCreateResult enum covers Created/AlreadyExists/Conflicts; StoredIndexDefinition record wraps name and definition with null guards.
InMemoryIndexDefinitionStore
src/EventStore.Core/Services/Storage/Indexing/InMemoryIndexDefinitionStore.cs
Lock-guarded dictionary keyed by IndexName.Value implements all four store operations with null-argument and cancellation checks.
Tests
src/EventStore.Core.XUnit.Tests/Services/Storage/Indexing/IndexNameTests.cs, src/EventStore.Core.XUnit.Tests/Services/Storage/Indexing/InMemoryIndexDefinitionStoreTests.cs
IndexNameTests covers valid/invalid construction and ToString. InMemoryIndexDefinitionStoreTests covers CRUD semantics, idempotency, conflict detection, snapshot behavior, argument validation, and cancellation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 A name must be tidy, no spaces allowed,
Just dashes and letters—the rabbit is proud.
The store holds your indexes, safe under lock,
Create, read, or delete, tick-tock, tick-tock.
Tests confirm every path, even cancel with grace—
A hoppy new feature lands right into place! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding index definition storage support.
Description check ✅ Passed The description matches the change by mentioning index lifecycle state and idempotent create/list semantics.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/feat-index-definition-store

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f662b88. Configure here.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/EventStore.Core/Services/Storage/Indexing/IIndexDefinitionStore.cs`:
- Line 12: The IIndexDefinitionStore.Read contract currently claims a non-null
StoredIndexDefinition even though the implemented behavior is null when the
index is missing. Update the Read signature in IIndexDefinitionStore to return a
nullable StoredIndexDefinition, and make sure any implementations and callers of
Read are aligned with that nullable contract so missing definitions are handled
safely instead of being treated as always present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4275a07b-7891-4f0c-923f-5c2e1c2f1a69

📥 Commits

Reviewing files that changed from the base of the PR and between f44b7f5 and f662b88.

📒 Files selected for processing (5)
  • src/EventStore.Core.XUnit.Tests/Services/Storage/Indexing/InMemoryIndexDefinitionStoreTests.cs
  • src/EventStore.Core.XUnit.Tests/Services/Storage/Indexing/IndexNameTests.cs
  • src/EventStore.Core/Services/Storage/Indexing/IIndexDefinitionStore.cs
  • src/EventStore.Core/Services/Storage/Indexing/InMemoryIndexDefinitionStore.cs
  • src/EventStore.Core/Services/Storage/Indexing/IndexName.cs

Comment thread src/EventStore.Core/Services/Storage/Indexing/IIndexDefinitionStore.cs Outdated
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis yordis force-pushed the yordis/feat-index-definition-store branch from 418a5c7 to fadc1be Compare June 30, 2026 15:49
@yordis yordis merged commit 34f6597 into master Jun 30, 2026
21 checks passed
@yordis yordis deleted the yordis/feat-index-definition-store branch June 30, 2026 22:00
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.

1 participant