Skip to content

[bug] Follow success check uses reply.statusCode which is always 200 at that point — logs are wrong #148

@MehtabSandhu11

Description

@MehtabSandhu11

In apps/backend/src/routes/follow.ts, the code checks reply.statusCode to decide whether to log a successful follow:

if (reply.statusCode === 200 || reply.statusCode === 204) {
  app.prisma.followLog.create({ data: { status: 'success' } })...
}

However, reply.statusCode is 200 by default before any response is sent. So this condition is always true at that point, meaning failed follows (e.g. 401, 404 from GitHub) are also logged as status: 'success'.

Expected behaviour

Only genuine successful follows should be logged as 'success'.

Proposed fix

Instead of checking reply.statusCode, check the actual response from the platform API directly:

// In followGitHub, return a boolean or throw on failure
// Then log based on that result, not reply.statusCode

Files to touch

  • apps/backend/src/routes/follow.ts
    ASSIGNMENT REQUEST — add this at the very bottom of the issue body:

I would like to work on this issue as part of GirlScript Summer of Code 2026 (GSSoC'26). I have reviewed the codebase and understand the root cause and the fix required.

Could you please assign this issue to me?

GitHub: @MehtabSandhu11

Thank you!

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions