fix(mcp): changed_on_humanized null in write tool responses (generate_dashboard, generate_chart)#39488
Conversation
Code Review Agent Run #1d2478Actionable 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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #39488 +/- ##
==========================================
- Coverage 64.16% 63.71% -0.46%
==========================================
Files 2591 2581 -10
Lines 138127 136283 -1844
Branches 32046 31309 -737
==========================================
- Hits 88635 86827 -1808
+ Misses 47964 47928 -36
Partials 1528 1528
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #514b80Actionable 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 |
…andrusoare/fix/humanized_response_for_mcp
SUMMARY
generate_dashboardandgenerate_chartresponses returnchanged_on_humanized=nullandcreated_on_humanized=nullfor newly created resources, while list tools (list_dashboards,list_charts) show correct humanized values for the same resources.Root Cause:
Two issues:
generate_dashboard: TheDashboardInfoconstructor was settingcreated_onandchanged_onbut never computing thecreated_on_humanized/changed_on_humanizedfields, so they defaulted toNone. In contrast,serialize_dashboard_object()(used bylist_dashboards) calls_humanize_timestamp()to compute these values.db.session.commit(), SQLAlchemy expires the ORM object's attributes. Server-generated timestamps (created_on,changed_on) were not reloaded before serialization, so they could beNoneor stale.Fix:
generate_dashboard.py: Addeddb.session.refresh(dashboard)after commit to reload timestamps. Addedcreated_on_humanizedandchanged_on_humanizedfields to theDashboardInfoconstructor using_humanize_timestamp().generate_chart.py: Addeddb.session.refresh(chart)after chart creation to ensure timestamps are populated beforeserialize_chart_object()runs (which already computes humanized values).datetimeobjects to match real ORM behavior.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION