Repository navigation
Conversation
kun-codes
commented
Jul 9, 2026
- needs the branch in PR Fix/fix multiple keywords #330 for verification of fixes in this branch so merge this into branch of Fix/fix multiple keywords #330 to test it locally
- merge this to main before merging pr Fix/fix multiple keywords #330
…tion
- adds a whole-param `${name}` resolver to `utils.py`, using an anchored regex (`^\$\{([^}]+)\}$`) rather than the loose `startswith`/`endswith` check used elsewhere. This distinguishes a param that *is* a single variable reference from one that merely embeds `${var}` inside a larger expression (e.g. `${a} + ${b}`), which must be left untouched for keywords like `Evaluate`/`Condition` to resolve internally
…ecutor`
- `optics serve`'s single-keyword execution path (`KeywordExecutor.execute`) passed params straight through with no `${var}` resolution at all, unlike CSV/YAML execution and `optics live`, which both do this generically. As a result, most keywords (anything not implementing its own internal resolution, e.g. `press_element`, `execute_module`, `date_evaluate`) received `${var}` completely unresolved when called over the HTTP API.
- resolve each param via `utils.resolve_scalar_param` before dispatch, skipping indices a keyword marks via `@raw_params` so keywords that manage their own substitution (`Evaluate`, `Condition`, etc.) are unaffected.
There was a problem hiding this comment.
Pull request overview
This PR centralizes ${var} parameter resolution for keyword execution (notably for optics serve) by resolving whole-parameter variable references from session.elements before dispatching to keyword methods, while allowing keywords to mark certain argument positions as “raw” and skip auto-resolution.
Changes:
- Added
resolve_scalar_paramutility to resolve whole-parameter${name}references fromsession.elements. - Updated
KeywordExecutor.executeto pre-resolve parameters (respecting_raw_param_indices) before deserializing and invoking keyword methods.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| optics_framework/common/utils.py | Adds a helper to resolve whole ${var} references against session.elements for use by execution paths. |
| optics_framework/common/execution.py | Resolves parameters before keyword dispatch (with raw-index opt-out) so optics serve can correctly substitute variables. |
Comments suppressed due to low confidence (1)
optics_framework/common/execution.py:192
KeywordExecutor.executewraps all exceptions (includingOpticsError) intoOpticsError(Code.E0401), which discards the original structured error code/details (e.g. element/variable resolution errors fromresolve_scalar_param). Prefer re-raisingOpticsErrorunchanged so callers can handle the specific code, while still wrapping unexpected exceptions.
except Exception as e:
await event_manager.publish_event(Event(
entity_type="keyword",
entity_id=session.session_id,
name=self.keyword,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
Hello @kun-codes what is it solving? |
|
@malto101 Currently when passing a variable like |
Got it!. |


