Skip to content

feat: revise deployment schemas#12150

Merged
HzaRashid merged 5 commits into
mainfrom
deployment-schemas-revision
Mar 11, 2026
Merged

feat: revise deployment schemas#12150
HzaRashid merged 5 commits into
mainfrom
deployment-schemas-revision

Conversation

@HzaRashid
Copy link
Copy Markdown
Collaborator

@HzaRashid HzaRashid commented Mar 11, 2026

adjusts the deployment schemas in the api and deployment adapter to allow raw payload passthrough of Deployment Configurations and Flow Artifacts in the e2e patch operation path. Introduces a breaking rename of the fields in the SnapshotDeploymentBindingUpdate schema.

Summary by CodeRabbit

  • New Features

    • Deployment updates now support provider-specific configuration data
    • Configuration and snapshot bindings can be created via raw payloads in addition to references
    • Enhanced deployment management with more flexible binding options
  • Improvements

    • UUID-based identification for improved reliability and consistency
    • Automatic deduplication of identifiers while preserving order
    • Enhanced validation for deployment configuration and binding operations

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 11, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 21313d92-feb9-457f-b9dc-5e0a22580357

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This pull request introduces deployment type routing hints, restructures deployment binding schemas to support raw payload creation workflows, enhances UUID handling in flow version attachments, and adds provider-specific update data support across deployment service interfaces and schemas.

Changes

Cohort / File(s) Summary
Secrets baseline update
.secrets.baseline
Updated secret keyword line numbers from 45→47 and 67→69 for deployment schema test file; refreshed generated_at timestamp.
Deployment schema restructuring
src/backend/base/langflow/api/v1/schemas/deployments.py
Migrated FlowVersionsAttach/FlowVersionsPatch from string-based to UUID-based ID handling with deduplication. Added provider_data field to DeploymentUpdateRequest. Introduced raw_payload alternative to config_id in DeploymentConfigBindingUpdate with strict one-of validation. Updated error messages for UUID context.
Deployment schema tests
src/backend/tests/unit/api/v1/test_deployment_schemas.py
Updated tests for UUID deduplication semantics in flow version attachments. Added validation tests for DeploymentConfigBindingUpdate covering config_id-only, raw_payload-only, explicit unbind, and mutual exclusivity checks. Added provider_data acceptance test for DeploymentUpdateRequest. Exported DeploymentConfigBindingUpdate as public entity.
Service base interface
src/lfx/src/lfx/services/adapters/deployment/base.py
Added optional deployment_type parameter to 8 abstract methods (get, update, redeploy, duplicate, delete, get_status, create_execution, get_execution) to propagate deployment type context through provider implementations. Updated TYPE_CHECKING imports to include DeploymentType.
Service schema definitions
src/lfx/src/lfx/services/adapters/deployment/schema.py
Restructured SnapshotDeploymentBindingUpdate with renamed fields: add→add_ids, remove→add_raw_payloads, new remove_ids; updated validation to check overlaps and require at least one operation. Enhanced ConfigDeploymentBindingUpdate with raw_payload field and exact-one-of validation. Extended DeploymentUpdate with provider_data field and updated change validation. Added snapshot_ids field to DeploymentUpdateResult.
Service implementations
src/lfx/src/lfx/services/adapters/deployment/service.py, src/lfx/src/lfx/services/interfaces.py
Added deployment_type parameter to 8 public methods across DeploymentService and DeploymentServiceProtocol for consistent deployment routing hints. Updated TYPE_CHECKING imports and protocol docstring to document deployment_type as optional routing hint.
Service schema tests
src/lfx/tests/unit/services/deployment/test_deployment_schema.py
Updated tests to reflect schema field renames (add→add_ids, remove→remove_ids) and new add_raw_payloads support for SnapshotDeploymentBindingUpdate. Added tests for raw_payload workflows in ConfigDeploymentBindingUpdate and provider_data in DeploymentUpdate. Updated validation expectations including deduplication, overlap checks, and snapshot_ids preservation in results.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • feat: schemas for pluggable deployment service #11979 — Modifies the same deployment schema and service interfaces, including ConfigDeploymentBindingUpdate/DeploymentUpdate provider_data/raw_payload changes, SnapshotDeploymentBindingUpdate field restructuring, and deployment_type parameter additions across service signatures.

Suggested labels

enhancement, lgtm

Suggested reviewers

  • jordanrfrazier
🚥 Pre-merge checks | ✅ 4 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.84% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Quality And Coverage ⚠️ Warning Test suite lacks adequate coverage for new validation logic: dedup tests use single UUIDs (don't verify order preservation), raw_payload tests only check non-null (not equality), and critical null-field rejection tests are missing for validators enforcing stricter rules. Add tests with multiple distinct UUIDs for order preservation, assert exact raw_payload equality with nested structures, and add explicit tests rejecting all-null update bodies in both DeploymentUpdateRequest and service layer validators.
Test File Naming And Structure ⚠️ Warning Backend test file has critical quality gaps: dedup tests use only single duplicated UUIDs and lack order-preservation verification, raw_payload tests only assert non-null rather than exact equality, and coverage (160 lines) lags LFX tests (505 lines). Update dedup tests with multiple interleaved UUIDs, revise raw_payload tests to use complex structures with exact equality assertions, and expand coverage to match LFX test comprehensiveness including edge cases.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Test Coverage For New Implementations ✅ Passed PR includes comprehensive test coverage for new functionality across backend and service layer test files with 665+ total lines of tests covering deduplication, mutual exclusivity, raw payload support, and provider_data.
Excessive Mock Usage Warning ✅ Passed All three test files contain zero mock imports and zero mock usage, which is appropriate for Pydantic schema validation unit tests.
Title check ✅ Passed The title 'refactor: revise deployment schemas' directly describes the main change—schema revisions across deployment-related modules. It accurately captures the core focus of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch deployment-schemas-revision

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.

❤️ Share

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

@github-actions github-actions Bot added refactor Maintenance tasks and housekeeping and removed refactor Maintenance tasks and housekeeping labels Mar 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 11, 2026

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 24%
24.14% (8609/35660) 16.89% (4743/28067) 16.87% (1261/7473)

Unit Test Results

Tests Skipped Failures Errors Time
2776 0 💤 0 ❌ 0 🔥 45.328s ⏱️

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 91.22807% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.23%. Comparing base (911bc9d) to head (efc8e87).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ackend/base/langflow/api/v1/schemas/deployments.py 83.87% 5 Missing ⚠️

❌ Your project status has failed because the head coverage (44.25%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #12150   +/-   ##
=======================================
  Coverage   38.22%   38.23%           
=======================================
  Files        1630     1630           
  Lines       80158    80188   +30     
  Branches    12112    12114    +2     
=======================================
+ Hits        30638    30656   +18     
- Misses      47784    47795   +11     
- Partials     1736     1737    +1     
Flag Coverage Δ
backend 56.75% <83.87%> (-0.03%) ⬇️
frontend 21.56% <ø> (ø)
lfx 44.25% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...c/lfx/src/lfx/services/adapters/deployment/base.py 100.00% <ø> (ø)
...lfx/src/lfx/services/adapters/deployment/schema.py 94.51% <100.00%> (+0.39%) ⬆️
...fx/src/lfx/services/adapters/deployment/service.py 100.00% <ø> (ø)
src/lfx/src/lfx/services/interfaces.py 100.00% <ø> (ø)
...ackend/base/langflow/api/v1/schemas/deployments.py 86.13% <83.87%> (-1.10%) ⬇️

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added refactor Maintenance tasks and housekeeping and removed refactor Maintenance tasks and housekeeping labels Mar 11, 2026
- Add exactly-one validation to ConfigDeploymentBindingUpdate (both layers)
  using model_fields_set XOR for config_id vs raw_payload
- Add raw_payload field to service-layer ConfigDeploymentBindingUpdate for
  symmetry with the snapshot passthrough pattern
- Add deployment_type routing hint to execution methods (protocol, ABC, service)
- Unify duplicate handling: silent dedup everywhere (dict.fromkeys)
- Fix broken API tests after FlowVersionsAttach/Patch str→UUID migration
- Restore deleted test coverage (blank ids, order-preserving dedup) and add
  new tests for raw_payload, mutual exclusion, snapshot_ids, and noop rejection
- Add clarifying comments: overlap check ID domains, post-validation types,
  deployment_type scope in protocol docstring
@HzaRashid HzaRashid force-pushed the deployment-schemas-revision branch from a6020a1 to 99ac50c Compare March 11, 2026 18:03
@github-actions github-actions Bot added refactor Maintenance tasks and housekeeping and removed refactor Maintenance tasks and housekeeping labels Mar 11, 2026
@github-actions github-actions Bot added refactor Maintenance tasks and housekeeping and removed refactor Maintenance tasks and housekeeping labels Mar 11, 2026
@HzaRashid
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 11, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@HzaRashid HzaRashid marked this pull request as ready for review March 11, 2026 18:30
@github-actions github-actions Bot added refactor Maintenance tasks and housekeeping and removed refactor Maintenance tasks and housekeeping labels Mar 11, 2026
@HzaRashid HzaRashid changed the title refactor: revise deployment schemas feat: revise deployment schemas Mar 11, 2026
@HzaRashid
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@github-actions github-actions Bot added enhancement New feature or request and removed refactor Maintenance tasks and housekeeping labels Mar 11, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 11, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

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

⚠️ Outside diff range comments (1)
src/lfx/src/lfx/services/adapters/deployment/schema.py (1)

96-145: ⚠️ Potential issue | 🟠 Major

Add model_config = ConfigDict(extra="forbid") to prevent silent field drops.

This class currently accepts Pydantic's default extra='ignore' behavior, which silently drops unknown fields. With the field rename from older names to add_ids/remove_ids, mixed payloads with typos or stale field names will partially apply without error—e.g., {"add_ids": ["snap_1"], "remove": ["snap_2"]} validates and only performs the attach, silently ignoring the malformed remove field.

Adding the config option (as is already done for SnapshotItems in this file) will fail fast on extra fields:

🛠️ Proposed fix
 class SnapshotDeploymentBindingUpdate(BaseModel):
     """Snapshot deployment binding patch payload.

     Supports three operations: bind existing snapshots by ID, create new
     snapshots from raw payloads, or unbind snapshots by ID.  At least one
     of the three fields must be provided.
     """
+    model_config = ConfigDict(extra="forbid")

     add_ids: list[IdLike] | None = Field(
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lfx/src/lfx/services/adapters/deployment/schema.py` around lines 96 -
145, The model currently allows unknown fields to be silently ignored; add a
Pydantic config to forbid extras by defining model_config =
ConfigDict(extra="forbid") on this model class (the one that declares add_ids,
add_raw_payloads, remove_ids and contains the `@field_validator` validate_id_lists
and `@model_validator` validate_operations methods) so that malformed or stale
fields (e.g., "remove") raise validation errors instead of being dropped; mirror
the pattern used on SnapshotItems in this file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/backend/base/langflow/api/v1/schemas/deployments.py`:
- Around line 478-483: The current ensure_any_field_provided model_validator
only checks model_fields_set, so payloads like {"spec": null} still pass; update
it to ensure at least one of the tracked fields ('spec', 'flow_version_ids',
'config', 'provider_data') is both present and not None/empty. In
ensure_any_field_provided, iterate the specific attributes (self.spec,
self.flow_version_ids, self.config, self.provider_data) or check their presence
in self.model_fields_set and that their value is not None (and not empty where
applicable), and raise the same ValueError if none of these contain a meaningful
value; return self otherwise.

In `@src/backend/tests/unit/api/v1/test_deployment_schemas.py`:
- Around line 103-111: The tests test_flow_versions_patch_deduplicates_add and
test_flow_versions_patch_deduplicates_remove currently only use a single UUID so
they don't detect reordering (a set-based dedup would pass). Update both tests
to use two distinct UUIDs with interleaved duplicates (e.g. u1, u2, u1) when
constructing FlowVersionsPatch so we assert that duplicates are removed but
original order of first occurrences is preserved (expect result.add == [u1, u2]
and result.remove == [u1, u2] respectively). Ensure you reference
FlowVersionsPatch in the updated assertions.
- Around line 130-133: The test test_accepts_raw_payload_only currently only
checks non-nullity; change it to assert exact passthrough by constructing a
representative nested dict (e.g., nested lists/dicts, extra keys) and creating
DeploymentConfigBindingUpdate(raw_payload=that_dict), then assert
update.raw_payload == that_dict and update.config_id is None so the schema truly
preserves the payload unchanged; update the test name or docstring if needed to
reflect exact equality check.

In `@src/lfx/src/lfx/services/adapters/deployment/schema.py`:
- Around line 410-414: The validator validate_has_changes currently relies on
model_fields_set and can allow fields explicitly set to None (e.g., {"spec":
null}) to pass; update it to perform explicit None checks against the instance
attributes (e.g., self.spec, self.snapshot, self.config, self.provider_data)
using "is not None" so only genuinely provided non-null values count as changes;
if all four fields are None (or absent) raise the same ValueError. Follow the
same explicit None-check pattern used in BaseDeploymentDataUpdate,
SnapshotDeploymentBindingUpdate, and ConfigDeploymentBindingUpdate when
implementing this logic in validate_has_changes.

---

Outside diff comments:
In `@src/lfx/src/lfx/services/adapters/deployment/schema.py`:
- Around line 96-145: The model currently allows unknown fields to be silently
ignored; add a Pydantic config to forbid extras by defining model_config =
ConfigDict(extra="forbid") on this model class (the one that declares add_ids,
add_raw_payloads, remove_ids and contains the `@field_validator` validate_id_lists
and `@model_validator` validate_operations methods) so that malformed or stale
fields (e.g., "remove") raise validation errors instead of being dropped; mirror
the pattern used on SnapshotItems in this 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2b556f1f-30fb-4585-b0df-3904663687a0

📥 Commits

Reviewing files that changed from the base of the PR and between 911bc9d and fa8a777.

📒 Files selected for processing (8)
  • .secrets.baseline
  • src/backend/base/langflow/api/v1/schemas/deployments.py
  • src/backend/tests/unit/api/v1/test_deployment_schemas.py
  • src/lfx/src/lfx/services/adapters/deployment/base.py
  • src/lfx/src/lfx/services/adapters/deployment/schema.py
  • src/lfx/src/lfx/services/adapters/deployment/service.py
  • src/lfx/src/lfx/services/interfaces.py
  • src/lfx/tests/unit/services/deployment/test_deployment_schema.py

Comment thread src/backend/base/langflow/api/v1/schemas/deployments.py
Comment thread src/backend/tests/unit/api/v1/test_deployment_schemas.py Outdated
Comment thread src/backend/tests/unit/api/v1/test_deployment_schemas.py
Comment thread src/lfx/src/lfx/services/adapters/deployment/schema.py
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Mar 11, 2026
Comment thread src/backend/base/langflow/api/v1/schemas/deployments.py
Copy link
Copy Markdown
Collaborator

@HimavarshaVS HimavarshaVS left a comment

Choose a reason for hiding this comment

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

minor comment , but not a blocker

@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Mar 11, 2026
Comment thread src/backend/base/langflow/api/v1/schemas/deployments.py Outdated
Comment thread src/backend/base/langflow/api/v1/schemas/deployments.py
Comment thread src/lfx/src/lfx/services/adapters/deployment/schema.py
Comment thread src/lfx/src/lfx/services/adapters/deployment/schema.py
Comment thread src/lfx/src/lfx/services/adapters/deployment/schema.py Outdated
@github-actions github-actions Bot added enhancement New feature or request and removed enhancement New feature or request labels Mar 11, 2026
@HzaRashid HzaRashid enabled auto-merge March 11, 2026 20:23
@HzaRashid HzaRashid added this pull request to the merge queue Mar 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Mar 11, 2026
@HzaRashid HzaRashid added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit 9012a54 Mar 11, 2026
99 of 100 checks passed
@HzaRashid HzaRashid deleted the deployment-schemas-revision branch March 11, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants