hardbyte / hardbyte/python-common-expression-language

audit support of evaluate or program.execute method(Support for execution tracing and variable-level audit logs)

Đang mở
#30 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
43
Fork
4
Merge trung bình
9 giờ 57 phút
Pull request đã merge (30 ngày)
14

Mô tả

Currently, the common-expression-language library evaluates expressions but provides limited or no visibility into the evaluation process. Specifically, there is:

No built-in execution trace.
No automatic "why it failed" explanation for complex logic.
No variable-level audit log to identify which specific part of the context triggered a result.

When dealing with collection-based macros like .exists(), etc,. it is difficult to debug which specific element in a list caused the expression to return True or False.

I would like a mechanism that returns a trace or an audit log. This trace should identify which value in the context resulted in the final pass, fail, or result.

Additional context (Example)
Consider the following scenario:

Expression: value.exists(v, v.x == 5)
Context: {"value": [{"x": 7}, {"x": 15}, {"x": 5}]}

The Issue:
The library correctly returns True because the third element matches the condition. However, there is no built-in way to programmatically identify that {"x": 5} was the specific element that satisfied the condition. In more complex real-world scenarios, knowing "why" or "which" value triggered the result is critical for auditing and debugging.

Suggested Output/API:
It would be helpful if the library could provide an output similar to:

{
"result": true,
"trace": {
"matched_element": {"x": 5},
"index": 2,
"expression_part": "v.x == 5"
}
}

Thanks in advance, please let me know if any more information or details needed.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.