Repository navigation
fix: do not treat falsy distinct field as no fields - #159
Open
thetutlage wants to merge 1 commit into
Open
thetutlage wants to merge 1 commit into
thetutlage wants to merge 1 commit into
Conversation
isDistinct used a truthy check to detect missing fields, so a numeric field like 0 fell into the no-fields path. That path compares items by reference, which meant duplicate objects were never reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
helpers.isDistinctusedif (!fields)to detect that no fields were provided. A falsy field like0therefore took the no-fields path, which compares items by reference, so duplicate objects were never reported:The check is now explicit (
undefined,nullor''). An empty string still means "no fields", so its behavior does not change.Numeric fields are outside the TypeScript signature, but JavaScript callers and
vine.helpers.isDistinctcan still reach this path. Numeric object keys are already supported (see theallow object keys to be numericregression test).Notes
vine.createand fails without the fix.tests/integration/validator.spec.tsonly, since both append a test to the same group. Keep both tests when resolving.🤖 Generated with Claude Code