R3: --body-file <path>/- across body/comment carriers (#1474)
ci/woodpecker/push/publish Pipeline was canceled

Co-authored-by: marcie <[email protected]>
This commit was merged in pull request #1474.
This commit is contained in:
2026-08-29 22:49:20 +00:00
committed by orch-01
parent ba3b854d50
commit ee6c842918
10 changed files with 199 additions and 0 deletions
@@ -161,6 +161,30 @@ rc=0
grep -q "GitHub comment write failed" "$ERR_FILE" || fail "GitHub path: normalized error missing from stderr"
grep -q "^gh issue comment" "$PROBE_LOG" || fail "GitHub path: gh write was not invoked"
# R3 body-file arms (2026-08-29): --body-file <path> and '-' (stdin).
BF_FILE="$WORK_DIR/body.md"
printf 'line one\nline two\n' > "$BF_FILE"
# File loads the body: parse acceptance then credential-class failure
# (sandboxed runner: rc nonzero and NOT 2).
rc=0
run_wrapper_sandboxed -i 5 --body-file "$BF_FILE" >"$OUT_FILE" 2>"$ERR_FILE" || rc=$?
[[ "$rc" -ne 0 ]] || fail "body-file arm unexpectedly succeeded in the sandbox"
[[ "$rc" -ne 2 ]] || fail "body-file arm misclassified credential failure as a usage error"
# Stdin form loads the body the same way.
rc=0
printf 'from stdin' | run_wrapper_sandboxed -i 5 --body-file - >"$OUT_FILE" 2>"$ERR_FILE" || rc=$?
[[ "$rc" -ne 0 && "$rc" -ne 2 ]] || fail "body-file stdin arm rc=$rc (want nonzero, not 2)"
# Mutually exclusive with --body: rc 2.
expect_rc 2 "body-file + body exclusive" -i 5 --body-file "$BF_FILE" -b explicit
expect_stderr "mutually exclusive" "exclusivity message on stderr"
# Missing file: rc 2 naming the path.
expect_rc 2 "missing body file" -i 5 --body-file "$WORK_DIR/nope.md"
expect_stderr "not readable" "missing-file message on stderr"
# 7. No provider contact from any usage-error arm (arm 6b's deliberate gh
# invocation is the only permitted entry in the probe log).
if grep -v '^gh issue comment' "$PROBE_LOG" | grep -q .; then