[bug-yhg8dqypwmar] fix(check-naming): reject hidden media #5
@@ -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,7 +81,7 @@ 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
|
||||
}
|
||||
}
|
||||
')
|
||||
|
||||
@@ -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>"
|
||||
|
||||
@@ -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" "PR body must contain a non-empty ## Tracking section"
|
||||
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" "PR body must contain a non-empty ## Tracking section"
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user