Skip to content

refactor: model pipeline stages as executable specs #323

Closed

Description

@Sinity

Context

The low-churn audit in #315 found that polylogue/pipeline/run_execution.py still carries long orchestration paths, especially around run_sources, nested helper functions, status/log/state handling, and stage sequencing.

The current implementation is type-safe but still path-dependent: stage behavior is encoded procedurally rather than as a clear executable model.

Scope

Introduce a table-driven stage execution model, likely centered on a PipelineStageSpec or equivalent, to make stage dependencies, cache behavior, status logging, and materialization boundaries explicit.

Acceptance criteria

  • Stage order and stage-specific behavior are represented by data/spec objects where practical.
  • Common logging/status/error handling is shared rather than duplicated in nested functions.
  • Existing run behavior and stage names remain compatible.
  • Pipeline-focused tests cover at least parse/materialize/render/index paths through the new model.
  • devtools verify passes before PR merge.

Ref #315

Activity

  1. added
    type:refactor
    on Apr 21, 2026
  2. Sinity commented on Apr 22, 2026

    @Sinity
    OwnerAuthor

    Starting #323 on feature/refactor/pipeline-executable-stage-specs.

    Initial boundary:

    • Focus on polylogue/pipeline/run_execution.py and directly adjacent stage/run tests.
    • Preserve existing stage names and operator behavior.
    • Make stage order/dependencies/status behavior explicit through executable specs where practical, instead of widening the pipeline scope into acquisition or source splitting work reserved for refactor: split source acquisition into explicit components #324.

    First step is to map the current run_sources path and existing pipeline tests before cutting the stage spec shape.

  3. Sinity commented on Apr 22, 2026

    @Sinity
    OwnerAuthor

    Progress update for #323:

    • Added a PipelineStageSpec catalog for leaf-stage execution facts: log/metric stage names, context-token policy, FTS trigger suspension, and whether the normal pipeline owns execution.
    • Replaced the default-vs-explicit run_sources() stage dispatch branches with a single spec-driven execution loop while keeping stage helpers scoped to their stage bodies.
    • Kept embed in the stage catalog as externally managed because the CLI dispatches embedding before entering run_sources(); this preserves existing direct run_sources(stage="embed") compatibility instead of changing it into an API-key-requiring path.
    • Added unit coverage that the spec catalog covers the full leaf-stage vocabulary and preserves sequence/FTS policy, plus existing parse/materialize/render/index sequencing coverage remains green.

    Focused verification so far:

    • ruff check polylogue/pipeline/run_execution.py polylogue/pipeline/stage_specs.py tests/unit/pipeline/test_run_sources.py
    • mypy polylogue/pipeline/run_execution.py polylogue/pipeline/stage_specs.py
    • pytest -q tests/unit/pipeline/test_run_sources.py
    • devtools render-all --check

    Next: commit this slice, run full devtools verify, then push/open the PR if the full local gate passes.

  4. added a commit that references this issue on Apr 22, 2026
    eea7f11
  5. added a commit that references this issue on May 7, 2026
    9848416
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:pipelinetype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions