Skip to content

Commit bda7191

Browse files
committed
[Store][ChromaDb] Split ChromaDb store as dedicated package
Similar to how tools were split in the Agent component, this extracts the ChromaDb store into its own standalone package with: - Independent composer.json with proper dependencies - Dedicated test suite with phpunit.xml.dist - Standard package files (LICENSE, README.md, CHANGELOG.md) - GitHub integration files for subtree split workflow
1 parent 65d9895 commit bda7191

File tree

17 files changed

+262
-9
lines changed

17 files changed

+262
-9
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Validate Store Bridges
2+
3+
on:
4+
push:
5+
paths:
6+
- 'src/store/src/Bridge/**/composer.json'
7+
- 'src/ai-bundle/config/options.php'
8+
- '.github/workflows/validate-store-bridges.yaml'
9+
pull_request:
10+
paths:
11+
- 'src/store/src/Bridge/**/composer.json'
12+
- 'src/ai-bundle/config/options.php'
13+
- '.github/workflows/validate-store-bridges.yaml'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
validate:
21+
name: Validate Store Bridge Naming
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v5
26+
27+
- name: Validate store bridge naming conventions
28+
run: |
29+
#!/bin/bash
30+
set -e
31+
32+
ERRORS=0
33+
34+
# Find all store bridges with composer.json
35+
for composer_file in src/store/src/Bridge/*/composer.json; do
36+
if [[ ! -f "$composer_file" ]]; then
37+
continue
38+
fi
39+
40+
# Get the bridge directory name (e.g., ChromaDb)
41+
bridge_dir=$(dirname "$composer_file")
42+
bridge_name=$(basename "$bridge_dir")
43+
44+
# Get the package name from composer.json
45+
package_name=$(jq -r '.name' "$composer_file")
46+
47+
# Expected package name format: symfony/ai-{lowercase-with-dashes}-store
48+
# Convert PascalCase to kebab-case (e.g., ChromaDb -> chroma-db)
49+
expected_kebab=$(echo "$bridge_name" | sed 's/\([a-z]\)\([A-Z]\)/\1-\2/g' | tr '[:upper:]' '[:lower:]')
50+
expected_package="symfony/ai-${expected_kebab}-store"
51+
52+
if [[ "$package_name" != "$expected_package" ]]; then
53+
echo "::error file=$composer_file::Package name '$package_name' does not match expected '$expected_package' for bridge '$bridge_name'"
54+
ERRORS=$((ERRORS + 1))
55+
else
56+
echo "✓ $bridge_name: package name '$package_name' is correct"
57+
fi
58+
59+
# Check options.php for the config key (should be lowercase without dashes/underscores)
60+
expected_config_key=$(echo "$bridge_name" | tr '[:upper:]' '[:lower:]')
61+
options_file="src/ai-bundle/config/options.php"
62+
63+
if [[ -f "$options_file" ]]; then
64+
# Look for ->arrayNode('configkey') under the store section
65+
if ! grep -q "->arrayNode('$expected_config_key')" "$options_file"; then
66+
echo "::error file=$options_file::Missing or incorrect config key for bridge '$bridge_name'. Expected '->arrayNode('$expected_config_key')' in store configuration"
67+
ERRORS=$((ERRORS + 1))
68+
else
69+
echo "✓ $bridge_name: config key '$expected_config_key' found in options.php"
70+
fi
71+
fi
72+
done
73+
74+
if [[ $ERRORS -gt 0 ]]; then
75+
echo ""
76+
echo "::error::Found $ERRORS naming convention violation(s)"
77+
exit 1
78+
fi
79+
80+
echo ""
81+
echo "All store bridge naming conventions are valid!"

demo/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ext-ctype": "*",
99
"ext-gd": "*",
1010
"ext-iconv": "*",
11-
"codewithkyrian/chromadb-php": "^0.4.0",
11+
"symfony/ai-chroma-db-store": "@dev",
1212
"league/commonmark": "^2.7.1",
1313
"mrmysql/youtube-transcript": "^0.0.5",
1414
"php-http/discovery": "^1.20",

deptrac.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ deptrac:
6464
- name: StoreComponent
6565
collectors:
6666
- type: classLike
67-
value: Symfony\\AI\\Store.*
67+
value: ^Symfony\\AI\\Store\\(?!Bridge\\).*
68+
- name: ChromaDbStore
69+
collectors:
70+
- type: classLike
71+
value: Symfony\\AI\\Store\\Bridge\\ChromaDb\\.*
6872
ruleset:
6973
AgentComponent:
7074
- PlatformComponent
@@ -101,6 +105,9 @@ deptrac:
101105
PlatformComponent: ~
102106
StoreComponent:
103107
- PlatformComponent
108+
ChromaDbStore:
109+
- StoreComponent
110+
- PlatformComponent
104111
# Baseline of known violations to be skipped for now
105112
skip_violations:
106113
Symfony\AI\Platform\Bridge\Anthropic\TokenOutputProcessor: [Symfony\AI\Agent\OutputProcessorInterface, Symfony\AI\Agent\Output]

examples/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"ext-pdo": "*",
2727
"ext-redis": "*",
2828
"async-aws/bedrock-runtime": "^1.1",
29-
"codewithkyrian/chromadb-php": "^0.4.0",
29+
"symfony/ai-chroma-db-store": "@dev",
3030
"codewithkyrian/transformers": "^0.6.2",
3131
"doctrine/dbal": "^3.3|^4.0",
3232
"google/auth": "^1.47",

src/ai-bundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"symfony/string": "^7.3|^8.0"
3232
},
3333
"require-dev": {
34-
"codewithkyrian/chromadb-php": "^0.2.1|^0.3|^0.4",
34+
"symfony/ai-chroma-db-store": "@dev",
3535
"google/auth": "^1.47",
3636
"mongodb/mongodb": "^1.21|^2.0",
3737
"phpstan/phpstan": "^2.1",

src/ai-bundle/src/AiBundle.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,10 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
10331033
}
10341034

10351035
if ('chromadb' === $type) {
1036+
if (!ContainerBuilder::willBeAvailable('symfony/ai-chroma-db-store', ChromaDbStore::class, ['symfony/ai-bundle'])) {
1037+
throw new RuntimeException('ChromaDB store configuration requires "symfony/ai-chroma-db-store" package. Try running "composer require symfony/ai-chroma-db-store".');
1038+
}
1039+
10361040
foreach ($stores as $name => $store) {
10371041
$definition = new Definition(ChromaDbStore::class);
10381042
$definition
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Tests export-ignore
2+
/phpunit.xml.dist export-ignore
3+
/.git* export-ignore
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Please do not submit any Pull Requests here. They will be closed.
2+
---
3+
4+
Please submit your PR here instead:
5+
https://github.com/symfony/ai
6+
7+
This repository is what we call a "subtree split": a read-only subset of that main repository.
8+
We're looking forward to your PR there!
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Close Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
run:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: superbrothers/close-pull-request@v3
12+
with:
13+
comment: |
14+
Thanks for your Pull Request! We love contributions.
15+
16+
However, you should instead open your PR on the main repository:
17+
https://github.com/symfony/ai
18+
19+
This repository is what we call a "subtree split": a read-only subset of that main repository.
20+
We're looking forward to your PR there!
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
vendor/
2+
composer.lock
3+
phpunit.xml
4+
.phpunit.result.cache

0 commit comments

Comments
 (0)