Skip to content

Conversation

@OskarStark
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
Docs? no
Issues Fixes #1075
License MIT

The options.php file was importing Distance enums from optional store bridge packages (postgres-store and redis-store) unconditionally. This caused errors when these packages weren't installed since PHP tries to resolve imports at parse time.

The fix uses string values for the distance configuration instead of enum references, and converts them to enums in AiBundle.php only after verifying the package is installed via willBeAvailable().

@carsonbot carsonbot added AI Bundle Issues & PRs about the AI integration bundle Bug Something isn't working Status: Needs Review labels Dec 8, 2025
@OskarStark OskarStark force-pushed the OskarStark/fix-store-deps-1075 branch 2 times, most recently from f5b7a84 to e22fa7f Compare December 8, 2025 10:03
The options.php file was importing Distance enums from optional store bridge
packages (postgres-store and redis-store) unconditionally. This caused errors
when these packages weren't installed since PHP tries to resolve imports at
parse time.

The fix uses string values for the distance configuration instead of enum
references, and converts them to enums in AiBundle.php only after verifying
the package is installed via willBeAvailable().
@OskarStark OskarStark force-pushed the OskarStark/fix-store-deps-1075 branch from e22fa7f to ca96627 Compare December 8, 2025 10:04
@xprojects-de
Copy link
Contributor

xprojects-de commented Dec 8, 2025

Why do we still need the Require-Dev packages?
EDIT: OK used in the AiBundle. It´s ok

@OskarStark
Copy link
Contributor Author

Yes for the tests

->info('Distance metric to use for vector similarity search')
->enumFqcn(PostgresDistance::class)
->defaultValue(PostgresDistance::L2)
->values(['cosine', 'inner_product', 'l1', 'l2'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only issue I see here is the fact that if a new case is added/removed in PostgresDistance, this config won't be up-to-date with it.
It will require to update the values (and add a conflict in the composer json ?).

But I don't see better solution for now. Unless removing the values restrictions and doing the value validation

  • either in the AiBundle.php
  • either in a callback here (but I'm not sure if it will avoid the unresolved enum...)

I wonder how it's dealed in other symfony packages, this should not be the first enum in an optional dependency isn't it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR welcome if you find something. To unblock, I merge this one in the current state.

@OskarStark OskarStark merged commit a5a34a8 into symfony:main Dec 8, 2025
15 checks passed
@OskarStark OskarStark deleted the OskarStark/fix-store-deps-1075 branch December 8, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Bundle Issues & PRs about the AI integration bundle Bug Something isn't working Status: Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AI Bundle] Unresolved dependencies

4 participants