-
Notifications
You must be signed in to change notification settings - Fork 267
Extension Update Warning #6512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extension Update Warning #6512
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds extension update checking functionality that notifies users when newer versions of installed extensions are available. The implementation runs update checks in parallel with extension execution to avoid adding latency.
Changes:
- Adds registry caching system with 4-hour TTL and per-source isolation
- Implements update checker with 24-hour warning cooldown tracked per extension
- Enhances WarningMessage UX component to support hint bullets
- Integrates update checks into extension command execution flow
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/output/ux/warning.go | Added Hints field to WarningMessage for displaying bulleted suggestions |
| cli/azd/pkg/extensions/extension.go | Added LastUpdateWarning field to track warning cooldown per extension |
| cli/azd/pkg/extensions/registry_cache.go | Implements per-source registry caching with TTL and file-based storage |
| cli/azd/pkg/extensions/registry_cache_test.go | Unit tests for cache manager functionality |
| cli/azd/pkg/extensions/update_checker.go | Core update checking logic with version comparison and cooldown management |
| cli/azd/pkg/extensions/update_checker_test.go | Unit tests for update checker |
| cli/azd/pkg/extensions/update_integration_test.go | Integration tests covering full update check workflow |
| cli/azd/pkg/extensions/manager.go | Added UpdateInstalled method to persist extension metadata changes |
| cli/azd/cmd/extensions.go | Integrated update checking into extension execution with async goroutine |
| cli/azd/.vscode/cspell.yaml | Added spelling exceptions for new terms |
Comments suppressed due to low confidence (4)
cli/azd/pkg/extensions/update_checker.go:92
- The comment uses "cool down" (two words) but elsewhere in the codebase it's written as "cooldown" (one word). Use consistent terminology throughout for better readability and searchability.
// ShouldShowWarning checks if a warning should be shown (respecting cool down)
cli/azd/cmd/extensions.go:172
- The defer function uses a non-blocking select with a default case to check if the update result is ready. If the goroutine hasn't completed by the time the extension finishes, the warning is silently skipped. This means fast-running extensions might never show update warnings even when updates are available. Consider either waiting for a reasonable timeout, or logging when the check didn't complete in time so users/developers are aware of the behavior.
defer func() {
// Collect result and show warning if needed (non-blocking read)
select {
case result := <-updateResultChan:
if result != nil && result.shouldShow && result.warning != nil {
a.console.MessageUxItem(ctx, result.warning)
a.console.Message(ctx, "")
}
default:
// Check didn't complete in time, skip warning
}
}()
cli/azd/pkg/extensions/manager.go:246
- The
UpdateInstalledmethod checks if the extension exists in the map but then overwrites it unconditionally. If the extension doesn't exist, the function returns an error, but if it does exist, the entire extension object is replaced rather than just updating specific fields. This means if the caller modifies the extension object between retrieval and update, unrelated fields could be changed. Consider documenting this full-replacement behavior, or implementing a more granular update mechanism.
// UpdateInstalled updates an installed extension's metadata in the config
func (m *Manager) UpdateInstalled(extension *Extension) error {
extensions, err := m.ListInstalled()
if err != nil {
return fmt.Errorf("failed to list installed extensions: %w", err)
}
if _, exists := extensions[extension.Id]; !exists {
return ErrInstalledExtensionNotFound
}
extensions[extension.Id] = extension
if err := m.userConfig.Set(installedConfigKey, extensions); err != nil {
return fmt.Errorf("failed to set extensions section: %w", err)
}
if err := m.configManager.Save(m.userConfig); err != nil {
return fmt.Errorf("failed to save user config: %w", err)
}
return nil
}
cli/azd/pkg/extensions/update_checker.go:37
- The comment uses "cool downs" (two words) but elsewhere in the codebase and in the constant name it's written as "cooldown" (one word). Use consistent terminology throughout for better readability and searchability.
// UpdateChecker checks for extension updates and manages warning cool downs
cli/azd/cmd/extensions.go
Outdated
| showUpdateWarning := !isJsonOutputFromArgs(os.Args) | ||
| if showUpdateWarning { | ||
| updateResultChan := make(chan *updateCheckOutcome, 1) | ||
| go a.checkForUpdateAsync(ctx, extension, updateResultChan) |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The context passed to the goroutine originates from the parent Run method. If the parent context is cancelled after the goroutine starts but before update checking completes, operations in checkForUpdateAsync may fail or behave unexpectedly. Consider using context.WithoutCancel or creating a detached context for the background update check to ensure it can complete independently of the main command execution.
| go a.checkForUpdateAsync(ctx, extension, updateResultChan) | |
| go a.checkForUpdateAsync(context.WithoutCancel(ctx), extension, updateResultChan) |
5dc0725 to
f3c7e5a
Compare
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Extension Update Warning
When users run an extension command, azd now checks if a newer version is available and displays a warning after execution with upgrade instructions.
Key Features
~/.azd/cache/extensions/<source>.jsonwith 4hr TTL (configurable viaAZD_EXTENSION_CACHE_TTL)Extension.LastUpdateWarningfield - auto-cleaned on uninstall--output jsonis usedExample Output