GeezerVison is showing github.com — fix(server): omit hidden drawings from DOCX attachment text by only21mil · Pull Request #44965 · pingdotgg/t3code
Conversation
Problem
When a user attaches a .docx with a drawing or text box hidden via Word's Selection Pane (wp:docPr hidden="1" or "true" on wp:anchor/wp:inline), the server includes its text in the extracted sidecar instead of omitting it. PowerPoint already omits hidden objects (#44287).
Change
In apps/server/src/provider/documentTextWorker.ts, xml() drops <wp:anchor> and <wp:inline> drawings whose <wp:docPr> (Transitional or Strict namespace) sets hidden="1" or "true", and stops prefixed xmlns attributes from shadowing the default namespace in any .docx part. When a hidden drawing is dropped from a kept compatibility branch, its sibling choices and VML <mc:Fallback> copy drop too, including across nested <mc:AlternateContent>. Non-hidden empty choices such as charts keep their fallback. Extended apps/server/src/provider/userInputAttachments.test.ts.
Scope
Small bug fix (26 non-test lines, 1 file) for hidden .docx drawings leaking into attachment text, matching #44287; needs no issue.
Verification
Setup: Linux (Node v26.13.1), sandboxed server (T3CODE_DEV_SEED=0, --base-dir, TZ=UTC, synthetic project, devReplay), isolated home per commit.
Steps: Upload hidden-box.docx (ECMA-376 §20.4.2.5 hidden anchored box in mc:AlternateContent + hidden wp:inline beside visible body/callout) via /api/attachments/upload/... → send on devReplay → wait → read .docx.txt.
Before (533c3ef609e8):
Commit: 533c3ef609e8
Provider: devReplay (default), run status: completed
Upload HTTP: 204, claimed sidecar: <attachmentsDir>/mcp-320b7e03-9404-4fe0-9100-adea96f94eb8-ba3e914e-1b96-4cb0-b585-7849edc07a70-docx.docx.txt
--- Extracted text provided to agent ---
Visible body
Visible callout
Hidden anchored draft
Hidden inline note
--- End extracted text ---
After (2a2109c2c376):
Commit: 2a2109c2c376
Provider: devReplay (default), run status: completed
Upload HTTP: 204, claimed sidecar: <attachmentsDir>/mcp-dc8a363b-be55-4688-8441-369e952d61dc-a5346e12-3819-45d8-be5c-486aff9283e5-docx.docx.txt
--- Extracted text provided to agent ---
Visible body
Visible callout
--- End extracted text ---
Links: apps/server/src/provider/userInputAttachments.test.ts, #44287.
Not shown:
- Word/LibreOffice-saved
.docx (neither installed; built from ECMA-376 Part 1 §20.4.2.5 and Part 3 5th ed. §§7.5–7.7, §9.3).
- Web preview:
@betteroffice/docx 0.6.1 still draws hidden text boxes; this PR changes only server attachment text.
- Hidden
<wpg:wgp> children (wps:cNvPr/wpg:cNvPr) and standalone VML <w:pict> (visibility:hidden), deferred as follow-ups.
- Paid provider turns (
devReplay used) and repo-wide suites (CI runs them).
Focused test output and local checks
Base commit: 533c3ef609e8 (57/57 check-runs green, commit status success).
Fail-first on 533c3ef609e8 (vp env exec --node 26.13.1 -- vp test run apps/server/src/provider/userInputAttachments.test.ts):
FAIL |t3| src/provider/userInputAttachments.test.ts > question answer paths > preserves office structure and EPUB reading order with bounded archives
Visible body
Visible callout
- Foreign kept
-
- StartEnd
+ Hidden anchored
+
+ Hidden strict inline
+
+ Foreign kept
+
+ Hidden default ns
+
+ Start
+ Hidden after tab
+ End
+ Nested hidden
+
+ Retained hidden
Tests 1 failed | 68 passed (69)
Passing on 2a2109c2c376 (Node v26.13.1):
vp test run apps/server/src/provider/userInputAttachments.test.ts: 69 passed (69).
vp run check:changed 533c3ef609e83ffe86e0f937c61b94f80161b335: exit 0 (format, lint 0 warnings, knip, graphql, typecheck 3 packages, 3 test files / 73 passed).
- Tested by: AI agent.
Generated with Gemini 4 Neon in T3 Code Nightly
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
DOCX extraction now detects hidden anchored and inline drawings in transitional and strict WordprocessingDrawing namespaces. It suppresses hidden drawing text and related fallback content while retaining visible text. A new test covers nested alternatives and namespace variations.
Changes: DOCX Hidden Drawing Extraction
| Layer / File(s) |
Summary |
Hidden drawing detection and extraction apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts |
The parser preserves DOCX namespace declarations, recognizes hidden drawings, and propagates hidden-content state to suppress drawing and fallback text. The test covers visible and hidden content, nested alternatives, and namespace variations. |
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix
Suggested reviewers: jadelike-wine, lucenx9
Merge Risk: Minimal · up to a7db1
-
This change stops text from hidden drawings and text boxes from appearing in extracted DOCX attachment text. No concrete defect was found, and the remaining risk is low and consists of the known deferred cases.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: hidden DOCX drawings are omitted from attachment text. It follows the conventional commit format, and the changeset matches it. The title is 59 characters and uses the… |
| Description check |
 |
The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections with substantive content. The Problem section states expected behavior and reproductio… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the main change: hidden DOCX drawings are omitted from attachment text. It follows the conventional commit format, and the changeset matches it. The title is 59 characters and uses the scope 'server', which matches the touched code under apps/server.
Full details: Description check
-
Explanation
The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections with substantive content. The Problem section states expected behavior and reproduction steps. The Change section explains the fix in documentTextWorker.ts. The Scope section explains why no issue is needed for this small fix and links #44287. The Verification section gives focused test output, before and after results, and local checks, and it states what was not checked. The description does not include a model/harness attribution line in the expected form, but it does include 'Generated with Gemini 4 Neon in T3 Code Nightly' and 'Tested by: AI agent.' The PR description is thorough and meets the template requirements.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 2a2109c and a7db123.
Files selected for processing: 2
-
apps/server/src/provider/documentTextWorker.ts
apps/server/src/provider/userInputAttachments.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Real web app, Chromium, 1280×800, light theme; fresh isolated state on each commit, Replay (dev).
Submitted the same synthetic DOCX and summary request through the composer on both commits, waited for the turn to complete, then opened an unchanged copy of the server-written attachment text sidecar in the app's Files preview. The document contains visible PELICAN/OSPREY text and hidden anchored ZEBRA-SECRET and inline WALRUS-SECRET drawings with compatibility copies.
Proven: scenarios:prove exited 0; the scenario fails on base and passes on head.
Self-contained scenario · DOCX fixture
Not shown:
- A file saved by real Microsoft Word was not exercised; this proof uses synthetic markup matching the reported reproduction.
- Nested AlternateContent, sibling Choice, strict namespaces, and foreign or default-namespace docPr edge cases were not exercised in this real-app scenario.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|