Skip to content

Renew rendering and source boundary contracts around block payloads and dispatch #278

Closed

Description

@Sinity

Problem

The verification-renewal branch has exhausted the tests/ and devtools/ weak-typing residue, but the next high-leverage source-side debt is still concentrated in a small boundary-heavy cluster:

  • polylogue/rendering/block_models.py
  • polylogue/sources/dispatch.py
  • polylogue/rendering/core_messages.py
  • polylogue/sources/token_store.py
  • polylogue/lib/json.py

These files still carry a disproportionate share of cast-heavy payload coercion, structural object plumbing, and runtime narrowing that is only partially modeled. They are also central seams used by adjacent helpers such as sources/parsers/drive_support_attachments.py, sources/providers/gemini_message.py, and sources/source_acquisition.py.

Outcome

Run a source-renewal tranche that turns these into explicit typed boundaries instead of loose compatibility layers.

Acceptance Criteria

  • rendering/block_models.py no longer relies on cast-driven extraction for block fields or tool-input payloads.
  • rendering/core_messages.py attaches branch payloads through typed helpers rather than list-level casts between rendered messages and mapping payloads.
  • sources/dispatch.py lowers payloads and provider detection through typed sequence/record helpers without the current list/object casts for Claude Code and Codex paths.
  • sources/token_store.py replaces the current keyring object/ignore seam with an explicit protocol-backed keyring contract.
  • lib/json.py removes its remaining cast-based loads path and keeps the JSON contract typed end-to-end.
  • Adjacent follow-through is applied where needed in nearby files (drive_support_attachments.py, gemini_message.py, source_acquisition.py, or similar) so the renewed contracts are actually consumed.
  • ruff check, mypy, and targeted pytest coverage pass for the touched tranche before PR.

Notes

This is the next source-side continuation after the verification-renewal work. It should stay substrate-first: define the new contracts in the source/rendering/lib layer first, then adapt any surface-level callers second.

Activity

  1. added
    type:refactor
    on Apr 22, 2026
  2. added 4 commits that reference this issue on Apr 22, 2026
    896c5d9
    4c4acbd
    d950e7b
    c67a16c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:parserarea:sitetype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions