Skip to content

finding(types,docs): BaseSchema.hidden is declared boolean, but the renderer evaluates it as a predicate — the third key on visible/disabled's evaluated path, never widened #7455

Description

@claude

Found while correcting BaseSchema.hidden's JSDoc for #7088. Filed unassigned and out of that card's scope: #7088's ruling is comment-level with Clause ② no, and this is a change to the declared type surface, which is the kind of thing #4580 needed a ruling for.

The claim

packages/types/src/base.ts declares:

hidden?: boolean;

content/docs/api/schema-reference.md states the same thing as behaviour:

| hidden | boolean | Inverse of visible. Boolean only — unlike visible, this key takes no expression. |

What the renderer does

SchemaRenderer.tsx's shouldHide chain does not read this key as a boolean either. It calls the same evaluator every other leg calls:

if (hasDeclaredPredicate(newSchema.hidden)) {
  return evaluateVisibilityPredicate(newSchema.hidden, 'hidden');
}

and predicate strings on hidden are already pinned as working, in packages/react/src/__tests__/SchemaRenderer.hiddenDeclaredGate.test.tsx:

  • it('an expression-valued hidden keeps its verdict, both ways')hidden: '${data.status === "draft"}' hides, hidden: '${data.published}' does not;
  • it('a non-empty CEL envelope keeps its verdict, both ways')hidden: { dialect: 'cel', source: 'true' } hides.

So the declaration under-reports a shipped, tested capability, and the docs row states the under-report as a fact about behaviour.

Why this is the same defect twice already fixed next door

visible carried exactly this asymmetry until objectui#4581 widened it to boolean | string, on the evidence that the renderer evaluates rather than reads it. disabled carried it until #4580 ruling Q3-A widened it on the identical evidence. base.ts's own JSDoc for both keys now records that reasoning in full — and both blocks note the sibling *On key exists for the same reason, which is the argument that was NOT taken to mean the base key should stay boolean.

hidden is the third key on that evaluated path and the only one still declared boolean-only, with hiddenOn as its sibling. The two earlier widenings also record that fixtures had been casting past the declaration; the pins above pass arbitrary values through a Record cast, so the same pressure is present here.

Not decided here

Whether to widen hidden to boolean | string (with the zod mirror and the docs row following), or to keep the narrow declaration deliberately and correct the docs row to describe the shipped behaviour instead. The two produce different diffs and different published surfaces:

Either way the declaration, the docs row and the pins should end up saying one thing; today they say two.

Refs #7088 · #4581 · #4580 · #3955.

Generated by Claude Code


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

domain:specobjectui spec stream: fix lands on packages/types, schema corpus or spec pin coupling — spec lanepm:dispatchedpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions