Skip to content

chore(ocr): upgrade Light OCR to 0.5.6 - #2073

Merged
yyhhyyyyyy merged 3 commits into
devfrom
chore/light-ocr-0.5.6
Jul 31, 2026
Merged

chore(ocr): upgrade Light OCR to 0.5.6#2073
yyhhyyyyyy merged 3 commits into
devfrom
chore/light-ocr-0.5.6

Conversation

@yyhhyyyyyy

@yyhhyyyyyy yyhhyyyyyy commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Upgrade the Light OCR facade to 0.5.6, runtime to 0.1.6, and all six native packages to 0.5.6.
  • Keep the PPOCRv6 Small model at 0.3.4 and preserve the existing bundle and Node runtime versions.
  • Package the new Noto Sans SC PDFium fallback font and OFL license assets.
  • Enforce an exact recursive PDFium inventory and reject missing, unexpected, corrupt, non-regular, or symlinked resources during packaging and packaged smoke validation.
  • Materialize verified PDFium font resources beside the encoded macOS loader with a bounded 16 MiB resource limit.
  • Add a deterministic non-embedded Chinese-font PDF smoke fixture that verifies recognition of 中文测试.
  • Refresh the generated provider database and ACP registry produced by the normal build.

Compatibility

  • No public Light OCR API or helper protocol changes.
  • No runtime manifest schema, cache schema, database, renderer, or i18n migration.
  • Existing image OCR and raster/scanned-PDF OCR behavior is preserved.
  • Linux and Windows retain their direct native package layout.
  • macOS retains gzip-base64-v1 encoding for native code.

Summary by CodeRabbit

  • New Features

    • Upgraded Light OCR support to version 0.5.6.
    • Added bundled PDFium fallback fonts and licensing resources.
    • Improved Chinese text recognition in PDFs without embedded fonts.
    • Expanded model-provider and ACP registry data with updated and newly available entries.
  • Bug Fixes

    • Strengthened runtime asset validation and detection of missing, corrupt, or unsupported files.
    • Improved macOS packaging and runtime resource handling.
  • Tests

    • Added coverage for PDFium resources, packaging integrity, and Chinese-language PDF OCR.

@dosubot

dosubot Bot commented Jul 31, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-08-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about deepchat Add Dosu to your team

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR upgrades Light OCR from 0.5.5 to 0.5.6, packages PDFium fallback fonts and licenses, strengthens artifact validation, adds Chinese-font PDF smoke coverage, and refreshes ACP registry and model-provider metadata.

Changes

Light OCR runtime-assets upgrade

Layer / File(s) Summary
OCR contracts and release closure
docs/architecture/light-ocr-0.5.6-runtime-assets/*, docs/features/light-ocr-pdf-support/spec.md, package.json, resources/runtime-versions.json
Defines the 0.5.6 dependency closure, PDFium resource inventory, compatibility rules, validation criteria, and updated package versions.
PDFium inventory and resource materialization
scripts/light-ocr-artifacts.mjs, scripts/afterPack.js, src/main/ocr/lightOcrNativePayload.ts, test/main/ocr/*, test/main/scripts/afterPack.test.ts, test/main/scripts/lightOcrArtifacts.test.ts
Adds recursive inventory checks, resource classification, hash and size validation, symlink rejection, legal-asset checks, and macOS font materialization coverage.
Packaged OCR smoke flow
scripts/smoke-light-ocr.js, test/main/scripts/smokeLightOcr.test.ts
Adds raster and non-embedded Chinese-font PDF fixtures, Chinese OCR assertions, PDFium resource checks, and packaged runtime validation.

Registry and model metadata refresh

Layer / File(s) Summary
ACP registry version records
resources/acp-registry/registry.json
Updates agent versions, package references, Harn archive URLs, and Harn checksums.
Model-provider database updates
resources/model-db/providers.json
Adds newly available models, updates capabilities and limits, corrects metadata dates, and removes obsolete entries.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PackageBuilder
  participant NativePayload
  participant PackagedRuntime
  participant OCRProcess
  PackageBuilder->>NativePayload: validate PDFium files, directories, hashes, and licenses
  NativePayload->>PackagedRuntime: materialize verified PDFium resources
  PackagedRuntime->>OCRProcess: start packaged OCR process
  OCRProcess->>PackagedRuntime: return raster and Chinese PDF recognition results
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: upgrading Light OCR to version 0.5.6.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/light-ocr-0.5.6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/main/scripts/smokeLightOcr.test.ts (1)

352-365: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the aggregate PDFium resource limit.

materializePackagedNativeRuntime now rejects resource entries whose aggregate size exceeds 16 MiB. Add a fixture with declared font-resource bytes above that limit and assert rejection before materialization.

As per coding guidelines, “Add the smallest regression test for user-visible behavior or a documented contract.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/main/scripts/smokeLightOcr.test.ts` around lines 352 - 365, Add a
minimal regression test near the existing materializePackagedNativeRuntime
coverage that provides a font-resource fixture whose declared aggregate bytes
exceed 16 MiB, then assert materializePackagedNativeRuntime rejects before
writing or materializing the runtime. Reuse the existing layout/temp-directory
setup and verify the rejection reflects the resource-limit failure.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@resources/model-db/providers.json`:
- Around line 151109-151114: Verify the source metadata for the affected model
entry in providers.json and correct either release_date or last_updated so the
dates reflect the actual model timeline, with last_updated not preceding
release_date.

---

Nitpick comments:
In `@test/main/scripts/smokeLightOcr.test.ts`:
- Around line 352-365: Add a minimal regression test near the existing
materializePackagedNativeRuntime coverage that provides a font-resource fixture
whose declared aggregate bytes exceed 16 MiB, then assert
materializePackagedNativeRuntime rejects before writing or materializing the
runtime. Reuse the existing layout/temp-directory setup and verify the rejection
reflects the resource-limit failure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b16a45a-c665-47bf-afe6-229e2ea87e0f

📥 Commits

Reviewing files that changed from the base of the PR and between 6ccb375 and 72bd14c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • docs/architecture/light-ocr-0.5.6-runtime-assets/plan.md
  • docs/architecture/light-ocr-0.5.6-runtime-assets/spec.md
  • docs/architecture/light-ocr-0.5.6-runtime-assets/tasks.md
  • docs/features/light-ocr-pdf-support/spec.md
  • package.json
  • resources/acp-registry/registry.json
  • resources/model-db/providers.json
  • resources/runtime-versions.json
  • scripts/afterPack.js
  • scripts/light-ocr-artifacts.mjs
  • scripts/smoke-light-ocr.js
  • src/main/ocr/lightOcrNativePayload.ts
  • test/main/ocr/lightOcrNativePayload.test.ts
  • test/main/ocr/lightOcrProcessHost.test.ts
  • test/main/ocr/ocrRuntimeAssetResolver.test.ts
  • test/main/ocr/ocrRuntimeService.test.ts
  • test/main/scripts/afterPack.test.ts
  • test/main/scripts/lightOcrArtifacts.test.ts
  • test/main/scripts/smokeLightOcr.test.ts

Comment thread resources/model-db/providers.json
@yyhhyyyyyy
yyhhyyyyyy merged commit aa8cb48 into dev Jul 31, 2026
15 checks passed
@yyhhyyyyyy
yyhhyyyyyy deleted the chore/light-ocr-0.5.6 branch July 31, 2026 06:07
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