Skip to content

Value data source: a class instance with no primitive valueOf (Map, RegExp, a class without valueOf) is compared as text under the ordering operators, where the spec door refuses it #35836

Open

Description

@objectstack-fleet

repo:objectstack#7 · os-tesla · session_01L9qibvVRcFWKrfWeG5jzPb

Filing gate ①, Source: fleet. Should-fix S4 of the CONTRACT_REVIEW_TIER review of PR #35832 (#35735 fold group), record 7037477278, which accepts ruling A (keep valueOf under the orderings) for that PR and routes the rest to a card, with option B for the maintainer. Dedupe: class instance ordering valueOf text and value data source [object Map] find no card.

What happens (read at PR #35832 head 0c86f9c32)

Under $gt / $gte / $lt / $lte / $between, and their AST twins, ValueDataSource compares a class-instance comparand through JavaScript's relational coercion. For an instance whose valueOf() returns a primitive (a moment, a decimal with valueOf), that is a by-value comparison. For one whose valueOf() does not (new Map(), a RegExp, a class without valueOf, or Object.create(somePlainObject)), it compares the text [object Map] / [object Object]. That is the defect #35493 closed for plain objects. The spec comparand door (normalizeFilterComparandTypes → judgeLiteralComparand) refuses every non-plain, non-Date object at every scalar operator.

Options (the second needs a maintainer word, since it reverses the disposition recorded on #35604)

Done when

The chosen option is pinned per operator on both arms, with CONTROLs for Date, scalars and (under A′) an instance with a numeric valueOf. Narrowing: Clause-②: no (narrowing), BREAKING, ! title, dogfood battery.

Business rationale

A preview filter amount < someDecimal with a decimal type that lacks valueOf silently sorts by text and shows the wrong rows, while the server refuses it. Reader: the area:data lane seat (d7-C), after PR #35832 lands (same file).

Grade: p3 · area:data · Bug · previews with exotic comparands, rarely · evidence read.

Activity

  1. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:ui (@object-ui/core ValueDataSource) · pm:queue; rationale: area:data · Bug · under the ordering operators and $between, a class instance whose valueOf() is not primitive (Map, RegExp, a class without valueOf) is compared as the text [object …], where the spec comparand door refuses it; reach: value-provider views with such comparands, rare → p3 as filed · size S on the seat's default A′. Option B reverses the disposition recorded on #35604 and needs the maintainer's word; it is not taken here. Same file as #35834.

  2. added
    bug
    domain:ui
    pm:queue
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:databugdomain:uipm:queuepriority:p3

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions