Create pull requests from the dev branch to
staging, run the 4-gate review process (BA, Architect,
Security, DevOps), and merge approved PRs. Ensures code quality and
compliance before staging deployment.
Applies to all services in the ADLC pipeline. Covers branch
consolidation, review gate execution, PR creation via gh,
and merge to staging.
bash ~/dev/ops/adlc-v2/scripts/test-runner.sh {project} {service}dev (branch consolidation
done)gh) authenticated~/.claude/agents/Before reviews, all feature branch work must be on
dev:
cd ~/dev/projects/{service}
git stash 2>/dev/null
git checkout dev
FEATURE_BRANCHES=$(git branch | grep 'feat/' | sed 's/^[* ]*//')
for branch in $FEATURE_BRANCHES; do
git merge $branch --no-edit 2>/dev/null
if [ $? -ne 0 ]; then
git merge --abort
echo "CONFLICT: {service}/$branch -- needs manual resolution"
# Post to Slack DM if conflict cannot be resolved
else
git branch -d $branch
fi
done
git push origin dev 2>/dev/nullbash ~/dev/ops/adlc-v2/scripts/test-runner.sh {project} {service}All tests must pass before proceeding. If tests fail, spawn dev fix agent – do not proceed to reviews.
Check memory before spawning:
awk '/MemAvailable/ {print int($2/1024)}' /proc/meminfoIf > 2000MB, spawn all reviews in parallel:
/agent ba "SERVICE: {service}. PROJECT: {project}. Review against spec: ~/dev/specs/{project}/specs/{service}/spec.md. Write JSON report to ~/dev/ops/reviews/{service}/ba-report.json."
/agent architect "SERVICE: {service}. PROJECT: {project}. Write JSON report to ~/dev/ops/reviews/{service}/architect-report.json"
/agent security "SERVICE: {service}. PROJECT: {project}. Write JSON report to ~/dev/ops/reviews/{service}/security-report.json"
/agent devops "SERVICE: {service}. PROJECT: {project}. MODE: review. Write JSON report to ~/dev/ops/reviews/{service}/devops-report.json"
BA=$(python3 -c "import json; print(json.load(open('$HOME/dev/ops/reviews/{service}/ba-report.json'))['status'])")
ARCH=$(python3 -c "import json; print(json.load(open('$HOME/dev/ops/reviews/{service}/architect-report.json'))['verdict'])")
SEC=$(python3 -c "import json; d=json.load(open('$HOME/dev/ops/reviews/{service}/security-report.json')); print(d['status'], d['severity'])")
DEVOPS=$(python3 -c "import json; print(json.load(open('$HOME/dev/ops/reviews/{service}/devops-report.json'))['verdict'])")
echo "BA: $BA | Architect: $ARCH | Security: $SEC | DevOps: $DEVOPS"Gate criteria: | Review | Pass | Fail | |——–|——|——|
| BA | compliant | non-compliant with missing
criteria on done tasks | | Architect | PASS |
FAIL | | Security | clean or
concerns (not HIGH/CRITICAL) | critical or
severity HIGH/CRITICAL | | DevOps | PASS or
PASS_WITH_NOTES | FAIL |
If a review fails: - Read the report JSON for specific findings - Spawn dev fix agent targeting the specific issues - After fix, re-run ONLY the failed review(s), not all 4 - Track retry count – after 3 retries, mark BLOCKED (circuit breaker)
cd ~/dev/projects/{service}
# Handle staging divergence (lesson from 2026-03-22)
git fetch origin staging
git merge origin/staging --no-edit
# Create PR
gh pr create \
--base staging \
--head dev \
--title "feat({service}): {description}" \
--body "$(cat <<'EOF'
## Summary
- {bullet point summary of changes}
## Reviews
- BA: compliant ({X}/{Y} criteria)
- Architect: PASS
- Security: {status} ({severity})
- DevOps: PASS
## Test Results
- {X} unit tests passed
- {Y} integration tests passed
## Review Reports
See ~/dev/ops/reviews/{service}/
EOF
)"PR_NUMBER=$(gh pr list --base staging --head dev --json number -q '.[0].number')
gh pr merge $PR_NUMBER --mergeCLI="$HOME/dev/ops/adlc-v2/scripts/cli"
bash $CLI/write-status.sh {service} pr DONE "PR#$PR_NUMBER merged to staging"
bash $CLI/write-pipeline-state.sh {project} {service} PR_MERGED "PR#$PR_NUMBER"gh pr view $PR_NUMBER --json state -q '.state' returns
MERGEDgit log origin/staging --oneline -3~/dev/ops/reviews/{service}/cat ~/dev/ops/outputs/{service}-pr.statusIf a PR was merged with issues: 1. Identify the merge commit:
git log origin/staging --oneline -5 2. Create a revert PR:
git revert {merge_commit} && gh pr create --base staging --title "revert: {service} PR#{number}"
3. Re-run the failed review to confirm the issue 4. Fix and create a new
PR
~/dev/ops/reviews/{service}/~/dev/ops/adlc-v2/scripts/cli/write-review.sh