Skip to content

fix(extensions): support optional source on extension instances and add ensureInstanceSpec - #11011

Merged
inlined merged 9 commits into
mainfrom
fix_ext_ensure_instance_spec
Sep 1, 2026
Merged

fix(extensions): support optional source on extension instances and add ensureInstanceSpec#11011
inlined merged 9 commits into
mainfrom
fix_ext_ensure_instance_spec

Conversation

@inlined

@inlined inlined commented Aug 31, 2026

Copy link
Copy Markdown
Member

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

…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`

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread src/extensions/extensionsHelper.ts Outdated
Comment thread src/extensions/secretsUtils.ts Outdated
Comment thread src/extensions/export.spec.ts
inlined and others added 4 commits August 31, 2026 16:16
…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.
Comment thread src/extensions/export.ts Outdated
Comment thread src/extensions/export.ts Outdated
Comment thread src/extensions/extensionsHelper.ts
Comment thread src/extensions/export.spec.ts Outdated
- 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.
@inlined
inlined enabled auto-merge (squash) September 1, 2026 00:47
@inlined
inlined merged commit cc177a3 into main Sep 1, 2026
51 checks passed
@inlined
inlined deleted the fix_ext_ensure_instance_spec branch September 1, 2026 00:56
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.

3 participants