Repository navigation
Updated invites service to TypeScript - #32153
Conversation
no ref Make invitation inputs and dependencies explicit while preserving the existing delivery, acceptance, and boot contracts.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
WalkthroughThe invitation service and acceptance action now use typed TypeScript imports and exports. The changes add invitation, dependency, and request types; update service inventory and documentation references; and adapt unit tests to typed fixtures. The email-send error handler checks an error’s shape before formatting and logging its message. The acceptance transaction setup retains its internal context, active transaction, and row-lock options. Priority: ⬇️ Low Change: Refactor Merge Risk: ⚪ Minimal · up to
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 2m 22s | View ↗ |
nx run ghost:test:integration |
✅ Succeeded | 1m 54s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 4m 58s | View ↗ |
nx run ghost:test:e2e |
✅ Succeeded | 3m 46s | View ↗ |
nx run ghost:test:legacy |
✅ Succeeded | 2m 22s | View ↗ |
nx run ghost:test:ci:unit |
✅ Succeeded | 1m 23s | View ↗ |
nx run-many -t test:unit -p ghost,@internal/scr... |
✅ Succeeded | 57s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 14s | View ↗ |
Additional runs (6) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-10-22 09:03:02 UTC
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #32153 +/- ##
==========================================
- Coverage 85.56% 85.30% -0.27%
==========================================
Files 1398 1398
Lines 52426 52419 -7
Branches 9006 9006
==========================================
- Hits 44860 44716 -144
- Misses 6487 6613 +126
- Partials 1079 1090 +11
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:
|
## Why Part of the ongoing JavaScript to TypeScript migration, one small PR at a time. The subject of this test, `ghost/core/server/services/machine-payments/content-loader.ts`, is already TypeScript, so its unit test can be converted to use the real types with no suppressions, no `any`, and no behaviour change. Developers editing the content loader now get type checking on its test fakes too. ## What - Renamed `ghost/test/unit/server/services/machine-payments/content-loader.test.js` to `content-loader.test.ts` (git rename, 83% similarity). - Switched `require` to `import`. - Added a small local `FakePostModel` type alias for the fake post model passed to `ContentLoader`. - Added `assert.ok(entry)` before reading properties of the `loadFullEntry` result, which is typed `Record<string, unknown> | null`. This narrows the type and is a strictly stronger assertion than the original. - Updated the one `service-inventory.yaml` test path for the machine-payments entry, as the invites migration (#32153) did; the inventory test asserts that every listed path exists. - No tests were deleted. Test names, structure and assertions are otherwise unchanged. ## How tested From `ghost/`: ``` pnpm test:single test/unit/server/services/machine-payments/content-loader.test.ts # 4 passed pnpm test:types # clean pnpm lint:test # clean pnpm test:unit # 756 files passed ``` The full unit run had two failing files, `test/unit/server/lib/mailgun/mailgun-client.test.js` and `test/unit/server/lib/mail/ghost-mailer.test.js` (`ERR_INVALID_URL`). They fail identically on a pristine `origin/main` checkout in the same sandbox, so they are an environment issue with the sandbox's HTTP proxy and unrelated to this change.

Converts invite delivery and acceptance to TypeScript, with explicit request, model and dependency types backed by the published
@tryghost/securitydeclarations.Keeps the existing boot-owned service API, delivery ordering and transactional acceptance flow. Tests, documentation and inventory paths follow the renamed files.
Validation
NX_PARALLEL=1 pnpm checkin a clean checkout. The default parallel run hit test timeouts.pnpm nx run-many -t test:types -p ghost --parallel=2.pnpm --filter ghost exec vitest run test/unit/server/services/invites/ test/unit/server/models/invite.test.js test/unit/server/auth/passwordreset.test.ts test/unit/lib/generate-password.test.ts test/unit/boot/init-core.test.ts --maxWorkers=2.Checklist