Skip to content

fix(cli): error when --instance does not match any configured docs instance#16721

Open
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1782416045-fix-instance-fallback
Open

fix(cli): error when --instance does not match any configured docs instance#16721
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/1782416045-fix-instance-fallback

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

When running fern generate --docs --instance <url> with a URL that doesn't exactly match any configured instance in docs.yml, the CLI silently falls back to publishing to instances[0] instead of erroring.

This caused docs to be published to the wrong production site — the user specified a Glean instance URL but docs were published to the first instance (partner-docs-ddn).

Changes Made

In runRemoteGenerationForDocsWorkspace.ts:

- const maybeInstance = instances.find((...) => ...) ?? instances[0];
+ const maybeInstance =
+     instanceUrl != null ? instances.find((...) => ...) : instances[0];

When instanceUrl is provided:

  • Only use find() — no fallback to instances[0]
  • If no match, failAndThrow with a message listing available instances

When instanceUrl is undefined (no --instance flag):

  • Preserve existing behavior: use instances[0]

The CLI-v2 PublishCommand.resolveInstanceUrl already handles this correctly by throwing CliError on mismatch; this fix aligns the v1 code path.

Testing

  • pnpm run check passes
  • Manual review of v2 path confirms it already has the correct behavior

Link to Devin session: https://app.devin.ai/sessions/4d76819a21d049f7a33174acd031e595


Open in Devin Review

…stance

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

willkendall01 and others added 2 commits June 25, 2026 22:25
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Tests now mock dependencies (TaskContext, publishDocs, core-utils) and call
the real runRemoteGenerationForDocsWorkspace() function, verifying behavior
through the mocked dependencies rather than duplicating logic.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant