Repository navigation
feat(notifications): add one-time nudge for unanswered question cards - #55
Merged
Merged
Conversation
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
요약
봇이 사용자에게 질문·승인·로그인·자격증명 카드를 남긴 채 일정 시간(기본 30분) 응답이 없을 때, 기존
personWaits상태를 바탕으로 1회 리마인더 알림(nudge)을 보내는 기능을 추가합니다.왜 필요한가
waiting-on-you상태로 방치된 채 후속 안내가 없었습니다.createQuestionNudge가 주기적으로personWaits.waiting()을 확인해 설정된 대기 시간(threads.questionNudgeMinutes, 기본 30분)을 지난 미응답 카드에 대해 메시지당 정확히 1회 리마인더 알림을 발송합니다.주요 변경
server/host/question-nudge.ts추가:personWaits.waiting()을 단일 출처로 사용해 이미 답변/취소/만료된 카드는 자동 제외question-nudges.json에 발송한messageId를 원자적으로 기록(writeFileAtomic)해 서버 재시작 후에도 중복 알림 방지,NEEDS_YOU_WINDOW_MS(7일) 이후 자동 정리busy), 보관됨(archivedAt), 알림 꺼짐(bot.notifications === false) 스레드 건너뜀moveFreeze수명주기에 맞춰start()/stop()연동server/config.ts:threads.questionNudge(기본 켜짐) 및threads.questionNudgeMinutes(1~1440분, 기본 30분) 스키마·헬퍼(threadQuestionNudgeMs) 추가server/index.ts:questionNudge생성·기동 및configStatus()의threads에questionNudgeStatus(cfg)노출src/locales/{en,ko,pt-br}.json:server.notify.stillWaiting,server.notify.stillWaitingFallback문구 추가검증
pnpm typecheck,pnpm lint(oxlint --deny-warnings .),pnpm build,pre-push모두 통과npx vitest run server/config.test.ts server/server-lines.test.ts server/host/person-waits.test.ts: 3 files / 257 tests 통과Store+createPersonWaits+createQuestionNudge+config.json왕복 7개 시나리오 직접 실행 확인:case1_not_due_yet: 29분 경과 시 미발송case2_fires_once_when_due: 30분 경과 시 1회 발송, 35분 재스윕 시 중복 미발송case3_persists_across_restart:question-nudges.json저장 후 인스턴스 재생성 시에도 중복 미발송 (초기 빈dataDir에서mkdirSync누락 버그 발견·수정)case4_answered_not_nudged: 사용자 답변 후 미발송case5_busy_and_archived_skipped: 실행 중·보관된 스레드 건너뜀case6_muted_and_disabled: 알림 꺼진 봇 및threads.questionNudge: false시 미발송case7_korean_and_custom_delay:questionNudgeMinutes: 10+ 한국어 스레드에서"아직 답변을 기다리고 있어요: 배포할까요?"발송 확인