Skip to content

packages/sdk/js v2 gen tree does not round-trip: build.ts regenerates ~12k lines of types.gen.ts on main #1148

Description

@ralphstodomingo

What

Running packages/sdk/js/script/build.ts on a clean checkout of main regenerates src/v2/gen/types.gen.ts with a ~12k-line diff (and sdk.gen.ts changes), then fails at its trailing tsc step. The committed v2 gen tree and the output of bun dev generate + codegen have drifted apart.

Why it matters

script/publish.ts runs build.ts inside prepareReleaseFiles() on every release, so what ships in @opencode-ai/sdk/v2 is the regenerated tree — not the reviewed, committed one. Any post-codegen patch (SseFn, and the JSON-parse guard being added in the non-JSON-response PR) is only as reproducible as this tree.

Evidence

Observed while adding a "SDK codegen is reproducible" CI check for the non-JSON-response PR: the patched client/client.gen.ts round-trips byte-for-byte, but types.gen.ts does not, so the check had to be scoped to the patched file. The build's final tsc fails on the regenerated types (e.g. FileSystemEntry no longer exported).

Suggested fix

Regenerate and commit the v2 gen tree from current main, then widen the CI check to git diff --exit-code -- src/v2/gen so it can never drift silently again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions