chore(excel): strip document metadata from Excel exports#40661
Conversation
Reset workbook document properties (authoring fields and generation timestamps) when generating .xlsx exports so the output files do not carry environment-specific details. Pins created/modified to a fixed neutral timestamp and clears title/subject/author/company/category/keywords/etc. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code Review Agent Run #4e7e5fActionable Suggestions - 0Additional Suggestions - 1
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40661 +/- ##
=======================================
Coverage 63.94% 63.94%
=======================================
Files 2658 2658
Lines 143011 143015 +4
Branches 32866 32866
=======================================
+ Hits 91454 91457 +3
- Misses 49994 49995 +1
Partials 1563 1563
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:
|
SUMMARY
When generating
.xlsxexports viasuperset/utils/excel.py(df_to_excel), the underlyingxlsxwriterengine embeds workbook document properties intodocProps/core.xml— notablycreated/modifiedtimestamps set to the actual generation time of the file. This change resets the workbook document properties before the file is written so exported workbooks carry a clean, neutral set of metadata rather than environment-specific details.Specifically,
df_to_excelnow callsworkbook.set_properties(...)to:title,subject,author,manager,company,category,keywords,comments,status.created/modifiedto a fixed, neutral timestamp (2000-01-01) instead of the real generation time.The actual sheet data is untouched — only the workbook's core document properties are normalized. This is the single shared export path used by both the chart/dashboard data export (
query_context_processor) and the legacy CSV/Excel view export (views/core.py).BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable (no UI change).
Before —
docProps/core.xmlcontained live generation timestamps:After — neutral, fixed values:
TESTING INSTRUCTIONS
pytest tests/unit_tests/utils/excel_tests.pytest_document_properties_are_neutralgenerates an xlsx viadf_to_excel, loads the bytes back withopenpyxl, and asserts the core properties are empty/neutral and timestamps are pinned.docProps/core.xmlinside the.xlsx(it is a zip); confirm authoring fields are empty and timestamps are neutral.ADDITIONAL INFORMATION
🤖 Generated with Claude Code