fix(extensions): support optional source on extension instances and add ensureInstanceSpec - #11011
Merged
Conversation
…dd ensureInstanceSpec ### Description - Updates `ExtensionConfig` interface to make `source?: ExtensionSource` optional, reflecting runtime API behavior for published extension instances. - Adds `ensureInstanceSpec` in `extensionsHelper.ts` to fetch an extension version's specification on demand when `instance.config.source?.spec` is absent. - Adds defensive guards when accessing `instance.config.source?.spec` in `secretsUtils.ts` and `export.ts`. ### Scenarios Tested - Added unit tests in `src/extensions/export.spec.ts` for `ensureInstanceSpec`: - Returns instance unchanged when spec is already present. - Fetches spec on demand from the Extension publisher API when missing. - Verified TypeScript compilation and ESLint checks. ### Sample Commands - `npm test`
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces the ensureInstanceSpec helper to fetch extension specs on demand when missing, updates ExtensionConfig to make source optional, and handles mapping for migrated system location parameters. The review feedback suggests improving the robustness of ensureInstanceSpec by reducing nesting and falling back to instance-level references, adding a unit test for this fallback behavior, and using optional chaining in getManagedSecrets to prevent potential runtime crashes if instance.config is undefined.
…lback extensionRef - Use optional chaining for instance.config?.source?.spec in getManagedSecrets. - Fall back to top-level instance.extensionRef and instance.extensionVersion in ensureInstanceSpec. - Add unit test verifying top-level instance.extensionRef spec fetch.
…rror bubbling - Remove silent error suppression; allow errors from getExtensionVersion to bubble up. - Flatten control flow with early returns. - Populate real source metadata from ExtensionVersion instead of placeholder fields. - Update unit tests.
ajperel
approved these changes
Sep 1, 2026
- Rename DEFAULT_FUNCTION_REGION to FUNCTION_DEFAULT_REGION in functionsEnvFromInstance. - Use ref.version from parsed extensionRef if top-level extensionVersion is unset in ensureInstanceSpec. - Co-locate ensureInstanceSpec unit tests in extensionsHelper.spec.ts.
…to fix_ext_ensure_instance_spec
inlined
enabled auto-merge (squash)
September 1, 2026 00:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ExtensionConfiginterface to makesource?: ExtensionSourceoptional, reflecting runtime API behavior for published extension instances.ensureInstanceSpecinextensionsHelper.tsto fetch an extension version's specification on demand wheninstance.config.source?.specis absent.instance.config.source?.specinsecretsUtils.tsandexport.ts.Scenarios Tested
src/extensions/export.spec.tsforensureInstanceSpec:Sample Commands
npm test