feat(src): configure Discord to Linear backfills - #63
Draft
phorcys420 wants to merge 1 commit into
Draft
Conversation
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.
Makes the Discord to Linear backfills configurable.
Config
Under
linearBridge:backfill.enabled(defaulttrue): on the first live event of an unmapped#helpthread, mirror the thread's full history instead of just that event, so a thread opened while the bridge was off still lands complete.deepBackfill.days(default90): startup import that walks back through#helphistory. Mirrors every thread active within that many days.-1imports everything (pages all archived threads, retries through rate limits);0disables the startup import.deepBackfill.limit(default-1): caps how many threads the startup import mirrors, most recent first.-1is unlimited;0skips the import entirely.The old
backfillAllflag is replaced bydeepBackfill.days = -1.All three are env-overridable and coerced to their real types after load (configmasher hands back strings).
Implementation notes
backfillmoved from a bare boolean tobackfill.enabledto leave room for future backfill options.caughtUp) runs onMessageCreateand the debouncedThreadUpdate. It skips already-mirrored posts (Mirror.isMirrored) and routes throughwithRateLimitRetry, announcing the Linear issue link back to the thread. Reaction events are intentionally excluded to avoid duplicating the catch-up.backfill()pages archived threads in batches of 100, stops paging once a windowed import passes the day cutoff, sorts by latest message, applies the day window, then the limit cap.deepBackfill.limit === 0early-returns before any Discord paging.backfillThreadgained anannounceflag: off for the bulk startup import, on for live catch-up.days/limitvalues are treated as the unlimited sentinel (-1); no strict validation added.Generated by Coder Agents on behalf of @phorcys420.