Repository navigation
feat(onboarding): configure onboarding stages from Discord - #422
Conversation
The website builds the onboarding dashboard (wolfstar.rocks#613) against these tables, so the contract lands first, on its own. GuildOnboarding is a child of Modules like GuildJoinGuard; its revision guards every write of the log channel, the message and the stages. Stage names are unique per guild whatever their case, by an index made by hand. Refs #418
Both the panel and the dashboard edit the stages, the log channel and the verification message, so every write takes the revision the editor read in its own transaction and refuses when someone wrote first. The switch is the flat key onboardingEnabled, counted with the module switches. Refs #418
Administrators set up what a new member passes before they are in from /settings onboarding, the same configuration the dashboard edits. Members press the verification message, pass each stage in order and get its role; failing runs the stage's action as a case and every result is logged. Refs #418
Architecture Inside the changed components — 1 viewComponent view — Onboarding subsystem Internal modules driving stage validation, timeouts, and storage
Data flow Data model The other flows — 1 sequence
Tip Open a diagram on the canvas, then press W or click play to walk through the change one step at a time 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
There was a problem hiding this comment.
Important
A member can still be kicked or timed out after an administrator switches the onboarding or a stage off, and a switched-off stage can still be passed.
Approach: sound. One guarded row plus a revision check gives the panel and the dashboard last-writer-safe edits, the per-member flow is a pure function under a shared lock, and the stored state decides everything, so any process can answer a click.
Reviewed changes
I read the full diff apart from AGENTS.md, the generated contract snapshots, the locale files and the i18next typings.
- Contract and migration.
GuildOnboarding,GuildOnboardingStageandOnboardingVerification, their four enums, and a hand-madelower("name")unique index. - Revision-guarded storage.
writeOnboardingtakes the revision first and rolls the whole transaction back on a conflict or a refusal.validateOnboardingStageholds the shared rules. - Member runtime. The join, native-onboarding and leave listeners,
advanceOnboardingLocked, the pass and fail paths with kick or timeout cases, theonboardingTimeLimitjob, and theonboardingVerifyhandler for the button, emoji and question challenges. - Panel.
/settings onboardingwith readiness checks, per-stage editing, log channel and verification message posting.
claude-sonnet-5-5 | 𝕏
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #422 +/- ##
==========================================
- Coverage 62.66% 62.33% -0.33%
==========================================
Files 270 280 +10
Lines 9493 9944 +451
Branches 2253 2367 +114
==========================================
+ Hits 5949 6199 +250
- Misses 3162 3329 +167
- Partials 382 416 +34
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:
|
The module button flipped the stored switch, so a panel shown before a dashboard write, or a double click, undid the change. It now carries the state the panel offered and sets it. The switch has no revision, since the dashboard writes it with the other settings. A new stage with the question and answers left blank became a Question stage: an empty answers field reads as one empty answer. The challenge is now chosen on the normalized input, so the default is a Button stage. The time limit prefill wrote raw minutes into a 4 character input, which broke the modal for limits that are not whole minutes (61 s is 1.0166...). It now writes minutes with two decimals in a 7 character input, and the parser rounds to whole seconds, so every value from 60 to 86400 reads back exactly.
The row of a member was marked Passed before the role and Failed before the kick. A role or a kick Discord refused then stranded the member, since a resolved row is never acted on again. The role is now given first, and the failure action is taken first. A refusal leaves the row waiting, logs why, and the time limit job tries again (it throws for BullMQ to retry). The time limit job had one ID per row, and BullMQ ignores a new job whose ID the running one holds, so a longer limit was lost. The ID now carries the moment the job runs. The job also reads the configuration and the member afresh: it does nothing while the module or the stage is off, and it marks Left a row of a deleted stage or of a stay that ended while the bot was offline. A saved time limit did not reach the members who wait. The panel and the dashboard listener now schedule every waiting member at the new deadline after a write of the stages. A row whose job could not be scheduled is marked Left, and the next press schedules a missing job again. A challenge of a stage switched off since it was shown is now refused.
There was a problem hiding this comment.
ℹ️ No critical issues — one gap in the new "off" handling, inline.
Reviewed changes
I read the incremental diff 547fe35..ee39202 in full. The four earlier threads were already resolved, and the new commits address each of them.
- Module and stage switches.
runOnboardingTimeLimitreads the config from the database and returnsOffwhen the module or the stage is disabled,Leftfor a deleted stage or an ended stay.onboardingVerifyanswersstalefor a disabled stage. - Rows resolve after the action.
passOnboardingStageLockedgives the role before it marksPassed, andfailOnboardingStageLockedtakes the action before it marksFailed. A refusal leaves the row waiting, and the job retries with BullMQ backoff (about five hours). - Job IDs carry the deadline.
onboarding-<id>-<runAt>lets a shortened or lengthened limit schedule a job of its own.syncOnboardingTimeLimitsruns after every panel write and on the dashboardonboardingkey.advanceOnboardingLockedrepairs a missing job. - Panel fixes.
togglesets theonoroffthe button showed. The time limit modal prefill rounds to two decimals withmax_length7.createOnboardingStageInputdecidesButtonorQuestionafter normalizing.
claude-sonnet-5-5 | 𝕏
A time limit job that runs while the onboarding is off does nothing and schedules no other job. When the module was switched on again, the members who waited had no time limit until they pressed the button. A write of the bot that switches the module now emits onboardingSwitch, and its listener schedules the deadline of every waiting member again. The dashboard listener also runs for the onboardingEnabled key.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I read the incremental diff ee39202..01bfc94 in full. The one open thread from the previous review (waiting members left without a time limit after the module is re-enabled) is addressed.
- Resume on switch. Added
resumeOnboardingTimeLimits, which callssyncOnboardingTimeLimitsonly on an off→on flip and logs a failure instead of throwing. - Bot writes.
Transaction#submitcapturesonboardingEnabledbeforeObject.assignand emits the newEvents.OnboardingSwitchwhen it changed, so the panel,/conf, the settings menu and imports are all covered. The newonboardingSwitchlistener forwards it. - Dashboard writes.
dashboardSettingsUpdateOnboardingnow reacts to theonboardingEnabledkey as well asonboarding. Dashboard writes do not go throughTransaction#submit, so the two paths do not double-fire. - Tests.
resumeOnboardingTimeLimitsis covered for the off→on case and the three no-op combinations.
claude-sonnet-5-5 | 𝕏
The sync read the stages and then the waiting rows. A stage created and started between the two reads looked deleted, so its member was marked as left. A row is written only once its stage exists, so reading the rows first finds the stage of each row unless it was really deleted.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I read the incremental diff 01bfc94..a06ec8d in full. All earlier Pullfrog threads were already resolved.
- Read order in the sync.
syncOnboardingTimeLimitsnow reads the waiting rows before the stages. A member only starts a stage that exists, so every row's stage is in the later stage read unless it was really deleted. A stage created and started between the two reads is no longer taken for deleted, and its member is no longer markedLeft. - Regression test. The new test creates a stage and starts a member between the two reads and checks the row stays
Waiting. It fails with the old read order.
claude-sonnet-5-5 | 𝕏
The bot merged the onboarding (wolfstar-project/wolfstar#422) as 1f58b25. The contract is the one pinned before: the storage hash stays 980f5019, and columns.ts and constants.ts match the ports here.

🔗 Linked issue
Resolves #418
❓ Type of change
📚 Description
Administrators need to set up what a new member must pass before they are in, from Discord as well as from the dashboard (wolfstar-project/wolfstar.rocks#613, built in wolfstar-project/wolfstar.rocks#623 against this contract). Both sides edit one configuration, so a stale edit must never overwrite a newer one.
GuildOnboarding(a child ofModules, likeGuildJoinGuard),GuildOnboardingStage(at most 5, names unique per guild whatever the case through a hand-made index) andOnboardingVerification(written by the bot only), with their four enums. The migration is20261126T2123_add_onboarding. It lands on its own in the first commit so the website can pin it.writeOnboardingrunsUPDATE "GuildOnboarding" SET revision = revision + 1 WHERE id = $guild AND revision = $readfirst in the transaction. It creates the row at revision 0 when the guild has none. A refused write undoes the whole transaction. Readers read the revision before the stages, one after the other.validateOnboardingStageholds the rules both sides share.onboardingEnabled(onboarding.enabled) is the oneGuildDatakey. It is counted with the module switches likejoinGuardEnabled.Joinstage starts on join. ANativeOnboardingstage starts once the member has theCompletedOnboardingflag. Stages run inpositionorder, then byid. The verification message's button shows the challenge privately:Button,Emoji, orQuestionin a modal. A pass gives the role and starts the next stage. AftermaxAttemptswrong answers, or when theonboardingTimeLimitjob fires, the member fails, and the bot opens aKickorTimeoutcase. A leave marks the rowLeft, and rows from an earlier stay do not count after a rejoin. Every pass, failure and action goes to the log channel./settings onboardingis a Components V2 private panel. It shows the stage summary with what blocks each stage and this week's counts (byresolvedAt). It creates, edits, reorders, switches and deletes stages, sets the log channel, and posts or moves the verification message. Every write uses the revision the panel showed. A conflict says nothing was saved and offers a reload. Readiness reads Community from the API, not the cache.Differences from the brief's contract:
main.V7no longer exists: it was squash merged as refactor: V7 — new stack, monorepo structure, and tooling modernization #208. The website's.gitmodulesstill namesV7.GuildOnboardingStage_guild_id_position_idx,OnboardingVerification_guild_id_created_at_idx,OnboardingVerification_guild_id_user_id_idxandOnboardingVerification_stage_id_idx. Primary and foreign keys are<Table>_pkeyand<Table>_<column>_fkey.NoneorTimeoutstage may press the button again. OnlyKickends the stay. The brief only says so forNone; without it, a member who was timed out would stay stuck.Captchais never offered whileOnboardingCaptchaAvailableis false. A stage that already has it stays editable and can be switched off.

Confidence Score: 5/5
The latest changes appear safe to merge, with no new actionable issues found.Reviews (3) · Last reviewed commit: "fix(onboarding): read waiting rows befor..." · Reviewed by Greptile