fix(ci): offer multi to bond-less rows whose deploy pulls Tor in

A role without a Tor bond only took clearnet rows, and clearnet rows disable
Tor. svc-ai-litellm (variants 0 and 2) and web-app-seaweedfs (variant 0) still
pull the Tor provider in through their dependencies, so they ran on a node
with Tor about half the time under the tor axis and never under the network
axis.

row_states now gives such a row clearnet and multi. Whether the deploy pulls
the provider in is read from the services closure the discovery row already
carries, which matched the deploy's own include resolution on all 33 rows
without a bond. A row whose deploy contains no Tor provider stays clearnet
only, because NETWORK_MODE=multi without the provider fails the deploy, and a
gate pinned false still means clearnet. The matrix and the selection
validator pass the same flag, so a +multi pin agrees with the matrix.
tor_capable lost its last caller and is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5.5 committed 2026-09-24 22:42:55 +02:00
1 parent 6314938133
commit 098b0caffc
7 files changed
+117 -51

No files matched your search

+6 -2
View File
@@ -49,6 +49,7 @@ from utils.github.variant.network import (
combinations,
disabled_services,
network_states,
row_pulls_tor,
row_states,
)
from utils.github.variant.pools import DISTROS, FILESYSTEMS, rotate
@@ -290,7 +291,8 @@ def assign(
Args:
rows: discovery rows, each carrying ``name``, ``variant``, ``modes``
(the offered subset) and ``priority``, in global query order.
(the offered subset), ``priority`` and the ``services`` closure
(:func:`row_pulls_tor`), in global query order.
``pin_mode``/``pin_network``/``pin_distro``/``pin_filesystem``,
when a selection token set them, pin that axis: the priority line
then covers only the combinations that match, and the regular line
@@ -332,7 +334,9 @@ def assign(
app = row["name"]
variant = row.get("variant")
priority = bool(row.get("priority"))
states = row_states(app, variant, variants_per_app)
states = row_states(
app, variant, variants_per_app, pulls_tor=row_pulls_tor(row)
)
offered = tuple(row["modes"])
variant_csv = "" if variant is None else str(variant)
pin_mode = row.get("pin_mode")
+28 -25
View File
@@ -60,31 +60,18 @@ def _tor_flag(config: Mapping[str, Any]) -> Any:
return tor.get("enabled") if isinstance(tor, dict) else None
def tor_capable(
def _row_tor_flag(
app: str,
variant: int | None = None,
variants_per_app: Mapping[str, Sequence[Mapping[str, Any]]] | None = None,
) -> bool:
"""Whether a matrix row may be deployed on a node that runs Tor.
Args:
app: application id.
variant: the row's variant index; ``None`` for a role declaring none.
variants_per_app: rendered variant configs per app; ``None`` falls back
to the role's base ``meta/services.yml``.
Returns:
``False`` when the role has no ``tor`` bond or the covered variant pins
``services.tor.enabled`` to a literal false, ``True`` otherwise. A
reactive Jinja flag counts as capable. Consulting the variant matters:
roles pin the gate ``true`` in variant 0 and ``false`` in the rest.
"""
variant: int | None,
variants_per_app: Mapping[str, Sequence[Mapping[str, Any]]] | None,
) -> Any:
"""The row's ``services.tor.enabled``: the covered variant's value, else
the role's base ``meta/services.yml`` one; ``None`` without a Tor bond.
Roles pin the gate ``true`` in variant 0 and ``false`` in the rest."""
declared = (variants_per_app or {}).get(app) or []
if variant is None or not 0 <= variant < len(declared):
flag = _tor_flag({"services": _meta(app, ROLE_FILE_META_SERVICES)})
else:
flag = _tor_flag(declared[variant])
return flag is not None and flag is not False
return _tor_flag({"services": _meta(app, ROLE_FILE_META_SERVICES)})
return _tor_flag(declared[variant])
def _reachability(
@@ -110,10 +97,17 @@ def tor_provider() -> str | None:
return role if isinstance(role, str) and role else None
def row_pulls_tor(row: Mapping[str, Any]) -> bool:
"""Whether a discovery row's ``services`` closure takes the Tor provider in."""
return tor_provider() in (row.get("services") or ())
def row_states(
app: str,
variant: int | None = None,
variants_per_app: Mapping[str, Sequence[Mapping[str, Any]]] | None = None,
*,
pulls_tor: bool = False,
) -> tuple[str, ...]:
"""Every node network mode the row's role can be served in.
@@ -121,15 +115,24 @@ def row_states(
app: application id.
variant: the row's variant index; ``None`` for a role declaring none.
variants_per_app: rendered variant configs per app.
pulls_tor: the row's deploy takes the Tor provider in
(:func:`row_pulls_tor`).
Returns:
``clearnet`` alone for a row that cannot take Tor. Otherwise the modes
whose networks all lie inside the role's ``reachability.modes``,
``clearnet`` alone when the covered variant pins the Tor gate to a
literal false, or when the role has no Tor bond and nothing pulls the
provider in. ``clearnet`` and ``multi`` for a role without a bond whose
deploy pulls the provider in anyway: the node then runs Tor while the
role stays on clearnet. Otherwise, a reactive Jinja gate included, the
modes whose networks all lie inside the role's ``reachability.modes``,
without ``multi`` for a ``single_mode`` role and without ``clearnet``
for the Tor provider, which disabling Tor would strip out of its own
deploy.
"""
if not tor_capable(app, variant, variants_per_app):
flag = _row_tor_flag(app, variant, variants_per_app)
if flag is None:
return (CLEARNET, MULTI) if pulls_tor else (CLEARNET,)
if flag is False:
return (CLEARNET,)
modes, single_mode = _reachability(app, variant, variants_per_app)
allowed = modes or tuple(NETWORKS)