Authored-By: Codex (GPT-5) <noreply@openai.com>
This commit is contained in:
@@ -42,7 +42,8 @@ elif ! RENDERED_BODY=$(printf '%s' "${BODY}" |
|
||||
fi
|
||||
|
||||
# A collapsed disclosure is valid supporting content, but provenance inside one
|
||||
# is not visible by default. Remove details subtrees before locating sections.
|
||||
# is not visible by default. Remove only collapsed details subtrees; an open
|
||||
# disclosure remains visible unless one of its ancestors is collapsed.
|
||||
VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
|
||||
awk '
|
||||
{
|
||||
@@ -53,11 +54,18 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
|
||||
tag=tag char
|
||||
if (char == ">") {
|
||||
lower=tolower(tag)
|
||||
if (lower ~ /^<details([[:space:]>])/) details_depth++
|
||||
else if (lower ~ /^<\/details([[:space:]>])/) {
|
||||
if (details_depth > 0) details_depth--
|
||||
if (lower ~ /^<details([[:space:]>])/) {
|
||||
parent_hidden=(details_depth > 0 && hidden[details_depth])
|
||||
details_depth++
|
||||
hidden[details_depth]=(parent_hidden || lower !~ /[[:space:]]open([[:space:]=>]|$)/)
|
||||
}
|
||||
else if (details_depth == 0) printf "%s", tag
|
||||
else if (lower ~ /^<\/details([[:space:]>])/) {
|
||||
if (details_depth > 0) {
|
||||
delete hidden[details_depth]
|
||||
details_depth--
|
||||
}
|
||||
}
|
||||
else if (!hidden[details_depth]) printf "%s", tag
|
||||
in_tag=0
|
||||
tag=""
|
||||
}
|
||||
@@ -66,7 +74,7 @@ VISIBLE_BODY=$(printf '%s\n' "${RENDERED_BODY}" |
|
||||
in_tag=1
|
||||
tag=char
|
||||
}
|
||||
else if (details_depth == 0) printf "%s", char
|
||||
else if (!hidden[details_depth]) printf "%s", char
|
||||
}
|
||||
}
|
||||
')
|
||||
|
||||
+2
-1
@@ -62,7 +62,8 @@ printf '%s\n' "${PR_BODY}" | awk '
|
||||
next
|
||||
}
|
||||
if (lower ~ /^[ ]{0,3}<details([[:blank:]>])/) {
|
||||
print "<details>"
|
||||
if (lower ~ /[[:blank:]]open([[:blank:]=>]|$)/) print "<details open=\"\">"
|
||||
else print "<details>"
|
||||
next
|
||||
}
|
||||
if (line ~ /^## Tracking[[:space:]]*$/) print "<h2>Tracking</h2>"
|
||||
|
||||
@@ -179,6 +179,12 @@ check_contract_pass "fenced code examples remain available" \
|
||||
check_contract "details cannot collapse provenance" \
|
||||
$'<details><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_pass "open details preserve visible provenance" \
|
||||
$'<details open><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"
|
||||
check_contract "open details inside collapsed details remain hidden" \
|
||||
$'<details><summary>Release notes</summary>\n<details open><summary>Visible only after expansion</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>\n</details>' \
|
||||
"$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