Skip to content

refactor: renew session-product persistence seams - #238

Merged
Sinity merged 2 commits into
masterfrom
feature/refactor/session-product-persistence-renewal
Apr 20, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/refactor/session-product-persistence-renewal

Conversation

@Sinity

@Sinity Sinity commented Apr 20, 2026 •

Copy link
Copy Markdown
Owner

Ref #237
Ref #225
Ref #222

Summary

  • rebuild session-product insert packing around shared typed SQL binding helpers instead of repeated tuple[object, ...] assembly
  • extract shared legacy payload hydrators for session profile, work-event, and phase row mappers
  • add focused mapper fallback tests covering both missing-column and empty-JSON typed-payload cases

Problem

The session-product persistence seam still carried older path-dependent structure. On the write side, profile/work-event/phase rows each repeated their own insert column/value assembly with broad object tuples. On the read side, the profile and timeline mappers each reconstructed legacy payload_json fallbacks inline, duplicating row parsing and defaulting rules.

Solution

  • introduced explicit SqlValue / SqlBindings packing helpers plus shared insert SQL generation in polylogue/storage/session_product_storage.py
  • rewired the async profile/timeline write queries to consume those shared insert builders instead of hand-assembling SQL placeholders locally
  • added polylogue/storage/backends/queries/mappers_product_legacy.py as the single typed fallback surface for hydrating legacy session profile, work-event, and phase payloads
  • slimmed mappers_product_profiles.py and mappers_product_timelines.py so they prefer modern payload columns when present and delegate legacy reconstruction to the shared helper otherwise
  • added tests/unit/storage/test_session_product_mapper_fallbacks.py to lock the fallback contract for missing and empty typed payload columns

Verification

  • ruff check polylogue/storage/session_product_storage.py polylogue/storage/backends/queries/mappers_product_legacy.py polylogue/storage/backends/queries/mappers_product_profiles.py polylogue/storage/backends/queries/mappers_product_timelines.py polylogue/storage/backends/queries/session_product_profile_writes.py polylogue/storage/backends/queries/session_product_timeline_writes.py tests/unit/storage/test_session_product_mapper_fallbacks.py
  • mypy polylogue/storage/session_product_storage.py polylogue/storage/backends/queries/mappers_product_legacy.py polylogue/storage/backends/queries/mappers_product_profiles.py polylogue/storage/backends/queries/mappers_product_timelines.py polylogue/storage/backends/queries/session_product_profile_writes.py polylogue/storage/backends/queries/session_product_timeline_writes.py tests/unit/storage/test_session_product_mapper_fallbacks.py
  • pytest -q tests/unit/storage/test_session_product_profiles.py tests/unit/storage/test_session_product_timeline_rows.py tests/unit/storage/test_session_product_mapper_fallbacks.py
  • devtools verify

@coderabbitai

coderabbitai Bot commented Apr 20, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Sinity has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 54 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 56 minutes and 54 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 10752530-d44d-4786-817c-94fbaeae2c5b

📥 Commits

Reviewing files that changed from the base of the PR and between 5ed4243 and 80d5f52.

📒 Files selected for processing (29)
  • devtools/pipeline_probe.py
  • devtools/project_motd.py
  • polylogue/cli/embed_stats.py
  • polylogue/pipeline/run_finalization.py
  • polylogue/pipeline/run_stages.py
  • polylogue/pipeline/semantic_capture.py
  • polylogue/pipeline/services/indexing.py
  • polylogue/pipeline/services/ingest_worker.py
  • polylogue/sources/assembly.py
  • polylogue/storage/backends/queries/mappers_product_legacy.py
  • polylogue/storage/backends/queries/mappers_product_profiles.py
  • polylogue/storage/backends/queries/mappers_product_timelines.py
  • polylogue/storage/backends/queries/session_product_profile_writes.py
  • polylogue/storage/backends/queries/session_product_timeline_writes.py
  • polylogue/storage/backends/queries/stats.py
  • polylogue/storage/query_models.py
  • polylogue/storage/session_product_runtime.py
  • polylogue/storage/session_product_storage.py
  • polylogue/storage/state_views.py
  • polylogue/surface_payloads.py
  • tests/infra/cli_subprocess.py
  • tests/unit/cli/test_source_selection_helpers.py
  • tests/unit/core/test_filters_props.py
  • tests/unit/pipeline/test_resilience.py
  • tests/unit/sources/test_drive_source_client.py
  • tests/unit/sources/test_parser_crashlessness.py
  • tests/unit/sources/test_source_laws.py
  • tests/unit/storage/test_session_product_mapper_fallbacks.py
  • tests/unit/storage/test_store_ops.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/session-product-persistence-renewal

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6802a998f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Sinity
Sinity merged commit f395346 into master Apr 20, 2026
13 checks passed
@Sinity
Sinity deleted the feature/refactor/session-product-persistence-renewal branch April 20, 2026 03:06
Sinity added a commit that referenced this pull request Apr 22, 2026
Ref #237
Ref #225
Ref #222

## Summary
- rebuild session-product insert packing around shared typed SQL binding helpers instead of repeated `tuple[object, ...]` assembly
- extract shared legacy payload hydrators for session profile, work-event, and phase row mappers
- add focused mapper fallback tests covering both missing-column and empty-JSON typed-payload cases

## Problem
The session-product persistence seam still carried older path-dependent structure. On the write side, profile/work-event/phase rows each repeated their own insert column/value assembly with broad `object` tuples. On the read side, the profile and timeline mappers each reconstructed legacy `payload_json` fallbacks inline, duplicating row parsing and defaulting rules.

## Solution
- introduced explicit `SqlValue` / `SqlBindings` packing helpers plus shared insert SQL generation in `polylogue/storage/session_product_storage.py`
- rewired the async profile/timeline write queries to consume those shared insert builders instead of hand-assembling SQL placeholders locally
- added `polylogue/storage/backends/queries/mappers_product_legacy.py` as the single typed fallback surface for hydrating legacy session profile, work-event, and phase payloads
- slimmed `mappers_product_profiles.py` and `mappers_product_timelines.py` so they prefer modern payload columns when present and delegate legacy reconstruction to the shared helper otherwise
- added `tests/unit/storage/test_session_product_mapper_fallbacks.py` to lock the fallback contract for missing and empty typed payload columns

## Verification
- `ruff check polylogue/storage/session_product_storage.py polylogue/storage/backends/queries/mappers_product_legacy.py polylogue/storage/backends/queries/mappers_product_profiles.py polylogue/storage/backends/queries/mappers_product_timelines.py polylogue/storage/backends/queries/session_product_profile_writes.py polylogue/storage/backends/queries/session_product_timeline_writes.py tests/unit/storage/test_session_product_mapper_fallbacks.py`
- `mypy polylogue/storage/session_product_storage.py polylogue/storage/backends/queries/mappers_product_legacy.py polylogue/storage/backends/queries/mappers_product_profiles.py polylogue/storage/backends/queries/mappers_product_timelines.py polylogue/storage/backends/queries/session_product_profile_writes.py polylogue/storage/backends/queries/session_product_timeline_writes.py tests/unit/storage/test_session_product_mapper_fallbacks.py`
- `pytest -q tests/unit/storage/test_session_product_profiles.py tests/unit/storage/test_session_product_timeline_rows.py tests/unit/storage/test_session_product_mapper_fallbacks.py`
- `devtools verify`
@Sinity Sinity added tool:claude Claude type:refactor Code restructuring labels Apr 22, 2026
Sinity added a commit that referenced this pull request Apr 22, 2026
The session-product persistence seam still carried older path-
dependent structure. On the write side, profile/work-event/phase
rows each repeated their own insert column/value assembly with
broad `tuple[object, ...]`. On the read side, the profile and
timeline mappers each reconstructed legacy `payload_json` fallbacks
inline, duplicating row parsing and defaulting rules.

Introduces explicit `SqlValue` / `SqlBindings` packing helpers plus
shared insert SQL generation in `storage/session_product_storage.py`
; the async profile/timeline write queries consume those shared
builders instead of hand-assembling SQL placeholders locally. Adds
`storage/backends/queries/mappers_product_legacy.py` as the single
typed fallback surface for hydrating legacy session profile,
work-event, and phase payloads. Slims
`mappers_product_profiles.py` and `mappers_product_timelines.py` so
they prefer modern payload columns when present and delegate legacy
reconstruction to the shared helper otherwise.

Adds `tests/unit/storage/test_session_product_mapper_fallbacks.py`
to lock the fallback contract for missing and empty typed-payload
columns.

Verification: ruff + mypy + pytest over the touched storage mapper
and write-query tests; devtools verify green.

Ref #237
Ref #225
Ref #222
Sinity added a commit that referenced this pull request Apr 22, 2026
The session-product persistence seam still carried older path-
dependent structure. On the write side, profile/work-event/phase
rows each repeated their own insert column/value assembly with
broad `tuple[object, ...]`. On the read side, the profile and
timeline mappers each reconstructed legacy `payload_json` fallbacks
inline, duplicating row parsing and defaulting rules.

Introduces explicit `SqlValue` / `SqlBindings` packing helpers plus
shared insert SQL generation in `storage/session_product_storage.py`
; the async profile/timeline write queries consume those shared
builders instead of hand-assembling SQL placeholders locally. Adds
`storage/backends/queries/mappers_product_legacy.py` as the single
typed fallback surface for hydrating legacy session profile,
work-event, and phase payloads. Slims
`mappers_product_profiles.py` and `mappers_product_timelines.py` so
they prefer modern payload columns when present and delegate legacy
reconstruction to the shared helper otherwise.

Adds `tests/unit/storage/test_session_product_mapper_fallbacks.py`
to lock the fallback contract for missing and empty typed-payload
columns.

Verification: ruff + mypy + pytest over the touched storage mapper
and write-query tests; devtools verify green.

Ref #237
Ref #225
Ref #222
Sinity added a commit that referenced this pull request Apr 22, 2026
The session-product persistence seam still carried older path-
dependent structure. On the write side, profile/work-event/phase
rows each repeated their own insert column/value assembly with
broad `tuple[object, ...]`. On the read side, the profile and
timeline mappers each reconstructed legacy `payload_json` fallbacks
inline, duplicating row parsing and defaulting rules.

Introduces explicit `SqlValue` / `SqlBindings` packing helpers plus
shared insert SQL generation in `storage/session_product_storage.py`
; the async profile/timeline write queries consume those shared
builders instead of hand-assembling SQL placeholders locally. Adds
`storage/backends/queries/mappers_product_legacy.py` as the single
typed fallback surface for hydrating legacy session profile,
work-event, and phase payloads. Slims
`mappers_product_profiles.py` and `mappers_product_timelines.py` so
they prefer modern payload columns when present and delegate legacy
reconstruction to the shared helper otherwise.

Adds `tests/unit/storage/test_session_product_mapper_fallbacks.py`
to lock the fallback contract for missing and empty typed-payload
columns.

Verification: ruff + mypy + pytest over the touched storage mapper
and write-query tests; devtools verify green.

Ref #237
Ref #225
Ref #222
@Sinity
Sinity requested a review from Copilot May 1, 2026 00:43
@Sinity
Sinity requested review from Copilot and removed request for Copilot May 1, 2026 01:05
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool:claude Claude type:refactor Code restructuring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant