Skip to content

Fetch image builder version from Modal settings#234

Open
ehdr wants to merge 9 commits intomainfrom
ehdr/image-builder-version-from-server
Open

Fetch image builder version from Modal settings#234
ehdr wants to merge 9 commits intomainfrom
ehdr/image-builder-version-from-server

Conversation

@ehdr
Copy link
Contributor

@ehdr ehdr commented Dec 5, 2025

Note

Both SDKs now fetch and cache environment settings and use the server-provided Image Builder Version for image builds, replacing hardcoded defaults and updating calls to pass the resolved environment.

  • Breaking change:
    • SDKs read Image Builder Version from account settings instead of defaulting to 2024.10 (may trigger one rebuild on first run).
  • Go SDK:
    • Environment settings: Add environment.go with Environment model, cached fetch (sync.Map + singleflight) via EnvironmentGetOrCreate and imageBuilderVersion(ctx, env).
    • Image builds: Image.Build() uses server-derived builderVersion and logs builder_version/env_name.
    • Environment resolution: Replace environmentName() with firstNonEmpty(..., profile.Environment) across services (Apps, Cls, Functions, Proxy, Queue, Volume, Sandbox, Secret).
    • Client: Track environmentsCache and environmentGroup.
  • JS SDK:
    • Environment settings: Add environment fetch/caching in ModalClient (fetchEnvironment, getImageBuilderVersion) via environmentGetOrCreate.
    • Image builds: Image.build() uses server-derived builderVersion and logs builder_version/env_name.
  • Tests:
    • Add environment caching/precedence tests in Go and JS.
    • Update image-related tests to set MODAL_IMAGE_BUILDER_VERSION where needed; vitest sets default env var.
  • Docs:
    • Update CHANGELOG.md to note breaking change.

Written by Cursor Bugbot for commit b65b047. This will update automatically on new commits. Configure here.

@ehdr ehdr force-pushed the ehdr/image-builder-version-from-server branch from e159323 to b86031d Compare December 5, 2025 16:11
@ehdr ehdr requested review from freider and thomasjpfan December 8, 2025 09:38
}

return env.Settings.ImageBuilderVersion, nil
}
Copy link

Choose a reason for hiding this comment

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

Bug: Missing fallback for empty server image builder version

The new imageBuilderVersion function returns whatever the server provides, which could be an empty string if EnvironmentSettings.ImageBuilderVersion is not set. The old implementation had a hardcoded fallback of "2024.10" when both the profile and server-provided values were empty. Without this fallback, image builds may receive an empty builderVersion, potentially causing undefined behavior if the server doesn't guarantee this field is always populated.

Additional Locations (1)

Fix in Cursor Fix in Web

@ehdr ehdr force-pushed the ehdr/image-builder-version-from-server branch from 64c56c7 to 005dfb8 Compare December 11, 2025 09:27
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