Skip to content

refactor: pipeline orchestration + cli seams#354

Merged
stanlrt merged 5 commits into
mainfrom
351-pipeline-cli-cleanups
Jul 7, 2026
Merged

refactor: pipeline orchestration + cli seams#354
stanlrt merged 5 commits into
mainfrom
351-pipeline-cli-cleanups

Conversation

@stanlrt

@stanlrt stanlrt commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Four contained pipeline/CLI-seam cleanups surfaced by the advisor review (issue #1, the config-access campaign, shipped separately as #353). No user-facing config or behaviour change; the public raitap.run entry is untouched.

  1. Decompose _run_pipeline — the 108-line god function in pipeline/orchestrator.py split into four order-preserving helpers (_build_run_context, _write_run_reproducibility, _generate_report, _log_run_to_tracker). Pure extraction.
  2. Log the best-effort swallows — the two silent except Exception: return None fallbacks in models/model.py now emit a raitap_log.debug(..., module=Module.models) line. Fallback behaviour unchanged.
  3. Consolidate CLI argv parsing — all Hydra-flag logic moved from cli.py + pipeline/__main__.py into a new stdlib-only raitap/_cli_argv.py; deps/bootstrap.py also now consumes it (killing a third duplicate copy of the flag constants + parser). New tests/test_cli_argv.py.
  4. Untangle the run namesorchestrator.run_without_trackingrun_phases (named by what it does); the duplicate pipeline.run re-export deleted (tracking/smoke_test_mlflow migrated to public raitap.run); pipeline/__init__ now uses a typed lazy __getattr__ re-export so raitap.pipeline.run_phases gets a real typed signature instead of (*args, **kwargs).

API surface note (pre-1.0, non-headline): raitap.pipeline.run is removed and raitap.pipeline.run_without_trackingrun_phases. The documented public entry raitap.run is unchanged. Judged non-breaking for release purposes; flag if you'd prefer a ! title.

Reviewed by whole-branch correctness (clean) + refactor (bootstrap dedup folded in) passes.

Closes #351

Checklist

  • CI — Required checks are green
  • Breaking changes — If this PR breaks compatibility the title uses !. Assessed: public raitap.run untouched; only pre-1.0 internal raitap.pipeline helpers renamed/removed — not marked breaking.
  • Contributor guide — I've read Pull requests and commit messages before requesting review.

Optional

Copilot AI review requested due to automatic review settings July 7, 2026 12:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Breaking change: Yes — this PR removes raitap.pipeline.run and renames/removes raitap.pipeline.run_without_tracking (now run_phases) from the importable raitap.pipeline surface.

Warning

The PR contains breaking changes, but the tiles does not contain "!". Please mark it as breaking by adding "!" after the type or scope (e.g. feat!: or feat(api)!:).

This PR refactors pipeline orchestration and CLI argument handling to reduce duplication and improve internal seams, while updating tests/docs to match the new names and extraction boundaries.

Changes:

  • Decomposes pipeline.orchestrator._run_pipeline into smaller helpers and renames run_without_trackingrun_phases.
  • Consolidates Hydra argv munging into a new stdlib-only src/raitap/_cli_argv.py, used by cli.py, pipeline/__main__.py, and deps/bootstrap.py.
  • Adds debug logging to previously silent best-effort fallbacks in models/model.py and updates call sites/tests/docs for the renamed pipeline helpers.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/raitap/tracking/smoke_test_mlflow.py Switches smoke test to use public raitap.run.
src/raitap/tests/test_run_main.py Updates tests to call _run_pipeline and patches run_phases instead of run_without_tracking.
src/raitap/tests/test_run_labels.py Updates metrics-label threading test for run_phases rename.
src/raitap/tests/test_reproducibility_orchestrator.py Updates reproducibility tests to patch run_phases.
src/raitap/tests/test_memory_leaks.py Updates memory leak test imports and name references for run_phases.
src/raitap/tests/test_e2e_detection.py Updates E2E detection test to use run_phases.
src/raitap/tests/test_cli_argv.py New unit tests covering shared argv helper behavior.
src/raitap/robustness/tests/test_e2e_real_data.py Updates robustness E2E test naming/imports for run_phases.
src/raitap/pipeline/phases/registry.py Updates doc reference from run_without_tracking to run_phases.
src/raitap/pipeline/outputs.py Updates docstring to reference raitap.run as the primary entrypoint.
src/raitap/pipeline/orchestrator.py Extracts helpers (_build_run_context, _write_run_reproducibility, _generate_report, _log_run_to_tracker) and renames run_without_trackingrun_phases.
src/raitap/pipeline/main.py Uses _cli_argv constants/helpers for Hydra config-path/name and argv rewriting.
src/raitap/pipeline/init.py Replaces run/run_without_tracking wrappers with typed lazy __getattr__ exports for run_phases and other functions.
src/raitap/models/model.py Adds debug logging when best-effort metadata parsing falls back.
src/raitap/deps/bootstrap.py Deduplicates Hydra flag parsing by importing _cli_argv helpers/constants.
src/raitap/cli.py Delegates demo/help-frame logic to _cli_argv.
src/raitap/_cli_argv.py New shared stdlib-only argv parsing/rewriting utilities.
docs/contributor/architecture.md Updates contributor docs for run_phases rename.

Comment thread src/raitap/pipeline/__init__.py
Comment thread src/raitap/pipeline/orchestrator.py
@stanlrt stanlrt merged commit 2ad2dac into main Jul 7, 2026
19 checks passed
@stanlrt stanlrt deleted the 351-pipeline-cli-cleanups branch July 7, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: pipeline orchestration + CLI seam cleanups

2 participants