Restored 'text', 'text_long', 'file', 'image' field-handler semantics and added type-coverage safety net.#360
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (14)
✨ 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 |
… and added type-coverage safety net.
51b0797 to
2e3e4c3
Compare
|
Code coverage (threshold: 95%) Per-class coverage |
Summary
The v3 field-handler registry introduced a loud-failure policy in
DefaultHandlerfor multi-column field types, but shipped without handlers fortextandtext_long- both multi-column (value/format) types. This caused an immediate regression for any consumer that stubbed those fields.FileHandlerandImageHandleralso lost the 2.x reuse behaviour: they always uploaded a new managed file instead of looking up an existing one by URI or basename, breaking assertions that relied on a stable file ID after pre-creating a managed file. This PR closes both gaps and adds a safety net that prevents the same class of regression from shipping silently in future.Stack
This PR is #3 of 4 in a stacked series:
feature/driver-interface->master(Tightened 'DrupalDriverInterface' contract and 'DrupalDriver' visibility. #358)feature/field-classifier->feature/driver-interface(Added 'FieldClassifier' with nine F-row predicates and rewrote field-expansion pipeline. #359)feature/field-coverage->feature/field-classifierfeature/ext-smoke-ci->feature/field-coverageMerge in order. Depends on #359.
Changes
New handlers -
text/text_longTextHandlerandTextLongHandler- minimal pass-through implementations ofFieldHandlerInterface. Both auto-register via the directory scan inCore::registerDefaultFieldHandlers().TextHandlerTest,TextLongHandlerTest) and kernel round-trip tests (TextHandlerKernelTest,TextLongHandlerKernelTest).FileHandlerreuse refactorresolveExistingFile(string $value): ?object- looks up a managed file by URI (scheme present) or by bare basename (probespublic://thenprivate://). Absolute disk paths (contain/but no scheme) fall through unchanged.uploadAndSave(string $file_path): object- the original upload-and-rename path, now a named method.expand()delegates:$this->resolveExistingFile($file_path) ?? $this->uploadAndSave($file_path).entity_type.managerstub alongsidefile.repository.FileHandlerReuseKernelTestverifies the round-trip - pre-create a file, reference it by URI or basename, assert sametarget_idand exactly one file entity in storage.ImageHandlersubclassImageHandlernow extendsFileHandler(previously extendedAbstractHandler).expand()calls the inheritedresolveExistingFile/uploadAndSavepair, then wraps the result in the image-specifictarget_id/alt/titleshape.ImageHandlerReuseKernelTest).Coverage safety net -
FieldTypeCoverageKernelTestfield_typeplugin in the loaded install.DefaultHandler-safe (singlevaluecolumn), or (c) listed in a documentedSKIPmap.testDefaultHandlerIsNotRegistered()guards againstDefaultHandlerbeing inadvertently added to the registry (which would mask gaps in the coverage check itself).README / field-handler table
textandtext_longalongside existing compound types.FileHandler/ImageHandler.FieldTypeCoverageKernelTest.Before / After