Skip to content
This repository was archived by the owner on Nov 16, 2026. It is now read-only.

fix(build): Keep bounded int64 integers as numbers - #123

Merged
BYK merged 1 commit into
mainfrom
fix/int64-bigint-build
Nov 3, 2026
Merged

BYK merged 1 commit into
mainfrom
fix/int64-bigint-build

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Fixes the Build failure on main (df30eaf, 2cf7aec) and on release/0.445.0 (run):

Error: valibot.gen.ts: unexpected top-level call outside `v.*`: BigInt(0)

Cause

df30eaf brought in the fingerprint query param on the profiling flamegraph endpoint. It is typed integer / format: int64 with bounds 0..4294967295; a UInt32 needs int64 in OpenAPI. For a bounded int64 field, Hey API generates v.minValue(BigInt(0)) / z.coerce.bigint().gte(BigInt(0)), and make-tree-shakeable.mjs fails closed on the top-level BigInt(...) call. The types also disagree: types.gen.ts declares fingerprint?: number, but both validators coerce to bigint.

Fix

normalizeSpec now removes format: int64 from integer schemas when both minimum and maximum are safe integers. Unbounded int64 fields and fields with larger bounds don't change. The field now generates as v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(4294967295)) / z.number().int().gte(0).lte(4294967295), which matches the TS type.

Zod warning

Warning: Installed zod v3.24.0 does not support compatibility version 3, using 3.

Hey API takes the zod version from the minimum of the declared range. The ^3.24.0 peer range wins over the devDependency, and an explicit compatibilityVersion requires >=3.25.0. This PR removes the explicit compatibilityVersion: 3, so Hey API infers major 3 from the peer range. The generated zod.gen.ts is byte-identical and still imports from 'zod'. I left the peer range alone because test/package.test.ts pins it as a consumer contract. Bumping it to ^3.25.0 is the alternative if we'd rather keep the explicit setting.

Verification

Ran locally:

  • Passed: bun run build (no zod warning), bun run typecheck, bun run test:node, npm pack.
  • bun test: everything passed except packs isolated runtime entries…, which hit bun's 5s default timeout in my sandbox (about 5.1–5.7s). It passes with --timeout 30000 and passed once at 4.66s, so I think the sandbox is just slow and this change isn't the cause.

via @BYK.

--

View Session in Sentry

The spec now types the profiling flamegraph `fingerprint` query param as
int64 with UInt32 bounds. Hey API turns bounded int64 fields into
`BigInt(...)` calls in the Valibot and Zod schemas, which
make-tree-shakeable rejects, and coerces them to bigint while the SDK
types them as number. Drop int64 when both bounds are safe integers.

Also let Hey API infer Zod 3 output from the peer range instead of
pinning compatibilityVersion, which warned because it expects zod >=3.25.

Co-Authored-By: BYK <[email protected]>
@BYK
BYK merged commit 4e76d3b into main Nov 3, 2026
10 checks passed
@BYK
BYK deleted the fix/int64-bigint-build branch November 3, 2026 22:15
@betegon betegon mentioned this pull request Nov 5, 2026
8 of 39 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant