Repository navigation
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #43567 +/- ##
==========================================
+ Coverage 65.62% 65.65% +0.02%
==========================================
Files 3059 3060 +1
Lines 202434 202516 +82
Branches 47448 47460 +12
==========================================
+ Hits 132852 132953 +101
+ Misses 66587 66572 -15
+ Partials 2995 2991 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cfe6118 to
a168933
Compare
|
The issue is valid. The Here is the suggested fix for form_data: Dict[str, Any] = {
"viz_type": "funnel",
"groupby": [config.dimension.name],
"metric": create_metric_object(config.metric),
"sort_by_metric": config.sort_by_metric,
"row_limit": config.row_limit,
"color_scheme": config.color_scheme or "supersetColors",
}
if config.sort_by_metric:
form_data["orderby"] = [[create_metric_object(config.metric), False]]
_add_adhoc_filters(form_data, config.filters)Would you like me to check the other comments on this PR and implement fixes for them as well? superset/mcp_service/chart/chart_utils.py |
Code Review Agent Run #2b2179Actionable Suggestions - 0Additional Suggestions - 2
Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
aminghadersohi
left a comment
There was a problem hiding this comment.
Thanks @gkneighb — this is the fourth MCP chart plugin in the family and it's clean, well-tested, and faithfully mirrors the existing map_pie_config structure. Comments only; nothing here blocks on its own, but two items are worth landing as a shared fix across the family rather than one-off patches.
1. Confirming the CodeAnt thread — sort_by_metric is dropped, and the mechanism is architectural (not one missing key)
The bot thread on chart_utils.py is correct at the mechanism level, and I traced it end-to-end. The MCP path builds its query context through build_query_dicts_from_form_data (superset/mcp_service/chart/chart_helpers.py:562), which reads metrics/groupby/row_limit/filters and — for everything except the bespoke deck_* branch — never emits an orderby. The frontend Funnel/buildQuery.ts is the only place that turns the flag into ordering:
...(sort_by_metric && { orderby: [[metric, false]] }),That transform lives only in buildQuery and the MCP path does not run buildQuery, so it is silently dropped. RAN — stubbing the datasource helpers and feeding the funnel's own form_data through the canonical builder:
form_data: sort_by_metric=True
query dict: {'columns': ['stage'], 'metrics': ['SUM(leads)'], 'row_limit': 10, 'filters': []}
'orderby' in query dict: False
This is the same shape confirmed repeatedly in mcp_service this cycle (granularity_sqla, gauge bounds, radar arity, treemap grain, sankey groupby): any transformation that lives only in a frontend buildQuery is absent on the MCP path. The durable fix is to route MCP form_data through the canonical build path (or centralize a sort_by_metric → orderby step in the shared builder) once, rather than patch each plugin. Note map_pie_config (chart_utils.py:1005) already ships this exact latent no-op, so a shared fix retroactively covers pie too.
2. …but the funnel-specific user impact is narrower than the bot states — worth calibrating
The bot says "funnel stages may appear in nondeterministic order / top-stage-first is not guaranteed." For funnel specifically that overstates the display impact, because the echarts funnel series re-sorts at render time — DEFAULT_FORM_DATA.sort = 'descending' (Funnel/types.ts:73), independent of sort_by_metric. So whatever rows come back are drawn largest-first regardless. INSPECTED (transformProps.ts passes sort straight from form_data to series.sort).
The real consequence is row selection, not draw order: row_limit (default 10) becomes a LIMIT with no ORDER BY. When the dimension has ≤10 distinct values (the common funnel case: a handful of stages) → all rows returned, echarts sorts them, result is visually correct. When distinct values > 10, the DB returns 10 arbitrary rows, so the funnel can show the wrong stages entirely — a silent data-correctness bug, not a cosmetic one. So: harmless in the typical case, wrong-data in the high-cardinality case. That's the precise line to put in the fix's test.
3. aggregate on the dimension is silently accepted — same byte-identical gap as gauge/treemap/radar
reject_sql_expression_on_dimensions (schemas.py) rejects sql_expression and saved_metric on dimension, but not aggregate. RAN:
dimension={"name":"stage","aggregate":"SUM"} -> VALIDATION PASSED
dimension.is_metric = True
mapped groupby = ['stage'] (aggregate silently dropped)
dimension={"name":"x","saved_metric":True} -> REJECTED
dimension={"sql_expression":"COUNT(*)",...} -> REJECTED
The repo already has the canonical predicate — ColumnRef.is_metric (schemas.py:751): bool(self.aggregate) or self.saved_metric or bool(self.sql_expression). Swapping the hand-rolled two-check for is_metric closes all three at once:
@model_validator(mode="after")
def reject_sql_expression_on_dimensions(self) -> "FunnelChartConfig":
if self.dimension and self.dimension.is_metric:
raise ValueError(
"dimension must be a plain category column; "
"aggregate/saved_metric/sql_expression belong in 'metric'"
)
return selfSeverity here is low — the dimension is a single required field, aggregate is silently ignored (grouped as a plain column), so it's wrong-intent, not wrong-data. But it's the same gap now confirmed in four plugins, so it's worth fixing family-wide.
4. Negative-test coverage (Rule 26)
Mentally reverting the production files fails all 16 tests (they import the new symbols) — so the suite is coupled, not vacuous, and it's the largest test file in the family (+188). But the two gaps above are untested, and the sort_by_metric tests actively lock in the no-op:
test_basic_funnel_form_data/test_funnel_form_data_with_filters_and_no_sortassertform_data["sort_by_metric"]is passed through, but never assert anorderbyis produced — they entrench the dropped transform (same as radar's three tests).test_funnel_dimension_rejects_saved_metricexists, but there is no test assertingaggregateon the dimension is rejected.
Adding one test that the built query dict carries orderby when sort_by_metric=True, and one that aggregate-on-dimension raises, would pin both fixes.
Verification: RAN — the 16 unit tests (16 passed), plus both repros above (query-dict inspection and the aggregate/saved_metric/sql_expression validation matrix), against head a168933. INSPECTED — the frontend buildQuery.ts/transformProps.ts/types.ts and the build_query_dicts_from_form_data path. CI at post time: 46 SUCCESS / 0 pending / 0 failing (deduped by check name). Great work — happy to help wire the shared orderby + is_metric fix across the family.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
aminghadersohi
left a comment
There was a problem hiding this comment.
Round 2 — reviewed the new commit b7bab40 on top of round 1. Thanks for the quick turnaround, @gkneighb. Comments only (external contributor ceiling); one item from round 1 is fixed, one is still open.
✅ Fixed — aggregate on the dimension is now rejected
FunnelChartConfig.reject_sql_expression_on_dimensions now gates on ColumnRef.is_metric (schemas.py), which is exactly the canonical predicate. RAN at b7bab40:
dimension={"name":"stage","aggregate":"COUNT"} -> REJECTED
"dimension must be a plain column, not a metric ..."
and the new test_funnel_dimension_rejects_aggregate pins it. Full file: 17 passed. The explicit _reject_sql_expression_on_dimension(...) call is now technically redundant with is_metric (which already covers sql_expression), but it yields a more specific error message for the SQL case, so keeping it is fine. This closes the family-wide gap for funnel. 👍
⏳ Still open — sort_by_metric never becomes an orderby (row-limit selection bug)
This is the more serious of the two round-1 findings and is unchanged — map_funnel_config still emits sort_by_metric as a bare flag and the MCP builder never turns it into ordering. Tracked in the still-open CodeAnt thread on chart_utils.py:1032; not re-filing, just confirming it survives. RAN at b7bab40, feeding the funnel form_data through the canonical build_query_dicts_from_form_data:
query dict: {'columns': ['stage'], 'metrics': ['SUM(leads)'], 'row_limit': 10, 'filters': []}
'orderby' in query dict: False # row_limit=10 applies as LIMIT with no ORDER BY
Consequence remains: with ≤10 distinct stages it renders correctly (echarts re-sorts descending), but with >10 distinct values you get 10 arbitrary rows, not the top-N by the metric.
form_data["orderby"] = [[metric, False]]. That path is a no-op on the MCP builder: _build_single_query_dict builds the query entry from columns/metrics/row_limit/filters and only ever sets orderby inside the deck_* branch (chart_helpers.py:586); a top-level form_data["orderby"] is ignored. The durable fix is to add orderby to the emitted query dict (mirroring the deck-gl pattern) or to route MCP form_data through the shared build path — not to stash orderby in form_data. Same shared fix would retroactively cover map_pie_config, which has the identical latent no-op.
Verification: RAN — 17/17 unit tests and both repros (aggregate rejection + query-dict orderby absence) at head b7bab40. INSPECTED — chart_helpers.py builder path and the Bito/CodeAnt suggestions. CI at post time: 48 SUCCESS / 0 failing / 0 pending (deduped by check name). Nice work on the aggregate fix.
Code Review Agent Run #52f8b6Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
@aminghadersohi — fixed the still-open |
Code Review Agent Run #85c1d5Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
aminghadersohi
left a comment
There was a problem hiding this comment.
Re-reviewed at eceedafe. Both prior-round findings are fixed and verified.
aggregateon the dimension — rejected viaColumnRef.is_metricinFunnelChartConfig(schemas.py). ✔sort_by_metric→orderby— fixed in the shared_build_single_query_dict(chart_helpers.py), not in form_data (correct: the builder ignores a top-levelform_data['orderby']). Verified the built query dict now carriesorderby=[(metric, False)]when the flag is set, none when it'sFalse, and theand metricsguard avoids anIndexErroron metric-less queries. Same change also fixes the identical latent no-op inmap_pie_config. ✔
Net-new this round: the branch now conflicts with master. The only textual conflict is in superset/mcp_service/chart/schemas.py at the ChartConfig discriminator description — HEAD adds 'funnel' to the type list, master added 'interactive_pivot'. Rebase and keep both strings; the union member itself auto-merges, only the description literal collides.
The CodeAnt thread on chart_utils.py:1032 still shows unresolved because the fix landed in chart_helpers.py rather than the anchored line — it is addressed, not outstanding.
eceedaf to
1018e8a
Compare
aminghadersohi
left a comment
There was a problem hiding this comment.
Re-reviewed at 1018e8a. Clean — the round-3 conflict is resolved and there's nothing net-new.
- Rebase resolved the
CONFLICTINGstate (nowMERGEABLE). Theschemas.pyChartConfigdiscriminator description now correctly lists both'funnel'and'interactive_pivot'(#43480), andFunnelChartConfigremains in the union. - Both prior fixes survived the rebase, verified at HEAD:
sort_by_metric→orderbyin_build_single_query_dict(emits[(metric, False)]when the flag is set) and theColumnRef.is_metricaggregate-on-dimension rejection. - New docs-only commit adds
funnelto theget_chart_type_schemacore-types docstring — matches the registered adapters. ✔
The CodeAnt thread on chart_utils.py (line 1059 after the rebase) is still marked unresolved but is addressed — the fix lives in _build_single_query_dict (chart_helpers.py), not the anchored mapper line.
No outstanding or new findings. CI is green; mergeStateStatus=BLOCKED reflects the required-review gate only.
Code Review Agent Run #09ec02Actionable Suggestions - 0Additional Suggestions - 3
Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
@gkneighb Thanks—the earlier Funnel aggregate-dimension and saved get-data ordering fixes remain correct at
I ran the 18 focused Funnel tests and the full MCP chart suite (1,385 passed) plus native-shape, preservation, ordering, alias/type, and ambiguity reproductions; these gaps remain with green CI. Shared builder/canonicalization/error handling from #43737 and omission-aware update work from #43679 should be reused/rebased rather than duplicated. I did not modify or push to your branch. |
|
@gkneighb tempted to merge this, but wondering if you were going to address any of the (potentially) follow up work here before merging. Let us know, and thanks! |
1018e8a to
de8ae20
Compare
aminghadersohi
left a comment
There was a problem hiding this comment.
Re-reviewed at 061c350b: the delta vs our approved 1018e8a1 is rebase-only — the chart_helpers.py orderby fix moved to master via #43568 and still fires, so the approval premise holds. Three non-blocking inline notes; 61/61 CI legs concluded, 0 failures.
There was a problem hiding this comment.
Code Review Agent Run #525973
Actionable Suggestions - 1
-
superset/mcp_service/chart/plugins/funnel.py - 1
- CWE-1188: Loses model_fields_set on normalize · Line 99-99
Additional Suggestions - 3
-
superset/mcp_service/chart/schemas.py - 2
-
Validator name inconsistent · Line 1718-1718This validator rejects every metric marker on the dimension — `sql_expression` via `_reject_sql_expression_on_dimension` plus `aggregate`/`saved_metric` via `ColumnRef.is_metric` — and there is only one dimension, yet the name says `sql_expression` and plural `dimensions`. Sibling `BubbleChartConfig.reject_metric_style_dimensions` names the same job for entity/series. Rename to e.g. `reject_metric_style_dimension` so the name matches scope and count.
-
Always-true dimension guard · Line 1722-1722`self.dimension` is a required `ColumnRef` (`...` on the `dimension` field), and Pydantic v2 runs `mode="after"` validators only after field validation, so it is always a truthy instance here — the `self.dimension and` operand is dead. Sibling validators (`BubbleChartConfig.reject_metric_style_dimensions`) test `col.is_metric` directly. Drop the truthiness check so the code does not imply `dimension` can be absent.
-
-
superset/mcp_service/chart/plugins/__init__.py - 1
-
Unsorted __all__ entry · Line 81-81`__all__` is alphabetically sorted (BigNumber…XY), but `"FunnelChartPlugin"` sits between `PieChartPlugin` and `PivotTableChartPlugin`, breaking the ordering. The import block and `register()` calls follow alphabetical order, so this looks like an accidental insertion. Move it after `"GaugeChartPlugin"` to keep the list navigable and consistent.
-
Review Details
-
Files reviewed - 7 · Commit Range:
061c350..061c350- superset/mcp_service/chart/chart_utils.py
- superset/mcp_service/chart/plugins/__init__.py
- superset/mcp_service/chart/plugins/funnel.py
- superset/mcp_service/chart/schemas.py
- superset/mcp_service/chart/tool/generate_chart.py
- superset/mcp_service/chart/tool/get_chart_type_schema.py
- tests/unit_tests/mcp_service/chart/test_funnel_chart.py
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- Manually triggers a full AI Review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
|
@gkneighb thanks for the PR. Holler if you want a hand addressing/resolving the latest PR review comments (human and bot ones ;) |
061c350 to
235a683
Compare
|
@rusackas Thanks for the offer. Nothing outstanding here is blocking, but I did push one substantive change since your comment, at
On @aminghadersohi's three notes, all of which he marked non-blocking: the thin-coverage one is fair (every test uses the default Say the word on the fixture and I'll push it; otherwise this is ready from my side. |
There was a problem hiding this comment.
Code Review Agent Run #ffe711
Actionable Suggestions - 1
-
superset/mcp_service/chart/schemas.py - 1
- Metric aggregate not validated · Line 1721-1727
Additional Suggestions - 3
-
tests/unit_tests/mcp_service/chart/test_funnel_chart.py - 1
-
Misleading test docstring · Line 146-146This docstring says the MCP query builder never reads a top-level `form_data['orderby']`, but `_build_single_query_dict` does exactly that (`chart_helpers.py:740-741`). What is true is that `map_funnel_config` never emits one, so the `sort_by_metric` translation at `chart_helpers.py:753-754` carries the ordering. Reword to avoid misleading maintainers.
-
-
superset/mcp_service/chart/plugins/__init__.py - 1
-
Alphabetical order broken · Line 81-81`FunnelChartPlugin` is exported in `__all__` but placed after `PieChartPlugin`, breaking the alphabetical ordering every other entry follows (compare `BigNumberChartPlugin`...`XYChartPlugin`). This is the same ordering used by the import block, so the list reads inconsistently and future alphabetical inserts may collide with this entry. Reorder it between `GanttChartPlugin` and `HandlebarsChartPlugin`.
-
-
superset/mcp_service/chart/plugins/funnel.py - 1
-
Replace `Any` with specific type · Line 77-77Avoid using `typing.Any` in method signatures. For `extract_column_refs`, change `config: Any` to `config: FunnelChartConfig` and remove the `isinstance` check. Similar `Any` usages exist in other methods.
-
Review Details
-
Files reviewed - 8 · Commit Range:
235a683..235a683- superset/mcp_service/chart/chart_utils.py
- superset/mcp_service/chart/plugins/__init__.py
- superset/mcp_service/chart/plugins/funnel.py
- superset/mcp_service/chart/schemas.py
- superset/mcp_service/chart/tool/generate_chart.py
- superset/mcp_service/chart/tool/get_chart_type_schema.py
- tests/unit_tests/mcp_service/chart/test_chart_utils.py
- tests/unit_tests/mcp_service/chart/test_funnel_chart.py
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- Manually triggers a full AI Review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
| _reject_sql_expression_on_dimension(self.dimension, "dimension") | ||
| if self.dimension and self.dimension.is_metric: | ||
| raise ValueError( | ||
| "dimension must be a plain column, not a metric; drop " | ||
| "'aggregate'/'saved_metric' (metrics belong in the 'metric' field)" | ||
| ) | ||
| return self |
There was a problem hiding this comment.
metric accepts a bare column ({"name": ...}, no aggregate), but create_metric_object silently defaults it to SUM and DatasetValidator._validate_aggregations skips refs without aggregate — so SUM(text_column) reaches the database as a raw DB error. GaugeChartConfig rejects non-metric refs; BubbleChartConfig.record_implicit_metric_aggregate records the implicit SUM for exactly this reason. Add the gauge-style guard here.
Code Review Run #ffe711
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
235a683 to
bed07ee
Compare
There was a problem hiding this comment.
Code Review Agent Run #826fad
Actionable Suggestions - 1
-
superset/mcp_service/chart/schemas.py - 1
- Metric SUM default unvalidated · Line 1746-1750
Additional Suggestions - 5
-
tests/unit_tests/mcp_service/chart/test_chart_utils.py - 2
-
Duplicated test scaffold · Line 163-212Third near-identical copy of the omitted-defaults merge test: the parametrize table, `DatasetContext` construction, existing dict and assertion match `test_merge_bubble_preserves_omitted_defaults` and `test_merge_chart_preserves_omitted_defaults` verbatim except for config/mapper lines. A shared helper parametrized over config factory and mapper would stop harness fixes from diverging across the three copies.
-
Missing explicit-None parametrize case · Line 166-171The pie sibling `test_merge_chart_preserves_omitted_defaults` pins a third case this table lacks: explicitly sending `color_scheme: None` must replace the saved scheme with the `map_funnel_config` default (`config.color_scheme or "supersetColors"`) instead of preserving `lyftColors`. Adding it pins the fields-set-vs-None branch for funnel, whose table already diverged from the pie copy.
-
-
superset/mcp_service/chart/schemas.py - 1
-
Legacy List[] typing · Line 1756-1756`filters: List[FilterConfig]` uses legacy `typing.List` on a newly added class. CLAUDE.md §6 mandates Python 3.10+ style (`list[str]`, `T | None`) for all new code and labels `List[...]` 'DO NOT USE'. Use `list[FilterConfig] | None` here.
-
-
superset/mcp_service/chart/plugins/__init__.py - 1
-
Misordered __all__ Entry · Line 81-81The `__all__` list is maintained in strict alphabetical order (all 15 pre-existing entries: BigNumber...XY), but the new `"FunnelChartPlugin"` entry at line 81 is inserted after `"PieChartPlugin"`, breaking the ordering. Alphabetically it belongs between `"BubbleChartPlugin"` and `"GanttChartPlugin"`. The misplaced entry impedes scanning and invites duplicate/misplaced insertions in future plugin additions.
-
-
superset/mcp_service/chart/plugins/funnel.py - 1
-
Missing method docstrings · Line 45-141BITO.md adaptive rule 12147 requires inline docstrings on every newly introduced Python function. None of the seven overrides here (`pre_validate`, `extract_column_refs`, `to_form_data`, `generate_name`, `resolve_viz_type`, `normalize_column_refs`, `schema_error_hint`) has one; the contracts they implement live only in `BaseChartPlugin`/`ChartTypePlugin` in `plugin.py`. Add one-line docstrings stating each method's funnel-specific behavior.
-
Review Details
-
Files reviewed - 8 · Commit Range:
bed07ee..bed07ee- superset/mcp_service/chart/chart_utils.py
- superset/mcp_service/chart/plugins/__init__.py
- superset/mcp_service/chart/plugins/funnel.py
- superset/mcp_service/chart/schemas.py
- superset/mcp_service/chart/tool/generate_chart.py
- superset/mcp_service/chart/tool/get_chart_type_schema.py
- tests/unit_tests/mcp_service/chart/test_chart_utils.py
- tests/unit_tests/mcp_service/chart/test_funnel_chart.py
-
Files skipped - 0
-
Tools
- MyPy (Static Code Analysis) - ✔︎ Successful
- Astral Ruff (Static Code Analysis) - ✔︎ Successful
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers an incremental AI Review. -
/review full- Manually triggers a full AI Review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at [email protected].
Documentation & Help
| ) | ||
| metric: ColumnRef = Field( | ||
| ..., | ||
| description="Value metric sizing each stage (use aggregate e.g. SUM, " | ||
| "COUNT for ad-hoc, or set saved_metric=True for a saved dataset metric)", |
There was a problem hiding this comment.
A bare metric (no aggregate/saved_metric/sql_expression) is silently summed by create_metric_object (chart_utils.py), but DatasetValidator._validate_aggregations skips refs without aggregate (dataset_validator.py:785), so SUM(text) reaches the DB on Tier-2-skipping paths. BubbleChartConfig.record_implicit_metric_aggregate guards exactly this; add the same recording here.
Code Review Run #826fad
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
|
Rebased onto current master. CI here is down to one failing test, The same single test fails on all four chart-plugin PRs (#43567, #43570, #43571, #43573) for the same structural reason: that guard flags dispatcher branches keyed on registered chart types, so registering a new type is enough to turn pre-existing code into a violation. It needs the per-type behavior moved into the new plugin hooks rather than a line edit. I've written the full analysis and two questions for @rusackas in one place to avoid four parallel threads: #43573 (comment) Otherwise this branch is rebased, mergeable, and green. |
bed07ee to
9317e2c
Compare
|
I'll leave the judgement calls on the thread to @aminghadersohi but this does seem to need a conflict resolved if you can tackle that bit @gkneighb. Thanks! |
|
@gkneighb @rusackas thanks both. Taking the judgement calls on my threads:
I haven't reviewed the changes made after my last review: |
Adds a generate_chart plugin for funnel (viz_type 'funnel'): a single dimension defines the funnel stages, one metric sizes each stage, and sort_by_metric orders the stages by that metric. Redone against current master (past the gauge plugin + the gauge_chart->gauge rename follow-up) so it applies cleanly. Ordering is applied by the shared query-dict builder via sort_by_metric. Adds the generate_chart.py docstring entry + the get_chart_type_schema core list. Co-Authored-By: Claude Opus 4.8 <[email protected]>
9317e2c to
e11dfdd
Compare
|
Resolved the stale threads that had already been fixed or explicitly deferred as follow-up (sort_by_metric → orderby, the CWE-1188 model_fields_set fix, and the three items @aminghadersohi already called non-blocking in the thread above). Also rebased onto current master to clear the conflict in One thread is still genuinely open and not just stale: |
SUMMARY
Adds a
generate_chartMCP plugin for the funnel chart type (viz_type: funnel), so the MCPgenerate_charttool can produce funnels. Funnel is a shipped Superset viz type that had no MCP plugin; this closes that gap.The plugin mirrors the frontend Funnel
buildQuerycontract: a singlegroupbydimension whose values become the funnel stages, plus onemetricsizing each stage. Whensort_by_metricis set (the frontend default), the query orders stages by the metric descending.It follows the established plugin pattern (
pie/waterfall) — a config schema, amap_*_configmapper, a plugin class, and registration:FunnelChartConfig—dimension+metricrequired; optionalsort_by_metric,row_limit(frontend default 10),filters,color_scheme. Added to theChartConfigdiscriminated union and theget_chart_type_schemaadapters. A dimension may not be asaved_metric/sql_expression(metric-only), matching the pie schema.map_funnel_config— maps the config toform_data; saved metrics pass through as a bare name string, ad-hoc metrics as SIMPLE/SQL adhoc objects (via the sharedcreate_metric_object).FunnelChartPlugin— registered in the plugin registry;funnelwas already present in the recommendation category map.The field set is intentionally minimal (core query contract). Cosmetic controls such as
label_typewere deliberately left out for a follow-up — funnel'slabel_typeis a numeric ECharts enum that needs a string→int mapping, which is out of scope here.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend/MCP only, no UI change.
TESTING INSTRUCTIONS
pytest tests/unit_tests/mcp_service/chart/test_funnel_chart.py— 16 unit tests cover schema validation (required fields, extra-field rejection, dimension-not-a-metric), nativegroupbyaliasing,ChartConfigunion dispatch,form_datamapping (viz_type/groupby/metric/sort/row_limit/filters/saved-metric), and registry integration (registration,resolve_viz_type,display_name,pre_validate).To exercise end-to-end: call the
generate_chartMCP tool with{"chart_type": "funnel", "dimension": {"name": "stage"}, "metric": {"name": "leads", "aggregate": "SUM"}}.ADDITIONAL INFORMATION
🤖 Generated with Claude Code