Skip to content

refactor(discord): extract recovery backfill + reaction hooks into DiscordRecoveryBackfillMixin (adapter.py god-file slice R2) - #79651

Open
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/dc-recovery-backfill
Open

refactor(discord): extract recovery backfill + reaction hooks into DiscordRecoveryBackfillMixin (adapter.py god-file slice R2)#79651
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/dc-recovery-backfill

Conversation

@andrexibiza

@andrexibiza andrexibiza commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

discord adapter.py god-file slice R2: extract the recovery-backfill + reaction-hooks clusters from plugins/platforms/discord/adapter.py into plugins/platforms/discord/recovery_backfill_mixin.py (class DiscordRecoveryBackfillMixin). Part of the repo-wide large-file decomposition (tracker #78647).

What changed and why

  • RecoveryBackfill (2096–2745) + ReactionHooks (2942–2996) — 34 methods total — moved byte-verbatim into the new mixin (705 lines; diff vs original windows = 1 inserted blank only)
  • Mixin-FIRST class line (hard requirement): class DiscordAdapter(DiscordRecoveryBackfillMixin, BasePlatformAdapter): — base on_processing_start/complete stubs @4925–4959 would otherwise silently kill reaction hooks
  • C3 CommandSync (2747–2941) correctly preserved in place (BLOCKED-now per consensus — R1 callers @1864/2025/2054)
  • 15-test file test_discord_missed_message_backfill.py stays green
  • Double-blind: 2 analysts (fully converged) → consensus (R2-CONSENSUS.md) → implementer → commit lane verified verbatim → 3 seam-test bugs fixed (test-only) → 2 blind re-reviewers

Testing

  • 59 passed (test_discord_missed_message_backfill.py + test_discord_recovery_backfill_seam.py)
  • Seam test fixes were test-only (widened FakeReactionMessage.remove_reaction signature, added mentions param, relaxed sys.modules assert) — extraction untouched
  • python -c "import plugins.platforms.discord.adapter" OK · git diff --check clean · LF-only · DCO signed

Coordination / interlock

Part of #78647
Part of #78634

Part of #79564
Part of #79772

@eyeonall

Copy link
Copy Markdown

Cross-PR integration note: #79651 moves lifecycle reaction methods into DiscordRecoveryBackfillMixin, while #89405 adds default inbound reaction-target recording in on_processing_start.

Proposed low-risk sequence:

  1. Merge refactor(discord): extract recovery backfill + reaction hooks into DiscordRecoveryBackfillMixin (adapter.py god-file slice R2) #79651 as a pure extraction.
  2. Rebase feat(discord): add plugin-owned reaction actions #89405 and carry self._record_inbound_reaction_target(event) into the extracted mixin's on_processing_start.
  3. Run the focused reaction and recovery seam suites, including a regression where a plugin reaction action omits message_id and targets the inbound message.

#89405's manifest send path and raw-reaction dispatch can remain in adapter.py; they do not need to be folded into #79651. This preserves the feature ownership in #89405 and avoids mixin method resolution silently bypassing the default-target recording.

Reapply the verified R2 extraction unchanged because the Discord adapter has not changed between d762ed9 and f43eabe.

Part of NousResearch#78647
Part of NousResearch#78634
Part of NousResearch#79564
Part of NousResearch#79772

Signed-off-by: Axl Ibiza <84248988+andrexibiza@users.noreply.github.com>
@andrexibiza
andrexibiza force-pushed the fix/dc-recovery-backfill branch from 7c5ffc1 to 51e04cd Compare August 20, 2026 14:42
@andrexibiza

Copy link
Copy Markdown
Contributor Author

The exact current head is 51e04cde0b91391ac572db43ab2475f99a3d44a5, with covered commit 51e04cde0b91. It reapplies the verified recovery-backfill extraction unchanged: the 34 recovery and reaction-hook methods are housed in DiscordRecoveryBackfillMixin, and the mixin is first in DiscordAdapter's bases so the base adapter stubs cannot shadow those hooks. The command-sync cluster stays in place, preserving its caller dependencies; the reapplication reflects that the adapter source remained unchanged across the stated base comparison.

For refactor(discord): extract recovery backfill + reaction hooks into DiscordRecoveryBackfillMixin (adapter.py god-file slice R2), GitHub reports check rollup SUCCESS on exact head 51e04cde0b91391ac572db43ab2475f99a3d44a5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have platform/discord Discord bot adapter type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants