Skip to content

Commit ed7386b

Browse files
committed
Address sixteenth review: docs regex, fan_in try/finally, hyphenated dot-path keys
- PUBLISHING.md: update ID regex docs to match implementation (single-char OK) - FanInStep: wrap expression evaluation in try/finally for context.fan_in - Expression dot-path: allow hyphens in keys before list index (e.g. run-tests[0])
1 parent 18e7354 commit ed7386b

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/specify_cli/workflows/expressions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _resolve_dot_path(obj: Any, path: str) -> Any:
7171
current = obj
7272
for part in parts:
7373
# Handle list indexing: name[0]
74-
idx_match = re.match(r"^(\w+)\[(\d+)\]$", part)
74+
idx_match = re.match(r"^([\w-]+)\[(\d+)\]$", part)
7575
if idx_match:
7676
key, idx = idx_match.group(1), int(idx_match.group(2))
7777
if isinstance(current, dict):

src/specify_cli/workflows/steps/fan_in/__init__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ def execute(self, config: dict[str, Any], context: StepContext) -> StepResult:
3535
context.fan_in = {"results": results}
3636
resolved_output: dict[str, Any] = {"results": results}
3737

38-
for key, expr in output_config.items():
39-
if isinstance(expr, str) and "{{" in expr:
40-
resolved_output[key] = evaluate_expression(expr, context)
41-
else:
42-
resolved_output[key] = expr
43-
44-
# Restore previous fan_in state
45-
context.fan_in = prev_fan_in
38+
try:
39+
for key, expr in output_config.items():
40+
if isinstance(expr, str) and "{{" in expr:
41+
resolved_output[key] = evaluate_expression(expr, context)
42+
else:
43+
resolved_output[key] = expr
44+
finally:
45+
# Restore previous fan_in state even if evaluation fails
46+
context.fan_in = prev_fan_in
4647

4748
return StepResult(
4849
status=StepStatus.COMPLETED,

workflows/PUBLISHING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ steps:
8686
8787
**Validation Checklist**:
8888
89-
- ✅ `id` is lowercase with hyphens only (matches `^[a-z0-9][a-z0-9-]*[a-z0-9]$`)
89+
- ✅ `id` is lowercase alphanumeric with hyphens (single-character IDs are allowed)
9090
- ✅ `version` follows semantic versioning (X.Y.Z)
9191
- ✅ `description` is concise
9292
- ✅ All step IDs are unique

0 commit comments

Comments
 (0)