Skip to content

Commit 7debdfa

Browse files
committed
minor #1210 [CI] Add bridge type validation and fix message store types (OskarStark)
This PR was merged into the main branch. Discussion ---------- [CI] Add bridge type validation and fix message store types | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | -- | License | MIT Commits ------- 496eb89 Add bridge type validation and fix message store types
2 parents a709229 + 496eb89 commit 7debdfa

File tree

11 files changed

+84
-9
lines changed

11 files changed

+84
-9
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
#
3+
# Validates that all bridges have the correct "type" field in composer.json.
4+
#
5+
# Usage: validate-bridge-type.sh <bridge_type> [component]
6+
#
7+
# Arguments:
8+
# bridge_type Type of bridge (e.g., "store", "tool", "platform", "message-store")
9+
# This determines the expected composer.json type: symfony-ai-{bridge_type}
10+
# component Name of the parent component (e.g., agent, platform, store, chat)
11+
# If not provided, defaults to bridge_type
12+
#
13+
# Example:
14+
# validate-bridge-type.sh store
15+
# validate-bridge-type.sh tool agent
16+
# validate-bridge-type.sh message-store chat
17+
#
18+
# The script builds the bridge path internally as: src/${component}/src/Bridge/*
19+
20+
set -e
21+
22+
BRIDGE_TYPE="${1:?Bridge type is required (e.g., store, tool, platform, message-store)}"
23+
COMPONENT="${2:-$BRIDGE_TYPE}"
24+
BRIDGE_PATH="src/${COMPONENT}/src/Bridge/*"
25+
26+
EXPECTED_TYPE="symfony-ai-${BRIDGE_TYPE}"
27+
ERRORS=0
28+
29+
echo "Validating ${BRIDGE_TYPE} bridges have correct type (${BRIDGE_PATH})..."
30+
echo "Expected type: ${EXPECTED_TYPE}"
31+
echo ""
32+
33+
for composer_file in ${BRIDGE_PATH}/composer.json; do
34+
if [[ ! -f "$composer_file" ]]; then
35+
continue
36+
fi
37+
38+
bridge_dir=$(dirname "$composer_file")
39+
bridge_name=$(basename "$bridge_dir")
40+
41+
actual_type=$(jq -r '.type // empty' "$composer_file")
42+
43+
if [[ -z "$actual_type" ]]; then
44+
echo "::error file=$composer_file::${BRIDGE_TYPE} bridge '$bridge_name' is missing 'type' field in composer.json"
45+
ERRORS=$((ERRORS + 1))
46+
elif [[ "$actual_type" != "$EXPECTED_TYPE" ]]; then
47+
echo "::error file=$composer_file::${BRIDGE_TYPE} bridge '$bridge_name' has incorrect type '$actual_type', expected '$EXPECTED_TYPE'"
48+
ERRORS=$((ERRORS + 1))
49+
else
50+
echo "$bridge_name: type '$actual_type' is correct"
51+
fi
52+
done
53+
54+
if [[ $ERRORS -gt 0 ]]; then
55+
echo ""
56+
echo "::error::Found $ERRORS type validation error(s) in ${BRIDGE_TYPE} bridges"
57+
exit 1
58+
fi
59+
60+
echo ""
61+
echo "All ${BRIDGE_TYPE} bridges have the correct type!"

.github/workflows/validation.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '.github/scripts/validate-bridge-naming.sh'
1111
- '.github/scripts/validate-bridge-splitsh.sh'
1212
- '.github/scripts/validate-bridge-files.sh'
13+
- '.github/scripts/validate-bridge-type.sh'
1314
pull_request:
1415
paths:
1516
- 'src/*/src/Bridge/**/*'
@@ -19,6 +20,7 @@ on:
1920
- '.github/scripts/validate-bridge-naming.sh'
2021
- '.github/scripts/validate-bridge-splitsh.sh'
2122
- '.github/scripts/validate-bridge-files.sh'
23+
- '.github/scripts/validate-bridge-type.sh'
2224

2325
concurrency:
2426
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -41,6 +43,9 @@ jobs:
4143
- name: Validate store bridges have required files
4244
run: .github/scripts/validate-bridge-files.sh store
4345

46+
- name: Validate store bridges have correct type
47+
run: .github/scripts/validate-bridge-type.sh store
48+
4449
validate_tools:
4550
name: Tool Bridges
4651
runs-on: ubuntu-latest
@@ -57,6 +62,9 @@ jobs:
5762
- name: Validate tool bridges have required files
5863
run: .github/scripts/validate-bridge-files.sh tool agent
5964

65+
- name: Validate tool bridges have correct type
66+
run: .github/scripts/validate-bridge-type.sh tool agent
67+
6068
validate_message_stores:
6169
name: Message Store Bridges
6270
runs-on: ubuntu-latest
@@ -73,6 +81,9 @@ jobs:
7381
- name: Validate message store bridges have required files
7482
run: .github/scripts/validate-bridge-files.sh message-store chat
7583

84+
- name: Validate message store bridges have correct type
85+
run: .github/scripts/validate-bridge-type.sh message-store chat
86+
7687
validate_platforms:
7788
name: Platform Bridges
7889
runs-on: ubuntu-latest
@@ -89,3 +100,6 @@ jobs:
89100
- name: Validate platform bridges have required files
90101
run: .github/scripts/validate-bridge-files.sh platform
91102

103+
- name: Validate platform bridges have correct type
104+
run: .github/scripts/validate-bridge-type.sh platform
105+

src/chat/src/Bridge/Cache/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-cache-message-store",
33
"description": "Cache message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

src/chat/src/Bridge/Cloudflare/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-cloudflare-message-store",
33
"description": "Cloudflare KV message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

src/chat/src/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-doctrine-message-store",
33
"description": "Doctrine DBAL message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

src/chat/src/Bridge/Meilisearch/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-meilisearch-message-store",
33
"description": "Meilisearch message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

src/chat/src/Bridge/MongoDb/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-mongo-db-message-store",
33
"description": "MongoDB message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

src/chat/src/Bridge/Pogocache/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-pogocache-message-store",
33
"description": "Pogocache message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

src/chat/src/Bridge/Redis/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-redis-message-store",
33
"description": "Redis message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

src/chat/src/Bridge/Session/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "symfony/ai-session-message-store",
33
"description": "Symfony session message store bridge for Symfony AI Chat",
44
"license": "MIT",
5-
"type": "symfony-ai-chat",
5+
"type": "symfony-ai-message-store",
66
"keywords": [
77
"ai",
88
"bridge",

0 commit comments

Comments
 (0)