fix(postprocessing): keep operation signatures visible through validate_column_args - #43186
Conversation
…te_column_args validate_column_args returned a bare `wrapped(df, **options)` without functools.wraps, so every decorated post-processing operation lost its name, docstring and signature. `inspect.signature(pandas_postprocessing.pivot)` reported the wrapper's catch-all instead of `index`, `aggregates` and friends, which makes each operation look like it accepts arbitrary keywords. That matters beyond tidiness: a chart's stored query_context is never migrated, so it can carry options an operation has since dropped -- `pivot` no longer takes `flatten_columns` or `reset_index` -- and replaying one raises TypeError from deep inside pandas. Any attempt to detect a stale option by introspection first needs the real signature to be reachable. This is the secondary defect described in apache#42926; the missing query_context migration itself is not addressed here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Code Review Agent Run #b7ec1bActionable 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #43186 +/- ##
==========================================
- Coverage 66.70% 66.65% -0.06%
==========================================
Files 2872 2873 +1
Lines 163447 163607 +160
Branches 37727 37763 +36
==========================================
+ Hits 109027 109051 +24
- Misses 52291 52426 +135
- Partials 2129 2130 +1
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:
|
SUMMARY
validate_column_argsreturned a barewrapped(df, **options)withoutfunctools.wraps, so every decorated post-processing operation lost its__name__,__doc__and signature.inspect.signature(pandas_postprocessing.pivot)reported the wrapper's(df, **options)catch-all rather thanindex,aggregatesand the rest — every operation looked like it accepts arbitrary keywords.That matters beyond tidiness. As #42926 describes, a chart's stored
query_contextis never migrated, so it can carry options an operation has since dropped —pivotno longer takesflatten_columnsorreset_index— and replaying one raisesTypeErrorfrom deep inside pandas on every non-Explore path (chart data API, alerts and reports, thumbnails, cache warm-up, CSV/Excel export, MCP tools). Any attempt to spot a stale option by introspection needs the real signature to be reachable first, and the missingwrapsis precisely what hides it.Scope: this is the secondary defect called out in #42926. The missing
query_contextmigration itself is not addressed here — that is a larger design question also tracked in #33152 and #31872 — so this says Addresses rather than Fixes and leaves the issue open.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
New tests assert the operation keeps its name and docstring, that its real parameters are introspectable, that the removed
flatten_columns/reset_indexare visibly absent, and that column validation still rejects unknown columns. Locally: 4 passed for the new file and 110 passed across the post-processing suites.ADDITIONAL INFORMATION
🤖 Generated with Claude Code