Decompose localci run into testable CLI, DI container, and orchestration flow (#46)#48
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughDecomposes the monolithic ChangesRun Command Decomposition
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cli/localci/cli/run/run_flow.py`:
- Around line 318-320: The code uses cfg.logging.directory directly when
building paths (logs_dir / "last-run.json") which can crash if
cfg.logging.directory is a string; update execute_run() to normalize the
directory into a Path before joining: set logs_dir = Path(cfg.logging.directory)
(or ensure Path(...) is applied to cfg.logging.directory where logs_dir is
assigned) and then build last_run_file and execution_file from logs_dir;
reference symbols: cfg.logging.directory, logs_dir, execute_run(),
last_run_file, execution_file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 340f6e79-a61a-49cb-aef5-87446217bb4a
📒 Files selected for processing (10)
cli/localci/cli/run/__init__.pycli/localci/cli/run/cli.pycli/localci/cli/run/click_options.pycli/localci/cli/run/container.pycli/localci/cli/run/params.pycli/localci/cli/run/patcher.pycli/localci/cli/run/run_flow.pycli/tests/test_cli.pycli/tests/test_github_token.pycli/tests/test_run_flow.py
Summary
Closes #46.
Replaces the monolithic
cli/localci/cli/run.py(~679 lines, ~275-linerun()body) with a focused package so orchestration can be tested with injected dependencies while preserving the existing CLI surface.cli/localci/cli/run/cli.py— Click entry: buildsRunOptions, delegates toexecute_run, maps exit code toctx.exit()cli/localci/cli/run/click_options.py— Shared@run_optionsdecorator (keepscli.pythin)cli/localci/cli/run/params.py—RunOptionsdataclasscli/localci/cli/run/container.py—RunDependencies+build_run_container()(workflow analyzer, queue builder, executor, parallel manager, patcher, cache helpers)cli/localci/cli/run/run_flow.py—execute_run()orchestration: parse/filter/queue, dry-run, preflight, parallel execution, summary persistencecli/localci/cli/run/patcher.py—_print_execution_planand_write_patched_workflowonly (regex patcher logic unchanged; full extraction deferred)Integrates with #47 (
resolve_github_token/warn_sentinel_github_token) insiderun_flowso sentinel warnings and offline behavior match develop.Adds
cli/tests/test_run_flow.py— directexecute_runtests (dry-run plan, preflight skip on dry-run, act-missing exit, CLI parity).Test plan
cd cli && python -m pytest tests/ --ignore=tests/integration(529 passed)localci run --workflow cli/tests/fixtures/sample_workflow.yml --dry-run— execution plan printslocalci run --workflow … --dry-runwith noGITHUB_TOKEN— sentinel warning (including under-q)localci run --workflow … --dry-run --offline— no sentinel warningpytest tests/integration/test_localci_run.py(requires act + Docker)Summary by CodeRabbit
New Features
localci runcommand with workflow/job/platform/compiler filters, matrix filtering, and merged CLI filters.Tests