Skip to content

deploy: PDF parse DOMMatrix polyfill + email send pacing#94

Merged
RikepilB merged 1 commit into
masterfrom
main
Jun 11, 2026
Merged

deploy: PDF parse DOMMatrix polyfill + email send pacing#94
RikepilB merged 1 commit into
masterfrom
main

Conversation

@RikepilB

@RikepilB RikepilB commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Promotes main to master for production deploy.

Changes

Test plan

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed PDF text extraction to work properly in server-side environments.
  • Performance

    • Improved admin email dispatch with paced delivery between sequential sends.

Production PDF parsing failed with "ReferenceError: DOMMatrix is not
defined" (pdfjs expects browser canvas globals that Node lacks). Add
@napi-rs/canvas as a real dependency and install DOMMatrix/ImageData/
Path2D on globalThis before pdf-parse loads. Local parsing was
unaffected, which masked the bug until the prod smoke test.

Also pace inline admin email fan-out with a 300ms gap between sends:
sequential-but-instant rejections still tripped Resend's
requests-per-second cap (observed 429 in prod EmailLog).

Co-authored-by: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
scoutlane Building Building Preview, Comment Jun 11, 2026 9:08pm

@RikepilB RikepilB merged commit 21ba1ad into master Jun 11, 2026
2 of 4 checks passed
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5cb963c3-31f0-4a76-92cf-9954a51778b2

📥 Commits

Reviewing files that changed from the base of the PR and between 01fefa9 and 0486b22.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • package.json
  • src/lib/resume/extractText.ts
  • src/server/jobs/dispatch.test.ts
  • src/server/jobs/dispatch.ts

📝 Walkthrough

Walkthrough

This PR adds a Canvas polyfill to enable server-side PDF text extraction and implements pacing for admin notification email dispatches. The canvas dependency polyfills missing DOM globals in Node environments, while the dispatch change throttles consecutive email sends with 300ms inter-send delays.

Changes

PDF Text Extraction Polyfill

Layer / File(s) Summary
Canvas dependency and DOM globals polyfill
package.json, src/lib/resume/extractText.ts
Added @napi-rs/canvas dependency and implemented ensurePdfDomGlobals() helper that lazily loads canvas APIs and assigns DOMMatrix, ImageData, and Path2D to globalThis with graceful failure handling.
PDF parse initialization with polyfill
src/lib/resume/extractText.ts
Updated loadPdfParse() to call ensurePdfDomGlobals() before importing pdf-parse, ensuring DOM globals are available for server-side text extraction.

Admin Email Dispatch Pacing

Layer / File(s) Summary
Email dispatch pacing with test helpers
src/server/jobs/dispatch.ts, src/server/jobs/dispatch.test.ts
Changed dispatchAdminNotificationEmails to insert 300ms delays between consecutive inline email sends, added flushPacedFanOut() test helper to wait for paced work completion, and updated inline-mode tests to use the new timing-aware flush approach.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰 Canvas globals now paint the PDF page,
Emails pace their way, no longer in a rage,
Server and client shake hands, sweet!
🎨✉️

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch main

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

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