Open
Conversation
1. Replace select-then-insert/update with onConflictDoUpdate in upsertState
2. Explicitly set time_updated in upsert .set() call
3. Add validator("param") for sessionID on timeline route
4. Remove redundant aiv_event_session_idx (covered by composite index)
5. Remove unnecessary aiv_event_type_idx (no query filters by type alone)
6. Add index on aiv_state.time_updated for listStates ordering
7. Add migration to drop old indexes and create new one
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
onConflictDoUpdateinupsertState(single round-trip)time_updatedin upsert to prevent stale timestampsvalidator("param")forsessionIDon the timeline routeaiv_event_session_idx(covered by compositeaiv_event_session_time_idx)aiv_event_type_idx(no queries filter by type alone)aiv_state_time_updated_idxforlistStatesordering performanceAddresses all 7 action items from
review-agent3-persistence.md.Test plan
upsertStateworks for both insert and update pathstime_updatedadvances on each upsert🤖 Generated with Claude Code