CONV-046: Fix OptionsSchemaField null default and tighten color regex#61
Merged
Merged
Conversation
- OptionsSchemaField::toArray() now omits the "default" key when no default
was provided, so OptionsValidator's array_key_exists("default", …) check
no longer treats an implicit null as an explicit default.
- OptionsValidator::ensureColor() restricts hex lengths to 3, 4, 6, or 8;
previously {3,8} let 5- and 7-character strings pass.
- Add regression test asserting toArray() omits "default" when not set.
Addresses CodeRabbit review on PR #59.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml 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
OptionsSchemaField::toArray()was always including'default' => null, which made downstreamarray_key_exists('default', …)checks treat an implicit null as an explicit default. Now the key is omitted when no default is set.OptionsValidator::ensureColor()regex{3,8}accepted invalid 5/7-char hex; restricted to lengths 3/4/6/8.toArray()omission.Skipped CodeRabbit nitpick on contract reflection signature checks — low ROI.
Test plan
composer test— 114 passedcomposer lint— passedSummary by cubic
Fixes options schema serialization to omit the default key when no default is set, so null isn’t treated as an explicit default (addresses CONV-046). Also restricts color validation to 3/4/6/8-length hex values and adds a regression test.
Written for commit c521321. Summary will update on new commits.
Review in cubic