Added 'FieldClassifier' with nine F-row predicates and rewrote field-expansion pipeline.#359
Merged
AlexSkrypnyk merged 2 commits intomasterfrom Apr 28, 2026
Merged
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
Introduces
FieldClassifierandFieldClassifierInterfacewith nine F-row predicates (F1-F9) that classify every Drupal field by origin (base / configurable / bundle-storage-backed) and storage profile (standard / computed / custom).Core::expandEntityFields()is rewritten to route fields through the classifier — only F1 (base standard), F5 (configurable), and F9 (bundle-storage-backed) rows enter the handler pipeline, which eliminates the silent mis-classification of computed and non-writable base fields.DefaultHandleris tightened to throw a clear, actionable error for any field type whose schema is not single-columnvalue, enforcing a loud-failure policy so broken handlers surface immediately. A full F-row truth table is documented insrc/Drupal/Driver/Core/Field/README.md.Stack
This PR is #2 of 4 in a stacked series:
feature/driver-interface→master(Tightened 'DrupalDriverInterface' contract and 'DrupalDriver' visibility. #358)feature/field-classifier→feature/driver-interfacefeature/field-coverage→feature/field-classifierfeature/ext-smoke-ci→feature/field-coverageMerge in order. This PR depends on #358.
Changes
Field classifier
FieldClassifierInterfacewith nine predicates:fieldIsBaseStandard,fieldIsBaseComputed,fieldIsBaseCustom,fieldIsConfigurableStandard,fieldIsConfigurableComputed,fieldIsConfigurableCustom,fieldIsBundleStorageBacked,fieldIsConfigurable,fieldIsBase.FieldClassifierimplementing the interface, backed byEntityFieldManagerInterface.Coreholds a lazily createdFieldClassifierInterfaceinstance exposed viaclassifier()onCoreInterface; subclasses overridecreateFieldClassifier()to inject a version-specific implementation.Pipeline rewrite
Core::expandEntityFields()no longer accepts$base_fields; bundle is resolved automatically viaresolveBundleFromEntity()(bundle key →step_bundle→ entity type id).Core::getEntityFieldTypes()signature changed fromarray $base_fields = []to?string $bundle = NULL; the method now gates inclusion on classifier predicates (F1 OR F5 OR F9) rather than a hard-coded storage-config check.Core::expandEntityBaseFields()removed (was a thin wrapper; callers useexpandEntityFields()directly).Core::detectBaseFieldsOnEntity()replaced byresolveBundleFromEntity().Core::fieldExists()andCore::fieldIsBase()removed; useclassifier()predicates instead.Core::getFieldHandler()now passes the resolved bundle togetEntityFieldTypes().DefaultHandlerloud-failure policyDefaultHandler::expand()now throws\RuntimeExceptionfor any field whose storage schema is not a singlevaluecolumn, surfacing handler gaps immediately rather than silently returning garbage.EntityReferenceRevisionsHandlerentity_reference_revisionsfields (paragraphs, media, and other revision-tracked references); mirrorsEntityReferenceHandlerbut targetstarget_revision_idalongsidetarget_id.Documentation
src/Drupal/Driver/Core/Field/README.mdwith the F-row truth table, column definitions, and guidance on which rows enter the pipeline.UPGRADING.mdupdated with migration notes for removed predicates (fieldExists,fieldIsBase), the removedFieldCapabilityInterface, and the changedgetEntityFieldTypes()signature.Removed
src/Drupal/Driver/Capability/FieldCapabilityInterface.php— contract superseded by classifier predicates.CoreInterfaceno longer extendsFieldCapabilityInterface.DrupalDriverInterfaceno longer re-exportsfieldExists/fieldIsBase.Tests
FieldClassifierTest(221 lines, unit, all nine predicates).EntityReferenceRevisionsHandlerTest(163 lines, unit).DefaultHandlerTestwith loud-failure coverage.CoreEntityCreateModerationStateKernelTest— round-trip kernel test for F3 (writable computed base fieldmoderation_state).CoreFieldMethodsTestandCoreEntityMethodsKernelTestfor the new signatures.Before / After