fix(tools): reach the lane from the stack, and judge every role it serves

Three faults, one mechanism each, that together let the oracle suite report
a verdict it never reached.

The address. lane_url handed out the runner's compose service name, but the
stack's containers resolve through the deployment's CoreDNS, which never
learns one: getent hosts tools answers nothing inside them, so every check
that asked the lane from there skipped itself. The bring-up now writes the
runner's address, picked as the one inside INFINITO_SUBNET because the
runner sits on every network it was ever brought up on, and the checks read
it from there. It is rewritten on both paths, because a restart gives the
runner a new one.

The readiness. serving judged the engine alone, so a lane whose engine make
i18n had already brought up counted as up while System One was down. It now
probes every role the caller names, which is why the runner republishes
System One's port: a container IP is unreachable from the host that decides
whether to deploy.

The verdict. A silent lane made the suite skip, and a skip exits green.
Only a deploy that is already running leaves the stack alone and exits 0
now; a crashed deploy and a deployed-but-silent role both exit 1.

The override's third :? guard is added to the gate that decides whether the
file is layered in at all, next to the one that was already missing. Without
it an .env written before these keys aborts every compose command, down to
compose-down, instead of dropping the lane. A test now keeps that list and
the override's guards in step.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-10-17 20:27:54 +02:00
1 parent 9d1cb15adf
commit 2f9a53f073
10 files changed
+351 -30

No files matched your search

@@ -8,10 +8,16 @@ because an unsatisfied `:?` guard inside one of them aborts the whole stack.
from __future__ import annotations
import os
import re
import unittest
from unittest.mock import patch
from cli.administration.deploy.development.env import compose_file_args
from cli.administration.deploy.development.env import (
TOOLS_LANE_KEYS,
compose_file_args,
)
from utils.cache import PROJECT_ROOT
from utils.cache.files import read_text
_LOCAL_PRIMARY = {
"GITHUB_ACTIONS": "",
@@ -25,6 +31,8 @@ _LOCAL_PRIMARY = {
"INFINITO_GPU_COUNT": "0",
"INFINITO_TOOLS_LIBRETRANSLATE_PORT": "8097",
"INFINITO_TOOLS_MODELS_HOST_PATH": "/var/cache/infinito/core/cache/models",
"INFINITO_TOOLS_S1_PORT": "8096",
"INFINITO_TOOLS_TRANSLATE_PORT": "8101",
}
_WORKTREE = {
@@ -159,5 +167,33 @@ class TestComposeFileArgs(unittest.TestCase):
self.assertNotIn("compose/tools.override.yml", compose_file_args())
class TestToolsLaneGateCoversItsGuards(unittest.TestCase):
def test_every_guard_the_override_adds_is_gated(self) -> None:
"""A `:?` guard the gate does not know aborts every compose call.
The guards compose.yml already carries are satisfied for any stack
that runs at all, so only the ones the lane's override adds on top
can fire against an .env that predates them. INFINITO_IMAGE is the
one exception: the deploy CLI injects it into the process
environment and it never reaches .env, so gating on it would drop
the lane permanently.
"""
guards = re.compile(r"\$\{([A-Z_][A-Z0-9_]*):\?")
shared = set(guards.findall(read_text(PROJECT_ROOT / "compose.yml")))
override = set(
guards.findall(read_text(PROJECT_ROOT / "compose" / "tools.override.yml"))
)
added = override - shared - {"INFINITO_IMAGE"}
self.assertEqual(
sorted(added - set(TOOLS_LANE_KEYS)),
[],
"compose/tools.override.yml guards these variables, and "
"compose_file_args layers the file in without checking them, so "
"an .env written before they existed aborts every compose "
"command instead of only dropping the lane. Add them to "
"TOOLS_LANE_KEYS.",
)
if __name__ == "__main__": # pragma: no cover
unittest.main()