test(git-tools): cover rollup curl mock behavior
This commit is contained in:
33
docs/scratchpads/git-wrapper-rollup-20260526.md
Normal file
33
docs/scratchpads/git-wrapper-rollup-20260526.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Git Wrapper Rollup — 2026-05-26
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
Consolidate pending Mosaic wrapper fixes after `mosaic update` reported the local framework package was already current (`@mosaicstack/mosaic 0.0.30`) but the installed `~/.config/mosaic/tools` wrappers still lacked the open Gitea/Woodpecker wrapper patches.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
Roll up the open wrapper-related Gitea PR branches into one integration branch:
|
||||||
|
|
||||||
|
- PR #513: `pr-ci-wait.sh` stdin collision fix.
|
||||||
|
- PR #518: Gitea PR metadata/merge preflight hardening.
|
||||||
|
- PR #521: Gitea merge fallback + unsafe PR-number rejection.
|
||||||
|
- PR #522: Woodpecker credential/pagination fixes and CI Postgres service collision fix.
|
||||||
|
- PR #523: explicit Gitea repo/login args and `eval` removal for PR/issue creation.
|
||||||
|
|
||||||
|
## Conflict resolutions
|
||||||
|
|
||||||
|
- Kept array-based command construction where possible instead of reintroducing `eval`.
|
||||||
|
- Kept explicit `--repo OWNER/REPO --login mosaicstack` Gitea arguments for `tea` calls.
|
||||||
|
- Combined PR merge API fallback behavior from metadata hardening and empty-identity fallback branches.
|
||||||
|
- Preserved numeric PR-number validation for `pr-merge.sh`.
|
||||||
|
|
||||||
|
## Verification checklist
|
||||||
|
|
||||||
|
- `bash -n` on changed shell scripts.
|
||||||
|
- Wrapper smoke checks from a clean worktree.
|
||||||
|
- Gitea PR verification after push.
|
||||||
|
- CI status checked through Gitea/Woodpecker.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
`mosaic update` did not install these fixes because the package registry still reports `@mosaicstack/mosaic 0.0.30` as current. The source patches must merge/release before normal framework update will carry them.
|
||||||
@@ -37,16 +37,40 @@ set -euo pipefail
|
|||||||
printf 'curl %q ' "$@" >> "$PR_MERGE_TEST_LOG"
|
printf 'curl %q ' "$@" >> "$PR_MERGE_TEST_LOG"
|
||||||
printf '\n' >> "$PR_MERGE_TEST_LOG"
|
printf '\n' >> "$PR_MERGE_TEST_LOG"
|
||||||
args=" $* "
|
args=" $* "
|
||||||
|
out_file=""
|
||||||
|
write_code=false
|
||||||
|
prev=""
|
||||||
|
for arg in "$@"; do
|
||||||
|
if [[ "$prev" == "-o" ]]; then
|
||||||
|
out_file="$arg"
|
||||||
|
prev=""
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ "$arg" == "-o" ]]; then
|
||||||
|
prev="-o"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [[ "$arg" == "-w" ]]; then
|
||||||
|
write_code=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
emit_response() {
|
||||||
|
local body="$1"
|
||||||
|
if [[ -n "$out_file" ]]; then
|
||||||
|
printf '%s' "$body" > "$out_file"
|
||||||
|
else
|
||||||
|
printf '%s' "$body"
|
||||||
|
fi
|
||||||
|
if [[ "$write_code" == true ]]; then
|
||||||
|
printf '200'
|
||||||
|
fi
|
||||||
|
}
|
||||||
if [[ "$args" == *"/api/v1/repos/mosaicstack/stack/pulls/123"* && "$args" != *"/api/v1/repos/mosaicstack/stack/pulls/123/merge"* ]]; then
|
if [[ "$args" == *"/api/v1/repos/mosaicstack/stack/pulls/123"* && "$args" != *"/api/v1/repos/mosaicstack/stack/pulls/123/merge"* ]]; then
|
||||||
cat <<'JSON'
|
emit_response '{"number":123,"title":"mock","state":"open","user":{"login":"tester"},"head":{"ref":"feature/mock"},"base":{"ref":"main"},"labels":[],"assignees":[],"html_url":"https://git.mosaicstack.dev/mosaicstack/stack/pulls/123","mergeable":true}'
|
||||||
{"number":123,"title":"mock","state":"open","user":{"login":"tester"},"head":{"ref":"feature/mock"},"base":{"ref":"main"},"labels":[],"assignees":[],"html_url":"https://git.mosaicstack.dev/mosaicstack/stack/pulls/123","mergeable":true}
|
|
||||||
JSON
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if [[ "$args" == *"-X POST"* && "$args" == *"/api/v1/repos/mosaicstack/stack/pulls/123/merge"* ]]; then
|
if [[ "$args" == *"-X POST"* && "$args" == *"/api/v1/repos/mosaicstack/stack/pulls/123/merge"* ]]; then
|
||||||
cat <<'JSON'
|
emit_response '{"merged":true,"message":"mock merge complete"}'
|
||||||
{"merged":true,"message":"mock merge complete"}
|
|
||||||
JSON
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "unexpected curl invocation: $*" >&2
|
echo "unexpected curl invocation: $*" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user