Skip to content

Conversation

@vcarl
Copy link
Member

@vcarl vcarl commented Dec 10, 2025

No description provided.

@vcarl vcarl marked this pull request as ready for review December 10, 2025 22:18
@github-actions
Copy link

vcarl and others added 7 commits January 12, 2026 19:06
Implements the foundation for gradual Effect-TS migration:
- Install effect package
- Create tagged error types for typed error handling
- Create runtime helpers to bridge Effect with Promise-based code
- Create observability bridge for Sentry span integration
- Create Database Service wrapping Kysely with typed errors
- Convert userThreads model as first Effect-based model example

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Upgrade @sentry/node to v8 with skipOpenTelemetrySetup
- Add @effect/opentelemetry and OpenTelemetry SDK packages
- Add @sentry/opentelemetry for span export
- Add posthog-node for future server-side analytics
- Create tracing.ts with SentrySpanProcessor, SentrySampler, SentryPropagator
- Update runtime.ts to provide TracingLive layer to all effects

Effects using Effect.withSpan will now have their spans exported to Sentry
for visualization in the Performance dashboard.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updates modLog.ts to use the Effect-based userThreads implementation
via the legacy wrapper functions. This validates the Effect migration
approach while maintaining backward compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create app/effects/models/reportedMessages.ts with Effect-based functions
- Update all imports to use Effect-based version with legacy wrappers
- Delete dead app/models/reportedMessages.server.ts

Functions migrated:
- recordReport (with DatabaseConstraintError handling)
- getReportsForUser
- getReportsForMessage
- getUserReportStats
- deleteReport
- markMessageAsDeleted
- getUniqueNonDeletedMessages
- deleteAllReportedForUser (partial - still uses Discord client directly)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
vcarl and others added 8 commits January 13, 2026 04:39
Replace patchwork logging bridge with Effect's native Logger service.
Add Effect.Metric definitions for APM-style observability (counters,
gauges, histograms). Instrument Database service with query metrics.
Convert deleteAllReportedForUser to Effect-based implementation.

New files:
- app/effects/logger.ts - JSON logger using Effect's Logger service
- app/effects/metrics.ts - Effect.Metric definitions

Changes:
- runtime.ts now provides LoggerLive layer
- observability.ts uses Effect.log* internally (API unchanged)
- Database service tracks query latency/count/errors automatically

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Split the monolithic handlers.ts into focused modules:
- directActions.ts: delete, kick, ban, restrict, timeout handlers
- simpleVote.ts: level 0 escalation, vote, and expedite handlers
- majorityVote.ts: level 1+ escalation upgrade handler
- handlers.ts: thin dispatch layer that re-exports EscalationHandlers

Also fixes missing metrics import in Effect services.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add runner helpers to escalation/index.ts:
- runEscalationEffect: runs Effect with EscalationService provided
- runDirectEffect: runs Effect without service requirements
- getFailure: extracts error from Cause for type-safe matching

Update handlers.ts to use getFailure() pattern instead of directly
accessing exit.cause._tag, which is a Cause discriminator not an
error discriminator.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create Effect-based resolver at app/effects/resolver/escalationResolver.ts:
- processEscalationEffect: processes single due escalation
- checkPendingEscalationsEffect: gets all due and processes sequentially

Update app/discord/escalationResolver.ts to delegate to Effect resolver:
- Keep executeResolution for use by EscalationService
- Scheduler remains Promise-based but delegates to Effect

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove dead code:
- Delete simpleVote.ts and majorityVote.ts (replaced by Effect handlers)
- Delete old escalationVotes.server.ts model (replaced by EscalationService)
- Remove unused vote handler from voting.ts (keep pure functions only)

Consolidate types and imports:
- Export Escalation/EscalationRecord types from EscalationService
- Move calculateScheduledFor to helpers/escalationVotes.ts
- Update all imports to use new locations

Files deleted: 4 (-939 lines)
Files modified: 9 (cleanup and import updates)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants