refactor(profiles): nuke components-v2 and its mixed Python serving stack#119
Conversation
|
WalkthroughChangesRoute Bundle Migration and Profile API Retirement
Estimated code review effort: 5 (Critical) | ~120 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/readme/test_readme.py (1)
71-95: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winValidate the bundle-level schema too.
This helper ignores top-level fields such as
defaults:and only validates individual routes. A malformed global default or invalidroutesshape can therefore pass despite the test claiming route-bundle schema validation. Validate the root bundle/defaults through the same validation layer before iterating routes.🤖 Prompt for 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. In `@tests/readme/test_readme.py` around lines 71 - 95, The _validate_route_blocks helper currently validates only individual routes, leaving malformed bundle-level fields and routes shapes unchecked. Before iterating payload["routes"], pass the full parsed bundle, including defaults and routes, through the existing route-bundle validation layer, while preserving the per-route validation and error context.
🤖 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 `@docs/cli_reference.md`:
- Around line 63-69: Update the route-type overviews to document the supported
escalation_router strategy: in docs/cli_reference.md lines 63-69, add
escalation_router to the public route-type list or explicitly mark the list
non-exhaustive; in docs/core_concepts.md lines 49-53, include escalation routing
in the strategy overview or mark that list non-exhaustive.
In `@docs/routing_algorithms/llm_classifier_routing.md`:
- Around line 81-83: Clarify in the configuration table that
classifier.min_confidence, classifier.fail_open, and
classifier.recent_turn_window are dotted paths to nested YAML keys, not literal
option names. Update the surrounding table heading or descriptions while
preserving the existing nested-key examples and setting meanings.
In `@switchyard/cli/switchyard_cli.py`:
- Around line 362-365: Update the remediation command in the bundle-only flow
near the routing-profile handling to place the global --routing-profiles PATH
option before the configure subcommand. Ensure the displayed command is
switchyard --routing-profiles PATH configure so argparse accepts the recovery
path.
---
Outside diff comments:
In `@tests/readme/test_readme.py`:
- Around line 71-95: The _validate_route_blocks helper currently validates only
individual routes, leaving malformed bundle-level fields and routes shapes
unchecked. Before iterating payload["routes"], pass the full parsed bundle,
including defaults and routes, through the existing route-bundle validation
layer, while preserving the per-route validation and error context.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: a0b7339e-ad1d-4c8b-a417-ca5b5e03652e
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (80)
.agents/skills/switchyard-codebase-exploration/SKILL.mdAGENTS.mdCargo.tomlREADME.mdcrates/switchyard-components-v2-macros/Cargo.tomlcrates/switchyard-components-v2-macros/src/lib.rscrates/switchyard-components-v2/Cargo.tomlcrates/switchyard-components-v2/DESIGN.mdcrates/switchyard-components-v2/src/backend.rscrates/switchyard-components-v2/src/config.rscrates/switchyard-components-v2/src/config/loading.rscrates/switchyard-components-v2/src/config/parsing.rscrates/switchyard-components-v2/src/config/resolving.rscrates/switchyard-components-v2/src/lib.rscrates/switchyard-components-v2/src/profile.rscrates/switchyard-components-v2/src/profiles/latency_service/health.rscrates/switchyard-components-v2/src/profiles/latency_service/mod.rscrates/switchyard-components-v2/src/profiles/latency_service/polling.rscrates/switchyard-components-v2/src/profiles/latency_service/selection.rscrates/switchyard-components-v2/src/profiles/latency_service/tests.rscrates/switchyard-components-v2/src/profiles/llm_routing.rscrates/switchyard-components-v2/src/profiles/llm_routing/prompts/coding_agent.mdcrates/switchyard-components-v2/src/profiles/llm_routing/prompts/general.mdcrates/switchyard-components-v2/src/profiles/llm_routing/prompts/openclaw.mdcrates/switchyard-components-v2/src/profiles/macros.rscrates/switchyard-components-v2/src/profiles/mod.rscrates/switchyard-components-v2/src/profiles/noop.rscrates/switchyard-components-v2/src/profiles/passthrough.rscrates/switchyard-components-v2/src/profiles/profile_types.rscrates/switchyard-components-v2/src/profiles/random_routing.rscrates/switchyard-components-v2/src/profiles/stage_router.rscrates/switchyard-components-v2/src/profiles/stage_router/prompts/classifier.mdcrates/switchyard-components-v2/src/stats.rscrates/switchyard-components-v2/src/stats_recording.rscrates/switchyard-components-v2/tests/config.rscrates/switchyard-components-v2/tests/latency_service_profile.rscrates/switchyard-components-v2/tests/llm_routing_profile.rscrates/switchyard-components-v2/tests/passthrough_profile.rscrates/switchyard-components-v2/tests/random_routing_profile.rscrates/switchyard-components-v2/tests/stage_router_profile.rscrates/switchyard-components/src/lib.rscrates/switchyard-py/Cargo.tomlcrates/switchyard-py/src/lib.rscrates/switchyard-py/src/profile_bindings/mod.rscrates/switchyard-py/src/profile_bindings/typed.rsdocs/cli_reference.mddocs/core_concepts.mddocs/guides/agent_launchers.mddocs/index.mddocs/internal/latency_service_routing.mddocs/internal/metrics_reference.mddocs/routing_algorithms/escalation_router_routing.mddocs/routing_algorithms/llm_classifier_routing.mddocs/routing_algorithms/overview.mddocs/routing_algorithms/random_routing.mddocs/routing_algorithms/stage_router_routing.mddocs/routing_algorithms/sticky_routing.mdexamples/profiles.yamlexamples/python_profile.yamlswitchyard/__init__.pyswitchyard/cli/route_bundle.pyswitchyard/cli/switchyard_cli.pyswitchyard/lib/__init__.pyswitchyard/lib/profiles/__init__.pyswitchyard/lib/profiles/header_routing.pyswitchyard/lib/profiles/loader.pyswitchyard/lib/profiles/protocols.pyswitchyard/lib/profiles/stage_router_config.pyswitchyard_rust/core.pyswitchyard_rust/profiles.pyswitchyard_rust/profiles.pyitests/readme/test_readme.pytests/test_cli_reference_docs.pytests/test_profile_migration.pytests/test_python_profile_abstractions.pytests/test_python_profile_loader.pytests/test_rl_logging.pytests/test_route_bundle.pytests/test_serve_profile_config.pytests/test_switchyard_rust_profile_bindings.py
💤 Files with no reviewable changes (51)
- crates/switchyard-components-v2/src/profiles/llm_routing/prompts/coding_agent.md
- crates/switchyard-components-v2-macros/Cargo.toml
- crates/switchyard-components-v2/src/profiles/stage_router/prompts/classifier.md
- crates/switchyard-components-v2/DESIGN.md
- crates/switchyard-components-v2/src/profiles/llm_routing/prompts/general.md
- crates/switchyard-components-v2/tests/stage_router_profile.rs
- crates/switchyard-components-v2/src/stats.rs
- crates/switchyard-components-v2/tests/latency_service_profile.rs
- crates/switchyard-components-v2/src/profiles/profile_types.rs
- examples/python_profile.yaml
- examples/profiles.yaml
- crates/switchyard-components-v2/src/profiles/llm_routing/prompts/openclaw.md
- crates/switchyard-components-v2/tests/random_routing_profile.rs
- crates/switchyard-components-v2/tests/passthrough_profile.rs
- crates/switchyard-components-v2/Cargo.toml
- crates/switchyard-components-v2-macros/src/lib.rs
- switchyard/lib/profiles/loader.py
- crates/switchyard-components-v2/tests/llm_routing_profile.rs
- Cargo.toml
- crates/switchyard-components-v2/src/profiles/macros.rs
- crates/switchyard-components-v2/src/profiles/latency_service/tests.rs
- crates/switchyard-components-v2/src/profiles/random_routing.rs
- crates/switchyard-components-v2/src/profiles/noop.rs
- crates/switchyard-components-v2/src/config/loading.rs
- crates/switchyard-py/src/profile_bindings/typed.rs
- crates/switchyard-components-v2/src/profiles/passthrough.rs
- crates/switchyard-components-v2/src/profiles/latency_service/health.rs
- tests/test_serve_profile_config.py
- crates/switchyard-components-v2/src/profiles/latency_service/polling.rs
- docs/internal/latency_service_routing.md
- crates/switchyard-components-v2/tests/config.rs
- crates/switchyard-components-v2/src/backend.rs
- crates/switchyard-components-v2/src/config.rs
- crates/switchyard-components-v2/src/profiles/llm_routing.rs
- crates/switchyard-py/Cargo.toml
- crates/switchyard-components-v2/src/lib.rs
- crates/switchyard-components-v2/src/profiles/mod.rs
- crates/switchyard-components-v2/src/stats_recording.rs
- crates/switchyard-components-v2/src/profile.rs
- tests/test_python_profile_loader.py
- tests/test_profile_migration.py
- crates/switchyard-components-v2/src/profiles/stage_router.rs
- tests/test_switchyard_rust_profile_bindings.py
- crates/switchyard-components-v2/src/profiles/latency_service/mod.rs
- crates/switchyard-components-v2/src/config/parsing.rs
- switchyard/init.py
- crates/switchyard-py/src/lib.rs
- crates/switchyard-py/src/profile_bindings/mod.rs
- crates/switchyard-components-v2/src/profiles/latency_service/selection.rs
- crates/switchyard-components-v2/src/config/resolving.rs
- switchyard_rust/core.py
|
@nachiketb-nvidia can you check code rabbit comments? |
Signed-off-by: nachiketb <nachiketb@nvidia.com>
2e160d9 to
1a3f472
Compare
Signed-off-by: nachiketb <nachiketb@nvidia.com>
|
addressed! Added bundle-level schema validation. |
What
This PR nukes the abandoned components-v2 stack and the mixed Rust/Python serving path built around it.
switchyard-components-v2andswitchyard-components-v2-macrosswitchyard serve --configProfileInputandProfileRequestMetadatasmall Python-owned valuesswitchyard-serverTOML configuration path workingThis includes the components-v2 sub-agent override that landed on
mainduring the rebase. Its protocol metadata, libsySubagentOverride, libsy PyO3 binding, and libsy tests remain intact.The result is 14.5k deleted lines and no remaining dependency from the Python extension or Rust workspace on components-v2.
Why
The repository had two unrelated configuration and execution paths:
Components-v2 was no longer the direction of the server architecture, but Python still linked it through PyO3 solely to load profile configs and expose request wrapper types. That kept a large, duplicated implementation alive without providing a migration path toward libsy.
Removing it now makes the ownership boundary explicit: the current Python runtime remains Python-owned, while new Rust orchestration belongs in libsy and
switchyard-server.How
switchyard_rustserve --configCLI branchserve --configis no longer documentedWhat remains in Python
This PR intentionally preserves the currently supported Python behavior:
ProfileInputandProfileRequestMetadataProfile,ProfileConfig, and profile runner protocols--routing-profilesparsing and route-table constructionThese remain because the public Python CLI and launchers still depend on them today. Removing components-v2 does not silently remove those user-facing workflows.
Next steps
Follow-up work can now remove the remaining Python orchestration incrementally, without another compatibility bridge:
What to review
Please focus on these boundaries:
ProfileInputandProfileRequestMetadatapreserve the behavior callers rely onserve --configis intentionally removed, while global--routing-profilesremains supportedswitchyard-serverretains its separate TOML workflowValidation
uv run ruff check .uv run mypy switchyardcargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceuv run --only-group docs mkdocs build --strict[cli,server]package smoke testsCloses SWITCH-1042