Skip to content

fix: accept legacy source/target edge keys in GraphEdge for backwards compat (#895)#900

Open
livepeer-tessa wants to merge 1 commit intomainfrom
fix/895-graph-edge-legacy-schema-compat
Open

fix: accept legacy source/target edge keys in GraphEdge for backwards compat (#895)#900
livepeer-tessa wants to merge 1 commit intomainfrom
fix/895-graph-edge-legacy-schema-compat

Conversation

@livepeer-tessa
Copy link
Copy Markdown
Contributor

Problem

Older Scope desktop clients send GraphEdge payloads with source/target keys instead of the current from/from_port/to_node/to_port schema. This triggered a pydantic ValidationError (8 missing fields) in frame_processor, causing sessions to start but process 0 frames — a silent failure from the user's perspective.

Observed 4 times in a 12 h window (2026-04-09 23:09–23:45 UTC), fal_job_id d35991f0-7869-44ca-88b4-1459ad9c7774.

Fix

Added a model_validator(mode='before') to GraphEdge in graph_schema.py that:

  • Detects source/target legacy keys
  • Maps them to from/to_node (only when the canonical fields are absent)
  • Defaults from_port and to_port to "video" when port info is missing
  • Emits a WARNING log to help identify outdated clients in production

Mixed payloads (partial legacy + current keys) are also handled.

Tests

Added tests/test_graph_schema.py with 10 test cases:

  • Legacy source/target minimal (no ports) — defaults to video
  • Legacy with explicit ports
  • Mixed legacy + current keys (partial compat)
  • Deprecation warning emission via caplog
  • Full GraphConfig with legacy edges
  • validate_structure() passes after coercion
  • Current schema — no warning, no regression

All 10 pass; no regressions in broader suite.

Related

Fixes #895

…ds-compat (#895)

Old Scope clients send edge definitions using the deprecated
'source'/'target' key names instead of the current 'from'/'from_port'/
'to_node'/'to_port' fields.  This caused a pydantic ValidationError in
scope.server.frame_processor, resulting in sessions starting but
processing 0 frames (silent failure for users). Error was observed 4x in
a 12 h window.

Changes:
- Add a model_validator(mode='before') on GraphEdge that detects legacy
  'source'/'target' keys and transparently maps them to the current schema.
- When port fields are absent, default from_port to 'video' and to_port to
  'video' (matching the existing convention for simple linear graphs).
- Log a WARNING with the raw edge data whenever legacy keys are coerced so
  operators can identify outdated clients in logs.
- Add tests/test_graph_schema.py covering legacy-only, mixed, and
  current-only edge formats plus the deprecation warning emission.

Fixes #895

Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

Important

Review skipped

Auto 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4307fa34-cfec-4a67-b535-1492bb6e8afc

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/895-graph-edge-legacy-schema-compat

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
Copy link
Copy Markdown
Contributor

🚀 fal.ai Preview Deployment

App ID daydream/scope-pr-900--preview
WebSocket wss://fal.run/daydream/scope-pr-900--preview/ws
Commit 1e1fce8

Livepeer Runner

App ID daydream/scope-livepeer-pr-900--preview
WebSocket wss://fal.run/daydream/scope-livepeer-pr-900--preview/ws
Auth private

Testing Livepeer Mode

SCOPE_CLOUD_MODE=livepeer SCOPE_CLOUD_APP_ID="daydream/scope-livepeer-pr-900--preview/ws" uv run daydream-scope

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.

[fal.ai] frame_processor: Pipeline setup fails with GraphConfig validation error — edges use 'source'/'target' but schema expects 'from'/'to_node'

1 participant