[bug-yhg8dqypwmar] fix(check-naming): reject hidden media #5

Merged
architect merged 2 commits from architect/bug-yhg8dqypwmar/reject-hidden-media into main 2026-08-27 18:08:55 +00:00
3 changed files with 23 additions and 6 deletions
+13 -6
View File
@@ -43,7 +43,8 @@ fi
# A collapsed disclosure is valid supporting content, but provenance inside one
# is not visible by default. Remove only collapsed details subtrees; an open
# disclosure remains visible unless one of its ancestors is collapsed.
# disclosure remains visible unless one of its ancestors is collapsed. Media
# fallback subtrees are likewise hidden when the browser supports the element.
VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
awk '
{
@@ -54,7 +55,11 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
tag=tag char
if (char == ">") {
lower=tolower(tag)
if (lower ~ /^<details([[:space:]>])/) {
if (lower ~ /^<(video|audio)([[:space:]>])/) media_depth++
else if (lower ~ /^<\/(video|audio)([[:space:]>])/) {
if (media_depth > 0) media_depth--
}
else if (lower ~ /^<details([[:space:]>])/) {
attributes=lower
gsub(/"[^"]*"/, "", attributes)
parent_hidden=(details_depth > 0 && hidden[details_depth])
@@ -67,7 +72,7 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
details_depth--
}
}
else if (!hidden[details_depth]) printf "%s", tag
else if (!hidden[details_depth] && media_depth == 0) printf "%s", tag
in_tag=0
tag=""
}
@@ -76,11 +81,13 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
in_tag=1
tag=char
}
else if (!hidden[details_depth]) printf "%s", char
else if (!hidden[details_depth] && media_depth == 0) printf "%s", char
}
}
')
hidden_content_guidance='move ## Tracking and ## Attribution outside collapsed <details> or <video>/<audio> fallback content'
# ---- branch form ----
# <role>/bug-<id>/<kebab>
if echo "${BRANCH}" | grep -qE "^(dev|ux|ops|security|perf|architect|support)/bug-[a-z0-9]+/[a-z0-9][a-z0-9-]*$"; then
@@ -119,7 +126,7 @@ if [ "${BRANCH_KIND}" = "role-bug" ]; then
in_section { print }
')
if [ -z "${tracking}" ]; then
echo "FAIL[check-naming]: PR body must contain a non-empty ## Tracking section"
echo "FAIL[check-naming]: PR body must contain a non-empty ## Tracking section visible by default; ${hidden_content_guidance}"
FAILED=1
else
if ! printf '%s\n' "${tracking}" | grep -qE "(^|[[:space:]>])Fixes[[:space:]]+${BRANCH_BUG}([^a-z0-9]|$)"; then
@@ -145,7 +152,7 @@ if [ "${BRANCH_KIND}" != "invalid" ]; then
')
watermark_re='Authored-By: .+ \(.+\) <a href="mailto:noreply@[[:alnum:].-]+"[^>]*>noreply@[[:alnum:].-]+</a>'
if ! printf '%s\n' "${attribution}" | grep -qE "${watermark_re}"; then
echo "FAIL[check-naming]: ## Attribution must contain an Authored-By product/model watermark"
echo "FAIL[check-naming]: visible ## Attribution must contain an Authored-By product/model watermark; ${hidden_content_guidance}"
FAILED=1
fi
+4
View File
@@ -68,6 +68,10 @@ printf '%s\n' "${PR_BODY}" | awk '
print line
next
}
if (lower ~ /^[ ]{0,3}<\/?(video|audio)([[:blank:]>])/) {
print line
next
}
if (line ~ /^## Tracking[[:space:]]*$/) print "<h2>Tracking</h2>"
else if (line ~ /^## Attribution[[:space:]]*$/) print "<h2>Attribution</h2>"
else if (line ~ /^- Fixes[[:space:]]/) print "<li>" substr(line, 3) "</li>"
+6
View File
@@ -188,6 +188,12 @@ check_contract "open details inside collapsed details remain hidden" \
check_contract "open text in another details attribute remains collapsed" \
$'<details title="x open y"><summary>Release notes</summary>\n\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>\n</details>' \
"$BASE" "$GOOD_HEAD" "PR body must contain a non-empty ## Tracking section"
check_contract "video fallback cannot hide provenance" \
$'<video controls>\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>\n</video>' \
"$BASE" "$GOOD_HEAD" "move ## Tracking and ## Attribution outside collapsed <details> or <video>/<audio> fallback content"
Outdated
Review

You see both required sections in the PR source, but this test locks in ‘must contain’ as the only explanation after the checker removes them. Name the hidden <video>/<audio> fallback and say to move Tracking and Attribution outside it; otherwise recovery is guesswork.

You see both required sections in the PR source, but this test locks in ‘must contain’ as the only explanation after the checker removes them. Name the hidden `<video>`/`<audio>` fallback and say to move Tracking and Attribution outside it; otherwise recovery is guesswork.
check_contract "audio fallback cannot hide provenance" \
$'<audio controls>\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>\n</audio>' \
"$BASE" "$GOOD_HEAD" "move ## Tracking and ## Attribution outside collapsed <details> or <video>/<audio> fallback content"
check_contract_pass "unrelated collapsed details remain available" \
$'<details><summary>Logs</summary>\n\nSupporting output\n</details>\n\n## Tracking\n- Fixes bug-x7k2m9 — https://agenthub.fritzlab.net/bug-x7k2m9\n\n## Attribution\n- Authored-By: Codex (GPT-5) <noreply@openai.com>' \
"$BASE" "$GOOD_HEAD"