Skip to content

Commit e6e23a4

Browse files
mnriemCopilot
andcommitted
fix: address PR review feedback
- Add type guard before 'in' check for effect to prevent TypeError on unhashable YAML values (list/dict) - Comment out category/effect in template so authors must opt in - Use VALID_EFFECTS constant in test instead of hard-coded values Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 26f0407 commit e6e23a4

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

extensions/template/extension.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ extension:
1515

1616
# CUSTOMIZE: Extension category — describes what the extension operates on
1717
# Common values: docs, code, process, integration, visibility
18-
category: "process"
18+
# category: "process"
1919

2020
# CUSTOMIZE: Extension effect — whether it modifies project files
2121
# One of: read-only | read-write
22-
effect: "read-write"
22+
# effect: "read-write"
2323

2424
# CUSTOMIZE: Your name or organization name
2525
author: "Your Name"

src/specify_cli/extensions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ def _validate(self):
212212

213213
# Validate optional effect field
214214
if "effect" in ext:
215-
if ext["effect"] not in VALID_EFFECTS:
215+
if not isinstance(ext["effect"], str) or ext["effect"] not in VALID_EFFECTS:
216216
raise ValidationError(
217-
f"Invalid extension.effect '{ext['effect']}': "
217+
f"Invalid extension.effect '{ext.get('effect')}': "
218218
f"must be one of {sorted(VALID_EFFECTS)}"
219219
)
220220

tests/test_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def test_valid_effect(self, temp_dir, valid_manifest_data):
317317
"""Test manifest with valid effect values."""
318318
import yaml
319319

320-
for effect in ("read-only", "read-write"):
320+
for effect in sorted(VALID_EFFECTS):
321321
valid_manifest_data["extension"]["effect"] = effect
322322
manifest_path = temp_dir / "extension.yml"
323323
with open(manifest_path, 'w') as f:

0 commit comments

Comments
 (0)