fix: scope custom steps to current project - #4466
Conversation
Assisted-by: GitHub Copilot (model: gpt-5.6-sol, autonomous) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Same-path reloads may reuse stale bytecode, and related comments must be updated.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Scopes dynamically loaded workflow steps to the current project.
Changes:
- Resets custom-step registrations and cached modules before each scan.
- Adds cross-project isolation regression coverage.
File summaries
| File | Description |
|---|---|
tests/test_workflows.py |
Tests replacing identically named steps across projects. |
src/specify_cli/workflows/__init__.py |
Resets custom-step state; bytecode caching may still cause stale same-path reloads. |
Review details
Suppressed comments (1)
src/specify_cli/workflows/init.py:104
- This new removal behavior makes the existing explanations in
src/specify_cli/bundler/services/references.py:50-53andtests/unit/test_bundler_references.py:50-55incorrect: both still state thatload_custom_steps“never removes” custom entries. Please update those comments to explain thatBUILTIN_STEP_TYPESremains the immutable built-in snapshot even though the active registry is reset between scans.
for _type_key in tuple(STEP_REGISTRY):
if _type_key not in BUILTIN_STEP_TYPES:
STEP_REGISTRY.pop(_type_key, None)
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| _module_prefix = "_speckit_custom_step_" | ||
| for _mod_key in [k for k in _sys.modules if k.startswith(_module_prefix)]: | ||
| _sys.modules.pop(_mod_key, None) |
There was a problem hiding this comment.
Addressed on 7e2961ea: custom-step __pycache__ directories are purged before import, import caches are invalidated, and a same-path/same-mtime regression test now verifies updated helper code is loaded. I also updated the stale BUILTIN_STEP_TYPES comments identified in the review. Full runnable suite: 7,533 passed, 195 skipped; Ruff and CLI smoke are clean. Posted on behalf of @marcelsafin by GitHub Copilot (model: GPT-5.6 Sol).
Assisted-by: GitHub Copilot (model: gpt-5.6-sol, autonomous) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
Scope dynamically loaded custom workflow steps to the current project.
STEP_REGISTRYand Python's module cache are process-global. Loading projectA followed by project B previously left A's step classes active, and a shared
type key could keep using A's imported helper code. Each scan now removes
non-built-in registry entries and generated custom-step modules before loading
the requested project.
Testing
uv run specify --helpuv sync && uv run pytestTargeted:
TestLoadCustomSteps(12 passed).Full suite: 7,533 passed, 195 skipped. One existing PowerShell-launcher test
was omitted because
pwshis unavailable locally; it fails identically on theunchanged upstream commit.
AI Disclosure
GitHub Copilot (GPT-5.6 Sol) autonomously reproduced the bug, wrote the
regression test and implementation, and ran verification under
@marcelsafin's direction and review.