Skip to content

fix(go): preserve SDK version in dynamic snippets instead of using generator version#14937

Merged
patrickthornton merged 4 commits into
mainfrom
devin/1775918647-fix-go-dynamic-snippets-version
Apr 15, 2026
Merged

fix(go): preserve SDK version in dynamic snippets instead of using generator version#14937
patrickthornton merged 4 commits into
mainfrom
devin/1775918647-fix-go-dynamic-snippets-version

Conversation

@davidkonigsberg
Copy link
Copy Markdown
Contributor

Description

Fixes the test-remote-vs-local-generation-parity CI workflow, which has been consistently failing for go-sdk since ~April 9 (when go-sdk 1.33.6 was published).

Root Cause

DynamicSnippetsGeneratorContext.buildEffectiveConfig() unconditionally overrode the output mode's version with publishInfo.version from the dynamic IR. This version reflects the generator's own version (e.g., 1.34.3), not the SDK version being generated (e.g., 7.7.7 from the --version flag).

This caused resolveRootImportPath to compute wrong Go major version suffixes. For example, wire test imports would reference github.com/fern-api/empty/v1/client (from generator version 1.x) instead of github.com/fern-api/empty/v7/client (from SDK version 7.x), breaking go mod tidy.

The WireTestGenerator creates a DynamicSnippetsGenerator internally, so every wire test file was affected.

Changes Made

  • Preserve the original config's output mode version (set by --version flag during generation) when available, falling back to publishInfo.version only when the original config doesn't have one
  • Added unreleased changelog entry

Testing

  • Reproduced locally by generating with --version 7.7.7 and generator version 99.99.99 — confirmed go mod tidy fails with github.com/fern-api/empty/v99 imports before the fix
  • Verified the fix resolves the failure — generation completes successfully after the change

Key Review Points

  • The originalVersion ?? publishInfo.version fallback: verify this is correct for all callers of DynamicSnippetsGeneratorContext (wire tests, README snippets, FDR/docs snippets), not just the wire test path
  • When the original config has a github or publish output mode, the original version now takes precedence — confirm this doesn't break the FDR/docs snippet use case described in the buildEffectiveConfig docstring

Link to Devin session: https://app.devin.ai/sessions/12fe238561b44a609b818f935749f9c2
Requested by: @davidkonigsberg

…nerator version

Co-Authored-By: David Konigsberg <davidakonigsberg@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 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 and CI monitoring

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

🌱 Seed Test Selector

Select languages to run seed tests for:

  • Python
  • TypeScript
  • Java
  • Go
  • Ruby
  • C#
  • PHP
  • Swift
  • Rust
  • OpenAPI

How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR.

@github-actions
Copy link
Copy Markdown
Contributor

SDK Generation Benchmark Results

Comparing PR branch against latest nightly baseline on main (2026-04-11T04:38:26Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
go-sdk square 105s 149s 105s +0s (+0.0%)

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-11T04:38:26Z). Trigger benchmark-baseline to refresh.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 14, 2026

SDK Generation Benchmark Results

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

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
go-sdk square 104s 142s 112s +8s (+7.7%)

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-15T04:55:58Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-15 11:26 UTC

@patrickthornton patrickthornton merged commit bff9e50 into main Apr 15, 2026
94 checks passed
@patrickthornton patrickthornton deleted the devin/1775918647-fix-go-dynamic-snippets-version branch April 15, 2026 15:22
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