Skip to content

Conversation

@jcscottiii
Copy link
Collaborator

This commit introduces the schema and client logic for managing the state of Saved Search notifications, specifically focusing on the ingestion worker locking mechanism.

Changes:

  • Infrastructure: Added migration 000026.sql to create the SavedSearchState table with SavedSearchId and SnapshotType composite PK.
  • Client: Added entityMutator generic helper to client.go to support transactional "Read-Inspect-Write" patterns required for conditional locking.
  • Client: Added SetTimeNowForTesting to allow deterministic TTL expiration testing.
  • Feature: Implemented saved_search_state.go containing:
    • TryAcquireSavedSearchStateWorkerLock
    • ReleaseSavedSearchStateWorkerLock
    • GetSavedSearchState
    • UpdateSavedSearchStateLastKnownStateBlobPath
  • Tests: Added saved_search_state_test.go covering lock acquisition, expiration, re-acquisition, and release scenarios.

This commit introduces the schema and client logic for managing the
state of Saved Search notifications, specifically focusing on the
ingestion worker locking mechanism.

Changes:
- Infrastructure: Added migration 000026.sql to create the
  `SavedSearchState` table with `SavedSearchId` and `SnapshotType`
  composite PK.
- Client: Added `entityMutator` generic helper to `client.go` to
  support transactional "Read-Inspect-Write" patterns required for
  conditional locking.
- Client: Added `SetTimeNowForTesting` to allow deterministic
  TTL expiration testing.
- Feature: Implemented `saved_search_state.go` containing:
  - `TryAcquireSavedSearchStateWorkerLock`
  - `ReleaseSavedSearchStateWorkerLock`
  - `GetSavedSearchState`
  - `UpdateSavedSearchStateLastKnownStateBlobPath`
- Tests: Added `saved_search_state_test.go` covering lock acquisition,
  expiration, re-acquisition, and release scenarios.
@jcscottiii
Copy link
Collaborator Author

This is not for this week's release. So feel free to deploy. @DanielRyanSmith

@jcscottiii jcscottiii added this pull request to the merge queue Dec 4, 2025
Merged via the queue into main with commit e07ed92 Dec 4, 2025
7 checks passed
@jcscottiii jcscottiii deleted the jcscottiii/saved_search_state_table branch December 4, 2025 13:39
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