Skip to content

Conversation

@mhmsvv
Copy link

@mhmsvv mhmsvv commented Jan 13, 2026

This pull request introduces a new method to count the number of projections in projection store adapters and provides comprehensive tests to ensure its correctness across implementations. The main changes include adding the abstract count method to the base adapter, implementing it in both the in-memory and Postgres adapters, and expanding the shared test suite to cover various counting scenarios.

Projection Store Adapter Enhancements

  • Added an abstract count method to the base adapter interface in base.py, requiring all projection store adapters to implement a method that returns the number of projections.
  • Implemented the count method in the in-memory adapter (memory.py), returning the length of the internal projections list.
  • Implemented the count method in the Postgres adapter (postgres.py), executing a SQL query to count the rows in the projections table.

Testing Improvements

  • Added a new CountCases test class to the shared adapter test suite (adapters.py), covering scenarios such as zero projections, single and multiple projections, and updating existing projections. Integrated these tests into the main test case mixin.

Copilot AI review requested due to automatic review settings January 13, 2026 16:13
Copy link

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 adds a count method to projection store adapters to return the total number of projections, implementing the method in both in-memory and Postgres adapters and adding comprehensive test coverage.

Changes:

  • Added abstract count method to the base adapter interface
  • Implemented count in both in-memory and Postgres adapters
  • Added CountCases test class with scenarios covering empty state, single/multiple projections, and updates

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/logicblocks/event/projection/store/adapters/base.py Added abstract count method to base adapter interface
src/logicblocks/event/projection/store/adapters/memory.py Implemented count method returning length of projections list
src/logicblocks/event/projection/store/adapters/postgres.py Implemented count method using SQL COUNT query
tests/shared/logicblocks/event/testcases/projection/store/adapters.py Added CountCases test class with comprehensive count scenarios and integrated into main test case mixin

@mhmsvv mhmsvv changed the title [CIT-237] adding count adding count method to projection store Jan 14, 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.

1 participant