Repository navigation
refactor(pipeline): catalog executable stage specs (#370) - #370
Conversation
Problem: run_sources carried stage order, stage context, metrics labels, and FTS suspension policy as duplicated branching across default and explicit stage paths. What changed: add PipelineStageSpec as the leaf-stage catalog, route run_sources through a single spec-driven execution loop, and keep embed represented as an externally managed stage so the existing CLI dispatch contract remains intact. Verification: 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. Ref #323
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe pipeline execution system is refactored from procedural, string-based stage sequencing to a spec-driven data model. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
## Summary Adds an executable `PipelineStageSpec` catalog for pipeline leaf-stage facts and routes `run_sources()` through a single spec-driven execution loop. ## Problem Closes #323. `polylogue/pipeline/run_execution.py` carried stage order, explicit-sequence context, metrics labels, FTS trigger suspension, and executed-stage bookkeeping in duplicated default and explicit dispatch branches. That made stage semantics harder to inspect and created another place where future pipeline stages could drift from the normalized stage vocabulary. ## Solution - Added `polylogue/pipeline/stage_specs.py` with the catalog of leaf-stage execution facts: log stage, context policy, FTS suspension policy, and whether the normal pipeline owns execution. - Replaced the split default/explicit `run_sources()` dispatch with one spec-driven loop. - Left individual stage helpers responsible only for stage bodies; the shared runner now owns context resolution and executed-stage tracking. - Kept `embed` represented as an externally managed leaf stage because `polylogue run embed` is dispatched by the CLI before entering `run_sources()`, preserving direct `run_sources(stage="embed")` compatibility without introducing an API-key-requiring behavior change. - Added unit coverage that the stage spec catalog covers the full leaf-stage vocabulary and preserves sequence/FTS policy; existing ordered parse/materialize/render/index tests continue to cover explicit-stage semantics. ## Verification - `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` -> `48 passed in 16.10s` - `devtools render-all --check` -> all generated surfaces in sync - `devtools verify` -> all checks passed - `git push -u origin feature/refactor/pipeline-executable-stage-specs` -> pre-push `devtools verify --quick` all checks passed
Summary
Adds an executable
PipelineStageSpeccatalog for pipeline leaf-stage facts and routesrun_sources()through a single spec-driven execution loop.Problem
Closes #323.
polylogue/pipeline/run_execution.pycarried stage order, explicit-sequence context, metrics labels, FTS trigger suspension, and executed-stage bookkeeping in duplicated default and explicit dispatch branches. That made stage semantics harder to inspect and created another place where future pipeline stages could drift from the normalized stage vocabulary.Solution
polylogue/pipeline/stage_specs.pywith the catalog of leaf-stage execution facts: log stage, context policy, FTS suspension policy, and whether the normal pipeline owns execution.run_sources()dispatch with one spec-driven loop.embedrepresented as an externally managed leaf stage becausepolylogue run embedis dispatched by the CLI before enteringrun_sources(), preserving directrun_sources(stage="embed")compatibility without introducing an API-key-requiring behavior change.Verification
ruff check polylogue/pipeline/run_execution.py polylogue/pipeline/stage_specs.py tests/unit/pipeline/test_run_sources.pymypy polylogue/pipeline/run_execution.py polylogue/pipeline/stage_specs.pypytest -q tests/unit/pipeline/test_run_sources.py->48 passed in 16.10sdevtools render-all --check-> all generated surfaces in syncdevtools verify-> all checks passedgit push -u origin feature/refactor/pipeline-executable-stage-specs-> pre-pushdevtools verify --quickall checks passedSummary by CodeRabbit
Refactor
Tests