Skip to content

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

Merged
FedeZara merged 2 commits intomainfrom
FedeZara/refactor/cli-error-small-packages
Apr 21, 2026
Merged

chore(cli): consolidate small CliError migration branches#15013
FedeZara merged 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 5 times, most recently 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

SDK Generation Benchmark Results

Comparing PR branch against latest nightly baseline on main (2026-04-21T17:51:21Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
csharp-sdk square 56s 86s 49s -7s (-12.5%)
go-sdk square 115s 132s 114s -1s (-0.9%)
java-sdk square 179s 207s 178s -1s (-0.6%)
php-sdk square 43s 68s 40s -3s (-7.0%)
python-sdk square 120s 228s 121s +1s (+0.8%)
ruby-sdk-v2 square 130s 159s 129s -1s (-0.8%)
rust-sdk square 166s 163s 162s -4s (-2.4%)
swift-sdk square 40s 291s 39s -1s (-2.5%)
ts-sdk square 76s 86s 69s -7s (-9.2%)

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-21T17:51:21Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-21 23:28 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 18, 2026

Docs Generation Benchmark Results

Comparing PR branch against latest nightly baseline on main (2026-04-21T17:51:21Z).

Fixture main PR Delta
docs 325.7s 329.7s (35 versions) +4.0s (+1.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-21T17:51:21Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-21 23:29 UTC

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
@FedeZara FedeZara force-pushed the FedeZara/refactor/cli-error-small-packages branch from d1c1962 to 6032a2a Compare April 21, 2026 22:32
@FedeZara FedeZara merged commit c1f3144 into main Apr 21, 2026
209 checks passed
Copy link
Copy Markdown
Contributor Author

Merge activity

@FedeZara FedeZara deleted the FedeZara/refactor/cli-error-small-packages branch April 21, 2026 23:29
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.

2 participants