Skip to content

Go SDK and dexcli: upload Flow Definition Graphs to the Dex Server - #1599

Merged
longquanzheng merged 12 commits into
mainfrom
feat/flow-definition-upload-go
Nov 11, 2026
Merged

longquanzheng merged 12 commits into
mainfrom
feat/flow-definition-upload-go

Conversation

@longquanzheng

Copy link
Copy Markdown
Contributor

Summary

  • Go SDK: WorkerOptions.FlowDefinitionPaths (files or directories) and WorkerOptions.FlowDefinitions ([]FlowDefinitionDocument). NewWorker reads and merges them (invalid files and duplicate Flow types are configuration errors); Start uploads only the registered Flow types after SyncAttributeIndexes and before opening task streams. Upload failures, including UNIMPLEMENTED from older servers (logged once), are warnings and never stop the Worker.
  • source.path is rewritten only when absolute (relative to the working directory, else the file name), byte-preserving otherwise. Batches split at 256 items or 16 MiB of content.
  • Client.UploadFlowDefinitions(ctx, documents, force) and ReadFlowDefinitionFiles, with FlowDefinitionUploadResult and FlowDefinitionUploadOutcome (including an unknown value for forward compatibility).
  • dexcli: dexcli flow-definition upload <path>... [--force] and dexcli flow-definition list. dexcli dev --flow-rendering-dir is documented as optional.
  • Docs: Go and cli reference, change logs (1.45), sdk-go README.

Why

Dex Web features (Designs, agent session view and Actions, Work Queue) need Flow Definition Graph JSON, which today must sit in a directory next to Dex Web. With the server-side storage in #1595, Workers can upload the graphs at startup so every Dex Web reads them from the Dex Server. Depends on #1595 (its commits appear here until it merges); Dex Web reading lands in a separate PR in the same 1.45 release.

Testing

  • sdk-go/integ/flow_definition_test.go against server-zd built from this branch: file and in-memory upload compared byte for byte via GetFlowDefinitions, registered-only filtering, source.path rewrite, mtime versus generatedAt, duplicate-source error, rejected upload still lets the Worker run a Flow, Client outcomes and force. Full ./integ passes.
  • Package tests: fake old server returning UNIMPLEMENTED (single warning, streams still open); go test -race ./dex ./examples/....
  • cli/internal/dev/flow_definition_integ_test.go: real server-zd and Dex Web without --flow-rendering-dir, 1001 definitions across several upload requests and list pages, KEPT_EXISTING then --force, 1.x file rejected.
  • make -C sdk-go docsCheck, make copyright-check, gofmt, cd docs && npm run 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.
Add WorkerOptions.FlowDefinitionPaths and FlowDefinitions. NewWorker reads
and validates the documents; Start uploads those of registered Flow types
after protocol negotiation and before opening task streams, and only logs a
warning when the upload fails. Add ReadFlowDefinitionFiles and
Client.UploadFlowDefinitions for deployment scripts.

Add dexcli flow-definition upload and list, which read files with the Go SDK
rules. Document both in the Go and cli references and changelogs.
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.83333% with 133 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
sdk-go/dex/flow_definition.go 71.05% 72 Missing and 38 partials ⚠️
sdk-go/dex/worker.go 70.31% 17 Missing and 2 partials ⚠️
sdk-go/dex/client.go 66.66% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

Skip non-FDG JSON files found in directories, parse generatedAt strictly
as RFC 3339, truncate generated times to milliseconds, and rewrite only
absolute source.path values with lexical normalization and minimal JSON
escaping. Upload without holding the Worker lifecycle lock so Stop cancels
an in-flight upload, and log unknown outcomes as unknown. Add the shared
conformance fixture under protos/conformance and assert it.
Rewrite source.path only when the top level has exactly one source object
with exactly one string path, check RFC 3339 field ranges, and assert the
extended conformance fixture. dexcli warns on unknown upload outcomes and
reports the uploaded digest and time for KEPT_EXISTING.
@longquanzheng
longquanzheng merged commit e6d2ef0 into main Nov 11, 2026
51 of 53 checks passed
@longquanzheng
longquanzheng deleted the feat/flow-definition-upload-go branch November 11, 2026 09:02
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