Skip to content

Agent 3: fix persistence review feedback#9

Open
joys0714 wants to merge 1 commit intodevfrom
joys0714/persistence-fixes
Open

Agent 3: fix persistence review feedback#9
joys0714 wants to merge 1 commit intodevfrom
joys0714/persistence-fixes

Conversation

@joys0714
Copy link
Copy Markdown
Collaborator

@joys0714 joys0714 commented Apr 7, 2026

Summary

  • Replace select-then-insert/update with onConflictDoUpdate in upsertState (single round-trip)
  • Explicitly set time_updated in upsert to prevent stale timestamps
  • Add validator("param") for sessionID on the timeline route
  • Remove redundant aiv_event_session_idx (covered by composite aiv_event_session_time_idx)
  • Remove unnecessary aiv_event_type_idx (no queries filter by type alone)
  • Add aiv_state_time_updated_idx for listStates ordering performance
  • Migration to drop old indexes and create new one

Addresses all 7 action items from review-agent3-persistence.md.

Test plan

  • Verify migration applies cleanly (drops 2 indexes, creates 1)
  • Verify upsertState works for both insert and update paths
  • Verify time_updated advances on each upsert
  • Verify timeline route validates sessionID param

🤖 Generated with Claude Code

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>
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