fix: update stale nested bundle URIs when reloaded from different source#83
Open
colombod wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: update stale nested bundle URIs when reloaded from different source#83colombod wants to merge 1 commit intomicrosoft:mainfrom
colombod wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When a parent bundle is overridden to a local path via settings.local.yaml, nested bundles previously persisted with git+ URIs would keep their stale URIs because _load_single() skipped re-registering existing entries. Now the existing entry's URI and local_path are updated when the bundle is reloaded from a different source, ensuring registry.json stays in sync with actual source overrides. Fixes: microsoft-amplifier/amplifier-support#62 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
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.
Summary
Fixes the persistent-state half of microsoft-amplifier/amplifier-support#62.
When a parent bundle (e.g.,
foundation) is overridden to a local path viasettings.local.yaml, nested bundles previously persisted withgit+URIs kept their stale URIs indefinitely. This PR ensures registry entries are refreshed when a bundle is reloaded from a different source.Root Cause
BundleRegistry._load_single()has an update block (lines 506–510) that refreshesversion,loaded_at, andlocal_pathfor known bundles — but it did not updateuri. Combined with persisted state loaded fromregistry.jsonon init, this meant:git+URIs → persisted toregistry.json_load_single()reloads the nested bundle from afile://URI, but the existing entry'surifield is never updatedregistry.jsonretains the stalegit+URI across all subsequent sessionsChange
+5 lines in
amplifier_foundation/registry.py— surgical addition to the existing update block:The URI is only updated when it actually differs, with a debug log for traceability. For same-URI reloads this is a no-op.
Evidence
Diff stats
amplifier_foundation/registry.py: +5 lines (production fix)tests/test_registry.py: +164 lines (3 regression tests)Test results
amplifier-foundationfull suiteNew regression tests (
TestNestedBundleURIUpdate)test_persisted_nested_bundle_uri_updates_on_reloadgit+URI inregistry.jsongets updated tofile://when the same bundle is loaded from a local pathtest_persisted_uri_update_survives_save_reloadsave()→ newBundleRegistrycycletest_same_uri_reload_does_not_change_entryCompanion PR
This is the first of two PRs for issue #62. The companion PR in
amplifier-app-clichangesget_bundle_categories()to read from the in-memory registry instead of staleregistry.jsonon disk. This foundation PR should merge first (it fixes the persistent state that the CLI reads).How to verify end-to-end
After both PRs merge:
bundle.added.foundation: ../../amplifier-foundationtosettings.local.yamlamplifier bundle list --allfile://paths, notgit+GitHub URLs