Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions examples/link-check/scripts/post-link-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ NUMBER="${BASH_REMATCH[3]}"
# findings it answers, and the findings comment stays as it was. Any earlier
# marked comment counts, an earlier all-clear included, so once a pull
# request has had a findings comment every later clean run adds one
# all-clear. An older fullsend edits the earlier comment in place instead;
# see --keep-history below.
# all-clear. An older fullsend edits the earlier comment in place instead.
if [[ "${status}" == "ok" ]]; then
if [[ "${POST_LINK_CHECK_DRY_RUN:-}" == "1" ]]; then
echo "post-link-check: status=ok, nothing to post (dry run: did not check for an earlier link-check comment)" >&2
Expand All @@ -162,36 +161,23 @@ if [[ "${status}" == "ok" ]]; then
# bash 3.2 has no ${var,,}.
help_lower=$(printf '%s\n' "${help_text}" | tr '[:upper:]' '[:lower:]')
only_if_exists_re='^[[:space:]]+--only-if-exists([=[:space:]]|$)'
keep_history_re='^[[:space:]]+--keep-history([=[:space:]]|$)'
has_only_if_exists=0
keep_history_args=()
while IFS= read -r help_line; do
if [[ "${help_line}" =~ ${only_if_exists_re} && "${help_line}" != *deprecated* ]]; then
has_only_if_exists=1
fi
if [[ "${help_line}" =~ ${keep_history_re} && "${help_line}" != *deprecated* ]]; then
keep_history_args=(--keep-history=false)
fi
done <<< "${help_lower}"
if (( ! has_only_if_exists )); then
echo "post-link-check: status=ok, nothing to post (this fullsend has no --only-if-exists; an earlier findings comment, if any, stays until a later run with findings)" >&2
exit 0
fi
# An older fullsend edits the earlier comment in place, and by default
# keeps the replaced text in a collapsed "Previous run" block, so repeated
# clean runs would stack identical blocks: keep_history_args passes
# --keep-history=false there. Since fullsend-ai/fullsend#9399 the flag is
# deprecated with no effect and passing it prints a warning, so it is left
# out when its flag line says "deprecated" or no such line is listed. The
# ${a[@]+...} form expands an empty array safely under set -u on bash 3.2.
printf '**%s**\n\n%s\n' "${summary}" "${comment}" \
| fullsend issues post-comment \
--tracker github \
--project "${REPO}" \
--number "${NUMBER}" \
--marker "${MARKER}" \
--only-if-exists \
${keep_history_args[@]+"${keep_history_args[@]}"} \
--result -
exit 0
fi
Expand Down
66 changes: 16 additions & 50 deletions scripts/example-link-check-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,12 @@ run_post() {
return "${rc}"
}

# The --only-if-exists and --keep-history lines of `fullsend issues
# post-comment --help`, after and before fullsend-ai/fullsend#9399.
NEW_CLI_HELP=' --keep-history deprecated: no effect (every result is posted as a new comment; sticky comments were removed) (default true)
--only-if-exists post only when an earlier comment with this marker exists (for an all-clear that follows earlier findings)'
OLD_CLI_HELP=' --keep-history append previous content as collapsed history blocks (set false to replace in-place) (default true)
--only-if-exists update an existing comment with this marker but never create one (for an all-clear that should replace earlier findings)'
# A fullsend that lists --only-if-exists but not --keep-history; the same
# flag table under a prose line naming --keep-history without "deprecated",
# so only a probe that reads the flag table, not the whole text, leaves the
# flag out; #9399's flag table with the flag marked in capitals; a help
# whose prose names --only-if-exists though its flag table lacks it; and one
# whose flag table marks --only-if-exists deprecated.
NO_KEEP_HISTORY_CLI_HELP=' --only-if-exists post only when an earlier comment with this marker exists (for an all-clear that follows earlier findings)'
PROSE_CLI_HELP="Earlier releases used --keep-history to fold old runs into the comment.
${NO_KEEP_HISTORY_CLI_HELP}"
UPPERCASE_DEPRECATED_CLI_HELP=' --keep-history DEPRECATED: no effect (every result is posted as a new comment; sticky comments were removed) (default true)
--only-if-exists post only when an earlier comment with this marker exists (for an all-clear that follows earlier findings)'
# The --only-if-exists line of `fullsend issues post-comment --help`, after
# and before fullsend-ai/fullsend#9399.
NEW_CLI_HELP=' --only-if-exists post only when an earlier comment with this marker exists (for an all-clear that follows earlier findings)'
OLD_CLI_HELP=' --only-if-exists update an existing comment with this marker but never create one (for an all-clear that should replace earlier findings)'
# A help whose prose names --only-if-exists though its flag table lacks it,
# and one whose flag table marks --only-if-exists deprecated.
PROSE_ONLY_IF_EXISTS_CLI_HELP='Later releases add --only-if-exists for an all-clear after earlier findings.
--dry-run print what would be posted without posting anything'
DEPRECATED_ONLY_IF_EXISTS_CLI_HELP=' --only-if-exists Deprecated: post only when an earlier comment with this marker exists'
Expand All @@ -76,14 +65,12 @@ DEPRECATED_ONLY_IF_EXISTS_CLI_HELP=' --only-if-exists Deprecated: post o
# records its arguments instead of talking to a forge. This is the only way to
# see what the script does on the path that actually posts. The stub answers
# `--help` the way the real CLI does since fullsend-ai/fullsend#9399, where
# every post is a new comment, --only-if-exists posts only after an earlier
# marked comment, and --keep-history is deprecated (passing it prints a
# warning, as the real CLI does). With "edit-in-place-cli" it answers the way
# a fullsend from before #9399 does: --only-if-exists then replaces the
# every post is a new comment and --only-if-exists posts only after an
# earlier marked comment. With "edit-in-place-cli" it answers the way a
# fullsend from before #9399 does: --only-if-exists then replaces the
# earlier comment. With "old-cli" it does NOT list --only-if-exists and fails
# on any post, which is what a runner pinned to a fullsend release older than
# the generator does. "no-keep-history-cli", "prose-cli",
# "uppercase-deprecated-cli", "prose-only-if-exists-cli" and
# the generator does. "prose-only-if-exists-cli" and
# "deprecated-only-if-exists-cli" behave like the default stub with the help
# texts named above. Any other name aborts the test run.
# With "broken-cli:<rc>" the stub's --help itself exits <rc> (127 stands in
Expand All @@ -109,9 +96,6 @@ run_post_live() {
else
local help="${NEW_CLI_HELP}"
case "${cli}" in
no-keep-history-cli) help="${NO_KEEP_HISTORY_CLI_HELP}" ;;
prose-cli) help="${PROSE_CLI_HELP}" ;;
uppercase-deprecated-cli) help="${UPPERCASE_DEPRECATED_CLI_HELP}" ;;
prose-only-if-exists-cli) help="${PROSE_ONLY_IF_EXISTS_CLI_HELP}" ;;
deprecated-only-if-exists-cli) help="${DEPRECATED_ONLY_IF_EXISTS_CLI_HELP}" ;;
new-cli) ;;
Expand All @@ -122,7 +106,7 @@ run_post_live() {
exit 2
;;
esac
printf '#!/usr/bin/env bash\nif [[ "$*" == *--help* ]]; then printf "%%s\\n" "%s"; exit 0; fi\nif [[ "$*" == *--keep-history* ]]; then echo "warning: --keep-history is deprecated and has no effect; every result is posted as a new comment" >&2; fi\nprintf "%%s\\n" "$@" > "%s/args"\ncat > "%s/stdin"\n' "${help}" "${stubdir}" "${stubdir}" > "${stubdir}/fullsend"
printf '#!/usr/bin/env bash\nif [[ "$*" == *--help* ]]; then printf "%%s\\n" "%s"; exit 0; fi\nprintf "%%s\\n" "$@" > "%s/args"\ncat > "%s/stdin"\n' "${help}" "${stubdir}" "${stubdir}" > "${stubdir}/fullsend"
fi
chmod +x "${stubdir}/fullsend"
local rc=0
Expand Down Expand Up @@ -220,19 +204,11 @@ EXPECTED_TARGET_ARGS=$'issues\npost-comment\n--tracker\ngithub\n--project\nfulls
# Since fullsend-ai/fullsend#9399 the all-clear is a new comment and any
# earlier marked comment counts, so each clean run after a findings comment
# delegates again: the script never suppresses a later all-clear itself.
# A fullsend from before #9399 replaces the earlier comment instead, and gets
# --keep-history=false so repeated clean runs do not stack identical
# "Previous run" blocks. A fullsend with #9399 does not: the flag is
# deprecated with no effect there, and passing it prints a warning. Nor does
# a fullsend whose help does not list --keep-history in its flag table, even
# when prose in the help names it, nor one whose flag line says DEPRECATED.

for _cli in new-cli edit-in-place-cli no-keep-history-cli prose-cli uppercase-deprecated-cli; do
if [[ "${_cli}" == "edit-in-place-cli" ]]; then
_expected_flags=$'--only-if-exists\n--keep-history=false\n--result\n-'
else
_expected_flags=$'--only-if-exists\n--result\n-'
fi
# A fullsend from before #9399 replaces the earlier comment instead, and
# gets the same arguments.

_expected_flags=$'--only-if-exists\n--result\n-'
for _cli in new-cli edit-in-place-cli; do
if run_post_live '{"status":"ok","summary":"all good","comment":"All documentation links resolve."}' "${_cli}"; then
if [[ "${LAST_FULLSEND_ARGS}" == *$'issues\npost-comment\n'* && "${LAST_FULLSEND_ARGS}" == *$'--only-if-exists\n'* && "${LAST_FULLSEND_ARGS}" == *$'--marker\n'* ]]; then
pass "ok-status-live-delegates-only-if-exists:${_cli}"
Expand All @@ -249,16 +225,6 @@ for _cli in new-cli edit-in-place-cli no-keep-history-cli prose-cli uppercase-de
else
fail "ok-status-live-sends-the-all-clear-body:${_cli}" "unexpected all-clear body on stdin: ${LAST_FULLSEND_STDIN}"
fi
# Every stub here but the pre-#9399 one is built on the #9399 stub, which
# warns when it is passed --keep-history; the pre-#9399 one never warns,
# so it cannot fail this check and is skipped.
if [[ "${_cli}" != "edit-in-place-cli" ]]; then
if [[ "${LAST_STDERR}" != *"deprecated"* ]]; then
pass "ok-status-live-no-deprecation-warning:${_cli}"
else
fail "ok-status-live-no-deprecation-warning:${_cli}" "fullsend warned about a deprecated flag: ${LAST_STDERR}"
fi
fi
else
fail "ok-status-live-delegates-only-if-exists:${_cli}" "script exited non-zero: ${LAST_STDERR}"
fi
Expand Down
33 changes: 0 additions & 33 deletions scripts/lib/jira-retro-ops.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -933,37 +933,6 @@ forge_parse_originating_url() {
fi
}

# `fullsend issues post-comment` updates a marked comment in place. Older
# CLIs keep the replaced text as a collapsed "Previous run" block unless
# --keep-history=false is passed, which would stack a copy of the previous
# summary on every rerun. fullsend-ai/fullsend#9399, still open, proposes
# deprecating the flag and posting every result as a new comment; once that
# merges, passing the flag prints a warning and has no effect, and each rerun
# adds another summary comment instead of replacing the previous one. The
# flag is therefore passed only when the CLI's flag table lists it without
# "deprecated", which covers a released CLI either way.
# Sets _RETRO_JIRA_KEEP_HISTORY_ARGS in the caller's shell.
_RETRO_JIRA_KEEP_HISTORY_ARGS=()
_retro_jira_keep_history_args() {
_RETRO_JIRA_KEEP_HISTORY_ARGS=()
local help_text line has_flag=0 deprecated=0
if ! help_text=$(fullsend issues post-comment --help 2>&1); then
# A broken CLI fails the post itself, with its own error.
return 0
fi
help_text=$(printf '%s\n' "${help_text}" | tr '[:upper:]' '[:lower:]')
while IFS= read -r line; do
[[ "${line}" =~ ^[[:space:]]+--keep-history([=[:space:]]|$) ]] || continue
has_flag=1
if [[ "${line}" == *deprecated* ]]; then
deprecated=1
fi
done <<< "${help_text}"
if [[ "${has_flag}" -eq 1 && "${deprecated}" -eq 0 ]]; then
_RETRO_JIRA_KEEP_HISTORY_ARGS=(--keep-history=false)
fi
}

_retro_jira_post_comment() {
local repo="$1" number="$2" body="$3"
if [[ -z "${FULLSEND_DIR:-}" ]]; then
Expand All @@ -977,13 +946,11 @@ _retro_jira_post_comment() {
# Jira issue keys are <PROJECT>-<NUMBER>; fullsend's --number expects the numeric suffix.
local num="${number##*-}"
local rc=0
_retro_jira_keep_history_args
_retro_jira_xtrace_off
printf '%s' "${body}" | jira_auth_fullsend fullsend "${JIRA_TOKEN:-}" "${JIRA_USER_EMAIL:-}" \
issues post-comment --tracker jira --fullsend-dir "${FULLSEND_DIR}" \
--project "${repo}" --number "${num}" \
--marker "<!-- fullsend:retro-agent -->" \
${_RETRO_JIRA_KEEP_HISTORY_ARGS[@]+"${_RETRO_JIRA_KEEP_HISTORY_ARGS[@]}"} \
--result - 2>&1 || rc=$?
_retro_jira_xtrace_restore
return "${rc}"
Expand Down
47 changes: 2 additions & 45 deletions scripts/post-retro-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,6 @@ if [[ "\$1" == "issues" ]] && [[ "\$2" == "create" ]]; then
exit 0
fi
if [[ "\$1" == "issues" ]] && [[ "\$2" == "post-comment" ]]; then
if [[ "\$3" == "--help" ]]; then
echo "Usage: fullsend issues post-comment [flags]"
case "\${FULLSEND_MOCK_KEEP_HISTORY:-}" in
supported)
echo " --keep-history append previous content as collapsed history blocks (set false to replace in-place) (default true)"
;;
deprecated)
echo " --keep-history deprecated: no effect (every result is posted as a new comment; sticky comments were removed) (default true)"
;;
esac
exit 0
fi
if [[ -n "\${FULLSEND_MOCK_POST_COMMENT_FAIL:-}" ]]; then
echo "Error: request failed: \${FULLSEND_MOCK_POST_COMMENT_FAIL}" >&2
exit 1
Expand Down Expand Up @@ -3963,38 +3951,7 @@ else
FAILURES=$((FAILURES + 1))
fi

# 27. On a CLI that still keeps sticky-comment history, pass
# --keep-history=false so a rerun replaces the summary instead of stacking
# copies; a CLI that marks the flag deprecated gets no flag. The deprecated
# branch models the shape fullsend-ai/fullsend#9399 (still open) proposes, so
# it pins the detection, not released CLI behaviour.
export FULLSEND_MOCK_KEEP_HISTORY="supported"
ORIGINATING_URL="https://mock.atlassian.net/browse/PROJ-123" \
run_test_stdout "jira/keep-history-supported" \
"${FIXTURE_ONE_PROPOSAL}" \
"Posting summary comment on PROJ#PROJ-123"
if grep -qF -- '--keep-history=false' "${FULLSEND_LOG}" 2>/dev/null; then
echo "PASS: jira/keep-history-supported-flag-passed"
else
echo "FAIL: jira/keep-history-supported-flag-passed — --keep-history=false was not passed"
cat "${FULLSEND_LOG}" 2>/dev/null || true
FAILURES=$((FAILURES + 1))
fi
export FULLSEND_MOCK_KEEP_HISTORY="deprecated"
ORIGINATING_URL="https://mock.atlassian.net/browse/PROJ-123" \
run_test_stdout "jira/keep-history-deprecated" \
"${FIXTURE_ONE_PROPOSAL}" \
"Posting summary comment on PROJ#PROJ-123"
if grep -qF -- '--keep-history' "${FULLSEND_LOG}" 2>/dev/null; then
echo "FAIL: jira/keep-history-deprecated-flag-omitted — deprecated flag was passed"
cat "${FULLSEND_LOG}" 2>/dev/null || true
FAILURES=$((FAILURES + 1))
else
echo "PASS: jira/keep-history-deprecated-flag-omitted"
fi
unset FULLSEND_MOCK_KEEP_HISTORY

# 28. Jira credentials never reach an xtrace line.
# 27. Jira credentials never reach an xtrace line.
JIRA_XTRACE_RUN="${TMPDIR}/run-jira-xtrace"
mkdir -p "${JIRA_XTRACE_RUN}/iteration-1/output"
printf '%s' "${FIXTURE_ONE_PROPOSAL}" > "${JIRA_XTRACE_RUN}/iteration-1/output/agent-result.json"
Expand Down Expand Up @@ -4022,7 +3979,7 @@ else
FAILURES=$((FAILURES + 1))
fi

# 29. A schema-valid proposal body over the CLI's 32 KiB Jira limit is
# 28. A schema-valid proposal body over the CLI's 32 KiB Jira limit is
# truncated, not refused. Each section below is 8160 characters of a two-byte
# character (well inside the schema's 8192-character cap), so the body is
# ~33000 bytes but only ~16500 characters: this pins that the cap is measured
Expand Down
33 changes: 0 additions & 33 deletions scripts/post-retro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1706,37 +1706,6 @@ forge_parse_originating_url() {
fi
}

# `fullsend issues post-comment` updates a marked comment in place. Older
# CLIs keep the replaced text as a collapsed "Previous run" block unless
# --keep-history=false is passed, which would stack a copy of the previous
# summary on every rerun. fullsend-ai/fullsend#9399, still open, proposes
# deprecating the flag and posting every result as a new comment; once that
# merges, passing the flag prints a warning and has no effect, and each rerun
# adds another summary comment instead of replacing the previous one. The
# flag is therefore passed only when the CLI's flag table lists it without
# "deprecated", which covers a released CLI either way.
# Sets _RETRO_JIRA_KEEP_HISTORY_ARGS in the caller's shell.
_RETRO_JIRA_KEEP_HISTORY_ARGS=()
_retro_jira_keep_history_args() {
_RETRO_JIRA_KEEP_HISTORY_ARGS=()
local help_text line has_flag=0 deprecated=0
if ! help_text=$(fullsend issues post-comment --help 2>&1); then
# A broken CLI fails the post itself, with its own error.
return 0
fi
help_text=$(printf '%s\n' "${help_text}" | tr '[:upper:]' '[:lower:]')
while IFS= read -r line; do
[[ "${line}" =~ ^[[:space:]]+--keep-history([=[:space:]]|$) ]] || continue
has_flag=1
if [[ "${line}" == *deprecated* ]]; then
deprecated=1
fi
done <<< "${help_text}"
if [[ "${has_flag}" -eq 1 && "${deprecated}" -eq 0 ]]; then
_RETRO_JIRA_KEEP_HISTORY_ARGS=(--keep-history=false)
fi
}

_retro_jira_post_comment() {
local repo="$1" number="$2" body="$3"
if [[ -z "${FULLSEND_DIR:-}" ]]; then
Expand All @@ -1750,13 +1719,11 @@ _retro_jira_post_comment() {
# Jira issue keys are <PROJECT>-<NUMBER>; fullsend's --number expects the numeric suffix.
local num="${number##*-}"
local rc=0
_retro_jira_keep_history_args
_retro_jira_xtrace_off
printf '%s' "${body}" | jira_auth_fullsend fullsend "${JIRA_TOKEN:-}" "${JIRA_USER_EMAIL:-}" \
issues post-comment --tracker jira --fullsend-dir "${FULLSEND_DIR}" \
--project "${repo}" --number "${num}" \
--marker "<!-- fullsend:retro-agent -->" \
${_RETRO_JIRA_KEEP_HISTORY_ARGS[@]+"${_RETRO_JIRA_KEEP_HISTORY_ARGS[@]}"} \
--result - 2>&1 || rc=$?
_retro_jira_xtrace_restore
return "${rc}"
Expand Down
33 changes: 0 additions & 33 deletions scripts/pre-retro.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1705,37 +1705,6 @@ forge_parse_originating_url() {
fi
}

# `fullsend issues post-comment` updates a marked comment in place. Older
# CLIs keep the replaced text as a collapsed "Previous run" block unless
# --keep-history=false is passed, which would stack a copy of the previous
# summary on every rerun. fullsend-ai/fullsend#9399, still open, proposes
# deprecating the flag and posting every result as a new comment; once that
# merges, passing the flag prints a warning and has no effect, and each rerun
# adds another summary comment instead of replacing the previous one. The
# flag is therefore passed only when the CLI's flag table lists it without
# "deprecated", which covers a released CLI either way.
# Sets _RETRO_JIRA_KEEP_HISTORY_ARGS in the caller's shell.
_RETRO_JIRA_KEEP_HISTORY_ARGS=()
_retro_jira_keep_history_args() {
_RETRO_JIRA_KEEP_HISTORY_ARGS=()
local help_text line has_flag=0 deprecated=0
if ! help_text=$(fullsend issues post-comment --help 2>&1); then
# A broken CLI fails the post itself, with its own error.
return 0
fi
help_text=$(printf '%s\n' "${help_text}" | tr '[:upper:]' '[:lower:]')
while IFS= read -r line; do
[[ "${line}" =~ ^[[:space:]]+--keep-history([=[:space:]]|$) ]] || continue
has_flag=1
if [[ "${line}" == *deprecated* ]]; then
deprecated=1
fi
done <<< "${help_text}"
if [[ "${has_flag}" -eq 1 && "${deprecated}" -eq 0 ]]; then
_RETRO_JIRA_KEEP_HISTORY_ARGS=(--keep-history=false)
fi
}

_retro_jira_post_comment() {
local repo="$1" number="$2" body="$3"
if [[ -z "${FULLSEND_DIR:-}" ]]; then
Expand All @@ -1749,13 +1718,11 @@ _retro_jira_post_comment() {
# Jira issue keys are <PROJECT>-<NUMBER>; fullsend's --number expects the numeric suffix.
local num="${number##*-}"
local rc=0
_retro_jira_keep_history_args
_retro_jira_xtrace_off
printf '%s' "${body}" | jira_auth_fullsend fullsend "${JIRA_TOKEN:-}" "${JIRA_USER_EMAIL:-}" \
issues post-comment --tracker jira --fullsend-dir "${FULLSEND_DIR}" \
--project "${repo}" --number "${num}" \
--marker "<!-- fullsend:retro-agent -->" \
${_RETRO_JIRA_KEEP_HISTORY_ARGS[@]+"${_RETRO_JIRA_KEEP_HISTORY_ARGS[@]}"} \
--result - 2>&1 || rc=$?
_retro_jira_xtrace_restore
return "${rc}"
Expand Down
Loading