Skip to content

feat(onboarding): configure onboarding stages from Discord - #422

Merged
kodiakhq[bot] merged 7 commits into
mainfrom
feat/onboarding
Nov 27, 2026
Merged

kodiakhq[bot] merged 7 commits into
mainfrom
feat/onboarding

Conversation

@RedStar071

@RedStar071 RedStar071 commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

🔗 Linked issue

Resolves #418

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking 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.

  • Contract. GuildOnboarding (a child of Modules, like GuildJoinGuard), GuildOnboardingStage (at most 5, names unique per guild whatever the case through a hand-made index) and OnboardingVerification (written by the bot only), with their four enums. The migration is 20261126T2123_add_onboarding. It lands on its own in the first commit so the website can pin it.
  • Writes. writeOnboarding runs UPDATE "GuildOnboarding" SET revision = revision + 1 WHERE id = $guild AND revision = $read first 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. validateOnboardingStage holds the rules both sides share.
  • Switch. onboardingEnabled (onboarding.enabled) is the one GuildData key. It is counted with the module switches like joinGuardEnabled.
  • Members. A Join stage starts on join. A NativeOnboarding stage starts once the member has the CompletedOnboarding flag. Stages run in position order, then by id. The verification message's button shows the challenge privately: Button, Emoji, or Question in a modal. A pass gives the role and starts the next stage. After maxAttempts wrong answers, or when the onboardingTimeLimit job fires, the member fails, and the bot opens a Kick or Timeout case. A leave marks the row Left, and rows from an earlier stay do not count after a rejoin. Every pass, failure and action goes to the log channel.
  • Panel. /settings onboarding is a Components V2 private panel. It shows the stage summary with what blocks each stage and this week's counts (by resolvedAt). 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.

Architecture of the onboarding: the panel and the dashboard write through the revision guard, members go through the stage runner

Differences from the brief's contract:

  • The base is main. V7 no longer exists: it was squash merged as refactor: V7 — new stack, monorepo structure, and tooling modernization #208. The website's .gitmodules still names V7.
  • The index names follow the existing pattern: GuildOnboardingStage_guild_id_position_idx, OnboardingVerification_guild_id_created_at_idx, OnboardingVerification_guild_id_user_id_idx and OnboardingVerification_stage_id_idx. Primary and foreign keys are <Table>_pkey and <Table>_<column>_fkey.
  • A member who failed a None or Timeout stage may press the button again. Only Kick ends the stay. The brief only says so for None; without it, a member who was timed out would stay stuck.
  • Captcha is never offered while OnboardingCaptchaAvailable is false. A stage that already has it stays editable and can be switched off.

🤖 AI disclosure: Wolfstar Agent Kit modified this description. AI open source policy.


Read this PR faster    Follow each request

Confidence Score: 5/5 · The latest changes appear safe to merge, with no new actionable issues found.RetriggerView in GreptileConfidence 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

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
@coldtea-pr-lens

coldtea-pr-lens Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
  • Redraw · drawn at 547fe35, the branch has moved on

Architecture

Walkthrough of Configurable multi-stage onboarding system, in five steps

Read this PR faster

Inside the changed components — 1 view

Component view — Onboarding subsystem

Internal modules driving stage validation, timeouts, and storage

Architecture view of Component view — Onboarding subsystem in wolfstar-project/wolfstar

Data flow

Data flow diagram for wolfstar-project/wolfstar at 547fe35

Follow each request


Data model

Data model diagram for wolfstar-project/wolfstar at 547fe35

+ 3 more tables on the canvas

Open the canvas

The other flows — 1 sequence

Admin updates onboarding configuration

Sequence diagram of Admin updates onboarding configuration in wolfstar-project/wolfstar

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
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through
  • The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change
  • The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture… row. Drawing still runs as before
  • Set github.draw: on-demand in .github/pr-lens.yml and PR Lens stops drawing pull requests on its own. Comment @pr-lens draw on a pull request when you want that one drawn
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works
  • After a push, tick Redraw to draw the latest commit
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion
  • Set github.description: false in .github/pr-lens.yml to stop PR Lens adding buttons to your PR descriptions

Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it.  Star PR Lens on GitHub

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, GuildOnboardingStage and OnboardingVerification, their four enums, and a hand-made lower("name") unique index.
  • Revision-guarded storage. writeOnboarding takes the revision first and rolls the whole transaction back on a conflict or a refusal. validateOnboardingStage holds the shared rules.
  • Member runtime. The join, native-onboarding and leave listeners, advanceOnboardingLocked, the pass and fail paths with kick or timeout cases, the onboardingTimeLimit job, and the onboardingVerify handler for the button, emoji and question challenges.
  • Panel. /settings onboarding with readiness checks, per-stage editing, log channel and verification message posting.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using claude-sonnet-5-5 | 𝕏

@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.30973% with 202 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.33%. Comparing base (ed88b1d) to head (a06ec8d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
projects/bot/src/lib/onboarding/members.ts 68.24% 28 Missing and 19 partials ⚠️
projects/bot/src/lib/onboarding/panel.ts 56.52% 35 Missing and 5 partials ⚠️
projects/bot/src/lib/onboarding/store.ts 0.00% 30 Missing ⚠️
projects/bot/src/lib/onboarding/discord.ts 0.00% 24 Missing ⚠️
projects/bot/src/lib/onboarding/log.ts 8.00% 23 Missing ⚠️
projects/bot/src/lib/onboarding/render.ts 0.00% 18 Missing ⚠️
projects/bot/src/lib/onboarding/ids.ts 68.57% 2 Missing and 9 partials ⚠️
projects/bot/src/lib/onboarding/panelData.ts 0.00% 4 Missing ⚠️
...rojects/bot/src/lib/database/settings/functions.ts 0.00% 3 Missing ⚠️
projects/bot/src/lib/onboarding/readiness.ts 90.00% 0 Missing and 2 partials ⚠️
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     
Flag Coverage Δ
unit 62.33% <55.30%> (-0.33%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ 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. runOnboardingTimeLimit reads the config from the database and returns Off when the module or the stage is disabled, Left for a deleted stage or an ended stay. onboardingVerify answers stale for a disabled stage.
  • Rows resolve after the action. passOnboardingStageLocked gives the role before it marks Passed, and failOnboardingStageLocked takes the action before it marks Failed. 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. syncOnboardingTimeLimits runs after every panel write and on the dashboard onboarding key. advanceOnboardingLocked repairs a missing job.
  • Panel fixes. toggle sets the on or off the button showed. The time limit modal prefill rounds to two decimals with max_length 7. createOnboardingStageInput decides Button or Question after normalizing.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using 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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 calls syncOnboardingTimeLimits only on an off→on flip and logs a failure instead of throwing.
  • Bot writes. Transaction#submit captures onboardingEnabled before Object.assign and emits the new Events.OnboardingSwitch when it changed, so the panel, /conf, the settings menu and imports are all covered. The new onboardingSwitch listener forwards it.
  • Dashboard writes. dashboardSettingsUpdateOnboarding now reacts to the onboardingEnabled key as well as onboarding. Dashboard writes do not go through Transaction#submit, so the two paths do not double-fire.
  • Tests. resumeOnboardingTimeLimits is covered for the off→on case and the three no-op combinations.

Pullfrog  | View workflow run | Using 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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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. syncOnboardingTimeLimits now 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 marked Left.
  • 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.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@github-project-automation github-project-automation Bot moved this from Todo to Review Approved in Wolfstar Nov 27, 2026
@kodiakhq
kodiakhq Bot merged commit 1f58b25 into main Nov 27, 2026
25 of 26 checks passed
@kodiakhq
kodiakhq Bot deleted the feat/onboarding branch November 27, 2026 10:03
@github-project-automation github-project-automation Bot moved this from Review Approved to Done in Wolfstar Nov 27, 2026
RedStar071 added a commit to wolfstar-project/wolfstar.rocks that referenced this pull request Nov 27, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature request: Configure server onboarding from Discord

1 participant