[Bug]: Extension alias conflict check misses spellings that map to the same file, so one extension overwrites and then deletes another's alias

Đang mở Phù hợp với người mới
#5,081 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@chelsealong đang làm issue này rồi.

Từ ngày 26/10/2026.

  • #5134 của @chelsealong — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Đọc src/specify_cli/extensions/__init__.py, bắt đầu với _normalize_shadow_name và _validate_install_conflicts gần các dòng 1203–1240. Chạy các bước tái hiện trong issue để xác nhận shared.sync và shared-sync trỏ đến cùng một tệp alias. Công việc hoàn tất khi việc thêm extension thứ hai báo xung đột và giữ nguyên alias của extension đầu tiên; thêm một bài kiểm thử hồi quy tập trung bên cạnh các bài kiểm thử extension.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

triage-must-have
Bug Description

_validate_install_conflicts normalises declared names with _normalize_shadow_name only when comparing them with core commands. Against installed extensions it uses an exact spelling check (if name in installed_names, src/specify_cli/extensions/__init__.py:1240). Aliases such as shared.sync and shared-sync both render to .claude/skills/speckit-shared-sync/SKILL.md, so a second extension is installed without error and overwrites the first extension's alias file. Removing the second extension then deletes that file, although the first extension is still installed.

Steps to Reproduce

Save this as repro.py and run uv run python -I repro.py from the repository root.

import os, tempfile
from pathlib import Path
from typer.testing import CliRunner
from specify_cli import app

root = Path(tempfile.mkdtemp())
def make_ext(eid, alias):
    d = root / eid
    (d / "commands").mkdir(parents=True)
    (d / "commands/hello.md").write_text(f"---\ndescription: {eid}\n---\n\nHello from {eid}\n")
    (d / "extension.yml").write_text(f"""schema_version: "1.0"
extension: {{id: {eid}, name: {eid}, version: 1.0.0, description: d}}
requires: {{speckit_version: ">=0.1.0"}}
provides:
  commands:
    - name: speckit.{eid}.hello
      file: commands/hello.md
      description: x
      aliases: ["{alias}"]
""")
    return d
proj = root / "project"
(proj / ".specify").mkdir(parents=True)
(proj / ".claude/skills").mkdir(parents=True)
os.chdir(proj)
run = lambda *a: CliRunner().invoke(app, list(a))
skill = proj / ".claude/skills/speckit-shared-sync/SKILL.md"

print("add alpha:", run("extension", "add", "--dev", str(make_ext("alpha", "shared.sync"))).exit_code)
print("skill belongs to alpha:", "alpha" in skill.read_text())
print("add beta:", run("extension", "add", "--dev", str(make_ext("beta", "shared-sync"))).exit_code)
print("skill belongs to beta:", "beta" in skill.read_text())
print("remove beta:", run("extension", "remove", "beta", "--force").exit_code)
print("alpha still installed:", "alpha" in run("extension", "list").output)
print("alpha's alias skill exists:", skill.exists())
Expected Behavior

specify extension add --dev for beta fails with a conflict error. The _validate_install_conflicts docstring says "Reject installs that would shadow core or installed extension commands" (__init__.py:1220). The _normalize_shadow_name docstring (__init__.py:1203-1216) notes that dotted and hyphenated spellings "land on the same on-disk command name".

Actual Behavior
add alpha: 0
skill belongs to alpha: True
add beta: 0
skill belongs to beta: True
remove beta: 0
alpha still installed: True
alpha's alias skill exists: False
Specify CLI Version

1.2.4.dev0 (main at 27d14e2)

AI Agent

Claude Code

Operating System

Linux 6.18 (Ubuntu container)

Python Version

Python 3.12.3

Additional Context

Comparing _normalize_shadow_name(name) against the normalised installed names, as is already done for core commands, would catch this.

Also reproduced on macOS (Darwin 25.6, arm64) with Python 3.14.4 and uv run python -I repro.py against 27d14e2; the output matches the above.

AI Disclosure

Found and reproduced with Claude Code (model: Claude Opus 4.8), run autonomously under human supervision. The human reporter re-ran every reproduction above before filing.

Ngôn ngữ chính
Python
Star
144k
Fork
12.9k
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
194

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/spec-kit

Tất cả issue của github/spec-kit

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.