Repository navigation
test: gate PDF extraction scenarios when pdfjs-dist is absent - #218
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Enhanced CI 在 main 的 Node 24 任务中 pdfjs-dist(optionalDependency)未装上(npm ci 对可选依赖安装失败不报错),导致 pdf → X 矩阵用例在缺少提取能力的环境下失败。 - format-validation-test:pdfjs 缺失且核心解析器取不到正文时,探针断言 PDF_TEXT_UNAVAILABLE 并跳过 pdf 输入用例;pdfjs 可用却取不到正文仍按回归失败 - ocr-baseline-test 29c:混合页按页 OCR 场景依赖 PDF.js 页级检测,缺失时整组跳过 - pdf-reader-test 测试 11:混合页页数/无文字页断言依赖 PDF.js 提取,缺失时跳过 本机双向验证:隐藏/恢复 node_modules/pdfjs-dist 各跑一遍完整 npm test 均通过。 Refs #216
Vantalens
force-pushed
the
fix/pdfjs-absent-test-gates
branch
from
September 24, 2026 06:12
dc37a90 to
226c12b
Compare
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.
变更说明
PR #217 合并后,main 的 Enhanced CI(Node 24,coverage 任务)失败:该任务环境中
pdfjs-dist(optionalDependency)未安装成功——npm ci对可选依赖安装失败不报错。PDF reader 回退到核心解析器后对本项目生成的 PDF 取不到正文,#216 引入的PDF_TEXT_UNAVAILABLE诚实错误(正确行为)使format-validation-test的 pdf → md/html/txt/json/xml/docx 六个用例失败。本 PR 让测试套件在可选依赖缺失时行为确定:区分「提取能力缺失」(跳过并断言错误码正确)与「真回归」(pdfjs 可用却取不到正文,仍然失败)。不改变任何产品代码行为。
变更内容
format-validation-test.js:增加提取能力探针——pdfjs 缺失且样例取不到正文时,pdf → * 用例记为跳过;探针同时断言PDF_TEXT_UNAVAILABLE错误码正确ocr-baseline-test.js29c:混合页按页 OCR 场景依赖 PDF.js 页级检测,pdfjs 缺失时整组跳过并打印原因pdf-reader-test.js测试 11:混合页页数 /pagesWithoutText断言依赖 PDF.js 提取,pdfjs 缺失时跳过并打印原因测试验证
node_modules/pdfjs-dist后完整npm test通过(复现并修复 Enhanced CI 失败场景)npm test通过(正常环境无回归)相关 Issue
Refs #216
注意事项
可选依赖的安装抖动无法从仓库侧根除(npm 语义如此);本 PR 保证测试套件在该情况下确定性通过。若希望 CI 强保证提取能力覆盖,可后续在 Enhanced CI 增加一个显式断言
pdfjs-dist安装成功的步骤(超出本 PR 范围)。