Skip to content

fix: shouldRegisterDistinctAuthorProfile compares a raw (case-sensitive) GitHub handle to a lowercased slug #5765

Description

@JSONbored

Goal

Fix shouldRegisterDistinctAuthorProfile's GitHub-handle comparison so it isn't case-sensitive against a lowercased slug.

Why this matters

The comparison this function performs is always false for the common case of a mixed-case GitHub handle, silently defeating the branch it's meant to guard regardless of intent.

Current behavior

apps/web/src/data/contributors.ts, lines 175-191:

export function shouldRegisterDistinctAuthorProfile(...) {
  const authorSlug = contributorSlug(author); // always lowercased
  ...
  if (
    entry.submittedBy &&
    !authorMatchesSubmitter(entry.author, entry.submittedBy) &&
    githubHandle(entry.authorProfileUrl) === authorSlug
  ) {
    return false;
  }

githubHandle() (lines 8-16) returns the raw URL path segment without lowercasing, while authorSlug always comes from contributorSlug(), which lowercases. Everywhere else in this module (e.g. identitySlugs, line 27) the GitHub handle is fed back through contributorSlug() before comparison. Here it isn't — so for any mixed-case handle (the common case, e.g. github.com/JSONbored), "JSONbored" === "jsonbored" is always false, and this branch never fires as intended.

Desired behavior

githubHandle(entry.authorProfileUrl) is normalized through contributorSlug() before comparison, matching the convention used at line 27 and elsewhere in the file.

Scope

  • apps/web/src/data/contributors.ts (shouldRegisterDistinctAuthorProfile only)
  • focused tests

Out of scope

  • identitySlugs and other already-correct comparisons in the file
  • contributorSlug/githubHandle themselves (already correct as building blocks)

Acceptance criteria

  • PR includes Closes #<issue>.
  • A mixed-case GitHub handle now correctly matches its lowercased slug equivalent in this function.
  • A new test covers a mixed-case handle case.

Quality evidence required in the PR

  • No visual impact; include the exact before/after boolean result for a mixed-case handle fixture.

Validation

pnpm build
pnpm exec vitest run tests/contributors.test.ts
git diff --check

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.5x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions