Skip to content

Effect migration: async/await files remaining #266

@vcarl

Description

@vcarl

Overview

The codebase is mid-migration to Effect-TS. Command handlers and core business logic are migrated, but Discord event handlers and some server-side models remain async/await.

Migration Priority (by dependency order)

Phase 1: Leaf Nodes (No Blockers)

  • app/discord/reactjiChanneler.ts - Self-contained, 119 LOC
  • app/discord/utils.ts - getOrFetchChannel helper

Phase 2: Blocker Dependencies

  • app/commands/report/userLog.ts - logUserMessageLegacy() blocks automod + honeypot

Phase 3: Primary Event Handlers

  • app/discord/activityTracker.ts - Already partially Effect-ified, 195 LOC
  • app/discord/honeypotTracker.ts - Blocked by userLog, 128 LOC
  • app/discord/onboardGuild.ts - Simple, 60 LOC

Phase 4: Final Event Handlers

  • app/discord/automod.ts - Blocked by userLog, 69 LOC

Phase 5: Orchestration (LAST)

  • app/discord/gateway.ts - Orchestrates all others, 280 LOC

Dependency Graph

                    gateway.ts (LAST)
                         │
    ┌────────┬───────────┼───────────┬────────────┐
    ▼        ▼           ▼           ▼            ▼
activity  automod   honeypot   reactji    onboardGuild
Tracker     .ts     Tracker   Channeler      .ts
   │         │          │         │            │
   │         ▼          ▼         │            │
   │    logUserMessageLegacy      │            │
   │                              │            │
   ▼                              │            │
utils.ts ◄────────────────────────┘            │

Related Work

discordSdk.ts Expansion Needed

Missing interaction helpers (currently inline Effect.tryPromise everywhere):

  • deferReply, deferUpdate, reply, update, editReply, followUp
  • deleteMessage
  • resolveReactionPartial, fetchReactionUsers

File Structure Issues to Address

  1. Bidirectional dependencies between layers (gateway ↔ commands ↔ discord/client)
  2. Command registration scattered across 4 files
  3. Escalation system has 3+ entry points
  4. Helpers directory overloaded (27 files with mixed concerns)
  5. Dual report implementations (legacy userLog vs Effect automodLog)

Reference

  • Model file: app/commands/escalate/escalationResolver.ts - demonstrates advanced patterns
  • Notes: /notes/EFFECT.md, /notes/EFFECT_REFERENCE.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions