Skip to content

Commit 92134c3

Browse files
committed
minor #1112 Add validation job to verify bridges are in splitsh.json (OskarStark)
This PR was merged into the main branch. Discussion ---------- Add validation job to verify bridges are in `splitsh.json` | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | -- | License | MIT Commits ------- dbf9cdc Add validation job to verify bridges are in splitsh.json
2 parents 6f6f8a9 + dbf9cdc commit 92134c3

File tree

2 files changed

+68
-2
lines changed

2 files changed

+68
-2
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
#
3+
# Validates that all bridge directories are configured in splitsh.json.
4+
#
5+
# Usage: validate-bridge-splitsh.sh <bridge_type> <bridge_path>
6+
#
7+
# Arguments:
8+
# bridge_type Type of bridge (e.g., "store", "tool") - used in output messages
9+
# bridge_path Path pattern to bridge directories (e.g., "src/store/src/Bridge/*")
10+
#
11+
# Example:
12+
# validate-bridge-splitsh.sh store "src/store/src/Bridge/*"
13+
# validate-bridge-splitsh.sh tool "src/agent/src/Bridge/*"
14+
15+
set -e
16+
17+
BRIDGE_TYPE="${1:?Bridge type is required (e.g., store, tool)}"
18+
BRIDGE_PATH="${2:?Bridge path pattern is required (e.g., src/store/src/Bridge/*)}"
19+
20+
SPLITSH_FILE="splitsh.json"
21+
22+
if [[ ! -f "$SPLITSH_FILE" ]]; then
23+
echo "::error::splitsh.json not found"
24+
exit 1
25+
fi
26+
27+
ERRORS=0
28+
29+
echo "Validating ${BRIDGE_TYPE} bridges (${BRIDGE_PATH})..."
30+
for bridge_dir in ${BRIDGE_PATH}/; do
31+
if [[ ! -d "$bridge_dir" ]]; then
32+
continue
33+
fi
34+
35+
bridge_name=$(basename "$bridge_dir")
36+
# Remove trailing /* from bridge_path and append bridge_name
37+
base_path="${BRIDGE_PATH%/*}"
38+
expected_path="${base_path}/${bridge_name}"
39+
40+
# Check if the path exists in splitsh.json
41+
if ! jq -e --arg path "$expected_path" 'any(.subtrees[]; . == $path or (type == "object" and .prefixes[0].from == $path))' "$SPLITSH_FILE" > /dev/null 2>&1; then
42+
echo "::error file=$SPLITSH_FILE::${BRIDGE_TYPE} bridge '$bridge_name' at '$expected_path' is not configured in splitsh.json"
43+
ERRORS=$((ERRORS + 1))
44+
else
45+
echo "$bridge_name: configured in splitsh.json"
46+
fi
47+
done
48+
49+
if [[ $ERRORS -gt 0 ]]; then
50+
echo ""
51+
echo "::error::Found $ERRORS ${BRIDGE_TYPE} bridge(s) missing from splitsh.json"
52+
exit 1
53+
fi
54+
55+
echo ""
56+
echo "All ${BRIDGE_TYPE} bridges are correctly configured in splitsh.json!"

.github/workflows/validation.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@ on:
55
paths:
66
- 'src/*/src/Bridge/**/composer.json'
77
- 'src/ai-bundle/config/options.php'
8+
- 'splitsh.json'
89
- '.github/workflows/validation.yaml'
910
- '.github/scripts/validate-bridge-naming.sh'
11+
- '.github/scripts/validate-bridge-splitsh.sh'
1012
pull_request:
1113
paths:
1214
- 'src/*/src/Bridge/**/composer.json'
1315
- 'src/ai-bundle/config/options.php'
16+
- 'splitsh.json'
1417
- '.github/workflows/validation.yaml'
1518
- '.github/scripts/validate-bridge-naming.sh'
19+
- '.github/scripts/validate-bridge-splitsh.sh'
1620

1721
concurrency:
1822
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1923
cancel-in-progress: true
2024

2125
jobs:
2226
validate_stores:
23-
name: Store Bridge Naming
27+
name: Store Bridges
2428
runs-on: ubuntu-latest
2529
steps:
2630
- name: Checkout
@@ -29,12 +33,18 @@ jobs:
2933
- name: Validate store bridge naming conventions
3034
run: .github/scripts/validate-bridge-naming.sh store "src/store/src/Bridge/*" src/ai-bundle/config/options.php
3135

36+
- name: Validate store bridges are in splitsh.json
37+
run: .github/scripts/validate-bridge-splitsh.sh store "src/store/src/Bridge/*"
38+
3239
validate_tools:
33-
name: Tool Bridge Naming
40+
name: Tool Bridges
3441
runs-on: ubuntu-latest
3542
steps:
3643
- name: Checkout
3744
uses: actions/checkout@v6
3845

3946
- name: Validate tool bridge naming conventions
4047
run: .github/scripts/validate-bridge-naming.sh tool "src/agent/src/Bridge/*"
48+
49+
- name: Validate tool bridges are in splitsh.json
50+
run: .github/scripts/validate-bridge-splitsh.sh tool "src/agent/src/Bridge/*"

0 commit comments

Comments
 (0)