simvue-io / simvue-io/python-api

Filter format inconsistent with UI

Open
#831 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog bug
Dominant language
Python
Stars
4
Forks
1
Avg merge
5d 8h
Merged PRs (30d)
4

Description

Description of Bug

When you copy a filter with multiple different items from the UI, you get:
"folder.path == /GS2/test_data && metrics.mtm.last == 1"

But if you submit that via the Client class, you get an error:

RuntimeError: Retrieval of runs failed for url 'https://uk.simvue.io/api/runs?filters=%5B%22folder.path+%3D%3D+%2FGS2%2Ftest_data+%26%26+metrics.mtm.last+%3D%3D+1%22%5D&return_basic=True&return_metrics=True&return_alerts=False&return_system=False&return_metadata=True&count=100&start=0' with status 422: Invalid filter

We believe this is because the python API instead expects a list of filters, not '&&'. Could we fix it so that the python API accepts either format and converts it appropriately?

Steps To Reproduce

Steps to reproduce the behavior:

  1. Go to web UI
  2. Add two filters
  3. Copy filter string with the button on the UI, and paste into client.get_runs()
  4. See error

Expected behavior

Runs retrieved correctly

Actual Behaviour

422 error

Setup

  • OS: Ubuntu
  • Python version: 3.10

Additional context

Add any other context about the problem here.

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 at the Client.get_runs() entry point named in the reproduction and trace how its filter argument is formatted for the runs request. Reproduce the two-filter example from the issue, then verify that both the UI's && string and the existing list format retrieve runs without a 422 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.