Skip to content

Follow logging is not idempotent and allows duplicate follow events to inflate analytics #484

@Ridanshi

Description

@Ridanshi

Summary

Follow logging creates a new follow record for every successful follow request even when the underlying follow operation is already complete.

Repeated requests, retries, and double-clicks generate duplicate analytics entries.

Affected Files

  • follow.ts
  • schema.prisma

Root Cause

The follow workflow records every successful follow action without enforcing uniqueness or idempotency guarantees.

Although external follow operations may be idempotent, the logging layer continues creating additional records.

Reproduction

  1. Follow a target account successfully.
  2. Repeat the same follow request multiple times.
  3. Observe multiple follow log entries being created.
  4. Review analytics totals.
  5. Observe inflated follow metrics.

Expected Behavior

Repeated follow requests should not create duplicate follow records once the follow relationship already exists.

Actual Behavior

Each request generates additional analytics entries.

Why This Is Difficult To Detect

Most tests validate individual follow requests and do not simulate retries or duplicate submissions.

Production Impact

  • Inflated analytics
  • Incorrect follow counts
  • Misleading engagement metrics
  • Duplicate historical records

Suggested Fix

Introduce idempotent follow logging using uniqueness constraints, upserts, or request-level idempotency protections.

Severity

High

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

Status
In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions