refactor: simplify to a list of intentionally-skipped rungs
Some checks failed
continuous-integration/drone/push Build is failing

Per operator: drop the gap-sensitivity / cap-intent-clause / stale-detection
machinery. Model is now dead simple — recipe_meta.EXPECTED_NA = {rung: reason}
lists the rungs a recipe intentionally skips; ANY rung skipped (N/A) and not in
that list is unintentional.

results.json: replace the 'na' block + level_cap_intent with
  skips: { intentional: {rung: reason}, unintentional: [rung] }
plus level_cap_rung (which rung capped). Badge/card derive intentional-vs-
unintentional from whether the capping rung is in the intentional list. Skips
still cap the level (never inflate). custom-html-tiny lists all three rungs it
intentionally skips (backup_restore, integration, recipe_local).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
autonomic-bot
2026-06-09 02:36:53 +00:00
parent d733e2c4ca
commit b3ab68a9dd
6 changed files with 105 additions and 146 deletions

View File

@ -79,27 +79,27 @@ def render_badge_svg(label: str, message: str, color: str) -> str:
)
# Third-segment colours for the level badge: amber = an UNEXPECTED skip (undeclared gap-sensitive
# N/A — likely missing coverage) capped the climb; muted = an EXPECTED skip (declared intentional
# N/A — reviewed, nothing to fix). Font-safe text labels (no emoji) so the SVG renders anywhere.
# Third-segment colours for the level badge: amber = an UNINTENTIONAL skip (a rung skipped but not
# in the recipe's intentional list — likely missing coverage) capped the climb; muted = an
# INTENTIONAL skip (declared in recipe_meta.EXPECTED_NA — nothing to fix). Font-safe text labels
# (no emoji) so the SVG renders anywhere.
GAP_COLOR = "#d29922"
EXPECT_COLOR = "#6e7681"
def level_badge_svg(level: int, cap_reason: str = "", cap_intent: str = "") -> str:
def level_badge_svg(level: int, cap_reason: str = "", cap_skip: str = "") -> str:
"""Per-recipe/-run LEVEL badge: 'cc-ci | level N' coloured by level (R6), with a THIRD segment
that differentiates *why* the climb stopped when an N/A capped it:
- undeclared gap-sensitive N/A (an UNEXPECTED skip — likely missing coverage): amber 'gap?'.
- declared intentional N/A (an EXPECTED skip — reviewed, nothing to fix): muted 'expected'.
- clean cap / full climb / a real failure: no third segment (the level + card carry it).
Derived from `cap_intent` (results.level_cap_intent) so the badge never inflates — it only
annotates the cap the level already reflects."""
that differentiates *why* the climb stopped when a SKIP capped it (`cap_skip`):
- "unintentional" (a rung skipped but not in the recipe's intentional list): amber 'gap?'.
- "intentional" (a skip declared in recipe_meta.EXPECTED_NA): muted 'expected'.
- "" (clean cap / full climb / a real failure): no third segment (the level + card carry it).
The badge never inflates — it only annotates the cap the level already reflects."""
label, msg = "cc-ci", f"level {int(level)}"
lw, mw = _text_width(label), _text_width(msg)
third: tuple[str, str] | None = None
if cap_intent.startswith("undeclared"):
if cap_skip == "unintentional":
third = ("gap?", GAP_COLOR)
elif cap_intent.startswith("intentional"):
elif cap_skip == "intentional":
third = ("expected", EXPECT_COLOR)
if third is None:
return render_badge_svg(label, msg, level_color(level))
@ -151,8 +151,15 @@ def render_card_html(data: dict, screenshot_rel: str | None = "screenshot.png")
version = html.escape(str(data.get("version") or data.get("ref") or ""))
level = int(data.get("level", 0))
cap_reason = str(data.get("level_cap_reason") or "")
cap_intent = str(data.get("level_cap_intent") or "")
cap = html.escape(cap_reason + (f" · {cap_intent}" if cap_intent else ""))
# Annotate the cap line by whether the capping rung was an intentional skip (declared, with its
# reason) or an unintentional one (skipped but not declared).
capped = data.get("level_cap_rung")
sk = data.get("skips", {}) or {}
if capped and capped in (sk.get("intentional") or {}):
cap_reason += f" · intentional: {sk['intentional'][capped]}"
elif capped and capped in (sk.get("unintentional") or []):
cap_reason += " · unintentional skip (no EXPECTED_NA — add a test or declare it)"
cap = html.escape(cap_reason)
color = level_color(level)
flags = data.get("flags", {}) or {}
flag_bits = []