Skip to content

refactor(intake): remove legacy sink pipeline - #238

Open
nachiketb-nvidia wants to merge 1 commit into
mainfrom
agent/remove-legacy-intake-sinks
Open

refactor(intake): remove legacy sink pipeline#238
nachiketb-nvidia wants to merge 1 commit into
mainfrom
agent/remove-legacy-intake-sinks

Conversation

@nachiketb-nvidia

@nachiketb-nvidia nachiketb-nvidia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

What

  • Remove the legacy Rust and Python Intake sink implementations, processor wiring, PyO3 bindings, CLI flags, tests, and public exports.
  • Remove the intake Python extra and nemo-platform dependency.
  • Retain x-switchyard-intake-task for routing-log and session-stats compatibility.

Why

The Rust server now exports Intake-consumable telemetry through OTLP. Maintaining a separate direct sink duplicates transport, payload, queueing, and retry logic.

How

  • Keep request session/task metadata in the Python compatibility logger without native sink state.
  • Leave switchyard-server, libsy, OTEL, /metrics, /v1/stats, routing logs, and session stats unchanged.
  • Regenerate Python lockfiles after removing the optional dependency.

What to review

  • The reduced request metadata boundary and retained task-header behavior.
  • Removal of Python CLI and public Intake surfaces.
  • Lockfile dependency reduction.

Validation

  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
  • uv run ruff check .
  • uv run mypy switchyard
  • uv run pytest tests/ -q (1329 passed, 31 skipped)

Summary by CodeRabbit

  • Removed Features

    • Removed intake capture, payload generation, delivery, and related request/response processors.
    • Removed intake configuration, CLI options, environment-variable support, and Python/Rust exports.
    • Removed submodel-call recording APIs and associated integrations.
  • Changes

    • Request metadata now provides session and task information directly through the Python package.
    • Serving and routing continue using the remaining processors and metadata capabilities.
  • Installation

    • Updated full installation extras to exclude the retired intake dependency.

Signed-off-by: nachiketb <nachiketb@nvidia.com>
@nachiketb-nvidia
nachiketb-nvidia marked this pull request as ready for review July 31, 2026 22:40
@nachiketb-nvidia
nachiketb-nvidia requested a review from a team as a code owner July 31, 2026 22:40
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The change removes the obsolete Intake implementation across Rust and Python components. It removes runtime wiring, public exports, dependencies, documentation, metadata APIs, and Intake-specific tests.

Changes

Intake Removal

Layer / File(s) Summary
Remove Rust component surface
crates/switchyard-components/..., switchyard_rust/...
Removes Intake modules, processors, configuration types, metadata types, exports, and type-stub declarations.
Remove Python bindings
crates/switchyard-py/...
Removes Intake configuration and processor bindings. PyProxyContext no longer applies native request metadata or records submodel calls.
Update runtime wiring and metadata
switchyard/cli/..., switchyard/lib/..., switchyard/__init__.py
Removes Intake serving options and processor wiring. Adds a local RequestMetadata dataclass that extracts session and task headers.
Align packaging, documentation, and tests
pyproject.toml, INSTALLATION.md, AGENTS.md, tests/...
Removes the Intake optional dependency and updates documentation and tests for the reduced API surface.

Estimated code review effort: 4 (Complex) | ~45 minutes

Poem

A rabbit hops through modules bright,
And clears old Intake paths from sight.
Rust exports fade, bindings rest,
New metadata passes the test.
“Less to carry!” the rabbit sings,
While tidy routes grow lighter wings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the removal of the legacy Intake sink pipeline, which is the primary change in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
switchyard/lib/request_metadata.py (1)

132-143: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Preserve a compatibility path for removed request-metadata exports.

INTAKE_APP_HEADER, INTAKE_ENABLED_HEADER, and IntakeRequestMetadata were public exports and now fail downstream imports. Retain deprecated aliases for one release, or document an approved breaking migration before removal.

🤖 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 `@switchyard/lib/request_metadata.py` around lines 132 - 143, Update the public
exports around __all__ and the request-metadata definitions to retain deprecated
compatibility aliases for INTAKE_APP_HEADER, INTAKE_ENABLED_HEADER, and
IntakeRequestMetadata for one release. Ensure downstream imports continue
resolving while directing users toward the current replacements, or document and
implement the approved breaking migration instead.

Source: Learnings

🧹 Nitpick comments (1)
crates/switchyard-py/src/interop/context.rs (1)

147-168: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Clarify the _NativeProxyContext constructor documentation.

ProxyContext still stores metadata in Python-owned ProxyMetadata; the native constructor only accepts it for compatibility. No tracked references to the removed submodel-call APIs remain. Update the Rust doc comment to describe this behavior.

🤖 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 `@crates/switchyard-py/src/interop/context.rs` around lines 147 - 168, The doc
comment above PyProxyContext::new should state that metadata is accepted for
Python compatibility but remains stored in Python-owned ProxyMetadata rather
than native state, while request_id is validated and stored by the native
ProxyContext. Update only this constructor documentation and preserve the
current implementation.
🤖 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 `@switchyard/lib/request_metadata.py`:
- Around line 42-56: Export the public RequestMetadata class from
switchyard/__init__.py by importing it and adding it to the package’s __all__
collection, while preserving its existing availability from
switchyard.lib.request_metadata.

---

Outside diff comments:
In `@switchyard/lib/request_metadata.py`:
- Around line 132-143: Update the public exports around __all__ and the
request-metadata definitions to retain deprecated compatibility aliases for
INTAKE_APP_HEADER, INTAKE_ENABLED_HEADER, and IntakeRequestMetadata for one
release. Ensure downstream imports continue resolving while directing users
toward the current replacements, or document and implement the approved breaking
migration instead.

---

Nitpick comments:
In `@crates/switchyard-py/src/interop/context.rs`:
- Around line 147-168: The doc comment above PyProxyContext::new should state
that metadata is accepted for Python compatibility but remains stored in
Python-owned ProxyMetadata rather than native state, while request_id is
validated and stored by the native ProxyContext. Update only this constructor
documentation and preserve the current implementation.
🪄 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: 25f01a35-5ae2-46b9-876b-9b5a69d86ab8

📥 Commits

Reviewing files that changed from the base of the PR and between 7e4929c and 18f7dcf.

⛔ Files ignored due to path filters (2)
  • examples/experimental/litellm/uv.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock, !uv.lock
📒 Files selected for processing (59)
  • AGENTS.md
  • INSTALLATION.md
  • crates/switchyard-components/src/intake.rs
  • crates/switchyard-components/src/intake/client.rs
  • crates/switchyard-components/src/intake/config.rs
  • crates/switchyard-components/src/intake/context.rs
  • crates/switchyard-components/src/intake/payload.rs
  • crates/switchyard-components/src/lib.rs
  • crates/switchyard-components/src/request_processors/intake.rs
  • crates/switchyard-components/src/request_processors/mod.rs
  • crates/switchyard-components/src/response_processors/intake.rs
  • crates/switchyard-components/src/response_processors/mod.rs
  • crates/switchyard-components/src/telemetry.rs
  • crates/switchyard-components/tests/flat_target_live.rs
  • crates/switchyard-components/tests/intake_http_sink.rs
  • crates/switchyard-components/tests/intake_payload.rs
  • crates/switchyard-components/tests/intake_request_processor.rs
  • crates/switchyard-components/tests/intake_response_processor.rs
  • crates/switchyard-components/tests/support/intake.rs
  • crates/switchyard-components/tests/support/mod.rs
  • crates/switchyard-py/src/component_bindings.rs
  • crates/switchyard-py/src/component_bindings/config.rs
  • crates/switchyard-py/src/component_bindings/intake.rs
  • crates/switchyard-py/src/component_bindings/request_processors.rs
  • crates/switchyard-py/src/component_bindings/response_processors.rs
  • crates/switchyard-py/src/interop/context.rs
  • pyproject.toml
  • switchyard/__init__.py
  • switchyard/cli/intake_cli_config.py
  • switchyard/cli/route_bundle.py
  • switchyard/cli/switchyard_cli.py
  • switchyard/lib/config/__init__.py
  • switchyard/lib/config/intake_sink_config.py
  • switchyard/lib/processors/__init__.py
  • switchyard/lib/processors/intake_client.py
  • switchyard/lib/processors/intake_payload_builder.py
  • switchyard/lib/processors/intake_request_processor.py
  • switchyard/lib/processors/intake_response_processor.py
  • switchyard/lib/processors/llm_classifier/request_processor.py
  • switchyard/lib/processors/routing_log_response_processor.py
  • switchyard/lib/processors/stage_router/classifier.py
  • switchyard/lib/profiles/chain.py
  • switchyard/lib/request_metadata.py
  • switchyard_rust/__init__.py
  • switchyard_rust/components.py
  • switchyard_rust/components.pyi
  • switchyard_rust/core.py
  • tests/test_init_all_exports.py
  • tests/test_intake_cli_flags.py
  • tests/test_intake_sink.py
  • tests/test_intake_target.py
  • tests/test_llm_classifier_request_processor.py
  • tests/test_request_metadata.py
  • tests/test_rl_logging.py
  • tests/test_route_bundle.py
  • tests/test_routing_log_response_processor.py
  • tests/test_stage_router_classifier.py
  • tests/test_switchyard_rust_component_bindings.py
  • tests/test_version_package_name.py
💤 Files with no reviewable changes (44)
  • switchyard/lib/config/init.py
  • switchyard/lib/processors/intake_request_processor.py
  • switchyard/lib/processors/intake_response_processor.py
  • crates/switchyard-components/src/response_processors/intake.rs
  • crates/switchyard-components/tests/intake_response_processor.rs
  • switchyard/lib/processors/llm_classifier/request_processor.py
  • crates/switchyard-components/tests/intake_payload.rs
  • tests/test_route_bundle.py
  • crates/switchyard-components/src/intake/client.rs
  • crates/switchyard-components/src/intake.rs
  • crates/switchyard-components/tests/support/intake.rs
  • crates/switchyard-components/src/intake/context.rs
  • switchyard_rust/core.py
  • crates/switchyard-components/tests/intake_request_processor.rs
  • tests/test_version_package_name.py
  • crates/switchyard-components/src/telemetry.rs
  • crates/switchyard-components/src/request_processors/intake.rs
  • tests/test_llm_classifier_request_processor.py
  • tests/test_init_all_exports.py
  • switchyard_rust/components.pyi
  • switchyard/lib/processors/stage_router/classifier.py
  • crates/switchyard-components/tests/support/mod.rs
  • switchyard/cli/intake_cli_config.py
  • tests/test_intake_cli_flags.py
  • switchyard/lib/processors/intake_payload_builder.py
  • crates/switchyard-py/src/component_bindings/intake.rs
  • tests/test_stage_router_classifier.py
  • tests/test_rl_logging.py
  • crates/switchyard-components/tests/flat_target_live.rs
  • crates/switchyard-components/src/intake/config.rs
  • tests/test_switchyard_rust_component_bindings.py
  • crates/switchyard-components/src/response_processors/mod.rs
  • tests/test_intake_target.py
  • crates/switchyard-components/src/request_processors/mod.rs
  • crates/switchyard-components/tests/intake_http_sink.rs
  • switchyard_rust/components.py
  • tests/test_intake_sink.py
  • crates/switchyard-components/src/intake/payload.rs
  • switchyard/init.py
  • crates/switchyard-py/src/component_bindings.rs
  • switchyard/lib/config/intake_sink_config.py
  • switchyard/lib/processors/intake_client.py
  • switchyard/lib/processors/init.py
  • switchyard_rust/init.py

Comment on lines +42 to +56
@dataclass(frozen=True, slots=True)
class RequestMetadata:
"""Session and task identifiers retained for compatibility routing logs."""

session_id: str | None = None
task: str | None = None

@classmethod
def from_headers(cls, headers: Mapping[str, str]) -> "RequestMetadata":
"""Extract request metadata from a case-insensitive header mapping."""
normalized = {name.lower(): value for name, value in headers.items()}
return cls(
session_id=_nonempty_header(normalized, PROXY_SESSION_ID_HEADER),
task=_nonempty_header(normalized, INTAKE_TASK_HEADER),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

ast-grep outline switchyard/__init__.py --items all
rg -n -C 2 --type py '\bRequestMetadata\b|__all__' \
  switchyard/__init__.py switchyard/lib/request_metadata.py

Repository: NVIDIA-NeMo/Switchyard

Length of output: 2886


Export RequestMetadata from switchyard/__init__.py and its __all__. The class is public in switchyard.lib.request_metadata, but it is not available from the package root as required.

🤖 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 `@switchyard/lib/request_metadata.py` around lines 42 - 56, Export the public
RequestMetadata class from switchyard/__init__.py by importing it and adding it
to the package’s __all__ collection, while preserving its existing availability
from switchyard.lib.request_metadata.

Source: Coding guidelines

@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://NVIDIA-NeMo.github.io/Switchyard/pr-preview/pr-238/

Built to branch gh-pages at 2026-07-31 22:48 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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.

1 participant