Rename orchestration, splice and routes: a Renamer runs one rename at a time, closing the gate, taking the controller lock and holding the engine, each waiting without a limit and saying what it waits for (summary rename status, rename_waiting); DELETE on the pending request or a closed connection calls it off until the journal begins (409 aborted); then journal, steps and audit, retried in the background on failure (503 completing); splice_renamed rebuilds the affected flows under the held lock keeping stopped, paused and parked work, history limits and device wiring refreshed before activation; AlertManager.rename and EventBus.rename/settle follow the names; flow and dashboard rename routes answer by code and repeat stored results; renamed, dashboard_changed and pipeline_rebuilt after release; fluksio serve reads flow files without building a FlowStore

This commit is contained in:
2026-11-02 22:14:44 +01:00
parent 2d65118d82
commit ba4aae390d
16 changed files with 2174 additions and 22 deletions
+23 -1
View File
@@ -17,7 +17,7 @@ import logging
import time
from collections import deque
from collections.abc import Callable
from typing import Any, Literal, Protocol
from typing import TYPE_CHECKING, Any, Literal, Protocol
import httpx
from pydantic import BaseModel, Field
@@ -25,6 +25,9 @@ from pydantic import BaseModel, Field
from fluksio.flow.events import EventBus
from fluksio.flow.secrets import resolve_params
if TYPE_CHECKING:
from fluksio.flow.namespace import Rename
logger = logging.getLogger(__name__)
# What is worth waking someone for. Everything else on the bus is traffic.
@@ -271,6 +274,25 @@ class AlertManager:
return
await self._deliver(event)
def rename(self, rename: Rename) -> None:
"""Follow a key rename: dashboard channels publish to the moved
message, as `alerts.json` now says, and what was sent, held back or
muted is kept under the new names with its timestamps, so nothing is
sent again. A connection waiting out its grace under an old name is
let go: its node reports again once it runs under the new one."""
config = self.config.model_copy(deep=True)
for channel in config.channels:
message = channel.config.get("message")
if channel.kind == "dashboard" and isinstance(message, str):
channel.config["message"] = rename.binding(message)
self.config = config
self._last_sent = {rename.dedup_key(k): v for k, v in self._last_sent.items()}
self._suppressed = {rename.dedup_key(k): v for k, v in self._suppressed.items()}
self._health_flips = {rename.name(k): v for k, v in self._health_flips.items()}
self._flapping = {rename.name(k): v for k, v in self._flapping.items()}
for node in [node for node in self._down if rename.name(node) != node]:
self._cancel_down(node)
def _cancel_down(self, node: str) -> None:
task = self._down.pop(node, None)
if task is not None: