Skip to content

PLAT-39414 connector: resolve Reddit user IDs without a directory search - #9

Open
Fizzadar wants to merge 2 commits into
mainfrom
nick/plat-39414-resolve-user-ids
Open

Fizzadar wants to merge 2 commits into
mainfrom
nick/plat-39414-resolve-user-ids

Conversation

@Fizzadar

@Fizzadar Fizzadar commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Clients pass the t2_ ID from search results when starting a DM, which Reddit's user directory never matches, so every new DM failed with "No Reddit user found". t2_ IDs are now looked up by profile (usernames still use the directory search), and newly created DMs return their members so bridgev2 doesn't refetch chat info before Reddit sets the chat type, the same 500 as #8. The profile endpoint hasn't been exercised against Reddit yet, so QA should start a DM with someone the account shares no chat with, and this should merge alongside #7.

🤖 Generated with Claude Code

Clients pass the t2_ ID from search results when starting a DM, which Reddit's user directory never matches, so every new DM failed with "No Reddit user found".

Look t2_ IDs up by profile and keep the directory search for usernames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@indent

indent Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Issues

1 potential issue found:

  • Still present at 50df6a9: usernames shaped like t2_ IDs (e.g. t2_abc) skip the directory search and are only looked up by profile, so a real account with such a name can no longer be resolved. Fall back to SearchUsers when GetProfile returns MNotFound.
    Found by Indent Review Agent

↑ Select any checkbox above to have Indent auto-fix the issue

CI Checks

All CI checks passed on 50df6a9.

Review agents

Select any unchecked box below to run or rerun that agent.

Found issues (1)
  • Indent Review Agent · The new-DM member list is correct; one earlier nit remains: t2_-shaped usernames skip directory sea…
Full results

Indent Review Agent

  • Summary: The new-DM member list is correct; one earlier nit remains: t2_-shaped usernames skip directory sea…
  • Last ran on commit: 50df6a9b
  • Latest result
    {
      "summary": "The new-DM member list is correct; one earlier nit remains: t2_-shaped usernames skip directory search.",
      "findings": [
        {
          "fix": "When GetProfile returns MNotFound for an ID-shaped identifier, fall back to the existing SearchUsers username match instead of going straight to the not-found error.",
          "line": 37,
          "path": "pkg/connector/startchat.go",
          "issue": "This is still present at 50df6a9b. Any identifier matching `t2_[0-9a-z]+` is sent only to GetProfile, and SearchUsers is skipped. Reddit usernames can contain underscores and are case-insensitive, so if a real account is named something like `t2_abc` and the user types `u/t2_abc`, it is looked up as an ID. If no account has that ID, the user gets 'No Reddit user found' (or the wrong person if one does). Before this PR, SearchUsers matched it by display name.",
          "title": "Usernames shaped like t2_ IDs no longer resolve through the directory",
          "severity": "nit"
        }
      ]
    }

if err != nil {
return nil, wrapRedditRespError(err)
}
var match *userDirectoryHit

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪️ Nit · Usernames shaped like t2_ IDs no longer resolve through the directory

Any identifier matching t2_[0-9a-z]+ now goes only to GetProfile and skips SearchUsers. Reddit usernames can contain underscores and are case-insensitive, so a real account named like t2_abc typed as u/t2_abc is looked up as an ID. If no account has that ID the user gets 'No Reddit user found', and if one does they get the wrong person. Before this change SearchUsers matched it by display name. Fall back to the directory search when GetProfile returns MNotFound.

Found by Indent Review Agent

Without members, bridgev2 refetched chat info before Reddit had set the new DM's chat type, so room creation failed with a 500 even though the DM was created.

Return the user as joined and the other user as invited, with the DM name, when Reddit creates a new DM.

Co-Authored-By: Claude Opus 5.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

Development

Successfully merging this pull request may close these issues.

1 participant