Skip to content

refactor: reduce weak payload plumbing across lib and storage runtime - #268

Merged
Sinity merged 4 commits into
masterfrom
feature/refactor/lib-storage-runtime-payload-plumbing
Apr 20, 2026
Merged

Sinity merged 4 commits into
masterfrom
feature/refactor/lib-storage-runtime-payload-plumbing

Conversation

@Sinity

@Sinity Sinity commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Ref #263

Summary

  • reduce weak metadata and analytics payload plumbing across repository write and archive analytics seams
  • route action-readiness checks through the typed action-event artifact state contract
  • share typed session payload documents across session profiles, work events, and work threads
  • normalize legacy session-product fallback payloads and MCP metadata adapters around those tightened contracts

Problem

Recent substrate renewal tightened JSON and session-product contracts, but the lib/storage runtime still had several weak seams:

  • metadata/tag operations still widened through loose dict/object shapes
  • provider analytics rows and action-readiness checks were not consistently using their typed runtime contracts
  • session profile, work event, and thread payloads duplicated near-identical dict schemas in multiple modules
  • legacy fallback hydration and MCP metadata surfaces still depended on ad hoc adapter logic that became brittle once payload shapes were made explicit

Solution

  • updated repository metadata/tag protocols and write paths to use shared JSON document/value contracts
  • introduced typed provider analytics rows and consumed them through archive operations instead of untyped row dicts
  • replaced awaitable probing in retrieval readiness with direct ActionEventArtifactState consumption
  • added polylogue/lib/session_payload_documents.py and rewired session profile, work event, and thread runtime/storage helpers to share those document contracts
  • localized compatibility work in the legacy mapper and MCP metadata wrapper so stricter runtime payloads do not leak regressions into old rows or surface serialization

Verification

  • devtools verify
  • pytest -q tests/unit/storage/test_session_product_refresh.py tests/unit/storage/test_product_materialization_laws.py tests/unit/mcp/test_tool_contracts.py -k 'thread or profile or work_event or phase or enrichment'
  • pytest -q tests/unit/storage/test_session_product_mapper_fallbacks.py tests/unit/storage/test_session_product_refresh.py tests/unit/mcp/test_tool_contracts.py -k 'metadata or timeline or work_event or session_profile_record_falls_back'

@Sinity
Sinity merged commit e6a0e7e into master Apr 20, 2026
10 checks passed
@Sinity
Sinity deleted the feature/refactor/lib-storage-runtime-payload-plumbing branch April 20, 2026 10:59
@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 4 minutes and 16 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 4 minutes and 16 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: 6bef8377-7334-40fd-b8f5-92c7453361f8

📥 Commits

Reviewing files that changed from the base of the PR and between 6d58b50 and fadae85.

📒 Files selected for processing (21)
  • polylogue/archive_product_models.py
  • polylogue/lib/query_retrieval_candidates.py
  • polylogue/lib/session_payload_documents.py
  • polylogue/lib/session_profile_models.py
  • polylogue/lib/threads.py
  • polylogue/lib/work_event_extraction.py
  • polylogue/mcp/payloads.py
  • polylogue/mcp/server_mutation_tools.py
  • polylogue/operations/archive.py
  • polylogue/protocols.py
  • polylogue/storage/backends/async_sqlite_archive.py
  • polylogue/storage/backends/queries/conversations_identity.py
  • polylogue/storage/backends/queries/mappers_product_legacy.py
  • polylogue/storage/backends/queries/stats.py
  • polylogue/storage/backends/query_store_archive.py
  • polylogue/storage/repository_write_conversations.py
  • polylogue/storage/repository_write_metadata.py
  • polylogue/storage/repository_writes.py
  • polylogue/storage/session_product_profiles.py
  • polylogue/storage/session_product_threads.py
  • polylogue/storage/session_product_timeline_rows.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/refactor/lib-storage-runtime-payload-plumbing

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

ℹ️ 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 added a commit that referenced this pull request Apr 22, 2026
…#268)

Ref #263

## Summary
- reduce weak metadata and analytics payload plumbing across repository write and archive analytics seams
- route action-readiness checks through the typed action-event artifact state contract
- share typed session payload documents across session profiles, work events, and work threads
- normalize legacy session-product fallback payloads and MCP metadata adapters around those tightened contracts

## Problem
Recent substrate renewal tightened JSON and session-product contracts, but the lib/storage runtime still had several weak seams:
- metadata/tag operations still widened through loose dict/object shapes
- provider analytics rows and action-readiness checks were not consistently using their typed runtime contracts
- session profile, work event, and thread payloads duplicated near-identical dict schemas in multiple modules
- legacy fallback hydration and MCP metadata surfaces still depended on ad hoc adapter logic that became brittle once payload shapes were made explicit

## Solution
- updated repository metadata/tag protocols and write paths to use shared JSON document/value contracts
- introduced typed provider analytics rows and consumed them through archive operations instead of untyped row dicts
- replaced awaitable probing in retrieval readiness with direct `ActionEventArtifactState` consumption
- added `polylogue/lib/session_payload_documents.py` and rewired session profile, work event, and thread runtime/storage helpers to share those document contracts
- localized compatibility work in the legacy mapper and MCP metadata wrapper so stricter runtime payloads do not leak regressions into old rows or surface serialization

## Verification
- `devtools verify`
- `pytest -q tests/unit/storage/test_session_product_refresh.py tests/unit/storage/test_product_materialization_laws.py tests/unit/mcp/test_tool_contracts.py -k 'thread or profile or work_event or phase or enrichment'`
- `pytest -q tests/unit/storage/test_session_product_mapper_fallbacks.py tests/unit/storage/test_session_product_refresh.py tests/unit/mcp/test_tool_contracts.py -k 'metadata or timeline or work_event or session_profile_record_falls_back'`
Sinity added a commit that referenced this pull request Apr 22, 2026
…#268)

Recent substrate renewal tightened JSON and session-product
contracts, but the lib/storage runtime still had several weak seams:
metadata/tag operations widened through loose dict/object shapes;
provider analytics rows and action-readiness checks were not
consistently using their typed runtime contracts; session profile,
work event, and thread payloads duplicated near-identical dict
schemas in multiple modules; legacy fallback hydration and MCP
metadata surfaces depended on ad hoc adapter logic that became
brittle once payload shapes were made explicit.

Updates repository metadata/tag protocols and write paths to use
shared JSON document/value contracts. Introduces typed provider
analytics rows and consumes them through archive operations instead
of untyped row dicts. Replaces awaitable probing in retrieval
readiness with direct `ActionEventArtifactState` consumption. Adds
`lib/session_payload_documents.py` and rewires session profile,
work event, and thread runtime/storage helpers to share those
document contracts. Localizes compatibility work in the legacy
mapper and MCP metadata wrapper so stricter runtime payloads don't
leak regressions into old rows or surface serialization.

Verification: pytest over session-product, MCP tool-contract, and
mapper-fallback suites; devtools verify green.

Ref #263
Sinity added a commit that referenced this pull request Apr 22, 2026
…#268)

Recent substrate renewal tightened JSON and session-product
contracts, but the lib/storage runtime still had several weak seams:
metadata/tag operations widened through loose dict/object shapes;
provider analytics rows and action-readiness checks were not
consistently using their typed runtime contracts; session profile,
work event, and thread payloads duplicated near-identical dict
schemas in multiple modules; legacy fallback hydration and MCP
metadata surfaces depended on ad hoc adapter logic that became
brittle once payload shapes were made explicit.

Updates repository metadata/tag protocols and write paths to use
shared JSON document/value contracts. Introduces typed provider
analytics rows and consumes them through archive operations instead
of untyped row dicts. Replaces awaitable probing in retrieval
readiness with direct `ActionEventArtifactState` consumption. Adds
`lib/session_payload_documents.py` and rewires session profile,
work event, and thread runtime/storage helpers to share those
document contracts. Localizes compatibility work in the legacy
mapper and MCP metadata wrapper so stricter runtime payloads don't
leak regressions into old rows or surface serialization.

Verification: pytest over session-product, MCP tool-contract, and
mapper-fallback suites; devtools verify green.

Ref #263
Sinity added a commit that referenced this pull request Apr 22, 2026
…#268)

Recent substrate renewal tightened JSON and session-product
contracts, but the lib/storage runtime still had several weak seams:
metadata/tag operations widened through loose dict/object shapes;
provider analytics rows and action-readiness checks were not
consistently using their typed runtime contracts; session profile,
work event, and thread payloads duplicated near-identical dict
schemas in multiple modules; legacy fallback hydration and MCP
metadata surfaces depended on ad hoc adapter logic that became
brittle once payload shapes were made explicit.

Updates repository metadata/tag protocols and write paths to use
shared JSON document/value contracts. Introduces typed provider
analytics rows and consumes them through archive operations instead
of untyped row dicts. Replaces awaitable probing in retrieval
readiness with direct `ActionEventArtifactState` consumption. Adds
`lib/session_payload_documents.py` and rewires session profile,
work event, and thread runtime/storage helpers to share those
document contracts. Localizes compatibility work in the legacy
mapper and MCP metadata wrapper so stricter runtime payloads don't
leak regressions into old rows or surface serialization.

Verification: pytest over session-product, MCP tool-contract, and
mapper-fallback suites; devtools verify green.

Ref #263
@Sinity
Sinity requested review from Copilot and removed request for Copilot May 1, 2026 00:43

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants