fix(extensions): support optional source on extension instances and add ensureInstanceSpec (#11011)
* fix(extensions): support optional source on extension instances and add 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` * fix(extensions): address review feedback on optional chaining and fallback 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. * fix(extensions): refactor ensureInstanceSpec with early returns and error 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. * fix(ext): address PR review comments - 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.
T
Thomas Bouldin committed
cc177a312a3aaf150e7cb07dcd227b1b11491bee
Parent: 9dc6e15
Committed by GitHub <noreply@github.com>
on 9/1/2026, 12:56:30 AM