Skip to content

fix: support officeparser exports in Bun - #3

Merged
ddbaron merged 2 commits into
mainfrom
fm/fix-rich-document-reader-officeparser-in-0a
Aug 15, 2026
Merged

fix: support officeparser exports in Bun#3
ddbaron merged 2 commits into
mainfrom
fm/fix-rich-document-reader-officeparser-in-0a

Conversation

@ddbaron

@ddbaron ddbaron commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Intent

Fix the public opencode-rich-document-reader plugin so its live read_rich_document tool parses the captain's valid DOCX in the OpenCode/Bun runtime. The supplied source is /Users/ddbaron/naventix/jobtracker-mvc/docs/maint-div/Pesticide Application Records.docx; never modify that source project or DOCX, and when smoke-testing a disposable copy invoke it with the project-relative path docs/maint-div/Pesticide Application Records.docx. Compare the direct Node TypeScript reader, which succeeds with officeparser 7.5.1, against the OpenCode/Bun plugin-loading path and fix the ESM/CJS interop boundary with the smallest robust support for named, default, and top-level parser exports without assuming named OfficeParser is available. Preserve project path safety, parser limits, media extraction, export behavior, and existing error semantics. Add behavior regression coverage through the reader/public behavior or a narrowly injected parser dependency that fails for the broken export shape, plus a real supplied-DOCX smoke that verifies readable content and metadata. The committed branch must not ship the captain's DOCX: CI must not depend on a tracked captain file, and the supplied-file smoke must use an explicit external smoke root/path or generated fixture; retain and rerun the real-file smoke evidence. Review and remove disposable scratch configs/artifacts. Run the repository check and test commands. Do not implement any JobTracker feature or modify the JobTracker repository. If the actual cause is only stale installed-plugin cache or session reload rather than code, prove that with a fresh install/load test and report the required operator action instead of making an unrelated code change. Do not make further product changes unless a no-mistakes validation gate requires a fix.

What Changed

  • Resolve officeparser through named, default, and top-level exports while preserving the parser receiver and existing format configuration.
  • Add regression coverage for export-shape interop and an opt-in external smoke test validating the supplied pesticide DOCX's content and metadata without tracking the source file.
  • Document the Bun interop behavior in the project agent notes.

Risk Assessment

✅ Low: The change is narrowly scoped to officeparser export resolution, preserves the existing reader boundaries, and adds behavior-oriented regression and opt-in external smoke coverage.

Testing

Focused regression tests, the real supplied-DOCX test, and an isolated OpenCode/Bun public-tool smoke passed. The direct and public results matched, content and metadata were readable, the source hash was unchanged, and transient dependencies/smoke files were removed. Full-suite and typecheck commands were not run in this assigned targeted-test phase.

Evidence: OpenCode Bun public-tool supplied-DOCX smoke
{
  "runtime": {
    "node": "v24.3.0",
    "bun": "1.3.14"
  },
  "projectRoot": "/Users/ddbaron/naventix/jobtracker-mvc",
  "documentPath": "docs/maint-div/Pesticide Application Records.docx",
  "title": "Read docs/maint-div/Pesticide Application Records.docx",
  "format": "docx",
  "sourcePath": "docs/maint-div/Pesticide Application Records.docx",
  "mediaCount": 0,
  "outputLength": 1286,
  "contentChecks": {
    "pesticideApplicationRecords": true,
    "applicatorsName": true
  },
  "outputExcerpt": "---\nauthor: \"Kelly McBride\"\ncreated: 2024-11-14T17:19:00.000Z\nmodified: 2024-11-19T15:14:00.000Z\n---\n\n**Pesticide Application Records:**\n\n- Applicators Name: is foreman of crew\n- Applicators #: autofill’s based on foreman spraying\n- Date: Pulls from daily task sheet\n- Time: Pulls from daily task sheet\n- Wind speed/Direction/Temperature: pulls from weather app?\n- Volume Applied: Pulls from daily task sheet\n- Manufacturer’s brand name (chemical): Pulls from daily task sheet\n- EPA Reg #: autofill’s based on chemical selected\n- Rate: autofill’s based on chemical selected\n- Area applied: scroll and select (landscape beds, front yard, back yard, yard trees)\n- Target Pests: autofill’s based on chem",
  "sourceSha256Before": "3d59bb2ec9bd28921b22f68498ea7bd9f9167abdcfb008a7b65a4c5e0f48706d",
  "sourceSha256After": "3d59bb2ec9bd28921b22f68498ea7bd9f9167abdcfb008a7b65a4c5e0f48706d",
  "sourceUnchanged": true
}
Evidence: OpenCode plugin registration smoke
{
  "runtime": {
    "node": "v22.22.0"
  },
  "serverUrl": "http://127.0.0.1:4096",
  "endpoint": "/experimental/tool/ids",
  "status": 200,
  "registeredReadRichDocument": true,
  "toolIds": [
    "invalid",
    "question",
    "bash",
    "read",
    "glob",
    "grep",
    "edit",
    "write",
    "task",
    "webfetch",
    "todowrite",
    "websearch",
    "skill",
    "apply_patch",
    "read_rich_document"
  ],
  "serverOutput": "Warning: OPENCODE_SERVER_PASSWORD is not set; server is unsecured.\nopencode server listening on http://127.0.0.1:4096\n"
}
Evidence: Supplied DOCX regression test
TAP version 13
# Subtest: read_rich_document
    # Subtest: reads the supplied pesticide records DOCX with content and metadata
    ok 1 - reads the supplied pesticide records DOCX with content and metadata
      ---
      duration_ms: 64.31
      type: 'test'
      ...
    1..1
ok 1 - read_rich_document
  ---
  duration_ms: 68.545125
  type: 'suite'
  ...
1..1
# tests 1
# suites 1
# pass 1
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 236.497417
Evidence: Direct Node versus public plugin comparison
{
  "runtime": "v22.22.0",
  "projectRoot": "/Users/ddbaron/naventix/jobtracker-mvc",
  "documentPath": "docs/maint-div/Pesticide Application Records.docx",
  "directNodeReader": {
    "title": "Read docs/maint-div/Pesticide Application Records.docx",
    "format": "docx",
    "sourcePath": "docs/maint-div/Pesticide Application Records.docx",
    "mediaCount": 0,
    "outputLength": 1286,
    "contentChecks": {
      "pesticideApplicationRecords": true,
      "applicatorsName": true
    },
    "outputExcerpt": "---\nauthor: \"Kelly McBride\"\ncreated: 2024-11-14T17:19:00.000Z\nmodified: 2024-11-19T15:14:00.000Z\n---\n\n**Pesticide Application Records:**\n\n- Applicators Name: is foreman of crew\n- Applicators #: autofill’s based on foreman spraying\n- Date: Pulls from daily task sheet\n- Time: Pulls from daily task sheet\n- Wind speed/Direction/Temperature: pulls from weather app?\n- Volume Applied: Pulls from daily task sheet\n- Manufacturer’s brand name (chemical): Pulls from daily task sheet\n- EPA Reg #: autofill’s based on chemical selected\n- Rate: autofill’s based on chemical selected\n- Area applied: scroll and select (landscape beds, front yard, back yard, yard trees)\n- Target Pests: autofill’s based on chem"
  },
  "publicPluginTool": {
    "title": "Read docs/maint-div/Pesticide Application Records.docx",
    "format": "docx",
    "sourcePath": "docs/maint-div/Pesticide Application Records.docx",
    "mediaCount": 0,
    "outputLength": 1286,
    "contentChecks": {
      "pesticideApplicationRecords": true,
      "applicatorsName": true
    },
    "outputExcerpt": "---\nauthor: \"Kelly McBride\"\ncreated: 2024-11-14T17:19:00.000Z\nmodified: 2024-11-19T15:14:00.000Z\n---\n\n**Pesticide Application Records:**\n\n- Applicators Name: is foreman of crew\n- Applicators #: autofill’s based on foreman spraying\n- Date: Pulls from daily task sheet\n- Time: Pulls from daily task sheet\n- Wind speed/Direction/Temperature: pulls from weather app?\n- Volume Applied: Pulls from daily task sheet\n- Manufacturer’s brand name (chemical): Pulls from daily task sheet\n- EPA Reg #: autofill’s based on chemical selected\n- Rate: autofill’s based on chemical selected\n- Area applied: scroll and select (landscape beds, front yard, back yard, yard trees)\n- Target Pests: autofill’s based on chem"
  },
  "resultsMatch": true,
  "sourceSha256Before": "3d59bb2ec9bd28921b22f68498ea7bd9f9167abdcfb008a7b65a4c5e0f48706d",
  "sourceSha256After": "3d59bb2ec9bd28921b22f68498ea7bd9f9167abdcfb008a7b65a4c5e0f48706d",
  "sourceUnchanged": true
}

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • node --experimental-strip-types --test --test-name-pattern='plugin registration|resolves named, default, and top-level officeparser exports|extracts DOCX structure, media, and section association' test/read-rich-document.test.ts
  • OPENCODE_RICH_DOCUMENT_SMOKE_ROOT="/Users/ddbaron/naventix/jobtracker-mvc" node --experimental-strip-types --test --test-name-pattern='reads the supplied pesticide records DOCX with content and metadata' test/read-rich-document.test.ts
  • Direct Node reader and RichDocumentReaderPlugin(...).tool.read_rich_document.execute(...) comparison using docs/maint-div/Pesticide Application Records.docx
  • Isolated opencode serve --hostname 127.0.0.1 --port 0 --log-level ERROR plugin-load smoke followed by GET /experimental/tool/ids?directory=...; the public tool executed under Bun 1.3.14
  • Transient-artifact review with git status --short and git ls-files '*.docx' '*.odt' '*.pptx'
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@ddbaron
ddbaron merged commit f79e61d into main Aug 15, 2026
2 checks passed
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