Changed all services to use one instantiation pattern - #35
Open
ErisDS wants to merge 6 commits into
Open
Conversation
no ref Service roots had accumulated several incompatible export and lifecycle shapes, which made boot ownership and dependency usage difficult to reason about. Standardising them on explicit init and service exports gives current consumers one contract and creates a stable base for generation and future boot-loader work.
no ref Theme activation must refresh on each Ghost boot because tests and runtime reconfiguration can reset the theme engine without changing its path. Member welcome rendering now receives link tracking as an explicit dependency and relies on boot initialization instead of invoking the old nested lifecycle shape.
no ref Custom redirects owns adapter-backed state that must be rebuilt on each Ghost boot. Keeping the first process-wide instance leaked an earlier boot's redirect store into later tests and runtime reconfiguration.
E2E Tests FailedTo view the Playwright test report locally, run: REPORT_DIR=$(mktemp -d) && gh run download 32101607621 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
core/server/servicesthe same public shape: an explicitinit()entry point and aservicefacade.This PR is based on #34 so the complete pattern and this repository-wide application can be reviewed separately.
What counts as a service here?
The conversion found 56 runtime service roots and 11 directories that currently live under
services/but do not represent independently initialized runtime services:auth,api-version-compatibility,public-configinvitations,update-checkmailemail-rendering,files,integrations,lib,verificationThose directories are classified by the contract test but are not forced into a lifecycle they do not have. Moving them to their eventual domain or Kernel locations is intentionally separate from this mechanical standardisation.
Implementation notes
{init, service}. TypeScript roots use equivalent named exports.init()owns construction and is safe to call more than once. Services whose state is intentionally refreshed on each Ghost boot, such as settings, permissions, themes, and route settings, retain that behaviour.Follow-ups
lazySingletonfacade is deliberately smaller than that future abstraction.Testing
pnpm lintfromghost/corepnpm exec vitest run test/unit/server/services/service-roots.test.js