Skip to content

fix: support aggregate field dictionaries in get_list (backport #65) - #73

Merged
barredterra merged 1 commit into
developfrom
mergify/bp/develop/pr-65
Jul 20, 2026
Merged

fix: support aggregate field dictionaries in get_list (backport #65)#73
barredterra merged 1 commit into
developfrom
mergify/bp/develop/pr-65

Conversation

@mergify

@mergify mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This is an automatic backport of pull request #65 done by [Mergify](https://mergify.com).

@greptile-apps

greptile-apps Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — the change is a targeted, well-tested fix that corrects a data-loss bug where aggregate field dicts were silently stringified before reaching Frappe's ORM.

The rewritten coerce_field_list correctly handles all three input shapes (None, str, list) and the new list comprehension properly distinguishes dict entries from string entries. The removal of TypeError from the except clause is safe because json.loads is only called after confirming the input is a str. A matching regression test covers the new behavior end-to-end. Docstring improvements in toolset.py are accurate. No unrelated changes were introduced.

No files require special attention.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Caller
    participant get_list as tools.get_list
    participant coerce as coerce_field_list
    participant client as client.get_list

    Caller->>get_list: "fields=[{"SUM": "grand_total", "as": "total"}]"
    get_list->>coerce: coerce_field_list(fields)
    note over coerce: isinstance(value, str)? No → skip JSON parse<br/>list comprehension: dict entry preserved as-is
    coerce-->>get_list: "[{"SUM": "grand_total", "as": "total"}]"
    get_list->>client: "doctype, fields=[{...}], filters, order_by, limit_page_length, group_by"
    client-->>get_list: list[dict]
    get_list-->>Caller: list[dict]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Caller
    participant get_list as tools.get_list
    participant coerce as coerce_field_list
    participant client as client.get_list

    Caller->>get_list: "fields=[{"SUM": "grand_total", "as": "total"}]"
    get_list->>coerce: coerce_field_list(fields)
    note over coerce: isinstance(value, str)? No → skip JSON parse<br/>list comprehension: dict entry preserved as-is
    coerce-->>get_list: "[{"SUM": "grand_total", "as": "total"}]"
    get_list->>client: "doctype, fields=[{...}], filters, order_by, limit_page_length, group_by"
    client-->>get_list: list[dict]
    get_list-->>Caller: list[dict]
Loading

Reviews (1): Last reviewed commit: "fix: support aggregate field dictionarie..." | Re-trigger Greptile

@barredterra
barredterra merged commit 3728297 into develop Jul 20, 2026
5 checks passed
@barredterra
barredterra deleted the mergify/bp/develop/pr-65 branch July 20, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant