Skip to content

Dex Web: read uploaded Flow definitions per Flow type, isolate bad ones, load lazily - #1604

Merged
longquanzheng merged 18 commits into
mainfrom
feat/dex-web-uploaded-definitions
Nov 11, 2026
Merged

longquanzheng merged 18 commits into
mainfrom
feat/dex-web-uploaded-definitions

Conversation

@longquanzheng

Copy link
Copy Markdown
Contributor

Summary

  • Sources: Dex Web merges the directory (--flow-rendering-dir, Target.FlowRenderingDirectory) with definitions uploaded to the Dex Server (ListFlowDefinitions / GetFlowDefinitions from server-zd: store uploaded Flow Definition Graphs per Flow type #1595, through the target's FlowServiceClient). A Flow type declared by any directory file is owned by the directory. UNIMPLEMENTED means no uploaded definitions. The embedded module needs no new Target field.
  • Lazy loading: run details load only the run's Flow type (GET /api/flow-definitions/{flowType}, ETag and 304); GET /api/flow-definition-types lists names; GET /api/flow-definitions returns metadata only. Server-side v2 routes resolve only the requested Flow type, with per-Flow-type revisions.
  • Robustness: each definition is validated on its own, so a bad, oversized, or conflicting one marks only itself invalid; limits on document size, nodes, edges, string length, nesting depth, and Connector Steps per definition (shared by server and browser); error boundary and a "too large to draw" state on the design canvas; iterative main-line traversal; Connector release lookups limited to 4 concurrent downloads with a 5-minute 404 cache.
  • Forward compatibility: unknown top-level Flow Definition Graph fields are ignored; known fields stay strictly validated.
  • UI: Designs shows each definition's source, generation and upload times, and why an invalid one is invalid; the empty state explains uploading at Worker start.
  • Docs: web reference (definition sources, lazy loading, limits, embedding) and change log 1.45.

Why

Flow Definition Graphs could only come from a directory next to Dex Web. With uploads stored on the Dex Server (#1595) and SDK Workers uploading at startup (#1599, #1602, #1603), Dex Web reads them from the server. Loading every definition on every page does not scale once Workers can upload many Flow types (agent CLIs use one Flow type per execution environment), and an audit found that one bad definition could take down the whole catalog and that very large graphs could freeze the page. Depends on #1595 (its commits appear here until it merges).

Compatibility

Dex Web browser API changes: GET /api/flow-definitions no longer includes graphs; v2 routes validate per-Flow-type revisions (X-Dex-Flow-Definition-Revision) instead of the catalog-wide revision; /readyz lists Flow type names and no longer fails on one invalid definition (it still fails when the directory is unreadable; its response fields are unchanged). A bad directory file now marks only itself invalid instead of failing the catalog.

Testing

  • go test ./... in web (server source: UNIMPLEMENTED, pagination, directory precedence, isolation, limits, batch splitting on RESOURCE_EXHAUSTED, server failure with the directory still served; per-type routes with 304, 404, and encoded names; v2 routes scoped to one Flow type with stale-revision 409; Connector 404 cache and concurrency; every Flow Definition Graph in the repository within the limits; embedded Target without a directory).
  • npm run check in web (795 tests, including lazy loading, cache, Designs page, error boundary and limits, main line).
  • server-zd e2e (web/scripts/run-server-zd-e2e.sh): new TestDexWebOnServerZDShowsUploadedDefinitions uploads via UploadFlowDefinitions and checks display and Actions without a directory, and directory precedence.
  • cd docs && npm run check, make copyright-check.

Add UploadFlowDefinitions, ListFlowDefinitions, and GetFlowDefinitions to
FlowService. server-zd keeps one FlowDefinitionRecord object per Flow type
under registry/flow-definitions/<tenant_id>/types/, created with
If-None-Match and replaced with If-Match by the replace rule.
Document the three FlowService RPCs, the replace rule and force, the
flowDefinitions.maxDefinitionBytes key, the object layout under
registry/flow-definitions/, and the 0.1.26 change log entries. Add the
key to the example configuration and the dexzd-api README. Cover Flow
types that contain percent signs, dots, and slashes in the tests.
@longquanzheng longquanzheng added the type:feature New capability or API label Nov 11, 2026
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Take main's server-zd, protos, and generated code from the merged Flow definition storage change.
@longquanzheng
longquanzheng merged commit aa76263 into main Nov 11, 2026
40 checks passed
@longquanzheng
longquanzheng deleted the feat/dex-web-uploaded-definitions branch November 11, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New capability or API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant