A run says whether the dashboard, the CLI or a script asked for it

`POST /runs/flows/{name}` hardcoded `cause: "api"`, so every row in the
history claimed the same origin. The body now carries an optional `cause`,
closed to the values the column knows — the dashboard sends nothing and stays
"api", `fluksio run` says "cli", and the SDK client says "sdk".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Gf7WaExcJ9bs3kfJXB3nK
This commit is contained in:
2026-08-25 22:06:29 +02:00
co-authored by Claude Opus 5
parent b194071ca5
commit 1148e54c9e
9 changed files with 83 additions and 9 deletions
+10 -3
View File
@@ -200,9 +200,10 @@ def test_a_local_run_always_waits(monkeypatch) -> None:
def get_flow(self, name: str) -> dict[str, object]:
return {"definition": {"inputs": []}}
def submit(self, flow, params, seed=None, no_cache=False):
def submit(self, flow, params, seed=None, no_cache=False, cause="sdk"):
submitted["flow"] = flow
submitted["no_cache"] = no_cache
submitted["cause"] = cause
return FakeHandle()
def run(self, run_id: str) -> dict[str, object]:
@@ -216,7 +217,13 @@ def test_a_local_run_always_waits(monkeypatch) -> None:
args = _parser().parse_args(["run", "train", "--local", "--no-sync", "--no-cache"])
assert cli.cmd_run(args, []) == 0
assert submitted == {"flow": "train", "no_cache": True, "waited": True}
# "cli" rather than the SDK's default: the history says which asked.
assert submitted == {
"flow": "train",
"no_cache": True,
"waited": True,
"cause": "cli",
}
def test_ctrl_c_while_waiting_cancels_the_run(monkeypatch) -> None:
@@ -240,7 +247,7 @@ def test_ctrl_c_while_waiting_cancels_the_run(monkeypatch) -> None:
def get_flow(self, name: str) -> dict[str, object]:
return {"definition": {"inputs": []}}
def submit(self, flow, params, seed=None, no_cache=False):
def submit(self, flow, params, seed=None, no_cache=False, cause="sdk"):
return FakeHandle()
def cancel(self, run_id: str) -> None: