Skip to content

fix(packaging): canonicalize the archive path in the Office engine hook - #650

Merged
yaojin3616 merged 1 commit into
mainfrom
fix/office-engine-realpath
Oct 3, 2026
Merged

yaojin3616 merged 1 commit into
mainfrom
fix/office-engine-realpath

Conversation

@yaojin3616

Copy link
Copy Markdown
Contributor

Follow-up to #647. This commit was pushed to that branch after the PR had already merged, so it never reached main. Needed before v0.11.0.

Problem

build/office-engine-resolution.mjs (added in #647) redirects @deepseek-ai/libreoffice-kit-<platform>-* to app.asar.unpacked, so the OS can spawn the LibreOffice engine. It compares the realpath'd resolution result with the archive path as spelled in the Harness entry path.

The spellings differ when the install directory is reached through a symlink or junction, uses Windows 8.3 short names (e.g. PROGRA~1), or has a different drive-letter case. Then the prefix check misses, the engine stays inside app.asar, and Office preview fails ("Installed LibreOfficeKit executable is not executable" / spawn failure).

Fix

Canonicalize the archive path before comparing, as upstream apps/desktop-host/src/office-engine.ts does. Electron's asar-aware fs returns the real path for app.asar itself.

Checks

  • New case in test/office-engine-resolution.test.ts: the entry path names the install directory through a link. It fails without the fix and passes with it. The test runs on the Electron runtime in Node mode.
  • In the packaged macOS test build, realpathSync(app.asar) on the Helper returns the archive path. A real ODT → PDF conversion through the hook still succeeds.
  • npm test on top of current main (including feat(office): offline Python authoring on Windows and macOS #649): 181 files / 1613 tests pass. pretest needed NODE_USE_ENV_PROXY=1 locally to download the Office runtime from GitHub. npm run typecheck passes; git diff --check is clean.

Not verified: an actual Windows install through a junction or 8.3 path.

🤖 Generated with Claude Code

The hook compared realpath'd resolution results against the archive path
as spelled in the Harness entry path. A symlinked or junctioned install
directory, Windows 8.3 names or drive-letter case made the prefix check
miss, leaving the LibreOffice engine resolved inside app.asar where the
OS cannot spawn it. Canonicalize the archive first, as upstream
office-engine.ts does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yaojin3616
yaojin3616 merged commit beb6821 into main Oct 3, 2026
4 checks passed
@yaojin3616
yaojin3616 deleted the fix/office-engine-realpath branch October 3, 2026 06:19
wangweif pushed a commit to wangweif/dsh-desktop that referenced this pull request Oct 4, 2026
合并 dataelement/dsh-desktop upstream/main(90 个提交):
- dsh 内核 0.1.5-rc.2 → 0.2.0-rc.2(DeepSeek 官方最新),patches 全套换代
- 内置 Office 引擎:office-docx/xlsx/pptx 技能 + Python authoring 运行时
- 打包架构升级:app.asar + 仅原生文件解包;macOS 去捆绑 Node
- macOS 构建矩阵化(arm64/x64 合一),windows-menu 改原生弹出菜单

冲突解决原则:采纳上游新架构,保留农科小智品牌与企业登录/平台智能体定制;
enterprise-login/agents 资源保留,productName 保持农科小智智能体。

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant