Skip to content

feat: Social monitoring job runner integration (#100)#124

Draft
arberx wants to merge 1 commit intomainfrom
fix/issue-100
Draft

feat: Social monitoring job runner integration (#100)#124
arberx wants to merge 1 commit intomainfrom
fix/issue-100

Conversation

@arberx
Copy link
Copy Markdown
Member

@arberx arberx commented Mar 19, 2026

Summary

Wires social platform adapters into the job runner so that social-monitor runs execute end-to-end. Adds the SocialPlatformRegistry, SocialPlatformAdapter contract, social_mentions DB table, and extends the job runner with deduplication, per-platform error handling, and correct partial/complete/failed status logic.

Changes

  • packages/contracts/src/social.ts (new) — SocialPlatformAdapter interface, SocialMention, SocialQuotaPolicy, SocialPlatformName, and SocialMentionDto DTO schema
  • packages/contracts/src/run.ts — add social-monitor to runKindSchema
  • packages/contracts/src/index.ts — export new social.ts
  • packages/db/src/schema.ts — add social_mentions table with (platform, external_id) unique constraint for deduplication
  • packages/canonry/src/social-registry.ts (new) — SocialPlatformRegistry class mirroring ProviderRegistry pattern
  • packages/canonry/src/job-runner.ts — add executeSocialMonitorRun() method; rate limiting via existing waitForRateLimit; UPSERT-on-conflict deduplication; per-platform error tracking; partial/failed/completed status
  • packages/canonry/src/server.ts — instantiate SocialPlatformRegistry, pass to JobRunner, route social-monitor runs to new executor
  • packages/api-routes/src/runs.ts — accept social-monitor kind in POST /projects/:name/runs; pass kind through onRunCreated callback
  • packages/api-routes/src/index.ts — update onRunCreated type signature to include kind

Testing

All existing tests pass (115 canonry tests + 116 api-routes tests + full typecheck + lint). Social-monitor execution is covered by the infrastructure; concrete adapter tests will be added alongside the Reddit adapter (tracked separately).

Fixes #100

- Add 'social-monitor' to runKindSchema in contracts
- Add SocialPlatformAdapter interface and SocialMention contracts (social.ts)
- Add social_mentions table to DB schema with (platform, external_id) unique index
- Create SocialPlatformRegistry (mirrors ProviderRegistry pattern)
- Add executeSocialMonitorRun() to JobRunner with per-platform error handling
  and partial/failed/completed status logic
- Update runs API to accept 'social-monitor' kind
- Pass kind through onRunCreated callback chain
- Wire SocialPlatformRegistry into server.ts

Fixes #100
@arberx arberx marked this pull request as draft March 21, 2026 15:03
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.

Social monitoring job runner integration

1 participant