fix(core): accept structured extension source in registry - #8
Open
PhanCongVuDuc wants to merge 1 commit into
Open
PhanCongVuDuc wants to merge 1 commit into
PhanCongVuDuc wants to merge 1 commit into
Conversation
spec-kit 1.0.12 writes `source` in `.specify/extensions/.registry` as an
object (`{"kind": "catalog", "catalog": "<name>"}`) when an extension is
installed or updated from a catalog. The registry parser only accepted a
string, so project discovery failed with "invalid type: map, expected a
string" and spectatui exited on startup.
Read `source` as raw JSON and map both the legacy string and the
structured object to ExtensionSource; any other shape falls back to Local
instead of failing discovery.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Problem
With spec-kit 1.0.12, spectatui fails to start in any project where an extension was installed or updated from a catalog:
spec-kit now writes
sourcein.specify/extensions/.registryas an object when the extension comes from a catalog (src/specify_cli/extensions/__init__.py,ExtensionManagerregistry update):Entries installed locally still use the legacy string (
"source": "local"), so a single registry can contain both shapes.ExtensionRegistryEntry.sourcewasOption<String>, so the object makes the whole registry fail to parse and discovery aborts.Reproduce:
specify extension update(orspecify extension add <id>from the default catalog) with spec-kit 1.0.12, then runspectatui.Fix
ExtensionRegistryEntry.sourceis read asOption<serde_json::Value>.extension_source()maps both shapes toExtensionSource:"local"→Local,http…→Url, anything else →Catalog){"kind": "catalog", "catalog": "<name>"}→Catalog(name);{"kind": "local"}, a blank catalog name or an unknownkind→Local— the same normalisation spec-kit applies in_installed_list_json._normalized_sourceLocalinstead of failing project discovery.The presets registry has the same new object
source, butPresetRegistryEntrydoes not declare the field, so serde already ignores it there — no change needed.Tests
loads_extensions_with_legacy_and_structured_sources— writes a registry containing one legacy and one structured entry and runsload_extensions. Confirmed it fails ondevelopwith the exact error above, and passes with the fix.maps_every_extension_source_shape— covers each string and object variant, plusNone.Checked locally (Windows,
stable-x86_64-pc-windows-gnu):cargo fmt --all -- --checkcargo clippy --workspace -- -D warningscargo test --workspace(76 passed)🤖 Generated with Claude Code