Skip to content

refactor: renew run and acquisition boundary contracts #252

Closed

Description

@Sinity

Summary

Continue the semantic-precision renewal program by rebuilding the run/acquisition boundary layer on explicit typed contracts instead of open dict[str, object] payloads and ad hoc casts.

Ref #250

Problem

The current schema/lib payload renewal cleaned the raw payload and harmonization surfaces, but the run pipeline and source acquisition layer still carry older path-dependent contracts:

  • run stage outcomes and observations are mostly dict[str, object]
  • acquisition sidecar/observation payloads still use loose aliases and cast-heavy flow
  • run finalization/execution paths convert typed state back into open dictionaries too early
  • these files remain one of the larger remaining concentrations of Any/object plumbing in non-test code

That leaves the substrate type-clean but not fully type-realized across the execution seam that ties source traversal, stage execution, and run-state reporting together.

Scope

Target the boundary layer around:

  • polylogue/pipeline/run_stages.py
  • polylogue/pipeline/run_execution.py
  • polylogue/pipeline/run_finalization.py
  • polylogue/pipeline/run_support.py
  • polylogue/pipeline/stage_models.py
  • polylogue/sources/source_acquisition.py
  • polylogue/sources/assembly.py
  • adjacent helpers where mechanical follow-through is required

Acceptance Criteria

  • stage observations and acquisition observations use explicit typed payload shapes rather than open dictionaries where the schema is known
  • repeated cast-based boundary conversions are removed or isolated behind shared helpers
  • run finalization/write paths preserve typed meaning until the final serialization edge
  • the affected source and pipeline modules pass ruff, mypy, and focused pytest coverage
  • the tranche lands as one coherent PR under the renewal program rather than opportunistic file-by-file cleanup

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:pipelinetype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions