#131 · Extract Question/Answer handlers from command-handler.ts (~2000 lines)
Last checked with GitLab: . Status comes from GitLab using a 2-minute cache. Merge events clear affected cached statuses. An already-open page does not update itself. Refresh page.
An MR completes this bounty when it is merged into main with Closes #131 and GitLab closes the issue. A mention or an updated timestamp is not completion. Awarded points appear in Activity.
cp .dev.vars.example .dev.vars && pnpm dev, after rebasing on main) and fully test your change before opening the MR.
Description
Background
Q&A handlers (\handleQuestion\, \handleQuestions\, \handleClarify\, \handleAcceptAnswer\, \handleSolve\, \handleUnsolve\, \handleVote\, \handleAnswer\, \handleInquire\, \handleShareQuestion\, \handleQuestionExpanded\, \handleQuestionTrack\, \handleQuestionUntrack\, \handleMarkPotential\, \handleDropQuestion\, \handleRejectAnswer\) span ~2000 lines in command-handler.ts.
Follows the capability-extraction pattern proven by dice and RPS — documented in \apps/signal-bot/CLAUDE.md\ § "Capability extraction pattern".
Why now
- Q&A surface is the most user-facing capability after group management — every \
!q\, \!a\, \!solve\runs through here - Has its own helper functions (\
getShortQuestionId\, \resolveQuestionId\) that move naturally with the cluster - Several silent-failure incidents have been traced to this code path (May 6 \
!a HC40QV\typo misroute — see lessons-learned in command-handler.ts) - Extracting unlocks proper testability — current state has zero unit-test coverage of these handlers (related: issue #119 covers \
!summarize\/\!rollup\)
Scope
- New file \
apps/signal-bot/src/src/bot/commands/community/qa.ts\(~2000 lines) - Export each handler as \
async function handleX(args, context, QADeps): Promise<CommandResponse>\ - \
QADeps\likely: \{ bot, dbClient, announcementHandler, getRoomSettings, isAdmin, formatForSignal: never (import direct), getShortQuestionId, resolveQuestionId }\ - Wire into command-handler.ts switch cases via \
qa.handleX(args, context, this.qaDeps())\
Acceptance
- All Q&A handlers moved cleanly
- command-handler.ts drops by ~2000 lines (32,122 → ~30,000)
- Typecheck green; pre-existing 11 tsc errors are the only remaining
- No behavior change (commands still respond identically)
Bounty: L
Largest cluster yet. Coordinate with #119 (test coverage) — once extracted, qa.ts can become a vitest target for the first real Signal-bot unit tests.
Getting Started (added for pickup-readiness)
Path note: code lives under selfhost/messaging-apps/signal-messenger/src/src/bot/; the
extraction-pattern doc is selfhost/messaging-apps/signal-messenger/CLAUDE.md.
Verify note: the "11 pre-existing tsc errors" baseline above is stale (fixed in #133); a bare
checkout shows @irregularchat/shared-utils vendor-noise instead — compare error count to baseline.
- Target file:
selfhost/messaging-apps/signal-messenger/src/src/bot/commands/community/qa.ts(newcommunity/dir). - Helpers that move with the cluster:
getShortQuestionId,resolveQuestionId. - Verify:
pnpm turbo typecheck;cd selfhost/messaging-apps/signal-messenger/src && npx tsc --noEmit; - Coordinate: once extracted,
qa.tsis the natural first vitest target — hands off to #119.
spot-check !q, !a, !solve respond identically.
Prepared for pickup by 🤖 GearSmith's Goal-Tender (Claude).
Relevant files
No relevant files linked yet.
Hints
No hints yet.
Activity
No points have been awarded for this bounty yet.
Comments
Sign in to join the discussion.
No comments yet. Be the first to weigh in.