Updated @tryghost/url-utils to 5.4.0 and froze url getters - #31293
Conversation
no ref url-utils 5.4.0 adds an opt-in freeze that snapshots the site, subdir and admin URLs. Ghost's getSubdir parses the configured url on every call, which showed up as a hot spot in sitemap builds on large sites. The url config never changes after boot, so the shared instance now freezes at construction. Tests do swap url config at runtime, so both vitest setup files unfreeze the shared instance. The media-inliner CDN tests mutated the private _assetBaseUrls field, which 5.4.0 now reads once at construction; they use the existing stubUrlUtilsWithCdn helper instead.
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:test:acceptance --shard=2/2 |
✅ Succeeded | 11m 3s | View ↗ |
nx run-many -t test:unit -p ghost,@tryghost/ada... |
✅ Succeeded | 10m 5s | View ↗ |
nx run ghost:test:ci:integration |
✅ Succeeded | 5m 2s | View ↗ |
nx run @tryghost/admin:test:acceptance --shard=1/2 |
✅ Succeeded | 9m 35s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 3m 33s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 4m 42s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 31s | View ↗ |
nx run-many -t lint -p ghost-monorepo,ghost,@tr... |
✅ Succeeded | 4m 18s | View ↗ |
Additional runs (13) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-10-02 17:28:40 UTC
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (2)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: TryGhost/Ghost/.coderabbit.yaml Review profile: QUIET Plan: Essentials Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (12)
🧰 Additional context used📓 Path-based instructions (6)Review whether tests prove changed behaviour, meaningful error/edge paths, and externally observable contracts without coupling to implementation details.⚙️ CodeRabbit configuration file Files:
New source files must be TypeScript: flag new JS files as a required change unless exempt (DB migrations, apps/ember-admin/, tool/config files, scripts/, docker/, generated code).⚙️ CodeRabbit configuration file Files:
Review lens: "where does this data become trusted?" Boundary data (HTTP input, external API/SDK responses, env/config, DB/filesystem reads, queue/webhook/event payloads) is `unknown` until validated — Zod by default.⚙️ CodeRabbit configuration file Files:
Prioritise concrete correctness, security, data-integrity, compatibility, and regression risks.⚙️ CodeRabbit configuration file Files:
Source excerpt: Ghost has several test suites across the monorepo.📄 CodeRabbit inference engine (docs/contributing/testing.md) Files:
Source excerpt: Built Admin assets are copied into `ghost/core/core/built/admin/` for the Ghost release.📄 CodeRabbit inference engine (docs/codebase/monorepo-structure.md) Files:
🔇 Additional comments (6)
WalkthroughURL-utils is configured as frozen by default. Both Vitest setup files unfreeze it after loading runtime overrides. The external media inliner test now uses a URL-utils helper to configure CDN base URLs. The workspace catalog and changeset record Suggested reviewers: Priority: ➖ Normal Change: Refactor Merge Risk: ⚪ Minimal · up to The dependency update and test setup have no identified issue requiring a fix before merge. 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #31293 +/- ##
==========================================
+ Coverage 69.29% 69.40% +0.10%
==========================================
Files 1585 1585
Lines 58062 58062
Branches 9969 9969
==========================================
+ Hits 40236 40297 +61
+ Misses 15665 15608 -57
+ Partials 2161 2157 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

no ref
Summary
@tryghost/url-utilsto 5.4.0 (Improved url-utils performance for sitemap-scale workloads SDK#1095), which adds an opt-infreeze()/frozenoption that snapshotsgetSiteUrl,getSubdirandgetAdminUrl, plus fastertransformReadyToAbsoluteandreplacePermalink.urlUtilsinstance incore/shared/url-utils.tsis now created withfrozen: true. Ghost'sgetSubdirrunsnew URL(config.get('url'))on every call, and url config never changes after boot, so this removes that work from hot paths like the sitemap build.configUtils.set), so both vitest setup files (vitest-setup.ts,vitest-setup-db.ts) callurlUtils.unfreeze()once after overrides load. Sinon stubs on the getters keep working either way.urlUtils._assetBaseUrlsno longer took effect. They now use the existingstubUrlUtilsWithCdnhelper.@tryghost/kg-default-cards, which picks up the catalog bump.Testing
pnpm test:typespassesdatabase: mysql8against my local MySQL, unrelated to this change🤖 Generated with Claude Code