fix(attributes): attach the auto filter in the batch creation path - #967
Conversation
createAttributes() is the third public path that creates attributes, and it was the only one that never attached the type-named filter listed in Database::ATTRIBUTE_FILTER_TYPES. createAttribute() and createCollection() both attach it before validating. The attribute validator requires that filter to be present, so a datetime, point, linestring, polygon, vector or object attribute created through the batch path was rejected outright with "Attribute of type: datetime requires the following filters: datetime". Had validation let it through, the value would have been stored without the encode/decode the other two paths apply — a datetime written as +05:00 would never have been normalised to +00:00. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
What
createAttributes()is the third public path that creates attributes, and it was the only one that never attached the type-named filter listed inDatabase::ATTRIBUTE_FILTER_TYPES.createAttribute()andcreateCollection()both attach it before validating.This adds the same guard to the batch path, right after the "Missing attribute key" check.
Why it matters
The attribute validator requires that filter to be present, so a
datetime,point,linestring,polygon,vectororobjectattribute created through the batch path was rejected outright:Had validation let it through, the value would have been stored without the encode/decode the other two paths apply — a datetime written as
+05:00would never have been normalised to+00:00.Test
testCreateAttributesAddingAutoFiltercreates a datetime attribute viacreateAttributes(), writes a+05:00offset and asserts it reads back normalised to+00:00. It skips on adapters withoutCapability::BatchCreateAttributes.Verified it is a real regression test — with the
src/change reverted it fails on the validator error above, and passes with the fix.Verification
composer lint(Pint, PSR-12)🤖 Generated with Claude Code