Skip to content

0010 - add session persistence models and storage coverage#22

Draft
ethanbailie wants to merge 3 commits intomainfrom
0010-session-storage-models
Draft

0010 - add session persistence models and storage coverage#22
ethanbailie wants to merge 3 commits intomainfrom
0010-session-storage-models

Conversation

@ethanbailie
Copy link
Copy Markdown
Collaborator

This PR introduces durable session persistence primitives before implementing session orchestration and API lifecycle behaviour.

What Changed

  • Added session domain models in tako_vm/models.py
    • SessionRecord
    • SessionEvent
    • SessionStatus and direction literals
  • Added migration 0002_sessions in tako_vm/storage.py
    • sessions table
    • session_events table with dedupe index (session_id, file_name)
  • Added storage operations in tako_vm/storage.py
    • save/get/list/touch session
    • save/list session events
    • cursor pagination support
  • Added row mappers for new session entities

Tests Added/Updated

  • tests/test_models.py
    • model defaults and literal validation
  • tests/test_storage.py
    • CRUD/list filters
    • touch timestamp updates
    • event dedupe behavior
    • cursor-based event listing
  • tests/test_postgres_integration.py
    • migration includes 0002_sessions

How To Review

  1. Review new models in tako_vm/models.py.
  2. Review migration DDL and indexes in tako_vm/storage.py.
  3. Review storage methods for idempotence and cursor semantics.
  4. Validate durability via tests/test_storage.py (behavior-focused, low mocking).

Suggested Verification

  • ruff check tako_vm tests
  • pytest tests/test_models.py tests/test_storage.py tests/test_postgres_integration.py -v

Out of Scope

  • No session container lifecycle yet.
  • No session HTTP endpoints yet.

@ethanbailie ethanbailie added the enhancement New feature or request label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant