fix(11): let the Phase 10 gate accept the Phase 12 pending goldens

- 11-06 records TestBroadcastGoldens/created and /updated and reports them
  as skipped until Phase 12; the Phase 10 detector refused any skip, so
  check-phase10.sh --all failed on the fonoteka.go suite
- mirrors 73cfed7 (check-phase10.1.sh): the detector accepts exactly those
  skips when their output carries 'pending: Phase 12'; the self-test proves
  a pending skip passes and one without the text fails
This commit is contained in:
Jakub Zych
2026-09-30 15:22:00 +02:00
parent 5fa062d554
commit 61da4d1a4c

View File

@@ -18,6 +18,11 @@ REVIEW="$PHASE_DIR/10-SECURITY-REVIEW.md"
VALIDATION="$PHASE_DIR/10-VALIDATION.md" VALIDATION="$PHASE_DIR/10-VALIDATION.md"
APP_PLUGINS=(./plugins/golem15/fonoteka/... ./plugins/golem15/user/...) APP_PLUGINS=(./plugins/golem15/fonoteka/... ./plugins/golem15/user/...)
KNOWN_APP_FAILURES="" KNOWN_APP_FAILURES=""
# Phase 11 (11-06) records the created/updated broadcast goldens from PHP and
# reports them as skipped until Phase 12 asserts them; check-phase11.sh
# requires exactly these skips with this text.
APP_PENDING_SKIPS="TestBroadcastGoldens/created TestBroadcastGoldens/updated"
APP_PENDING_TEXT="pending: Phase 12"
usage() { usage() {
cat >&2 <<'EOF' cat >&2 <<'EOF'
@@ -46,6 +51,9 @@ import json, os, sys
path = sys.argv[1] path = sys.argv[1]
allow = set(os.environ.get("PHASE10_ALLOW", "").split()) allow = set(os.environ.get("PHASE10_ALLOW", "").split())
require = set(os.environ.get("PHASE10_REQUIRE", "").split()) require = set(os.environ.get("PHASE10_REQUIRE", "").split())
expect_skip = set(os.environ.get("PHASE10_EXPECT_SKIP", "").split())
skip_text = os.environ.get("PHASE10_SKIP_TEXT", "")
skip_output = {}
passed = set() passed = set()
failed_tests = {} failed_tests = {}
failed_pkgs = [] failed_pkgs = []
@@ -65,7 +73,13 @@ with open(path, encoding="utf-8", errors="replace") as fh:
pkg = ev.get("Package") or "" pkg = ev.get("Package") or ""
if action == "build-fail": if action == "build-fail":
build_failed = True build_failed = True
if action == "output" and test in expect_skip:
skip_output.setdefault(test, []).append(ev.get("Output") or "")
if action == "skip" and test: if action == "skip" and test:
# A later phase's documented pending test (for example the Phase
# 12 broadcast goldens) may skip, but only with its pending text.
if test in expect_skip and skip_text and any(skip_text in o for o in skip_output.get(test, [])):
continue
print(f"refuse: skipped {pkg} {test}", file=sys.stderr) print(f"refuse: skipped {pkg} {test}", file=sys.stderr)
sys.exit(2) sys.exit(2)
if action == "fail": if action == "fail":
@@ -164,6 +178,13 @@ run_self_test() {
expect_detect fail 1 '{"Action":"pass","Package":"p","Test":"TestA"} expect_detect fail 1 '{"Action":"pass","Package":"p","Test":"TestA"}
{"Action":"fail","Package":"p","Test":"TestPhase10CSRF"}' {"Action":"fail","Package":"p","Test":"TestPhase10CSRF"}'
expect_detect skip 2 '{"Action":"skip","Package":"p","Test":"TestPhase10AssembledAcceptance"}' expect_detect skip 2 '{"Action":"skip","Package":"p","Test":"TestPhase10AssembledAcceptance"}'
PHASE10_EXPECT_SKIP="TestG/created" PHASE10_SKIP_TEXT="pending: Phase 12" expect_detect pending-skip 0 \
'{"Action":"output","Package":"p","Test":"TestG/created","Output":"pending: Phase 12 asserts it\n"}
{"Action":"skip","Package":"p","Test":"TestG/created"}
{"Action":"pass","Package":"p","Test":"TestG"}'
PHASE10_EXPECT_SKIP="TestG/created" PHASE10_SKIP_TEXT="pending: Phase 12" expect_detect pending-skip-without-text 2 \
'{"Action":"skip","Package":"p","Test":"TestG/created"}
{"Action":"pass","Package":"p","Test":"TestG"}'
expect_detect zero 3 '{"Action":"pass","Package":"git.golem15.com/golem15/summercms/modules/cabana"}' expect_detect zero 3 '{"Action":"pass","Package":"git.golem15.com/golem15/summercms/modules/cabana"}'
expect_detect nonjson 4 '{"Action":"pass",' expect_detect nonjson 4 '{"Action":"pass",'
expect_detect build 1 '{"Action":"build-fail","ImportPath":"p"} expect_detect build 1 '{"Action":"build-fail","ImportPath":"p"}
@@ -244,7 +265,8 @@ run_go() {
(cd "$ROOT" && go vet ./...) (cd "$ROOT" && go vet ./...)
phase10_go "$ROOT" ./... phase10_go "$ROOT" ./...
(cd "$APP" && go vet ./... "${APP_PLUGINS[@]}") (cd "$APP" && go vet ./... "${APP_PLUGINS[@]}")
PHASE10_ALLOW="$KNOWN_APP_FAILURES" phase10_go "$APP" ./... "${APP_PLUGINS[@]}" PHASE10_ALLOW="$KNOWN_APP_FAILURES" PHASE10_EXPECT_SKIP="$APP_PENDING_SKIPS" PHASE10_SKIP_TEXT="$APP_PENDING_TEXT" \
phase10_go "$APP" ./... "${APP_PLUGINS[@]}"
echo "phase10 go passed" echo "phase10 go passed"
} }