Skip to content

fix(api): align sort and prophet option schemas with their operations - #43206

Merged
rusackas merged 2 commits into
apache:masterfrom
SEPURI-SAI-KRISHNA:fix/post-processing-option-schemas
Sep 16, 2026
Merged

rusackas merged 2 commits into
apache:masterfrom
SEPURI-SAI-KRISHNA:fix/post-processing-option-schemas

Conversation

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Contributor

SUMMARY

Two post-processing option schemas document fields that the operations they
describe do not accept. Because options is passed through unvalidated, a
client that follows the OpenAPI spec gets an HTTP 500.

QueryObject.exec_post_processing dispatches with:

df = getattr(pandas_postprocessing, operation)(df, **options)

and ChartDataPostProcessingOperationSchema.options is a bare fields.Dict.
The per-operation schemas are therefore documentation only — nothing validates
against them — so a field they publish but the function does not accept becomes
TypeError: <op>() got an unexpected keyword argument.

ChartDataSortOptionsSchema is entirely out of sync with sort(). It
documents a columns dict — marked required=True — plus aggregates:

columns = fields.Dict(..., required=True)
aggregates = ChartDataAggregateConfigField()

while the function signature is:

def sort(df, is_sort_index=False, by=None, ascending=True) -> DataFrame:

So sending exactly what the spec marks as required fails, and the three real
parameters are undocumented:

>>> sort(df, columns={"country": True})
TypeError: sort() got an unexpected keyword argument 'columns'

The frontend sortOperator already sends {is_sort_index, ascending} or
{by, ascending}, confirming which side is correct.

ChartDataProphetOptionsSchema documents monthly_seasonality, which
prophet() does not take — it takes daily_seasonality, which was undocumented,
along with index:

>>> prophet(df, periods=2, confidence_interval=0.8, time_grain="P1D",
...         monthly_seasonality=True)
TypeError: prophet() got an unexpected keyword argument 'monthly_seasonality'

The frontend prophetOperator sends daily_seasonality and index, and never
sends monthly_seasonality.

This PR corrects both schemas to match their functions, and adds a test that
walks every ChartData*OptionsSchema, resolves the operation it describes, and
asserts each declared field is a real parameter — so the two cannot drift apart
again silently.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — the change is to the OpenAPI schema definitions.

TESTING INSTRUCTIONS

pytest tests/unit_tests/charts/test_schemas.py

test_post_processing_option_schemas_match_their_functions is added. Restoring
either pre-fix field makes it fail with:

schema fields that the post-processing function does not accept (each is a 500
for any client following the OpenAPI spec):
{'ChartDataSortOptionsSchema -> sort()': ['aggregates', 'columns'],
 'ChartDataProphetOptionsSchema -> prophet()': ['monthly_seasonality']}

To see the spec change, start Superset and open /swagger/v1, then compare the
ChartDataSortOptions and ChartDataProphetOptions definitions.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

CHECKLIST

  • CI checks pass
  • Tests added/updated
  • Documentation updated
  • PR title follows conventions

@dosubot dosubot Bot added the api Related to the REST API label Aug 15, 2026
@bito-code-review

bito-code-review Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c33740

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: ecee293..ecee293
    • superset/charts/schemas.py
    • tests/unit_tests/charts/test_schemas.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 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

AI Code Review powered by Bito Logo

@github-actions github-actions Bot removed the api Related to the REST API label Aug 15, 2026
@codecov

codecov Bot commented Aug 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.13%. Comparing base (1b46983) to head (1fa8ea1).
⚠️ Report is 117 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43206      +/-   ##
==========================================
- Coverage   80.13%   80.13%   -0.01%     
==========================================
  Files        2923     2923              
  Lines      172286   172288       +2     
  Branches    39995    39995              
==========================================
  Hits       138063   138063              
- Misses      31637    31639       +2     
  Partials     2586     2586              
Flag Coverage Δ
hive 37.35% <100.00%> (+<0.01%) ⬆️
mysql 56.89% <100.00%> (+<0.01%) ⬆️
postgres 56.92% <100.00%> (-0.01%) ⬇️
presto 39.24% <100.00%> (+<0.01%) ⬆️
python 84.49% <100.00%> (-0.01%) ⬇️
sqlite 56.62% <100.00%> (+<0.01%) ⬆️
unit 75.80% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread superset/charts/schemas.py Resolved
Comment thread tests/unit_tests/charts/test_schemas.py Resolved
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Aug 15, 2026
@bito-code-review

bito-code-review Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #082792

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: ecee293..ecdf9d5
    • tests/unit_tests/charts/test_schemas.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 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

AI Code Review powered by Bito Logo

@sadpandajoe
sadpandajoe requested a review from msyavuz August 18, 2026 17:05
@rusackas
rusackas requested review from rusackas and villebro August 29, 2026 04:06
@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Sep 3, 2026
@SEPURI-SAI-KRISHNA
SEPURI-SAI-KRISHNA force-pushed the fix/post-processing-option-schemas branch from c6daedd to e05aaae Compare September 6, 2026 08:39
@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Sep 6, 2026
@netlify

netlify Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 1fa8ea1
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aa21b00cc45e9000835f98d
😎 Deploy Preview https://deploy-preview-43206--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Sep 6, 2026
@bito-code-review

bito-code-review Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #d99df0

Actionable Suggestions - 0
Additional Suggestions - 1
  • tests/unit_tests/charts/test_schemas.py - 1
    • Unused test fixture param · Line 618-618
      The `app_context` fixture parameter is never referenced in the test body. Schema instantiation doesn't need it: `get_time_grain_choices()` catches `RuntimeError` and falls back to empty addons outside app context. Drop the parameter to avoid implying an app-context dependency that isn't exercised.
Review Details
  • Files reviewed - 2 · Commit Range: 5d6f70d..e05aaae
    • superset/charts/schemas.py
    • tests/unit_tests/charts/test_schemas.py
  • Files skipped - 1
    • docs/static/resources/openapi.json - Reason: Filter setting
  • 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

AI Code Review powered by Bito Logo

@github-actions github-actions Bot added the requires:rebase Requires rebasing on top of current master label Sep 9, 2026
@SEPURI-SAI-KRISHNA
SEPURI-SAI-KRISHNA force-pushed the fix/post-processing-option-schemas branch from e05aaae to 1fa8ea1 Compare September 10, 2026 02:50
@github-actions github-actions Bot removed the requires:rebase Requires rebasing on top of current master label Sep 10, 2026
@bito-code-review

bito-code-review Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #cd94ca

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 856f1c9..1fa8ea1
    • superset/charts/schemas.py
    • tests/unit_tests/charts/test_schemas.py
  • Files skipped - 1
    • docs/static/resources/openapi.json - Reason: Filter setting
  • 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

AI Code Review powered by Bito Logo

@bito-code-review

Copy link
Copy Markdown
Contributor

AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).

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

@rusackas rusackas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down, and for the test that keeps the option schemas honest going forward. LGTM!

@rusackas
rusackas merged commit 175c2f1 into apache:master Sep 16, 2026
75 checks passed
villebro pushed a commit that referenced this pull request Sep 20, 2026
@SEPURI-SAI-KRISHNA
SEPURI-SAI-KRISHNA deleted the fix/post-processing-option-schemas branch November 21, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants