Made automations test database more reliable#28520
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThis PR makes two test-only changes: the temporary fake automations database is created with a Knex sqlite3 pool limited to one connection, and the automations API switches to caching the database initialization as a shared Promise (testDatabasePromise) that is awaited on subsequent calls and cleared by the reset helper. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run ghost:test:ci:integration |
✅ Succeeded | 2m 29s | View ↗ |
nx run ghost:test:ci:e2e |
✅ Succeeded | 12m 45s | View ↗ |
nx run ghost:test:ci:legacy |
✅ Succeeded | 3m 30s | View ↗ |
nx build @tryghost/portal |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/signup-form |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/announcement-bar |
✅ Succeeded | <1s | View ↗ |
nx build @tryghost/activitypub |
✅ Succeeded | 1s | View ↗ |
nx build @tryghost/comments-ui |
✅ Succeeded | <1s | View ↗ |
Additional runs (8) |
✅ Succeeded | ... | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-11 21:56:55 UTC
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ghost/core/core/server/services/automations/automations-api.ts`:
- Around line 79-82: The cached rejected promise issue: when getDatabase()
assigns testDatabasePromise =
temporaryFakeAutomationsDatabase.createTemporaryFakeAutomationsDatabase(), a
rejected promise stays cached; fix by assigning the promise to
testDatabasePromise, then await it inside a try/catch and on catch reset
testDatabasePromise = undefined before rethrowing the error. Update the
getDatabase() logic that references testDatabasePromise and
createTemporaryFakeAutomationsDatabase() so transient init failures don’t remain
sticky.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1e717e90-cf49-4b85-96b2-187d92f5c259
📒 Files selected for processing (2)
ghost/core/core/server/services/automations/automations-api.tsghost/core/core/server/services/automations/temporary-fake-database.ts
ref https://github.com/TryGhost/Ghost/actions/runs/27375153163/ This database will soon be removed, but let's make it a little more reliable in the meantime because CI is flaky. Let's ensure there's just one connection at a time.
05913c4 to
fc7fa28
Compare

ref https://github.com/TryGhost/Ghost/actions/runs/27375153163/
This database will soon be removed, but let's make it a little more reliable in the meantime because CI is flaky. Let's ensure there's just one connection at a time.