Conversation
When too many targets are specified, the mention line can exceed traQ's message length limit. PostMessage now tokenizes the message at newline and space boundaries, then greedily packs tokens into chunks of at most 2000 runes, sending each chunk as a separate webhook request. https://claude.ai/code/session_01CgXuuWWwhkMr1fXAR9LGgw
…/footer When the target list causes a message to exceed traQ's 2000-char limit, createMessagesFromTargets splits targets into groups and creates a separate complete message for each group — each one includes the full questionnaire header, the subset of @mentions, and the response link. The previous generic token-based split in PostMessage is removed; createQuestionnaireMessage and createReminderMessage now return []string and their callers iterate to send each message. https://claude.ai/code/session_01CgXuuWWwhkMr1fXAR9LGgw
The actual traQ message length limit is 10,000 runes (validated in router/v3/messages.go with vd.RuneLength(1, 10000)), not 2,000. https://claude.ai/code/session_01CgXuuWWwhkMr1fXAR9LGgw
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/openapi #1511 +/- ##
===============================================
- Coverage 66.79% 64.37% -2.43%
===============================================
Files 25 25
Lines 3762 3888 +126
===============================================
- Hits 2513 2503 -10
- Misses 875 1012 +137
+ Partials 374 373 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
When PostMessage was called inside the DB transaction, a failure on the second or later chunk would roll back the transaction, but any previously sent chunks already contained a link to a questionnaire that no longer exists. By calling PostMessage after the transaction commits, the linked questionnaire is guaranteed to exist. Send failures are only logged; the questionnaire creation itself is still treated as successful. https://claude.ai/code/session_01CgXuuWWwhkMr1fXAR9LGgw
d406f12 to
4807e0f
Compare
概要
アンケート作成・リマインダー通知において、対象者が多い場合にtraQのメッセージ上限(10,000文字)を超えてしまう問題を修正します。
変更内容
分割方針
対象者リストを複数のメッセージに分割する際、各メッセージが完全な形(ヘッダー・対象者サブセット・回答リンク)になるようにします。
分割前(1件):
分割後(複数件):
主な変更ファイル
traq/webhook_impl.goMessageLimit = 10000定数を追加(traQ のvd.RuneLength(1, 10000)に基づく)controller/questionnaire.gocreateQuestionnaireMessageの戻り値をstring→[]stringに変更createReminderMessageの戻り値をstring→[]stringに変更createMessagesFromTargets(prefix, suffix, targets, limit)ヘルパー関数を追加controller/reminder.gocontroller/questionnaire_test.go[]string対応に更新TestCreateMessagesFromTargetsを新規追加