From 8f8cadea79a8ac136cdda50c862fcf3d4c4e64bb Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 4 Sep 2026 11:11:53 -0700 Subject: [PATCH] [eric] outputs: POST /outputs/create honours the workspace_id its request model advertises; the route dropped it and an API-created app had no workspace Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01C9zwUaHucUgrdxvK8FvjYT --- backend/apps/outputs/outputs.py | 2 ++ backend/tests/test_output_create_workspace.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 backend/tests/test_output_create_workspace.py diff --git a/backend/apps/outputs/outputs.py b/backend/apps/outputs/outputs.py index 80cb42f3..4bdc1284 100644 --- a/backend/apps/outputs/outputs.py +++ b/backend/apps/outputs/outputs.py @@ -671,6 +671,8 @@ async def create_output(body: OutputCreate): input_schema=body.input_schema, files=body.files, thumbnail=body.thumbnail, + # The request model has carried this since the workspace era; the route dropped it, so an API caller's app had no workspace and its card said the files were missing. + workspace_id=body.workspace_id, created_at=now, updated_at=now, ) diff --git a/backend/tests/test_output_create_workspace.py b/backend/tests/test_output_create_workspace.py new file mode 100644 index 00000000..be6e87ab --- /dev/null +++ b/backend/tests/test_output_create_workspace.py @@ -0,0 +1,12 @@ +"""`POST /api/outputs/create` advertises `workspace_id` in its request model and used to drop it on the +floor: an API caller's app had no workspace, its card said the files were missing, and the Windows +CI round trip exported an empty app before it ever reached the importer (2026-09-04).""" + +import inspect + +from backend.apps.outputs import outputs + + +def test_create_carries_the_workspace_id_into_the_record(): + src = inspect.getsource(outputs.create_output) + assert "workspace_id=body.workspace_id" in src