Started inserting automation run when member signs up#28263
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 (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR adds a public automationsApi.trigger(options) entrypoint (event restricted to 'member_sign_up'), a repository-level trigger implementation that schedules automation runs/steps based on the first eligible action revision and action type (wait/send_email), ES-module and schema updates for the temporary fake automations DB, MemberRepository wiring to call the new trigger (while preserving the legacy welcome-email enqueue path), GiftService updates to use the new method for paid signups, and unit tests covering repository and integration behaviors. Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ 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 |
towards https://linear.app/ghost/issue/NY-1286 *I recommend reviewing this with whitespace changes disabled.* When a member signs up, we should trigger an automation run and possibly insert a new row. Nothing happens yet when these rows are inserted--that will be done in a future change. This is development-only; triggering is a no-op in production.
4289304 to
66fb886
Compare
There was a problem hiding this comment.
Had to convert this to TypeScript so I could import it from another TypeScript file. (Alternatively, I could've added temporary-fake-database.d.ts, but I think that's strictly worse.
| } | ||
|
|
||
| function findFirstActionRevision(database: DatabaseSync, memberStatus: 'free' | 'paid'): NextActionRevisionRow | null { | ||
| const automationSlug: NonNullable<string> = MEMBER_WELCOME_EMAIL_SLUGS[memberStatus]; |
There was a problem hiding this comment.
hmm...not necessarily something for this PR and I might be over thinking it, but given we talked about moving away from using the slug to identify the automation, I wonder if there's a different way we should do this? Would this involve adding the concept of a trigger node perhaps? (not that i want to overcomplicate it at this step, but could at least be worth thinking about how this should work without slugs since we have a fake db to tinker with)
There was a problem hiding this comment.
I agree, but I think this should be done separately. I don't want to build "proper" triggers prematurely, and I don't think this blocks us from doing so.
towards https://linear.app/ghost/issue/NY-1286
ref #28120
I recommend reviewing this with whitespace changes disabled.
When a member signs up, we should trigger an automation run and possibly insert a new row.
Nothing happens yet when these rows are inserted. That will be done in a future change.
This is development-only; triggering is a no-op in production.
I tested this by:
Adding automated tests.
Verified that the old member welcome email is still sent on member signup.
Creating this temporary endpoint and verifying that the results looked expected after member signup: