fix: scaffold extension config when installing via bundler - #4285
Open
chelsealong wants to merge 1 commit into
Open
fix: scaffold extension config when installing via bundler#4285chelsealong wants to merge 1 commit into
chelsealong wants to merge 1 commit into
Conversation
ExtensionPrimitive.install_from_directory/install_from_zip in the bundler never called ExtensionManager.scaffold_config, so an extension's provides.config templates were deployed only when installed with `specify extension add`, not via `specify bundle install`. Call scaffold_config after a successful install in both code paths, matching the extension-add command flow. Fixes github#4283
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 #4283.
specify bundle installinstalls an extension by callingExtensionManager.install_from_directory/install_from_zipdirectlyfrom
_ExtensionKindManager._do_installinsrc/specify_cli/bundler/services/primitives.py, but never calledExtensionManager.scaffold_configafterwards. Thespecify extension addcommand flow (
src/specify_cli/extensions/_commands.py) does call it, soan extension installed as part of a bundle ended up with its
provides.configtemplates present on disk but never deployed — theextension silently had no configuration, while installing the same
extension directly worked correctly.
Change
src/specify_cli/bundler/services/primitives.py: callself._manager.scaffold_config(manifest.id)right after a successfulinstall_from_directory/install_from_zipcall in_ExtensionKindManager._do_install, using the id from the manifestreturned by the install call (matching what the
extension addcommandflow does).
tests/unit/test_bundler_primitives.py: addedtest_bundled_extension_install_scaffolds_config, which installs a real(unmocked) extension source with a
provides.configentry throughprimitive_manager("extensions", ...)and asserts the config file landsat
.specify/extensions/<id>/<name>. Also updated the existinginstall_from_directorymocks in this file to return an object with an.idattribute (as the real method does), since the new call site readsmanifest.idoff the return value.Out of scope: the issue's related documentation nit about
_target_follows_preserved_conventionnaming conventions not beingdocumented in
EXTENSION-API-REFERENCE.md, and surfacing per-filedeployed/skipped/failed console reporting through the bundler's CLI
summary (the bundler currently reports install results only as install
counts, not per-component detail — plumbing that through is a larger,
separate change).
Test plan
Confirmed the new test fails without the fix (temporarily reverted just
the production file):
With the fix:
Full suite (unmodified elsewhere):
ruff checkon the touched files reports 4 pre-existing issues (unusednoqaon lines untouched by this change, import-order in two unrelatedtest functions) that are also present on unmodified
upstream/main—confirmed by stashing this change and re-running the same
ruff checkinvocation, which reported the identical 4 findings at the same
locations.
AI disclosure
This change was implemented with AI assistance (Claude Code), including
the fix, the regression test, and this PR description. All commands
listed above were run and their output verified directly.