Clients take a flow's id or key: one resolver in the SDK, id first, explicit id:/key:, a warning for reads and a refusal for changes when a name means two flows, deleted flows found by their last key; sync creates by POST, retries a create race through the drift checks and reports the id; MCP gets create_flow and resolves every flow argument with the caller's token; displays show flow_name; an engine from before ids is named as such

This commit is contained in:
2026-11-02 19:39:14 +01:00
parent fd637e0f1e
commit 53916d869b
20 changed files with 816 additions and 147 deletions
+11 -6
View File
@@ -776,18 +776,23 @@ class Flow:
def submit(
self, *, seed: int | None = None, client: Any = None, **params: Any
) -> Any:
"""Start a run of this flow and hand back a handle to it."""
"""Start a run of this flow and hand back a handle to it.
By its key, which is all a declaration knows, and as a key: an id
that happens to be spelled the same is another flow's.
"""
from fluksio.sdk.client import Client
return (client or Client()).submit(self.name, params, seed=seed)
return (client or Client()).submit(f"key:{self.name}", params, seed=seed)
def runs(self, limit: int = 20, client: Any = None) -> list[dict[str, Any]]:
"""This flow's runs, newest first."""
"""This flow's runs, newest first: the flow holding its key now, not
one deleted before it that held the key too."""
from fluksio.sdk.client import Client
rows: list[dict[str, Any]] = (client or Client()).runs(
flow=self.name, limit=limit
)
engine = client or Client()
flow_id = engine.resolve_flow(f"key:{self.name}").id
rows: list[dict[str, Any]] = engine.runs(flow=f"id:{flow_id}", limit=limit)
return rows
def __repr__(self) -> str: