Admission gate for a rename: RenameGate in flow/rename.py, installed by main.AdmissionGate inside CORS, turns mutating API requests away with 503 renaming and Retry-After while closed and drains those admitted without a limit, abortable; affected flows' hooks get 503 or socket close 1013, reads, sign-in, assistant, workers, artifacts and rename routes pass; the run cache misses while the gate is closed; trigger_node lets EngineHeld through instead of reporting a node failure

This commit is contained in:
2026-11-02 20:53:08 +01:00
parent cb709c19ac
commit 81bd7c2724
7 changed files with 404 additions and 2 deletions
+17
View File
@@ -11,6 +11,7 @@ import time
import pytest
from fluksio.flow import executor
from fluksio.flow.controller import FlowController, LoadedNode
from fluksio.flow.executor import ExecutionService
from fluksio.flow.messages import DType, MessageSpec
from fluksio.flow.namespace import Rename
@@ -18,6 +19,7 @@ from fluksio.flow.nodes import Node
from fluksio.flow.pipeline import EngineHeld, Pipeline
from fluksio.flow.queue import MemoryWorkQueue, WorkItem
from fluksio.flow.state import MemoryState
from fluksio.flow.store import FlowStore
def _engine(consume, queue=None) -> tuple[Pipeline, ExecutionService, Node]:
@@ -214,6 +216,21 @@ def test_publish_is_refused_while_held():
assert seen == [2.0]
def test_a_trigger_by_hand_while_held_is_refused_not_failed(tmp_path, monkeypatch):
seen: list = []
pipeline, _, source = _engine(seen.append)
controller = FlowController(FlowStore(tmp_path / "flows"))
controller.pipeline = pipeline
controller.loaded[source.id] = LoadedNode(id=source.id, flow="f", node=source)
failures: list = []
monkeypatch.setattr(Pipeline, "publish_error", lambda *args: failures.append(args))
assert pipeline.hold(threading.Event())
with pytest.raises(EngineHeld):
controller.trigger_node(source.id, {"reading": 1.0})
assert failures == [] and seen == []
def test_work_arriving_during_a_hold_runs_after_it_in_order():
seen: list = []
pipeline, service, source = _engine(seen.append)