Skip to content

chore(cli): consolidate small CliError migration branches#15013

Open
FedeZara wants to merge 2 commits intomainfrom
FedeZara/refactor/cli-error-small-packages
Open

chore(cli): consolidate small CliError migration branches#15013
FedeZara wants to merge 2 commits intomainfrom
FedeZara/refactor/cli-error-small-packages

Conversation

@FedeZara
Copy link
Copy Markdown
Contributor

@FedeZara FedeZara commented Apr 14, 2026

Description

Consolidates CliError migrations for multiple smaller CLI packages into a single PR: @fern-api/init, @fern-api/project-loader, @fern-api/auth, @fern-api/api-workspace-validator, @fern-api/workspace-loader, @fern-api/docs-resolver, @fern-api/fern-definition-formatter, @fern-api/ir-to-jsonschema, @fern-api/login, @fern-api/api-workspace-commons, and others.

This is one of the package migration PRs that follow the error classification system introduced in #14749.

Changes Made

Assigned typed error codes across call sites in multiple smaller CLI packages. Also added missing CliError imports to all files that reference CliError.Code.

Error codes used

Code Usage
CONFIG_ERROR Missing fern directory, invalid project structure, workspace configuration errors
AUTH_ERROR Organization membership checks, user authentication, login flows
NETWORK_ERROR API call failures, Auth0 device authorization errors
VALIDATION_ERROR API workspace validation, docs validation
PARSE_ERROR OpenAPI/AsyncAPI file loading failures, schema parsing errors
REFERENCE_ERROR Unresolvable API references in docs
VERSION_ERROR Version existence checks

Files touched (grouped by area)

  • Init: createFernDirectoryAndOrganization.ts, initializeWithMintlify.ts, initializeWithReadme.ts
  • Project loader: loadProject.ts
  • Auth: orgs/createOrganizationIfDoesNotExist.ts, users/getCurrentUser.ts
  • Workspace: api-workspace-validator/validateAPIWorkspaceAndLogIssues.ts, loader/loadAsyncAPIFile.ts, loader/loadOpenAPIFile.ts
  • Docs: docs-resolver/ApiReferenceNodeConverter.ts
  • Fern definition: formatter/formatWorkspace.ts, ir-to-jsonschema/JsonSchemaConverterContext.ts
  • Login: auth0-login/doAuth0DeviceAuthorizationFlow.ts, askToLogin.ts
  • Commons: api-workspace-commons/checkVersionExists.ts

Testing

  • Existing tests pass (pnpm test, excluding e2e and pre-existing environment failures)

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@FedeZara FedeZara changed the title refactor(cli): rename FernCliError to TaskAbortSignal chore(cli): consolidate small CliError migration branches Apr 14, 2026
@FedeZara FedeZara force-pushed the FedeZara/refactor/cli-error-small-packages branch 4 times, most recently from 37df560 to fd464b8 Compare April 15, 2026 12:22
@FedeZara FedeZara force-pushed the FedeZara/refactor/cli-error-small-packages branch from fd464b8 to 0cf10c3 Compare April 18, 2026 15:16
@FedeZara FedeZara marked this pull request as ready for review April 18, 2026 15:18
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

The two happy-path tests in loader.test.ts fall through to
loadMigrationModule, which performs a real `npm install
@fern-api/generator-migrations@latest`. That call is network-bound
and regularly exceeds the 5s vitest default on CI, producing a
flaky timeout (observed 2s–8s locally).

Made-with: Cursor
@github-actions
Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against latest nightly baseline on main (2026-04-18T04:46:15Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
csharp-sdk square 87s 139s 43s -44s (-50.6%)
go-sdk square 109s 146s 52s -57s (-52.3%)
java-sdk square 175s 193s 116s -59s (-33.7%)
php-sdk square 92s 119s 43s -49s (-53.3%)
python-sdk square 98s 155s 61s -37s (-37.8%)
ruby-sdk-v2 square 99s 157s 67s -32s (-32.3%)
rust-sdk square 97s 102s 45s -52s (-53.6%)
swift-sdk square 92s 134s 41s -51s (-55.4%)
ts-sdk square 105s 120s 50s -55s (-52.4%)

main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-04-18T04:46:15Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-18 15:52 UTC

@github-actions
Copy link
Copy Markdown
Contributor

Docs Generation Benchmark Results

Comparing PR branch against latest nightly baseline on main (2026-04-18T04:46:15Z).

Fixture main PR Delta
docs 279.9s 302.9s (35 versions) +23.0s (+8.2%)

Docs generation runs fern generate --docs --preview end-to-end against the benchmark fixture with 35 API versions (each version: markdown processing + OpenAPI-to-IR + FDR upload).
Delta is computed against the nightly baseline on main.
Baseline from nightly run(s) on main (latest: 2026-04-18T04:46:15Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-18 15:53 UTC

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant