test(workflows): guard dead in-memory background machinery stays deleted

This commit is contained in:
ogabrielluiz
2026-06-04 03:18:08 -03:00
parent d3cf825754
commit 461cc2f1cb
2 changed files with 29 additions and 4 deletions

View File

@ -246,10 +246,10 @@ async def execute_workflow(
)
if parsed.mode == "background":
# Background owns its own adapter construction inside
# ``_buffer_background_run`` because the fire-and-forget coroutine
# needs its own ``StreamAdapterContext`` (different ``run_id``).
# The name-only check above already covered the 422 contract.
# Background runs are delegated to BackgroundExecutionService via
# ``execute_workflow_background``. The facade creates the durable job
# row, persists the request, enqueues the work, and owns ownership /
# IDOR. The name-only check above already covered the 422 contract.
return await execute_workflow_background(
parsed=parsed,
flow=flow,

View File

@ -323,3 +323,28 @@ class TestNoBreakingChange:
assert response.status_code == 200
event_ids = [line.removeprefix("id:").strip() for line in response.text.splitlines() if line.startswith("id:")]
assert "0" not in event_ids
class TestDeadMachineryRemoved:
"""The process-local background buffer machinery is gone after the cutover.
``execute_workflow_background`` is intentionally kept: it is now a thin
facade-delegating wrapper (builds the request dict, threads idempotency_key),
not the old in-memory run loop, so it is NOT in this list.
"""
def test_in_memory_background_machinery_is_deleted(self):
"""The old _BackgroundRun buffer and its helpers no longer exist."""
from langflow.api.v2 import workflow as wf
for name in (
"_BackgroundRun",
"_BACKGROUND_RUNS",
"_register_background_run",
"_clear_background_run",
"_buffer_background_run",
"_finalize_job_status",
"_MAX_BACKGROUND_RUNS",
"_MAX_FRAMES_PER_BACKGROUND_RUN",
):
assert not hasattr(wf, name), f"{name} should have been deleted in the facade cutover"