feat(db): partition browser sessions by created_at#364
Merged
Conversation
Remote browser session history needs the same rolling hot-table boundary as the other archive-managed tables. Add remote_browser_sessions to monthly PostgreSQL partition setup and make the model use a partition-compatible key. Use a scoped database guard for no-Redis active-session creation so PostgreSQL partition constraints remain valid.
Browser session history now shares the monthly partition contract with event and activity tables. Extend the partition-compatible primary key coverage to include remote_browser_sessions. The schema test now catches regressions that would break PostgreSQL partition constraints.
Phase 4 now includes browser session history in the monthly partitioned hot-table set. Refresh the progress table, capability matrix, and checklist with the new verification entry points. This keeps the scaling plan aligned with the implemented schema and session-guard change.
The PostgreSQL fallback guard needs a deterministic lock key without tripping gosec overflow checks. Use a fixed advisory-lock namespace with PostgreSQL hashtext for the user/platform scope. This preserves the partition-compatible active-session guard while keeping backend lint clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature Description
remote_browser_sessionsusingcreated_at, matching the existing archive-managed hot-table strategy.Implementation Approach
remote_browser_sessionsin the monthly partition DDL with a partition-compatible(id, created_at)primary key and rolling/default partition support.remote_browser_sessionsis checked alongside the other partitioned event/activity tables.Testing
go test ./internal/db ./internal/services/browser_session ./internal/services/archivebash script/ci/backend.shcd backend && golangci-lint run ./...