Files
lmxopcua/scripts/queue/finish-pr.sh
Joseph Doherty 2d07d716dc Recover stashed driver-gaps work from pre-v2-mxgw-merge working tree
Captures uncommitted work that lived in the working tree on
v2-mxgw-integration but was orthogonal to the migration. Stashed
during the v2-mxgw merge to master (2026-04-30) and replanted here on
a feature branch off master so it's git-visible rather than living in
the stash list.

Two distinct buckets:

1. Tracked fixture/config refinements (10 files, ~36 lines):
   - scripts/e2e/test-opcuaclient.ps1
   - src/ZB.MOM.WW.OtOpcUa.Admin/appsettings.json
   - 5 docker-compose.yml under tests/.../IntegrationTests/Docker/
     (AbCip, Modbus, OpcUaClient, S7)
   - 4 fixture .cs files (AbServerFixture, ModbusSimulatorFixture,
     OpcPlcFixture, Snap7ServerFixture)

2. Untracked driver-gaps queue artifacts (~8000 lines):
   - docs/plans/{abcip,ablegacy,focas,opcuaclient,s7,twincat}-plan.md
     — per-driver gap plans
   - docs/featuregaps.md — cross-cutting analysis
   - docs/v2/focas-deployment.md, docs/v2/implementation/focas-simulator-plan.md
   - followup.md — auto/driver-gaps queue follow-ups
   - scripts/queue/ — PR-queue automation tooling (12 files including
     pr-manifest.yaml at 1473 lines)

This commit is a snapshot for recoverability — review and split into
focused PRs (or discard) before merging anywhere downstream.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 08:28:01 -04:00

40 lines
1.7 KiB
Bash

#!/usr/bin/env bash
# Closes the issue (success) or marks failed and reopens for retry.
# Usage:
# finish-pr.sh ISSUE_NUM success PR_NUM
# finish-pr.sh ISSUE_NUM failed REASON_FILE
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "$HERE/lib.sh"
ISSUE="${1:?ISSUE_NUM required}"
RESULT="${2:?success|failed required}"
ARG3="${3:?PR_NUM or REASON_FILE required}"
INPROG=$(python -c "import json; print(json.load(open('$LABEL_MAP'))['queue/in-progress'])")
DONE=$(python -c "import json; print(json.load(open('$LABEL_MAP'))['queue/done'])")
FAILED=$(python -c "import json; print(json.load(open('$LABEL_MAP'))['queue/failed'])")
api_repo DELETE "issues/$ISSUE/labels/$INPROG" >/dev/null || true
case "$RESULT" in
success)
PR_NUM="$ARG3"
api_repo POST "issues/$ISSUE/labels" "{\"labels\":[$DONE]}" >/dev/null
BODY=$(python -c "import json; print(json.dumps({'body':'✅ Auto-loop completed. Merged via PR #$PR_NUM.'}))")
api_repo POST "issues/$ISSUE/comments" "$BODY" >/dev/null
api_repo PATCH "issues/$ISSUE" '{"state":"closed"}' >/dev/null
echo " issue #$ISSUE closed (PR #$PR_NUM merged)"
;;
failed)
REASON_FILE="$ARG3"
REASON=$(cat "$REASON_FILE" 2>/dev/null | head -c 4000 || echo "(no reason file)")
api_repo POST "issues/$ISSUE/labels" "{\"labels\":[$FAILED]}" >/dev/null
BODY=$(python -c "import json,sys; r=open('$REASON_FILE').read()[:4000] if __import__('os').path.exists('$REASON_FILE') else '(no log)'; print(json.dumps({'body':'❌ Auto-loop failed.\n\n\`\`\`\n'+r+'\n\`\`\`'}))")
api_repo POST "issues/$ISSUE/comments" "$BODY" >/dev/null
echo " issue #$ISSUE marked failed (still open for retry)"
;;
*)
echo "unknown result: $RESULT" >&2; exit 1 ;;
esac