Skip to content

[FIX] mis_builder: summed queries with the read_group signature of 20.0 - #4

Open
namilosh wants to merge 1 commit into
kmee:20.0-mig-mis_builderfrom
namilosh:20.0-mig-mis_builder-fix-query-sum
Open

namilosh wants to merge 1 commit into
kmee:20.0-mig-mis_builderfrom
namilosh:20.0-mig-mis_builder-fix-query-sum

Conversation

@namilosh

Copy link
Copy Markdown

For OCA#842 (20.0 migration).

Since 20.0, read_group takes (domain, groupby, aggregates) and returns tuples. In MisReport._fetch_queries the summed-query branch (aggregate = sum, all fields stored) still calls read_group(domain, field_names, []), i.e. groups by the fields, and reads data[0]["__count"], so any report with a summed query on stored fields fails with TypeError: tuple indices must be integers or slices, not str (or IndexError when nothing matches).

The fix asks for ["__count", "<field>:sum", ...] without groupby, which always returns exactly one row.

The existing query test uses a non-stored field and never reaches this branch; test_query_sum covers it (fails before the fix, passes after). All 103 mis_builder tests pass on top of a663110; pre-commit passes.

🤖 Generated with Claude Code

Since 20.0 read_group takes (domain, groupby, aggregates) and returns
tuples. The summed-query branch still passed the fields as groupby and
indexed the result as a dict, so a report with a summed query on stored
fields failed with "tuple indices must be integers or slices, not str".
Without groupby, read_group returns exactly one row, also when nothing
matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T17:23:03.117367Z 785d33b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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