IBX-12530: Rebuilt DatabaseSchemaHook on SchemaBuilderInterface instead of a raw-file reimplementation - #43
Merged
Conversation
…-file reimplementation Previously imported schema.yaml files listed by SchemaFilesProviderInterface via LegacySchemaImporter -- a test-only mechanism that never actually dispatched SchemaBuilderEvent, so any package's own event subscriber (e.g. one deriving its schema from Doctrine ORM entity mappings instead of a schema.yaml file) was never exercised by integration tests at all. Now calls SchemaBuilderInterface::buildSchema() directly -- the same production code ibexa:install's legacy path uses -- and applies the resulting Schema's SQL directly, since the test database is always freshly created. No per-package schema file list needed. Only registered when DoctrineSchemaBundle is actually present (detected in IbexaTestCoreBundle::build(), which runs against the real, shared container -- unlike Extension::load(), which runs against a temporary per-extension copy MergeExtensionConfigurationPass uses to avoid cross-extension leakage, so sibling bundles' extensions never show up there). Not registered by IbexaTestKernel by default; a consuming package must register it itself to use this hook.
This was referenced Sep 8, 2026
Merged
Steveb-p
force-pushed
the
database-schema-hook-schema-builder
branch
2 times, most recently
from
September 9, 2026 08:05
fd30e2d to
49c7ccd
Compare
Steveb-p
force-pushed
the
database-schema-hook-schema-builder
branch
from
September 9, 2026 09:18
49c7ccd to
2e50eac
Compare
…chema-file provider chain Registering only DoctrineSchemaBundle isn't enough: core's own schema contribution comes from IbexaRepositoryInstallerBundle's BuildSchemaSubscriber, not IbexaCoreBundle, so without it the SchemaBuilderEvent produces every package's tables but none of core's. Verified against ibexa/cart, which failed on a missing ezcontentclass_attribute_ml until that bundle was added. SchemaFilesProviderInterface and its whole chain (SchemaFilesKernelMethodProvider, SchemaFilesParameterProvider, SchemaFilesProviderChain, and the ibexa.test.schema_files parameter) existed solely to feed DatabaseSchemaHook, which no longer reads them -- removed. DefaultSchemaFilesProvider stays: IbexaTestKernel::getSchemaFiles() is mandated by IbexaTestKernelInterface and consumed by ibexa/core's own IbexaKernelTestTrait.
Steveb-p
force-pushed
the
database-schema-hook-schema-builder
branch
from
September 9, 2026 10:13
2e50eac to
cf1d81f
Compare
Steveb-p
marked this pull request as ready for review
September 9, 2026 12:00
alongosz
approved these changes
Sep 9, 2026
This was referenced Sep 9, 2026
Steveb-p
added a commit
to ibexa/user
that referenced
this pull request
Sep 9, 2026
ibexa/test-core#43 rebuilds DatabaseSchemaHook on SchemaBuilderInterface::buildSchema() instead of importing raw schema.yaml files, so the test kernel now has to register DoctrineSchemaBundle (which provides SchemaBuilderInterface) and IbexaRepositoryInstallerBundle (which holds core's own BuildSchemaSubscriber).
Steveb-p
added a commit
to ibexa/user
that referenced
this pull request
Sep 9, 2026
Points CI at the branch that rebuilds DatabaseSchemaHook, so this PR's tests can run before that PR merges. Must be removed before merging.
Every kernel extending IbexaTestKernel needs DoctrineSchemaBundle (for SchemaBuilderInterface) and IbexaRepositoryInstallerBundle (for core's own BuildSchemaSubscriber) once DatabaseSchemaHook builds the schema from the event, so registering them here rather than in each of the ~50 consuming packages keeps this from being a breaking change for all of them. Both live in packages test-core already requires: doctrine-schema, and core itself, which is where IbexaRepositoryInstallerBundle lives. They are registered as a pair because IbexaRepositoryInstallerBundle::build() throws without DoctrineSchemaBundle.
Steveb-p
added a commit
to ibexa/user
that referenced
this pull request
Sep 9, 2026
ibexa/test-core#43 rebuilds DatabaseSchemaHook on SchemaBuilderInterface::buildSchema() instead of importing raw schema.yaml files, so the test kernel now has to register DoctrineSchemaBundle (which provides SchemaBuilderInterface) and IbexaRepositoryInstallerBundle (which holds core's own BuildSchemaSubscriber).
Steveb-p
added a commit
to ibexa/user
that referenced
this pull request
Sep 9, 2026
Points CI at the branch that rebuilds DatabaseSchemaHook, so this PR's tests can run before that PR merges. Must be removed before merging.
konradoboza
approved these changes
Sep 9, 2026
Contributor
|
@Steveb-p please create and attach a proper JIRA ticket. |
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
DatabaseSchemaHookused to import rawschema.yamlfiles (listed viaSchemaFilesProviderInterface) throughLegacySchemaImporter— a test-only importer that never dispatchesSchemaBuilderEvent. So any package contributing its schema through that event rather than aschema.yaml(e.g. deriving it from Doctrine ORM mappings viaSchemaTool) was never exercised by integration tests at all, even though the event is exactly whatibexa:install's legacy path relies on in production.It now calls
SchemaBuilderInterface::buildSchema()— the same production code — and applies the resultingSchema's SQL directly, since the test database is always freshly created. A test kernel no longer declares which schema files to load: whatever bundles it registers is what the schema contains.That needs two bundles present:
DoctrineSchemaBundleforSchemaBuilderInterface, andIbexaRepositoryInstallerBundlebecause core's ownBuildSchemaSubscriberlives there rather than inIbexaCoreBundle— without it you get every other package's tables but none of core's. Rather than gate the registration, the hook is registered like any other andRemoveUnsatisfiableHooksPassdrops it when either collaborator is absent. It checks for the services themselves (SchemaBuilderInterface, and RepositoryInstaller'sBuildSchemaSubscriber) rather than for bundle names, and runs at the default compiler-pass priority — beforeAutowirePass, so removing the definition beats autowiring failing on it.SchemaFilesProviderInterfaceand the rest of that chain (SchemaFilesKernelMethodProvider,SchemaFilesParameterProvider,SchemaFilesProviderChain, and theibexa.test.schema_filesparameter) only ever existed to feed this hook, so they're gone.DefaultSchemaFilesProviderstays:IbexaTestKernel::getSchemaFiles()is still mandated byIbexaTestKernelInterface, andibexa/core'sIbexaKernelTestTrait::loadSchema()reads it when a test calls it explicitly.Downstream packages each need a small follow-up (register the two bundles, drop their own
*SchemaFilesProvider); those land separately. #44 builds on this to letBootstrapperaccept a non-Ibexa kernel, reusing the same pass for the other built-in hooks.For QA:
Checked against four packages spanning the range of Bootstrapper setups, each with its explicit schema file list removed:
ibexa/activity-logbootstrap(), 1 schema fileibexa/taxonomyschema.yamlat allibexa/cartibexa/order-managementThe order-management difference is worth a look: the event-driven schema additionally contains
ibexa_user_invitationsandibexa_user_invitations_assignments(plus indexes and FK). Those come fromibexa/user's subscriber, andIbexaUserBundleis registered in that test kernel — the hand-maintained file list had just never included it. Diff was one-directional in both packages: nothing the file list produced went missing.Also confirmed the pass behaves both ways: a full kernel keeps all four hooks, and
ibexa/doctrine-migrations' minimal kernel (noibexa/coreat all) drops every one of them and still boots.