fix(go): preserve SDK version in dynamic snippets instead of using generator version#14937
Conversation
…nerator version Co-Authored-By: David Konigsberg <davidakonigsberg@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
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.
🌱 Seed Test SelectorSelect languages to run seed tests for:
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. |
SDK Generation Benchmark ResultsComparing PR branch against latest nightly baseline on Full benchmark table (click to expand)
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 |
SDK Generation Benchmark ResultsComparing PR branch against latest nightly baseline on Full benchmark table (click to expand)
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 |
Description
Fixes the
test-remote-vs-local-generation-parityCI workflow, which has been consistently failing forgo-sdksince ~April 9 (when go-sdk1.33.6was published).Root Cause
DynamicSnippetsGeneratorContext.buildEffectiveConfig()unconditionally overrode the output mode'sversionwithpublishInfo.versionfrom 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.7from the--versionflag).This caused
resolveRootImportPathto compute wrong Go major version suffixes. For example, wire test imports would referencegithub.com/fern-api/empty/v1/client(from generator version1.x) instead ofgithub.com/fern-api/empty/v7/client(from SDK version7.x), breakinggo mod tidy.The
WireTestGeneratorcreates aDynamicSnippetsGeneratorinternally, so every wire test file was affected.Changes Made
--versionflag during generation) when available, falling back topublishInfo.versiononly when the original config doesn't have oneTesting
--version 7.7.7and generator version99.99.99— confirmedgo mod tidyfails withgithub.com/fern-api/empty/v99imports before the fixKey Review Points
originalVersion ?? publishInfo.versionfallback: verify this is correct for all callers ofDynamicSnippetsGeneratorContext(wire tests, README snippets, FDR/docs snippets), not just the wire test pathgithuborpublishoutput mode, the original version now takes precedence — confirm this doesn't break the FDR/docs snippet use case described in thebuildEffectiveConfigdocstringLink to Devin session: https://app.devin.ai/sessions/12fe238561b44a609b818f935749f9c2
Requested by: @davidkonigsberg