fix: read nested bundle URIs from in-memory registry in bundle list --all#92
fix: read nested bundle URIs from in-memory registry in bundle list --all#92colombod wants to merge 2 commits intomicrosoft:mainfrom
Conversation
…-all The get_bundle_categories() method read nested bundle and dependency URIs from ~/.amplifier/registry.json on disk, which could contain stale git+ URIs that don't reflect current local path overrides from settings.local.yaml. Changed to read from the in-memory BundleRegistry (via get_state()) which has current overrides applied, aligning the --all view with the default bundle list view that already reads from in-memory state. 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>
Review: Not approvingWe reviewed this alongside the companion foundation PR #83 and are choosing to accept #83 but not this PR. Foundation PR #83 fixes the root cause: stale URIs in the registry are now corrected during This PR fixes a one-time display inconsistency that only exists between when the user gets the new code and when they run their first session. It self-heals after one use. That is not enough to justify changing the CLI display code path. Thank you for the thorough work -- the root cause analysis and foundation fix are the right changes. |
|
Closing the pr |
Summary
Fixes the display half of microsoft-amplifier/amplifier-support#62.
amplifier bundle list --allshowed GitHub URLs for nested bundles even when the parent bundle was overridden to a local path viasettings.local.yaml. The nested bundles and dependencies categories read URIs from stale~/.amplifier/registry.jsonon disk instead of the in-memory registry that has current overrides applied.Root Cause
get_bundle_categories()indiscovery.pyused three inconsistent data sources for its output categories:_find_packaged_bundle()AppSettings().get_added_bundles()~/.amplifier/registry.jsonon disk~/.amplifier/registry.jsonon diskThe default
bundle listview (without--all) already correctly reads from the in-memory registry viadiscovery.find(). The--allview was the only inconsistent path.Change
Replaced the
registry.jsonfile-read block withself._registry.get_state()which returns the in-memoryBundleStateobjects that reflect current session state including local overrides.Before (read from disk):
After (read from in-memory registry):
The output format and category logic are preserved exactly — only the data source changes.
Evidence
Diff stats
amplifier_app_cli/lib/bundle_loader/discovery.py: +25/−33 lines (net reduction — simpler code)tests/lib/bundle_loader/test_discovery.py: +146 lines (NEW file, 3 regression tests)Test results
amplifier-app-clifull suiteNote: app-cli tests were run with the local
amplifier-foundationcheckout (including the companion PR's changes) viauv pip install -e+uv run --no-sync, sinceBundleState.explicitly_requestedis needed at runtime.New regression tests (
TestGetBundleCategoriesNestedURIs)test_nested_bundles_reflect_in_memory_stateBundleStateentries appear inget_bundle_categories()output with correct URIstest_stale_persisted_uri_not_used_for_nested_bundlesregistry.jsonhas agit+URI but in-memory state has been updated tofile://, the output reflects the in-memory URItest_dependencies_reflect_in_memory_stateincluded_bymetadataCompanion PR
This is the second of two PRs for issue #62. The companion PR is microsoft/amplifier-foundation#83 which fixes the persistent state in
BundleRegistry._load_single(). The foundation PR should merge first (it fixes the persistent state), then this PR (it fixes the display).Together, both PRs ensure:
bundle list --allreads from refreshed in-memory state, not stale disk dataHow to verify end-to-end
After both PRs merge:
bundle.added.foundation: ../../amplifier-foundationtosettings.local.yamlamplifier bundle list --allgit+GitHub URLs