Skip to content

Commit 22ab8a8

Browse files
jawwad-aliclaude
andcommitted
fix(bundler): resolve built-in step types when checking bundle references
`_resolved_locally` gives three of the four component kinds a "is it bundled with Spec Kit?" check before the installed-in-project one: presets -> _locate_bundled_preset or PresetManager.get_pack extensions -> _locate_bundled_extension or ExtensionManager...is_installed workflows -> _locate_bundled_workflow or WorkflowRegistry.is_installed steps -> StepRegistry.is_installed <-- no bundled check `StepRegistry` tracks *community* step types installed under `.specify/workflows/steps/`. Spec Kit ships 11 step types as built-ins registered in `STEP_REGISTRY`, so every one of them looked unresolved: steps/shell -> False steps/gate -> False steps/command -> False steps/if -> False A bundle declaring a dependency on any built-in step type was therefore reported as an unresolved reference — an error online, a warning offline. There is no `_locate_bundled_step` to mirror, because step types are not an on-disk asset directory; `STEP_REGISTRY` is the equivalent check, and is what `specify workflow step info` reports as "built-in". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 400ad01 commit 22ab8a8

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

src/specify_cli/bundler/services/references.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,17 @@ def _resolved_locally(root: Path, component: ComponentRef) -> bool:
4040
return True
4141
return WorkflowRegistry(root).is_installed(component.id)
4242
if kind == "steps":
43+
from ...workflows import STEP_REGISTRY
4344
from ...workflows.catalog import StepRegistry
4445

46+
# Step types ship with Spec Kit as built-ins (shell, gate, if, ...)
47+
# rather than as an on-disk asset directory, so there is no
48+
# ``_locate_bundled_step`` to mirror the three lookups above.
49+
# ``STEP_REGISTRY`` is the bundled-with-Spec-Kit check for this kind
50+
# -- it is what ``specify workflow step info`` reports as
51+
# "built-in". Without it every built-in step type looked unresolved.
52+
if component.id in STEP_REGISTRY:
53+
return True
4554
return StepRegistry(root).is_installed(component.id)
4655
except Exception: # noqa: BLE001 - resolution is best-effort
4756
return False

tests/unit/test_bundler_references.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,38 @@ def test_bundled_extension_resolves(tmp_path: Path):
2424
assert warnings == []
2525

2626

27+
def test_builtin_step_type_resolves(tmp_path: Path):
28+
"""A built-in step type must resolve, like a bundled extension.
29+
30+
Spec Kit ships 11 step types as built-ins registered in ``STEP_REGISTRY``
31+
rather than as on-disk asset directories, so there is no
32+
``_locate_bundled_step``. The ``steps`` branch of ``_resolved_locally`` only
33+
asked ``StepRegistry(root).is_installed()``, which tracks *community* step
34+
types installed under ``.specify/workflows/steps/`` — so every built-in step
35+
type was reported as an unresolved reference.
36+
"""
37+
from specify_cli.workflows import STEP_REGISTRY
38+
39+
root = make_project(tmp_path)
40+
warnings: list[str] = []
41+
check = make_reference_checker(root, allow_network=True, warnings=warnings)
42+
43+
for step_id in ("shell", "gate", "command", "if"):
44+
assert step_id in STEP_REGISTRY, step_id
45+
assert check(_ref("steps", step_id)) is None, step_id
46+
assert warnings == []
47+
48+
49+
def test_unknown_step_type_still_errors_online(tmp_path: Path):
50+
"""The guard must not make every step id resolve."""
51+
root = make_project(tmp_path)
52+
warnings: list[str] = []
53+
check = make_reference_checker(root, allow_network=True, warnings=warnings)
54+
problem = check(_ref("steps", "no-such-step-type"))
55+
assert problem is not None
56+
assert "no-such-step-type" in problem
57+
58+
2759
def test_unknown_reference_errors_online(tmp_path: Path):
2860
root = make_project(tmp_path)
2961
warnings: list[str] = []

0 commit comments

Comments
 (0)