Repository navigation
refactor: renew session-product persistence seams - #238
Conversation
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (29)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 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".
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`
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
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
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
|
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. |
Ref #237
Ref #225
Ref #222
Summary
tuple[object, ...]assemblyProblem
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
objecttuples. On the read side, the profile and timeline mappers each reconstructed legacypayload_jsonfallbacks inline, duplicating row parsing and defaulting rules.Solution
SqlValue/SqlBindingspacking helpers plus shared insert SQL generation inpolylogue/storage/session_product_storage.pypolylogue/storage/backends/queries/mappers_product_legacy.pyas the single typed fallback surface for hydrating legacy session profile, work-event, and phase payloadsmappers_product_profiles.pyandmappers_product_timelines.pyso they prefer modern payload columns when present and delegate legacy reconstruction to the shared helper otherwisetests/unit/storage/test_session_product_mapper_fallbacks.pyto lock the fallback contract for missing and empty typed payload columnsVerification
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.pymypy 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.pypytest -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.pydevtools verify