mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
feat(ci): replay a role's README instructions on its smallest deploy row
The instructions test held a job of its own that picked one random role per run, so a README's Production block was proven roughly once per 265 roles. The replay now rides on a deploy row instead: no extra runner, and every role the sweep touches gets its documented one-command deploy exercised. The row is the role's smallest variant -- fewest services enabled -- because that is the shape the README describes, and it is chosen among the variants the sweep actually deploys, so a row cut as redundant coverage cannot silently drop the role from the test. A role qualifies only when its README carries a Production block and the guide's own mode is one the role runs and tests. The marked entry carries the guide mode in `instructions` and a 📖 in its job title, between the variant number and a priority ⭐. The guide mode is independent of the mode the rotation gave the row: a swarm row still replays in compose. The step runs last in the deploy job, after the swarm teardown, because the replay deploys the role a second time and needs the runner's ports. call-test-instructions.yml, cli.meta.ci.guide_select and the `instructions` dispatch input go with it. `redundant()` moves next to the marker so the chunker, the plan table and the marker share one definition. The plan table trades its 📊 Weight column for 📖 Instructions; nothing read the weight any more, so it leaves the matrix entries too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
bfde5876ba
commit
7fd495cdfc
22 files changed
+330
-303
No files matched your search
@@ -42,6 +42,7 @@ import os
|
||||
import re
|
||||
from typing import TYPE_CHECKING, NamedTuple
|
||||
|
||||
from utils.github.variant import instructions
|
||||
from utils.github.variant.pools import DISTROS, FILESYSTEMS, rotate
|
||||
from utils.github.variant.tor import (
|
||||
TOR_DEPLOY_MODES,
|
||||
@@ -63,7 +64,8 @@ MODES = ("compose", "swarm", "host")
|
||||
LOCAL_GLYPH = to_emoji("test_host")
|
||||
|
||||
_AXIS_GLYPHS = (
|
||||
"".join(to_emoji(word) for word in ("tor", "clearnet", "priority")) + LOCAL_GLYPH
|
||||
"".join(to_emoji(word) for word in ("tor", "clearnet", "priority", "instructions"))
|
||||
+ LOCAL_GLYPH
|
||||
)
|
||||
|
||||
|
||||
@@ -393,7 +395,7 @@ def assign(
|
||||
else "false",
|
||||
"disable": "" if enabled else "tor",
|
||||
"priority": "true" if priority else "false",
|
||||
"weight": str(row.get("weight", 0)),
|
||||
"instructions": "",
|
||||
"id": str(row.get("id", 0)),
|
||||
"covered": str(row.get("covered_by", 0)),
|
||||
"clone": "true" if row.get("clone") else "false",
|
||||
@@ -404,7 +406,7 @@ def assign(
|
||||
+ (f" {to_emoji('priority')}" if priority else ""),
|
||||
}
|
||||
)
|
||||
return _one_per_deploy(entries)
|
||||
return instructions.mark(_one_per_deploy(entries), variants_per_app)
|
||||
|
||||
|
||||
def _one_per_deploy(entries: list[dict[str, str]]) -> list[dict[str, str]]:
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
"""Which matrix entry replays its role's README instructions.
|
||||
|
||||
The replay used to be a job of its own, picking one random role per run. It
|
||||
rides on a deploy row instead: the role's smallest variant among the rows this
|
||||
sweep actually deploys, marked with ``instructions`` (the mode the replay runs
|
||||
in) and a 📖 in the job title. :mod:`utils.roles.guide` decides which variant
|
||||
that is; this module is what turns the decision into matrix entries.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from utils.roles.guide import guide_variant
|
||||
from utils.symbol_glossary import to_emoji
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Mapping, Sequence
|
||||
from typing import Any
|
||||
|
||||
|
||||
def redundant(entry: Mapping[str, str]) -> bool:
|
||||
"""Whether the sweep drops this row as coverage an earlier row already has."""
|
||||
if entry["priority"] == "true":
|
||||
return False
|
||||
return entry["clone"] == "true" or entry["covered"] != "0"
|
||||
|
||||
|
||||
def mark(
|
||||
entries: list[dict[str, str]],
|
||||
variants_per_app: Mapping[str, Sequence[Mapping[str, Any]]] | None,
|
||||
) -> list[dict[str, str]]:
|
||||
"""Hand one entry per role the replay, and give its label the 📖.
|
||||
|
||||
Only the first entry of the chosen variant: a priority row runs every mode
|
||||
and onion state it offers, and replaying the same README block in each of
|
||||
them proves nothing the first replay did not. The glyph goes between the
|
||||
variant number and the ⭐ of a priority row, with no space between the two:
|
||||
they are one marker block, not two axes.
|
||||
"""
|
||||
deployed: dict[str, set[str]] = {}
|
||||
for entry in entries:
|
||||
if not redundant(entry):
|
||||
deployed.setdefault(entry["apps"], set()).add(entry["variant"])
|
||||
star = f" {to_emoji('priority')}"
|
||||
marked: set[str] = set()
|
||||
for entry in entries:
|
||||
app = entry["apps"]
|
||||
if app in marked or redundant(entry):
|
||||
continue
|
||||
variant, mode = guide_variant(app, variants_per_app, deployed.get(app, set()))
|
||||
if not mode or entry["variant"] != variant:
|
||||
continue
|
||||
entry["instructions"] = mode
|
||||
entry["label"] = (
|
||||
entry["label"].removesuffix(star)
|
||||
+ f" {to_emoji('instructions')}"
|
||||
+ (to_emoji("priority") if entry["priority"] == "true" else "")
|
||||
)
|
||||
marked.add(app)
|
||||
return entries
|
||||
Reference in new issue
Block a user