test(odf-core): skip LibreOffice-gated tests when soffice is present but unusable#438
test(odf-core): skip LibreOffice-gated tests when soffice is present but unusable#438stevenobiajulu wants to merge 1 commit into
Conversation
…but unusable resolveSoffice() proves the binary EXISTS, not that it can launch. Under a restricted shell (observed: macOS Seatbelt via `codex exec --sandbox workspace-write` while implementing #411) soffice dies with SIGABRT during init, so the four existence-gated odf-core tests (ORTS-02, OCMPI-13, the issue-#367 inline/paragraph round-trips) FAILED after burning their 60-240s oracle timeouts instead of skipping — misleading sandboxed agents into diagnosing the machine's LibreOffice as broken when only their shell is. CONV-13 already solved this with an inline preflight probe. Extract it as probeSofficeUsable() next to resolveSoffice() in docx-core (a throwaway headless --convert-to with a fresh profile — the same first step the oracle itself performs, memoized per binary path), apply it to the three ungated tests, and refactor CONV-13 onto the shared helper. The real oracle calls stay outside the probe so genuine round-trip regressions still fail loudly; only launchability is skip-worthy. ORTS-02's local resolveSoffice duplicate is replaced by the shared export (a superset: it also honors SAFE_DOCX_SOFFICE_BIN). Verified both paths: real soffice → 19 files / 133 tests pass with the oracle genuinely running (tests 35.8s); ODF_SOFFICE_BIN=/usr/bin/false → same 133 green with all oracle work skipped (tests 1.0s). Ref: #411
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
LLM-Based Quality GateOverall: ✅ PASS (4 pass · 0 warn · 11 skipped · 15 total)
Full checklist questions
Estimated cost (this run): $0.0059 — 17,869 input + 267 output tokens (≈4 chars/token) on |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Problem
resolveSoffice()proves the binary exists, not that it can launch. Under a restricted shell (observed: macOS Seatbelt viacodex exec --sandbox workspace-writewhile implementing #411), soffice dies with SIGABRT during init. Four odf-core tests gate only on existence, so in that environment they fail after burning their 60–240 s oracle timeouts — misleading sandboxed agents into diagnosing the machine's LibreOffice as broken when only their shell is:roundtrip.test.ts(ORTS-02)compare/lo_inline_roundtrip.test.ts(OCMPI-13 + issue-ODF compare: reject-all of an end-of-document whole-paragraph replacement merges paragraphs (LibreOffice oracle) #367 case)compare/lo_paragraph_roundtrip.test.ts(issue-ODF compare: reject-all of an end-of-document whole-paragraph replacement merges paragraphs (LibreOffice oracle) #367 compositions)CONV-13 (
convert/lo_convert_differential.test.ts) already solved this with an inline preflight probe.Change
probeSofficeUsable()next toresolveSoffice()indocx-core/src/integration/libreoffice-oracle.ts: a throwaway headless--convert-towith a fresh profile — the same first step the oracle itself performs — memoized per binary path. Re-exported from the docx-core index.resolveSoffice()null-check in the three ungated tests; refactor CONV-13 onto the shared helper. The real oracle calls stay outside the probe, so genuine round-trip regressions still fail loudly — only launchability is skip-worthy.resolveSofficeduplicate is replaced by the shared export (a superset: it also honorsSAFE_DOCX_SOFFICE_BIN).Verification
npm run test:run -w packages/odf-core→ 19 files / 133 tests pass, oracle genuinely running (tests 35.8 s).ODF_SOFFICE_BIN=/usr/bin/false …→ same 133 green, all oracle work skipped (tests 1.0 s).npm run test:run -w packages/docx-core→ 1436 passed (suite's normal gated skips/xfails). Lint,check:spec-coverage,check:conformance-citationsall pass.Ref: #411 (provenance — found while Codex ran the root suite for that issue; this PR is the test-infrastructure fix, the stats work stays in #411)