Skip to content

refactor: rebuild schema extraction and synthetic boundary contracts #261

Closed

Description

@Sinity

Ref #250

Outcome

Renew the schema-side core so extraction, synthetic generation, and verification helpers stop passing loosely shaped runtime payloads through multiple layers.

Problem

polylogue/schemas/ is now strict-type-clean, but several of its highest-churn seams still underspecify meaning through broad payload aliases, dict-shaped intermediate records, and duplicated conversion logic. The code works, but too much meaning is implicit.

This is most visible around extraction, synthetic generation/runtime, and schema-side verification helpers, where contract boundaries are still broader than they need to be.

Expected scope

Likely modules include:

  • polylogue/schemas/extraction.py
  • polylogue/schemas/observation_runtime.py
  • polylogue/schemas/unified_adapters.py follow-through
  • polylogue/schemas/synthetic/**
  • selected polylogue/pipeline/semantic_* and schema-facing helper surfaces
  • minimal test fallout needed to prove the tranche

Constraints and invariants

  • Preserve schema semantics and generated-output behavior.
  • Prefer explicit intermediate records, aliases, and narrowing helpers over open payload dicts.
  • Keep the tranche source-heavy; only touch tests where the renewed contracts require it.
  • Use worker follow-through only after local anchor rewrites establish the target shape.

Acceptance criteria

  • Extraction and synthetic-runtime boundaries use materially more explicit typed contracts.
  • Repeated schema payload coercion and conversion logic is reduced.
  • Broad dict-shaped intermediates are replaced where a stable semantic record exists.
  • The tranche lands as a coherent PR with devtools verify green.

Verification plan

Run devtools verify before merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:schematype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions