Skip to content

fix: missing docx defaults from llm generated files - #1030

Merged
harbournick merged 3 commits into
mainfrom
nick/fix-docx-defaults-missing-in-llm-files
Sep 25, 2025
Merged

fix: missing docx defaults from llm generated files#1030
harbournick merged 3 commits into
mainfrom
nick/fix-docx-defaults-missing-in-llm-files

Conversation

@harbournick

Copy link
Copy Markdown
Collaborator

No description provided.

@harbournick
harbournick requested a review from Copilot September 25, 2025 17:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes handling of missing w:docDefaults elements in DOCX files generated by LLM tools that may omit this required structure. The fix adds graceful fallbacks when document defaults are not present and improves defensive programming to prevent runtime errors.

  • Refactored document default style extraction to handle missing XML elements gracefully
  • Added defensive null checks and optional chaining throughout DOCX parsing logic
  • Added test coverage for DOCX files lacking w:docDefaults structure

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
SuperConverter.js Major refactor of getDocumentDefaultStyles() method with new helper function and improved error handling
w-p-helpers.js Added defensive programming with optional chaining for missing XML elements
font-default-styles.test.js Added test case for graceful fallback when w:docDefaults is missing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread packages/super-editor/src/core/super-converter/SuperConverter.js
Comment thread packages/super-editor/src/core/super-converter/SuperConverter.js
@harbournick
harbournick merged commit de7a2b2 into main Sep 25, 2025
7 checks passed
@harbournick
harbournick deleted the nick/fix-docx-defaults-missing-in-llm-files branch September 25, 2025 18:28
@harbournick

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 0.22.0-next.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

luccas-harbour pushed a commit that referenced this pull request Sep 26, 2025
* fix: missing docx defaults from llm generated files
* fix: protect against missing sectPr in documents from LLMs
harbournick pushed a commit that referenced this pull request Sep 30, 2025
# [0.22.0](v0.21.0...v0.22.0) (2025-09-30)

### Bug Fixes

* context menu bypass standards ([#1029](#1029)) ([99e6bf7](99e6bf7))
* context menu bypass standards ([#1032](#1032)) ([8c80c2c](8c80c2c))
* do not track the annotation deletion on table generation ([#1036](#1036)) ([5e77dd4](5e77dd4))
* import/export of missing pict separators ([#1048](#1048)) ([8320a2c](8320a2c))
* losing selection on right click ([1e66343](1e66343))
* missing docx defaults from llm generated files ([#1030](#1030)) ([de7a2b2](de7a2b2))
* scope editor DOM queries to recover typing latency ([#1033](#1033)) ([7149090](7149090))
* tracked changes don't have corresponding comments ([#1045](#1045)) ([ebead1a](ebead1a))

### Features

* add MS Word fallback sizes to tables from LLM generated docx missing key data ([#1035](#1035)) ([850cc0b](850cc0b))
* **menu:** add custom context menu items functionality ([#988](#988)) ([57e77d9](57e77d9))
* structured content commands ([#1037](#1037)) ([1acf705](1acf705))
@harbournick

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 0.22.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants