Split the node types into a package, and stop reconnecting per message

nodes.py had grown to 2k lines holding every integration behind a single
blanket mypy exemption. It is now a package split by the outside world
each node talks to, so the exemption shrinks to the four integration
modules; base and mlp are type-checked, which turned up a dozen missing
annotations.

The senders opened a fresh connection — and, in the MQTT case, a fresh
thread pool and event loop — for every single message. HTTP senders now
share one pooled client, and a publisher holds one broker connection for
its lifetime, fed from a bounded queue that drops the oldest value when
the broker cannot keep up.

An HTTP sender also no longer trips over a JSON reply that is not an
object: outputs are keyed by port, so a bare scalar is a valid reply with
nothing to publish.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011LF61rxW1FG5YCD2J9YqjY
This commit is contained in:
root
2026-08-16 07:33:10 +02:00
co-authored by Claude Fable 5
parent e7e48c4f13
commit f8693daad6
12 changed files with 2308 additions and 2038 deletions
+9 -4
View File
@@ -47,11 +47,16 @@ build-backend = "hatchling.build"
strict = true
exclude = ["venv", ".venv", "alembic"]
# app/flow/nodes.py still carries the prototype's node classes: the integration
# nodes need annotations of their own, plus stubs for croniter and influxdb_client.
# It is being revisited per integration; every module around it is checked strictly.
# The integration nodes still carry the prototype's annotations, and croniter and
# influxdb_client ship no stubs. Shrinking one module at a time as each integration
# is revisited; the rest of the package, and everything around it, is checked strictly.
[[tool.mypy.overrides]]
module = ["app.flow.nodes"]
module = [
"app.flow.nodes.delay",
"app.flow.nodes.http",
"app.flow.nodes.influx",
"app.flow.nodes.mqtt",
]
ignore_errors = true
[tool.ruff]