StackStorm / StackStorm/st2

orquesta with-items-model for dict error

Open
#5,547 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

orquesta with-items-model for dict is error

i compare two version ,data class type is different

stackstorm 3.5
yaql: $.items() type is:
<class 'generator'> <generator object ItemsView.iter at 0x7f5146a85d58>

stackstorm 3.6
yaql: $.items() type is:
class collections.abc.ItemsView

STACKSTORM VERSION

stacstorm 3.6 is error
stackstorm 3.5 is ok

OS, environment, install method

in docker

Steps to reproduce the problem

version: "1.0"
description: test with.
input:
  - input_num
tasks:
  task0:
    action: core.echo message=ok
    input:
      input_num: <% ctx().input_num %>
    next:
      - when: <% succeeded() %>
        publish:
          - messages: <% result().result %>
        do: task1

  task1:
    with: k, v in <% ctx(messages).items() %>
    action: core.echo message=<% item(v) %>

Expected Results

YaqlEvaluationException: Unable to evaluate expression '<% ctx(messages).items() %>'. TypeError: unhashable type: 'list",

Actual Results

stackstorm 3.5 is ok

stacstorm 3.6 is error

but, when i change source code at stackstorm 3.6 (yaql/language/utils.py):
engine.options.get('yaql.convertSetsToLists', False)===>engine.options.get('yaql.convertSetsToLists', True)
then it works ok. !!!!!
why?

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided workflow reproduction and compare the $.items() behavior between StackStorm 3.5 and 3.6. Inspect yaql/language/utils.py, especially the yaql.convertSetsToLists option, and verify that the dict-based with-items expression works in the 3.6 environment without regressing related YAQL conversions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.