Skip to content

fix(extensions): fall back to the ID when add sees no name - #5510

Merged
mnriem merged 1 commit into
github:mainfrom
chuenchen309:fix/extension-add-missing-name
Nov 23, 2026
Merged

mnriem merged 1 commit into
github:mainfrom
chuenchen309:fix/extension-add-missing-name

Conversation

@chuenchen309

Copy link
Copy Markdown
Contributor

Description

specify extension add <id> exits 1 with KeyError: 'name' when the catalog entry has no name, before anything is downloaded. #5308 fixed the same entries for extension search and extension info (#5307): catalog entries are kept without per-field validation, and display falls back to the extension ID. The Downloading … line in extension_add still indexed ext_info['name'] directly, while the same line already uses .get('version', 'unknown') and the preset twin (presets/command_add.py) uses pack_info.get('name', preset_id).

This reads the name with .get('name', extension_id), so add prints Downloading catalog-extension v1.0.0... and continues. Nothing else on the download path indexes name.

Testing

  • Tested locally with .venv/bin/specify --help (Windows PowerShell: .\.venv\Scripts\specify.exe --help)
  • Ran relevant existing tests with .venv/bin/python -m pytest tests -q (Windows PowerShell: .\.venv\Scripts\python.exe -m pytest tests -q); use affected test paths for focused checks and LC_ALL=en_US.UTF-8 on macOS
  • Tested with a sample project (if applicable)

Added test_catalog_add_without_entry_name_uses_id to tests/specify_cli/extensions/test_command_add.py. It fails on main (exit_code 1 from KeyError('name')) and passes with the fix. tests/specify_cli/extensions and tests/test_extensions.py pass (843 tests); ruff check is clean on the changed source file.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

AI disclosure: This PR was written by an AI coding agent, Claude Code (model: Claude Opus 5.5), working autonomously on behalf of the account holder, with no human review before submission. The agent found the bug by tracing #5308 to the remaining call site, wrote the fix and the test, ran the tests above, and wrote this description. The commit carries an Assisted-by: trailer.

`extension add` printed the catalog entry's name with ext_info['name'],
so an entry without one exited with KeyError: 'name' before the
download started. github#5308 made search and info fall back to the ID for
the same entries; add now does too, as the preset twin already does.

Assisted-by: Claude Code (model: Claude Opus 5.5, autonomous)
@chuenchen309
chuenchen309 requested a review from mnriem as a code owner November 21, 2026 03:42
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 03:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change addresses the nameless catalog-entry failure by falling back to the resolved extension ID and adds a focused regression test covering that installation path.

No open issues 🎉

What changed in this PR

Fixes specify extension add <id> so catalog entries without a name no longer fail before downloading, using the extension ID as the display fallback.

Changes:

  • Falls back to the resolved extension ID when rendering the download message.
  • Adds a regression test for successful installation from a catalog entry missing name.
File Description
tests/​specify_cli/​extensions/​test_command_add.py Adds a regression test verifying that nameless catalog entries install successfully and display the extension ID.
src/​specify_cli/​extensions/​command_add.py Uses the resolved extension ID as the fallback when a catalog entry has no name.

Review effort: Lite (adaptive)

@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Nov 21, 2026
@mnriem
mnriem requested a balanced review from Copilot November 23, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the change that uses the extension ID when a catalog entry lacks a name.

No open issues 🎉

Review effort: Balanced

@mnriem
mnriem merged commit 81abac7 into github:main Nov 23, 2026
14 checks passed
@mnriem

mnriem commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-must-have Verdict: high-value, important work for Spec Kit — do first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants