Skip to content

refactor: renew session-product persistence seams #237

Closed

Description

@Sinity

Ref #225
Ref #222

Outcome

Renew the session-product persistence seam so typed product records map to SQL rows and back through explicit, reusable contracts rather than broad tuple/object packing and repeated legacy-payload fallbacks.

Problem or opportunity

polylogue/storage/session_product_storage.py and the product row mappers still carry a lot of path-dependent glue:

  • repeated column/value packing logic split across profiles, work events, phases, and aggregates
  • loose tuple[object, ...] / object payload carriers between typed records and SQLite
  • duplicated legacy-payload fallback logic in the profile and timeline mappers

That seam is ripe for a whole-file renewal because the storage rows are already typed; the weak point is the adapter layer between those typed records and the SQL/JSON boundary.

Expected scope

Likely modules include:

  • polylogue/storage/session_product_storage.py
  • polylogue/storage/backends/queries/mappers_product_profiles.py
  • polylogue/storage/backends/queries/mappers_product_timelines.py
  • polylogue/storage/store_product_session_records.py
  • polylogue/storage/store_product_timeline_records.py
  • adjacent session-product read/write tests

Acceptance criteria

  • Session-product insert packing is expressed through clearer typed helpers instead of repeated ad hoc tuple/object assembly.
  • Legacy payload fallback logic is factored into reusable, typed mapper helpers rather than duplicated inline branches.
  • The slice lands as a coherent PR with devtools verify green.

Verification plan

Run devtools verify before merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:storagetype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions