Repository navigation
fix: npm wrapper never enforces PDFMUX_MIN_VERSION on an already-installed pdfmux - #45
Merged
Merged
Conversation
…alled pdfmux isPdfmuxInstalled() only checked `import pdfmux` succeeds, not that the resolved version meets PDFMUX_MIN_VERSION — so a stale pdfmux on whatever python3/python the wrapper finds (which can differ from the environment backing the user's own `pdfmux` CLI) ran silently instead of upgrading. Reported as #10 ("MCP server mode produces garbled Korean text while the CLI works correctly on the same PDF") — plausible root cause is exactly this: two installs of pdfmux, drifted apart, and the wrapper never noticed because it never checked.
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.
What
npm-wrapper/index.js'sisPdfmuxInstalled()only checked thatimport pdfmuxsucceeds on whateverpython3/pythonthe wrapper resolves to — never that the resolved version meets the wrapper's own declaredPDFMUX_MIN_VERSION(1.4.0). Replaced withgetInstalledVersion()+versionAtLeast(), which reinstall/upgrade when the existing install falls short, exactly like the already-correct "not installed at all" branch.Why
Reported as #10 ("MCP server mode produces garbled Korean text — Korean characters misrecognized as Chinese — while the CLI works correctly on the same PDF"). The reporter's own follow-up comment root-caused a
qualitydifference inside a singleprocess()call, but CLI and MCP call the identicalprocess()function with the identical default (quality="standard") — there is no code-path divergence there to explain a result difference on the same file.The wrapper's
findPython()searchespython3/pythonon PATH, which is not guaranteed to be the same interpreter/environment backing the user's ownpdfmuxCLI binary (a pip-installed console script can live in a venv that isn't first on PATH). If that other environment already had an older pdfmux importable, the old check accepted it outright — silently serving a stale, pre-fix version of the audit/OCR-trigger logic instead of the version the wrapper advertises installing (pdfmux[serve]>=1.4.0). Two installs of the same "verified extraction" product silently drifting apart is exactly the kind of inconsistency this product exists to rule out in its own distribution path.Verified
node -c npm-wrapper/index.js— syntax OK.versionAtLeast()against 7 cases including the "1.10.0 vs 1.9.0" string-vs-numeric trap (1.10.0must compare greater than1.9.0) — all pass.npm-wrapper/(plain JS, no deps, no test runner wired) — this PR doesn't add one; flagging in case a future PR wants to.Not done here (scope)
npm view pdfmux-mcp versionstill serves1.4.0after this merges — publishing a new version is a Tier-2 founder action in this product's pipeline, same gate as cutting a PyPI release. Filed as a decisions-pending row for the founder's call, same pattern as the existing PyPI-1.8.8 release decision.python3 -c "import pdfmux; print(pdfmux.__version__)"against their CLI's ownpdfmux --versionto confirm.Closes (partially — pending reporter confirmation) #10.