From 43b3759ce2b4ac2d5004785e3c5ec8a4bd15ba64 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Tue, 26 May 2026 15:02:04 -0500 Subject: [PATCH] test(git-tools): cover rollup curl mock behavior --- .../git-wrapper-rollup-20260526.md | 33 +++++++++++++++++ .../git/test-pr-merge-gitea-empty-uid.sh | 36 +++++++++++++++---- 2 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 docs/scratchpads/git-wrapper-rollup-20260526.md diff --git a/docs/scratchpads/git-wrapper-rollup-20260526.md b/docs/scratchpads/git-wrapper-rollup-20260526.md new file mode 100644 index 0000000..5cd9ac5 --- /dev/null +++ b/docs/scratchpads/git-wrapper-rollup-20260526.md @@ -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. diff --git a/packages/mosaic/framework/tools/git/test-pr-merge-gitea-empty-uid.sh b/packages/mosaic/framework/tools/git/test-pr-merge-gitea-empty-uid.sh index d64aa0e..ef299d5 100755 --- a/packages/mosaic/framework/tools/git/test-pr-merge-gitea-empty-uid.sh +++ b/packages/mosaic/framework/tools/git/test-pr-merge-gitea-empty-uid.sh @@ -37,16 +37,40 @@ set -euo pipefail printf 'curl %q ' "$@" >> "$PR_MERGE_TEST_LOG" printf '\n' >> "$PR_MERGE_TEST_LOG" 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 - cat <<'JSON' -{"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 + 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}' exit 0 fi if [[ "$args" == *"-X POST"* && "$args" == *"/api/v1/repos/mosaicstack/stack/pulls/123/merge"* ]]; then - cat <<'JSON' -{"merged":true,"message":"mock merge complete"} -JSON + emit_response '{"merged":true,"message":"mock merge complete"}' exit 0 fi echo "unexpected curl invocation: $*" >&2