Skip to content

chore(deps): bump @juspay/rescript-bindgen to ^1.4.0-beta.0 + regenerate (@tag variants) - #139

Merged
jagguji merged 2 commits into
mainfrom
chore/bindgen-1.4.0-beta.0
Aug 6, 2026
Merged

chore(deps): bump @juspay/rescript-bindgen to ^1.4.0-beta.0 + regenerate (@tag variants)#139
jagguji merged 2 commits into
mainfrom
chore/bindgen-1.4.0-beta.0

Conversation

@jagguji

@jagguji jagguji commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Bumps @juspay/rescript-bindgen to ^1.4.0-beta.0 and regenerates.

The beta ships juspay/rescript-bindgen#168 (issues #167/#169): a nested discriminated union now maps to a @tag variant instead of a flattened record.

Changes — 6 files, +37/−50

DataTableTypes.rowAnimationConfig — record → @tag variant:

@tag("transitionType")
type rowAnimationConfig =
  | @as("bezier") Bezier({enterDuration: float, enterOffset: float, duration: float, bezier: (float, float, float, float)})
  | @as("spring") Spring({enterDuration: float, enterOffset: float, stiffness: float, damping: float, mass: float})

This closes the binding half of #134. The crash shape no longer compiles:

let bad: DataTableTypes.rowAnimationConfig = Bezier({enterDuration: 0.32, enterOffset: 12.0})
Some required record fields are missing: duration bezier.

Previously {transitionType: Bezier} with no curve compiled fine and took the DataTable down inside useLayoutEffect. That is now a compile error rather than something the runtime guard in juspay/blend-design-system#1653 has to absorb.

MenuV2Types.menuV2FlatRow — 6 %identity externals and 3 per-arm records → one matchable variant, retiring 3 ⚪ loose type_: string fields. Reading an arm was an unchecked cast; it is now compiler-verified.

BlendDesignSystemBindings.flattenMenuV2Groups returns the variant. Shared types 3360 → 3356.

Verification

check result
npm run generate exit 0
components 226 · ✅ 219 usable · 🔍 7 review · 🛑 0 broken — unchanged
npm run build 305 modules compile
vs #138 src/ byte-identical to the pkg.pr.new build of #168 tested there

That last row matters: the published beta reproduces exactly what was reviewed and tested pre-release, so nothing changed between the PR build and the tag.

Runtime is the flat object blend reads, with the real lowercase tag:

{ transitionType: "bezier", enterDuration: 0.32, enterOffset: 12, duration: 0.4,
  bezier: [0.32, 0.72, 0, 1] }

Pattern matching compiles to a bare cfg.transitionType === "bezier" — no wrapper, no coercion.

⚠️ Breaking for consumers

Both types change shape.

// rowAnimationConfig — before
{enterDuration: 0.32, enterOffset: 12.0, transitionType: Bezier}
// after
Bezier({enterDuration: 0.32, enterOffset: 12.0, duration: 0.4, bezier: (0.32, 0.72, 0.0, 1.0)})

MenuV2Types.MenuV2FlatRow.t and its from*/as* externals are gone — replace the casts with a switch.

Pattern matching needs the type in scope or the constructors won't resolve:

let f = (cfg: DataTableTypes.rowAnimationConfig) =>
  switch cfg {
  | Bezier({duration}) => ...
  | Spring({stiffness}) => ...
  }

Without the annotation: "The variant constructor Bezier can't be found." Normal ReScript behaviour for a variant from another module, but it is the first thing anyone will hit.

Known issue in this beta — not triggered by blend

A self-referential discriminated union recurses without bound in the generator and the component is dropped from the output entirely, with only an extract-error line:

type TreeNode = { kind: 'leaf'; value: string }
              | { kind: 'branch'; children: TreeNode[]; label: string }
[bindgen] skipped: Tree(extract-error: Maximum call stack size exceeded)

Verified still present in 1.4.0-beta.0 (it was flagged during review of #168 and shipped anyway). On bindgen 1.3.0 the same input produces a degraded-but-present binding, so this is a regression.

blend is unaffected: it has recursive types (MenuItemType.subMenu) and discriminated unions (MenuV2FlatRow), but never both in one type. Nothing in this regeneration is impacted — which is also why a green result here is not evidence the bug is gone. Worth tracking before promoting this beta to latest.

Notes

🤖 Generated with Claude Code

jagguji and others added 2 commits August 6, 2026 19:39
1.4.0-beta.0 ships #167/#169: a nested discriminated union now maps to a
`@tag` variant instead of a flattened record.

  - DataTableTypes.rowAnimationConfig: record -> @tag variant. Closes the
    binding half of #134 — `Bezier` can no longer be
    constructed without its curve, so the DataTable crash is now a compile
    error rather than something the library's runtime guard has to absorb.
  - MenuV2Types.menuV2FlatRow: 6 `%identity` externals + 3 per-arm records
    -> one matchable variant; retires 3 `⚪ loose` `type_` fields. Reading an
    arm was an unchecked cast; it is now compiler-verified.
  - BlendDesignSystemBindings.flattenMenuV2Groups returns the variant.
  - 3360 -> 3356 shared types.

Buckets unchanged: 226 components, 219 usable, 7 review, 0 broken. All 305
modules compile. src/ is byte-identical to the pkg.pr.new build of #168 that
was tested in #138, so the published beta reproduces exactly what was reviewed.

BREAKING for consumers of both types — `rowAnimationConfig` is no longer a
record, and `MenuV2FlatRow.t` with its from*/as* externals is gone.

Known issue in this beta, NOT triggered by blend: a self-referential
discriminated union (`type T = {kind:'leaf',…} | {kind:'branch', children: T[]}`)
recurses without bound and the component is dropped from the output with only
an `extract-error` line. blend has recursive types (MenuItemType.subMenu) and
discriminated unions (MenuV2FlatRow) but never both in one type, so nothing
here is affected. Verified still present in 1.4.0-beta.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`git add -A` in the bump commit swept in `.claude/worktrees/feat+figma-code-connect`
as an embedded-repository gitlink (mode 160000). That is local Claude Code
state, not repository content, and a gitlink is unusable to anyone cloning.

Net effect across the branch is nil — the squash merge sees only the intended
6 files.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jagguji
jagguji merged commit 32ef2a5 into main Aug 6, 2026
6 checks passed
jagguji added a commit that referenced this pull request Aug 12, 2026
…ate (#142)

1.4.0-beta.1 is eight correctness fixes on top of beta.0. Two of them close
defects this repo has already been bitten by:

  - #171 constructor-name collisions put the WRONG string on the wire. ReScript
    scopes variant constructors per module, so two enums in one *Types.res could
    both define `Value`; where the expected type isn't known ReScript silently
    binds the last definition. In blend this hit HighchartsSharedTypes.Point
    ("point" vs "Point" — Highcharts treats these as case-sensitive) and broke
    the portal dashboard migration (#133). 16 collision groups are now renamed by
    their owning type; 145 same-value collisions are reported, not renamed.
  - #170 self-referential discriminated unions crashed extraction and the
    affected components vanished from the output with no report entry. This was
    called out as a known issue when #139 landed beta.0; it is fixed here.

Also #175 (void/undefined leaves map to unit, not a dead string), #186 (views
modules were write-only for some arms — 95 readers added), #181, #177, and the
entry-lifecycle fixes #179/#180/#182.

Regenerated against the current pin, @juspay/blend-design-system@0.0.37, so this
diff is the bindgen delta alone with no blend changes mixed in.

Buckets unchanged: 226 components, 219 usable, 7 review, 0 broken. Same 7
components in review as before. 3356 -> 3365 shared types. All 305 modules
compile; rescript format -c is clean.

Typing strictly improves — 362 `⚪ loose` fields removed, 0 added:
  - 330 were TS `undefined` and 18 were `void`, both emitted as a dead `string`;
    they are now `unit`. Anything passed there never reached the library.
  - 10 were `ColumnDefinition<T>` degraded to `'a`, now the real
    `columnDefinition_t` (#177 — two instantiations of one generic are two
    types, instead of one record that lied about both).
  - 3 single string literals became polyvars (`[#flex]`, `[#center]`, `[#auto]`).
`⚠️ REVIEW` placeholders unchanged at 93.

Runtime wire format is provably unchanged: the multiset of `@as("...")` literals
across src/ is byte-identical before and after, except `@as("type")` 225 -> 235,
which is the 10 new per-arm ColumnDefinition records. No emitted string moved.

BREAKING at ReScript call sites only, never at runtime:
  - Renamed collision constructors, e.g. HighchartsSharedTypes `Solid` ->
    `SolidStyleValue`/`SolidShapeValue`, `Point` -> `PointConstructorType`/
    `PointObjectScope`/`PointPointArray`, DataTableTypes `DateRange` ->
    `DateRangeColumnType`/`DateRangeTypeType`/`DateRangeFilterComponent`.
  - Content-hashed shared type names churn where content changed (14 names
    retired, 51 added) — the hash follows the content by design.
  - Props that were a dead `string` are now `unit` or a polyvar, so a call site
    passing a string there becomes a compile error. That code was already
    broken; this converts a silent runtime no-op into a loud one.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant