Skip to content

feat: support for key enumeration in the postgres store#359

Open
ashwin153 wants to merge 2 commits into
strawgate:mainfrom
ashwin153:main
Open

feat: support for key enumeration in the postgres store#359
ashwin153 wants to merge 2 commits into
strawgate:mainfrom
ashwin153:main

Conversation

@ashwin153

Copy link
Copy Markdown

No description provided.

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5fc119c4-4bb8-423f-9e1b-90aa2bdfb1e5

📥 Commits

Reviewing files that changed from the base of the PR and between d20ee4c and 19ff03b.

📒 Files selected for processing (2)
  • src/key_value/aio/stores/postgresql/store.py
  • tests/stores/postgresql/test_postgresql.py

Walkthrough

This PR extends the PostgreSQL key-value store with collection-level key enumeration. A new _get_collection_keys method retrieves all keys for a specified collection with optional pagination support, mirroring the existing _get_collection_names pagination pattern. The implementation runs a parameterized SQL query ordered by key and returns results as a string list. Five test cases validate the feature: empty collections, sorted key ordering, per-collection isolation, limit enforcement, and deletion reflection.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 and usage tips.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 1 file

Requires human review: This pull request implements a new feature for key enumeration in the PostgreSQL store; because it introduces new database query logic and extends the store's interface, a human review is necessary.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 1 file (changes from recent commits).

Auto-approved: This change adds a new read-only method to list keys in a PostgreSQL collection, following the same patterns as existing methods, with comprehensive tests covering edge cases, and does not alter any existing business logic or database schema.

Re-trigger cubic

@strawgate

Copy link
Copy Markdown
Owner

I'm happy to merge this but keep in mind that the AsyncKeyValue protocol does not expose key enumeration so this has limited utility in common use-cases

@ashwin153

ashwin153 commented May 29, 2026

Copy link
Copy Markdown
Author

@strawgate Yeah that's fine. For my use-case I depend on BaseEnumerateKeysStore instead of AsyncKeyValue because I specifically need this functionality to eliminate some racey behavior - I could store the list of keys within an index key or something but that'll create a race to update the index key and it forces me to read the whole index whenever I want to update it and the index can potentially be quite large.

@ashwin153

Copy link
Copy Markdown
Author

@strawgate Also it seems like the test failures are unrelated to my change but I might be reading them wrong. Let me know if there's something you need to me fix to make the build green.

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