Skip to content

Removed @vitest/utils patch that broke the production build#28011

Merged
9larsons merged 1 commit into
mainfrom
remove-vitest-utils-patch
May 21, 2026
Merged

Removed @vitest/utils patch that broke the production build#28011
9larsons merged 1 commit into
mainfrom
remove-vitest-utils-patch

Conversation

@9larsons
Copy link
Copy Markdown
Contributor

Summary

#28009 shipped a pnpm patch of @vitest/utils. The production Docker build runs pnpm install --prod, which fails with ENOENT: no such file or directory, open '/patches/@vitest__utils@4.1.5.patch' — the patches/ directory isn't part of the Docker build context, so package.json's patchedDependencies reference points at a file that isn't there. Build & Publish is currently broken on main.

Why the patch is safe to drop

The patch suppressed a vitest source-map crash (convert-source-map choking on tsx's bundled loader while parsing an error stack). But that crash was only ever triggered by milestone-queries.test.js throwing Invalid knex instance — and that test was fixed in the same PR (#28009), which removed the trigger.

With the trigger gone, the patch is redundant. Verified without it:

  • pnpm test:vitest (full): 544 files / 6522 tests pass, exit 0
  • pnpm test:vitest test/unit/server/services: 256 files / 3290 tests pass, exit 0 — no source-map crash, no errors

Changes

  • Removed patchedDependencies from package.json
  • Deleted patches/@vitest__utils@4.1.5.patch
  • Regenerated pnpm-lock.yaml

Note

The underlying vitest behaviour (it can throw while extracting a sourcemap from a file with an unparseable embedded sourceMappingURL) is a pre-existing, latent vitest/tsx fragility — it only surfaces while reporting an error, so a passing suite never hits it. If it needs a real fix later, it must be done without pnpm patch (incompatible with the prod build) — e.g. a runtime workaround or an upstream vitest fix.

- #28009 shipped a pnpm patch of @vitest/utils. The production Docker
  build runs `pnpm install --prod`, which fails with ENOENT because the
  patches/ directory isn't part of the build context — breaking
  Build & Publish on main
- the patch was redundant anyway: it suppressed a vitest source-map
  crash that was actually triggered by milestone-queries.test.js
  throwing "Invalid knex instance". That test was fixed in the same PR,
  which removed the trigger — the full vitest suite passes without the
  patch (verified: 544 files / 6522 tests, services bucket 256 / 3290,
  exit 0)
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5ddbb0fc-d58d-4ebb-95c5-5f0474b4487b

📥 Commits

Reviewing files that changed from the base of the PR and between afd8b4e and 67ed71b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json
  • patches/@vitest__utils@4.1.5.patch
💤 Files with no reviewable changes (1)

Walkthrough

This PR removes the pnpm.patchedDependencies configuration block from package.json and updates the associated @vitest/utils@4.1.5.patch file. The patch file modification adds error handling to the extractSourcemapFromFile function by wrapping source-map conversion calls in a try/catch block; when conversion fails, the function returns undefined instead of throwing an exception. The existing behavior is preserved when conversion succeeds.

Possibly related PRs

  • TryGhost/Ghost#27898: Introduces Vitest as a test runner; directly intersects with this PR's changes to vitest dependency patching configuration.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing a vitest/utils patch that broke the production build.
Description check ✅ Passed The description comprehensively explains the problem, solution, verification, and rationale for removing the patch, all directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-vitest-utils-patch

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 and usage tips.

@9larsons 9larsons enabled auto-merge (squash) May 21, 2026 01:39
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.83%. Comparing base (afd8b4e) to head (67ed71b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28011      +/-   ##
==========================================
- Coverage   73.83%   73.83%   -0.01%     
==========================================
  Files        1523     1523              
  Lines      128982   128982              
  Branches    15483    15483              
==========================================
- Hits        95229    95228       -1     
+ Misses      32815    32792      -23     
- Partials      938      962      +24     
Flag Coverage Δ
admin-tests 53.56% <ø> (-0.01%) ⬇️
e2e-tests 73.83% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@9larsons 9larsons merged commit bd46a1c into main May 21, 2026
48 checks passed
@9larsons 9larsons deleted the remove-vitest-utils-patch branch May 21, 2026 01:58
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