Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_rules() error #67

Closed
2 tasks done
tcpr1 opened this issue Sep 8, 2024 · 1 comment · Fixed by #70
Closed
2 tasks done

run_rules() error #67

tcpr1 opened this issue Sep 8, 2024 · 1 comment · Fixed by #70
Labels
bug Something isn't working

Comments

@tcpr1
Copy link

tcpr1 commented Sep 8, 2024

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of actualpy.

Reproducible example

with Actual(base_url=URL_ACTUAL, password=PASSWORD_ACTUAL, file=FILE_ACTUAL) as actual:
    actual.run_rules()
    actual.commit()

Log output

Traceback (most recent call last):
  File "/config/actual-pluggy-py/actual-pluggy.py", line 27, in <module>
    actual.run_rules()
  File "/config/actual-pluggy-py/.conda/lib/python3.11/site-packages/actual/__init__.py", line 414, in run_rules
    ruleset = get_ruleset(self.session)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/actual-pluggy-py/.conda/lib/python3.11/site-packages/actual/queries.py", line 604, in get_ruleset
    conditions = TypeAdapter(list[Condition]).validate_json(rule.conditions)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/actual-pluggy-py/.conda/lib/python3.11/site-packages/pydantic/type_adapter.py", line 144, in wrapped
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/actual-pluggy-py/.conda/lib/python3.11/site-packages/pydantic/type_adapter.py", line 393, in validate_json
    return self.validator.validate_json(data, strict=strict, context=context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for list[function-after[check_operation_type(), function-after[convert_value(), Condition]]]
0.type
  Input should be 'date', 'id', 'string', 'number' or 'boolean' [type=enum, input_value='imported_payee', input_type=str]
    For further information visit https://errors.pydantic.dev/2.9/v/enum

Issue description

Example of rule set that broke the code: "imported payee contains XXXXXX -> set payee to YYYYYY"

Expected behavior

do not get "exit code"

Installed versions

  • actualpy version: 0.4.0 - Actual Server version: 24.9.0
@tcpr1 tcpr1 added the bug Something isn't working label Sep 8, 2024
@bvanelli
Copy link
Owner

bvanelli commented Sep 8, 2024

Closed as solved in #70, the type of condition was not implemented, I might have skipped due to thinking it was a deprecated function.

You can try it locally and let me know if it works. I wrote some tests and also did some local testing too, and everything seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants