Skip to content

Commit 40df719

Browse files
committed
fix: validate descriptor root is dict, add shared infra to upgrade
- Add isinstance(self.data, dict) check at start of _validate() so non-mapping YAML roots raise IntegrationDescriptorError - Run _install_shared_infra() and ensure_executable_scripts() in upgrade command to match install/switch behavior
1 parent 3140f53 commit 40df719

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,6 +2286,12 @@ def integration_upgrade(
22862286

22872287
selected_script = _resolve_script_type(project_root, script)
22882288

2289+
# Ensure shared infrastructure is present (safe to run unconditionally;
2290+
# _install_shared_infra merges missing files without overwriting).
2291+
_install_shared_infra(project_root, selected_script)
2292+
if os.name != "nt":
2293+
ensure_executable_scripts(project_root)
2294+
22892295
# Phase 1: Install new files (overwrites existing; old-only files remain)
22902296
console.print(f"Upgrading integration: [cyan]{key}[/cyan]")
22912297
new_manifest = IntegrationManifest(key, project_root, version=get_speckit_version())

src/specify_cli/integrations/catalog.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,10 @@ def _load(path: Path) -> dict:
449449
# -- Validation -------------------------------------------------------
450450

451451
def _validate(self) -> None:
452+
if not isinstance(self.data, dict):
453+
raise IntegrationDescriptorError(
454+
f"Descriptor root must be a YAML mapping, got {type(self.data).__name__}"
455+
)
452456
for field in self.REQUIRED_TOP_LEVEL:
453457
if field not in self.data:
454458
raise IntegrationDescriptorError(

0 commit comments

Comments
 (0)