Skip to content

Commit df061e0

Browse files
Copilotmnriem
andauthored
Polish: rename _default to default_registry, strengthen unreadable-file test
Agent-Logs-Url: https://github.com/github/spec-kit/sessions/0dca6393-f5a9-40de-bb5c-77ba6af033d2 Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
1 parent e311afb commit df061e0

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/specify_cli/workflows/catalog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,20 +593,20 @@ def __init__(self, project_root: Path) -> None:
593593

594594
def _load(self) -> dict[str, Any]:
595595
"""Load registry from disk or create default."""
596-
_default: dict[str, Any] = {"schema_version": self.SCHEMA_VERSION, "steps": {}}
596+
default_registry: dict[str, Any] = {"schema_version": self.SCHEMA_VERSION, "steps": {}}
597597
if self.registry_path.exists():
598598
try:
599599
with open(self.registry_path, encoding="utf-8") as f:
600600
data = json.load(f)
601601
# Validate shape: must be a dict with a dict "steps" field
602602
if not isinstance(data, dict):
603-
return _default
603+
return default_registry
604604
if not isinstance(data.get("steps"), dict):
605605
data["steps"] = {}
606606
return data
607607
except (json.JSONDecodeError, ValueError, OSError, UnicodeError):
608-
return _default
609-
return _default
608+
return default_registry
609+
return default_registry
610610

611611
def save(self) -> None:
612612
"""Persist registry to disk."""

tests/test_workflows.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,10 @@ def test_registry_unreadable_file_resets(self, project_dir):
19571957
finally:
19581958
registry.registry_path.chmod(0o644)
19591959

1960+
# After restoring permissions the registry is fully functional
1961+
registry2.add("deploy", {"name": "Deploy", "type_key": "deploy"})
1962+
assert registry2.is_installed("deploy")
1963+
19601964

19611965
# ===== Step Catalog Tests =====
19621966

0 commit comments

Comments
 (0)