You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add stable logical aliases for immutable concrete flow versions through a DeployedFlow wrapper.
Callers start a stable alias such as greetUser. Startup deployment resolves that alias to one concrete version such as greetUserV2. Runs, tasks, queues, broadcasts, and history retain the concrete slug.
Alias metadata remains independent from DAG shape and queue mode.
A plain Flow remains supported and defaults to a self-alias:
alias = concrete flow_slug
defineDeployedFlow() preserves the exact wrapped plain or step-queued flow type. It must not weaken handler, dependency, condition, queue-mode, step-selector, context, or environment inference.
Ownership model
flow_slug
immutable concrete version and runtime identity
flow_alias
stable dispatch name with one active concrete target
Flow or StepQueuedFlow
DAG, handlers, and queue mode
DeployedFlow
immutable alias membership for one concrete definition
Aliases never appear in generated private queue names. Queue names use the concrete slug so versions remain isolated.
Data model
Add immutable alias membership and one active pointer:
pgflow.flows
flow_slug primary key
flow_alias not null
unique (flow_slug, flow_alias)
pgflow.flow_aliases
flow_alias primary key
flow_slug not null
created_at timestamptz not null
updated_at timestamptz not null
foreign key (flow_slug, flow_alias)
references pgflow.flows (flow_slug, flow_alias)
Invariants:
every concrete flow has one immutable alias membership;
omitted aliases resolve to the concrete slug;
several concrete versions may share one alias;
exactly one concrete version is active for each alias;
an existing concrete slug cannot move to another alias;
existing flows backfill as self-aliases;
the migration does not infer version families from slug suffixes.
Startup deployment and activation
Every worker carries the complete wrapped definition. Use one lock order everywhere:
compile or verify the complete concrete flow shape and queue mode;
activate the alias only for a brand-new concrete slug;
commit before worker registration.
Activation rules:
a brand-new concrete slug activates after complete compilation succeeds;
rechecking the active slug preserves activation;
rechecking an inactive slug leaves it inactive;
restarting an old worker never reclaims the alias;
local destructive recompilation preserves prior activation state;
alias mismatch always fails;
worker startup failure after activation leaves the alias active and work queued durably.
Several step workers may race to deploy the same new concrete version. The locks make one compile and the others verify.
Two different new versions for one alias must not be rolled out concurrently. The final alias-lock holder would win; document one new concrete version per alias rollout.
Start APIs
Move concrete behavior behind explicit slug functions and make aliases the default:
start_flow() alias
start_flow_by_alias() alias, explicit
start_flow_by_slug() concrete slug
start_flow_with_states() alias
start_flow_with_states_by_slug() concrete slug
Compatibility:
keep the existing flow_slug RPC argument name on default start functions;
Summary
Add stable logical aliases for immutable concrete flow versions through a
DeployedFlowwrapper.Callers start a stable alias such as
greetUser. Startup deployment resolves that alias to one concrete version such asgreetUserV2. Runs, tasks, queues, broadcasts, and history retain the concrete slug.Alias metadata remains independent from DAG shape and queue mode.
Dependencies and stage
Public API
Plain flow:
Private per-step flow:
A plain
Flowremains supported and defaults to a self-alias:defineDeployedFlow()preserves the exact wrapped plain or step-queued flow type. It must not weaken handler, dependency, condition, queue-mode, step-selector, context, or environment inference.Ownership model
Aliases never appear in generated private queue names. Queue names use the concrete slug so versions remain isolated.
Data model
Add immutable alias membership and one active pointer:
Invariants:
Startup deployment and activation
Every worker carries the complete wrapped definition. Use one lock order everywhere:
Within one transaction:
Activation rules:
Several step workers may race to deploy the same new concrete version. The locks make one compile and the others verify.
Two different new versions for one alias must not be rolled out concurrently. The final alias-lock holder would win; document one new concrete version per alias rollout.
Start APIs
Move concrete behavior behind explicit slug functions and make aliases the default:
Compatibility:
flow_slugRPC argument name on default start functions;Clients use alias semantics by default and add
startFlowBySlug()for pinned starts.Rollback and deletion
Add:
It validates membership, takes the alias lock, and atomically switches the pointer. It does not require live workers; durable queues may wait.
Keep deletion concrete-slug based. Rules:
Versioned private queues
For a step-queued deployment:
Existing V1 tasks never move to V2 queues. Keep V1 workers until no V1 run can create or execute more tasks.
Observability
Startup results and logs distinguish:
Do not log credentials or message bodies.
Acceptance criteria
defineDeployedFlow()preserves exact plain and step-queued flow types.Out of scope