Skip to content

Commit 7932b65

Browse files
sjarmakclaude
andcommitted
feat: create SG mirrors for MCP-unique tasks + add mirror aliases
Created 4 new sg-benchmarks mirrors at pinned versions: - sg-benchmarks/numpy (numpy/numpy @ v2.2.2) - sg-benchmarks/scipy (scipy/scipy @ v1.15.1) - sg-benchmarks/grafana (grafana/grafana @ v11.4.0, 9 docs stripped for push protection) - sg-benchmarks/prometheus (prometheus/prometheus @ v3.2.1) Added mirror aliases to _SG_MIRROR_ALIASES in all 8 oracle_checks.py files so agent answers using sg-benchmarks/ names resolve correctly. Mirror script: scripts/create_mcp_expansion_mirrors.sh Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7fb94b1 commit 7932b65

File tree

9 files changed

+174
-0
lines changed

9 files changed

+174
-0
lines changed

benchmarks/ccb_mcp_compliance/ccx-compliance-051/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

benchmarks/ccb_mcp_compliance/ccx-compliance-057-ds/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

benchmarks/ccb_mcp_incident/ccx-incident-034/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

benchmarks/ccb_mcp_incident/ccx-incident-037/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

benchmarks/ccb_mcp_migration/ccx-migration-025/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

benchmarks/ccb_mcp_migration/ccx-migration-027/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

benchmarks/ccb_mcp_platform/ccx-platform-094/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

benchmarks/ccb_mcp_platform/ccx-platform-100/tests/oracle_checks.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"sg-benchmarks/grafana-mimir": "grafana/mimir",
4343
"sg-benchmarks/prisma-prisma": "prisma/prisma",
4444
"sg-benchmarks/lodash": "lodash/lodash",
45+
"sg-benchmarks/numpy": "numpy/numpy",
46+
"sg-benchmarks/scipy": "scipy/scipy",
47+
"sg-benchmarks/grafana": "grafana/grafana",
48+
"sg-benchmarks/prometheus": "prometheus/prometheus",
4549
}
4650

4751

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#!/usr/bin/env bash
2+
# Create and populate sg-benchmarks mirrors for the 8 new MCP-unique tasks.
3+
#
4+
# Two phases:
5+
# Phase 1: Create NEW repos on sg-benchmarks (gh repo create)
6+
# Phase 2: Clone upstream at pinned tag, orphan commit, force-push
7+
#
8+
# Repos handled:
9+
# - numpy/numpy @ v2.2.2 → sg-benchmarks/numpy (NEW)
10+
# - scipy/scipy @ v1.15.1 → sg-benchmarks/scipy (NEW)
11+
# - grafana/grafana @ v11.4.0 → sg-benchmarks/grafana (NEW)
12+
# - prometheus/prometheus @ v3.2.1 → sg-benchmarks/prometheus (NEW)
13+
#
14+
# Already at correct version (no action needed):
15+
# - expressjs/express @ 4.21.1 → sg-benchmarks/expressjs-express (EXISTS)
16+
# - etcd-io/etcd @ v3.5.17 → sg-benchmarks/etcd-io-etcd (EXISTS)
17+
#
18+
# Usage: bash scripts/create_mcp_expansion_mirrors.sh [--dry-run]
19+
set -euo pipefail
20+
21+
DRY_RUN=false
22+
if [[ "${1:-}" == "--dry-run" ]]; then
23+
DRY_RUN=true
24+
echo "=== DRY RUN MODE — no repos will be created or pushed ==="
25+
echo ""
26+
fi
27+
28+
SG_ORG="sg-benchmarks"
29+
WORK_DIR=$(mktemp -d)
30+
trap 'rm -rf "$WORK_DIR"' EXIT
31+
32+
SUCCESS=0
33+
FAILED=0
34+
SKIPPED=0
35+
36+
# Format: "upstream_repo tag sg_name description"
37+
# Only repos that need NEW mirrors (not already at correct version)
38+
REPOS=(
39+
"numpy/numpy v2.2.2 numpy Mirror of numpy/numpy at v2.2.2"
40+
"scipy/scipy v1.15.1 scipy Mirror of scipy/scipy at v1.15.1"
41+
"grafana/grafana v11.4.0 grafana Mirror of grafana/grafana at v11.4.0"
42+
"prometheus/prometheus v3.2.1 prometheus Mirror of prometheus/prometheus at v3.2.1"
43+
)
44+
45+
for entry in "${REPOS[@]}"; do
46+
# Parse: first 3 space-delimited fields, rest is description
47+
github_repo=$(echo "$entry" | awk '{print $1}')
48+
tag=$(echo "$entry" | awk '{print $2}')
49+
sg_name=$(echo "$entry" | awk '{print $3}')
50+
description=$(echo "$entry" | awk '{$1=$2=$3=""; print}' | sed 's/^ *//')
51+
52+
echo ""
53+
echo "=== ${github_repo} @ ${tag}${SG_ORG}/${sg_name} ==="
54+
55+
# Phase 1: Create repo if it doesn't exist
56+
if gh api "repos/${SG_ORG}/${sg_name}" --jq '.full_name' &>/dev/null; then
57+
echo " Repo ${SG_ORG}/${sg_name} already exists — will force-push"
58+
else
59+
echo " Creating repo ${SG_ORG}/${sg_name}..."
60+
if $DRY_RUN; then
61+
echo " [DRY RUN] Would create: gh repo create ${SG_ORG}/${sg_name} --public --description '${description}'"
62+
else
63+
if ! gh repo create "${SG_ORG}/${sg_name}" --public --description "${description}" 2>&1; then
64+
echo " ERROR: Failed to create repo ${SG_ORG}/${sg_name}"
65+
FAILED=$((FAILED + 1))
66+
continue
67+
fi
68+
echo " Created ${SG_ORG}/${sg_name}"
69+
fi
70+
fi
71+
72+
if $DRY_RUN; then
73+
echo " [DRY RUN] Would clone ${github_repo} at ${tag}, orphan commit, force-push"
74+
SKIPPED=$((SKIPPED + 1))
75+
continue
76+
fi
77+
78+
clone_dir="${WORK_DIR}/clone_${sg_name}"
79+
fresh_dir="${WORK_DIR}/fresh_${sg_name}"
80+
81+
# Phase 2a: Shallow clone at pinned tag
82+
echo " Cloning ${github_repo} at tag ${tag} (shallow)..."
83+
if ! git clone --depth 1 --branch "$tag" "https://github.com/${github_repo}.git" "$clone_dir" 2>&1; then
84+
echo " ERROR: Failed to clone ${github_repo} at tag ${tag}"
85+
FAILED=$((FAILED + 1))
86+
continue
87+
fi
88+
89+
actual_commit=$(git -C "$clone_dir" rev-parse HEAD)
90+
echo " Cloned at commit ${actual_commit:0:12}"
91+
92+
# Phase 2b: Create fresh repo with orphan commit (avoids shallow-pack push errors)
93+
echo " Creating orphan commit..."
94+
mkdir -p "$fresh_dir"
95+
git -C "$fresh_dir" init -b main --quiet 2>&1
96+
rsync -a --exclude='.git' "$clone_dir/" "$fresh_dir/" 2>&1
97+
git -C "$fresh_dir" add -A 2>&1
98+
git -C "$fresh_dir" -c user.email="benchmark@sg-benchmarks.dev" -c user.name="sg-benchmarks" \
99+
commit -m "Mirror ${github_repo} @ ${tag} (${actual_commit:0:8}) — pinned for CCB MCP-unique tasks" --quiet 2>&1
100+
101+
rm -rf "$clone_dir"
102+
103+
# Phase 2c: Force-push
104+
echo " Force-pushing to ${SG_ORG}/${sg_name}..."
105+
git -C "$fresh_dir" remote add sg-target "https://github.com/${SG_ORG}/${sg_name}.git" 2>&1
106+
if ! git -C "$fresh_dir" push sg-target main --force 2>&1; then
107+
echo " ERROR: Failed to push to ${SG_ORG}/${sg_name}"
108+
rm -rf "$fresh_dir"
109+
FAILED=$((FAILED + 1))
110+
continue
111+
fi
112+
113+
echo " SUCCESS: ${SG_ORG}/${sg_name} pinned to ${tag} (${actual_commit:0:8})"
114+
SUCCESS=$((SUCCESS + 1))
115+
rm -rf "$fresh_dir"
116+
done
117+
118+
echo ""
119+
echo "=============================================="
120+
echo "Mirror creation complete!"
121+
echo "=============================================="
122+
echo "Succeeded: $SUCCESS"
123+
echo "Failed: $FAILED"
124+
echo "Skipped: $SKIPPED"
125+
echo ""
126+
echo "Already at correct version (no action taken):"
127+
echo " - sg-benchmarks/expressjs-express @ 4.21.1"
128+
echo " - sg-benchmarks/etcd-io-etcd @ v3.5.17"
129+
echo ""
130+
if [ "$SUCCESS" -gt 0 ]; then
131+
echo "Wait ~10-30 minutes for Sourcegraph indexing, then verify with:"
132+
echo ' python3 -c "'
133+
echo ' mirrors = {'
134+
echo ' "sg-benchmarks/numpy": ("numpy/f2py/_src_pyf.py", "numpy.distutils"),'
135+
echo ' "sg-benchmarks/scipy": ("tools/generate_f2pymod.py", "numpy.distutils"),'
136+
echo ' "sg-benchmarks/grafana": ("pkg/services/featuremgmt/registry.go", "auditLoggingAppPlatform"),'
137+
echo ' "sg-benchmarks/prometheus": ("config/config.go", "TLSConfig"),'
138+
echo ' }'
139+
echo ' for m, (f, kw) in mirrors.items():'
140+
echo ' print(f" keyword_search: repo:^github.com/{m}$ file:{f} {kw}")'
141+
echo ' "'
142+
fi

0 commit comments

Comments
 (0)