Skip to content

Codegen sync API and all enums#2845

Merged
andrewbranch merged 5 commits intomicrosoft:mainfrom
andrewbranch:api-codegen
Feb 20, 2026
Merged

Codegen sync API and all enums#2845
andrewbranch merged 5 commits intomicrosoft:mainfrom
andrewbranch:api-codegen

Conversation

@andrewbranch
Copy link
Member

This PR replaces the sync API types, implementation, tests, and benchmarks with ones generated from their async counterparts.

It also generates all the TypeScript enums used in the packages from the Go source.

Copilot AI review requested due to automatic review settings February 19, 2026 22:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive code generation infrastructure to automatically generate the sync API and all TypeScript enums from their source counterparts. The sync API is generated from async API source files using directive-based and AST-based transformations, while TypeScript enums are generated from Go source constants. This significantly reduces manual maintenance burden and ensures consistency between implementations.

Changes:

  • Implements sync API codegen from async source using directives (@sync:, @sync-skip) and AST transforms (removing async/await, unwrapping Promise<T>)
  • Implements enum generation from Go const blocks to TypeScript, with topological sorting to handle forward references
  • Reorganizes file structure: moves enums to src/enums/, removes src/base/ directory, consolidates imports using wildcard patterns

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated no comments.

Show a summary per file
File Description
_packages/api/scripts/generate-sync.ts New codegen script that transforms async API to sync using directives and AST manipulation
Herebyfile.mjs Adds generate:enums task to parse Go const blocks and generate TypeScript enums with dependency resolution
_packages/api/src/sync/api.ts Generated sync API with async/await removed, Promise types unwrapped
_packages/api/src/sync/types.ts Generated sync type definitions
_packages/api/src/sync/client.ts Sync client with socket check, synchronous request methods
_packages/api/src/enums/*.ts Generated enum files from Go source with auto-generated headers
_packages/api/package.json Updated with generation scripts, wildcard import maps for enums
_packages/api/test/sync/*.ts Generated sync tests and benchmarks from async source
.github/workflows/ci.yml Added enum generation and sync API generation steps to CI
internal/api/callbackfs.go Refactored null check logic to be more concise

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@andrewbranch andrewbranch added this pull request to the merge queue Feb 20, 2026
Merged via the queue into microsoft:main with commit 8b0c5d3 Feb 20, 2026
20 checks passed
@andrewbranch andrewbranch deleted the api-codegen branch February 20, 2026 16:55
Copilot AI pushed a commit that referenced this pull request Feb 25, 2026
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.

3 participants