fix: Chat backfill would send notifications#165
Conversation
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🧰 Additional context used📓 Path-based instructions (2)**/*.go📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/!(ltsm)/**/*.go📄 CodeRabbit inference engine (AGENTS.md)
Files:
🔇 Additional comments (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR implements the BackfillingNetworkAPI for the LINE connector, centralizes message filtering, timestamp parsing, and decryption, extracts a unified convertLineMessage pipeline, and adds LineClient.FetchMessages plus a queued DM backfill integrated into the unblock flow. ChangesBackfillingNetworkAPI Implementation and Message Handling Refactor
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/connector/handle_message.go`:
- Around line 324-379: MENTION span indices S/E are character offsets but the
code slices unwrappedText and body using byte indices; convert character offsets
to byte offsets before storing in mentionEntry (used in the entries slice) and
before doing any slicing/replacements. Specifically, when parsing ment.S/ment.E
and creating entries in the blocks that append mentionEntry (and when handling
"`@room`" entries), map the rune index s and e to byte offsets into unwrappedText
(or into the current part body) using a rune-to-byte conversion (walk the string
with utf8.DecodeRuneInString or build []rune->byte mapping) and validate bounds
against len(unwrappedText) in bytes; then store those byte offsets in
mentionEntry.start/end so the subsequent sorting,
html.EscapeString(unwrappedText[lastEnd:entry.start]) and body = body[:start]+
"`@room`" + body[end:] use correct byte ranges.
- Around line 107-118: The code currently converts msg.CreatedTime to tsInt and
then uses time.UnixMilli(tsInt).IsZero() to decide the fallback, but
time.UnixMilli(0) is the Unix epoch (not Go's zero time), so zero timestamps
still get bridged as 1970-01-01; change the fallback check to examine the
integer timestamp itself (e.g., if tsInt == 0 or tsInt <= 0) before constructing
ts and return time.Now() in that case, keeping the existing error-path that logs
the Int64 conversion failure; update references around msg.CreatedTime, tsInt,
time.UnixMilli and the subsequent return time.Now() accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 265915a6-9540-4901-8a98-025fe818ee8e
📒 Files selected for processing (3)
pkg/connector/client.gopkg/connector/handle_message.gopkg/connector/sync.go
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-docker
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/*.go: Usego fmtfor code formatting across all Go files
Usegoimportswith-local "github.com/highesttt/matrix-line-messenger"flag to group project-local imports correctly
Usezerologfor logging throughout the codebase
Do not useMsgfin logging; useMsgwith structured fields instead
UseStringerinterface where applicable in Go code
Files:
pkg/connector/client.gopkg/connector/sync.gopkg/connector/handle_message.go
**/!(ltsm)/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
**/!(ltsm)/**/*.go: Runstaticcheckon all Go files excludingpkg/ltsmpackage (transpiled WASM code)
Rungo veton all Go files excludingpkg/ltsmpackage (transpiled WASM code)
Files:
pkg/connector/client.gopkg/connector/sync.gopkg/connector/handle_message.go
🔇 Additional comments (1)
pkg/connector/client.go (1)
137-141: LGTM!
No description provided.