Repository navigation
feat(upload): upgrade legacy .doc/.ppt/.xls uploads to OpenXML - #7605
Merged
jbecke merged 1 commit intoOct 6, 2026
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
jbecke
force-pushed
the
claude/fervent-mccarthy-h6zlp1-legacy-office-upgrade
branch
from
October 6, 2026 15:09
4c51515 to
bed8843
Compare
jbecke
force-pushed
the
claude/fervent-mccarthy-h6zlp1-legacy-office-upgrade
branch
from
October 6, 2026 15:41
bed8843 to
5ea2c96
Compare
Uploaded legacy binary Office files are converted on the server so they
open in the native surfaces: .doc -> .docx (then the DOCX pipeline),
.ppt -> .pptx (presentation editor) and .xls -> .xlsx (uploaded-workbook
preview, importable into a native spreadsheet).
- The upload finalizer asks the convert service to write
upgraded.{docx,pptx,xlsx} when a legacy original lands, keeping the
original ready so it stays downloadable if conversion fails.
- When the upgraded object lands, the finalizer makes it the document's
latest version (a DocumentInstance, or a DOCX BOM staged for the DOCX
pipeline) and swaps the file type with a compare-and-swap, rolling back
if the copy fails. Redelivered events are no-ops.
- The convert service supports doc->docx, ppt->pptx and xls->xlsx,
accepts explicit file types for extensionless versioned keys, gives
upgrades 120s, and exits its LibreOffice child without teardown, which
could crash Writer after a successful save.
- The file view shows a converting state for fresh legacy uploads and
reopens the document in its new block when the upgrade lands.
- Infra: finalizer env, S3/SQS permissions and docx bucket policy.
Tests cover the domain flow, the repository queries, finalizer routing,
key parsing, real LibreOffice conversions (ignored without LOK_PATH), and
the docx/pptx engines and spreadsheet importer on LibreOffice output.
jbecke
force-pushed
the
claude/fervent-mccarthy-h6zlp1-legacy-office-upgrade
branch
from
October 6, 2026 16:16
5ea2c96 to
0cabada
Compare
jbecke
deleted the
claude/fervent-mccarthy-h6zlp1-legacy-office-upgrade
branch
October 6, 2026 19:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #7594, which adds the
.docfile type. Once that merges, this PR's base becomesmain.Uploaded legacy binary Office files are now converted on the server so they open in Macro's native surfaces:
.ppt.pptxpptx_engine).doc.docx.xls.xlsxThis works for single uploads and for files inside uploaded folders.
How it works
{owner}/{doc}/{version}).LegacyOfficeUpgrader::request_upgradethen enqueues a convert job that writes{owner}/{doc}/upgraded.{docx,pptx,xlsx}.ConvertQueueMessagegets optionalfrom_file_type/to_file_type, because versioned keys have no extension.DocumentKey::UpgradedOffice).apply_upgrademakes it the document's content.DocumentInstance(with the upgraded file's sha) becomes the latest version, and the object is copied to its versioned key.DocumentBomis created, the object is copied to the DOCX staging bucket, and content is set pendingConvertedPdf. From theredocx_unzip_handlertreats it exactly like a DOCX upload.WHERE LOWER("fileType") = $from), done before the copy, so the copy's own object-created event sees the new type and never requests a second upgrade.upgraded.*key.doc→docx,ppt→pptxandxls→xlsx. LibreOfficeKit picks the OOXML export filters from the target format._exits after a successful save. The existing docx→pdf export also goes through this function, and a test covers it..xlsfiles convert when uploaded.ENVIRONMENT(selects the stack's convert queue),DOCUMENT_STORAGE_BUCKET,DOCX_DOCUMENT_UPLOAD_BUCKET.s3:PutObjecton doc storage,s3:PutObjecton the docx bucket,sqs:SendMessageon the convert queue.Hexagonal boundary checked.
crates/documents/src/domain/legacy_office_upgrade.rs, behindLegacyOfficeUpgradeRepoPortandLegacyOfficeUpgradeStoragePort.pg_document_repo/legacy_upgrade.rsand the finalizer'soutbound.rs.Note: an upgraded
.docstill gets a PDF rendition, because every.docxdoes today. Search, AI document reads and citations read that PDF.Testing
sqlx::tests against Postgres: instance/BOM create and delete, compare-and-swap including uppercase stored types, and content.s3_key:upgraded.*build/parse/reject.memo.doc,deck.ppt,budget.xls):.doc→ docx lays out to 2+ pages indocx_engine;.ppt→ pptx renders all 4 slides inpptx_engine, with table, picture and notes;.xls→ xlsx keeps formulas, a cross-sheet formula, the merge, the number format and cached values;#[ignore]without LibreOffice. Run them withLOK_PATH=/usr/lib/libreoffice/program cargo test -p convert_service -- --ignored; all pass here with LibreOffice 24.2.docx_engineandpptx_engineintegration tests on the LibreOffice-upgraded fixtures: open, lay out/render, edit, save, reopen.xlsx-upgraded-legacy.test.ts: the upgraded workbook imports into a native spreadsheet, recalculates to the expected totals after Loro save/reopen, and exports back to Excel.legacy-office.test.ts(11 tests) andUnknownContent.test.tsx; all block-spreadsheet/block-unknown suites (711 tests) pass.cargo testfor documents (400, Postgres + Redis), finalizer, convert_service, s3_key, search_upload_handler, docx_unzip_handler.SQLX_OFFLINE=true cargo checkwith the 5 new.sqlxentries,cargo x deps --check.tsc, biome, oxlint, ast-grep.tscand biome.Generated by Claude Code