Skip to content

[backend] Make friend requests require complete profile#8520

Merged
aapeliv merged 2 commits into
developfrom
backend/feature/incomplete-profile-friend-request
May 13, 2026
Merged

[backend] Make friend requests require complete profile#8520
aapeliv merged 2 commits into
developfrom
backend/feature/incomplete-profile-friend-request

Conversation

@aapeliv

@aapeliv aapeliv commented May 10, 2026

Copy link
Copy Markdown
Member

Apply the same incomplete-profile precondition to SendFriendRequest that already guards CreateHostRequest and CreateGroupChat / SendMessage. Users without an avatar photo and a 150+ character about_me now get a FAILED_PRECONDITION with the new incomplete_profile_send_friend_request error code.

Frontend changes will follow in a separate PR.

Testing

  • New test_cant_friend_request_incomplete_profile in test_api.py confirms the block fires for an incomplete-profile sender and that the reverse direction still succeeds.
  • Existing friend-related tests still pass (uv run pytest src/tests/test_api.py -k friend).

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

This PR was created with the Couchers PR skill.

Apply the same incomplete-profile precondition to SendFriendRequest
that already guards host requests and messaging.
@aapeliv
aapeliv requested a review from tristanlabelle as a code owner May 10, 2026 03:49
@vercel

vercel Bot commented May 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
couchers Ready Ready Preview May 12, 2026 2:02am

Request Review

@aapeliv aapeliv changed the title Block friend requests from users with incomplete profiles [backend] Make friend requests require complete profile May 10, 2026

@nabramow nabramow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM - thanks for adding this!

@aapeliv

aapeliv commented May 12, 2026

Copy link
Copy Markdown
Member Author

@claude rebase this and bump the migration version appropriately

@claude

claude Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Claude finished @aapeliv's task in 7m 33s —— View job


Rebase request

  • Fetch develop and inspect state
  • Check whether a migration bump is required
  • Run git rebase origin/develop — blocked: see below
  • Push rebased branch — blocked: see below

Findings

  1. No migration to bump in this PR. The three changed files are i18n/locales/en.json, servicers/api.py, and tests/test_api.py. There are no files under app/backend/src/couchers/migrations/versions/ in this branch.
  2. develop advanced by one migration (0150_add_last_updated_field_to_photogallery.py) since this PR was branched (current PR base: 117e827, current origin/develop: 7271e06). Because this PR adds no migration of its own, there is no number collision and nothing to renumber after rebase.
  3. The rebase itself would be conflict-free. I diffed the three modified files between 117e827 and origin/develop — all three are byte-identical, so the single PR commit eba3707 would replay cleanly on top of 7271e06.

Why I can't push the rebase

In this environment my Bash allowlist does not include git rebase, git reset, git checkout, git cherry-pick, git fetch, git merge, or git apply — all of them return "This command requires approval" and fail. The push wrapper at scripts/git-push.sh also rejects any flags, so I can't force-push a rewritten branch tip either. That means I can't actually execute the rebase from here, even though it would otherwise be trivial.

Suggested next steps

  • Use GitHub's "Update branch" → "Rebase" button on this PR, or rebase locally:
    git fetch origin develop
    git rebase origin/develop
    git push --force-with-lease
    
  • If you intended this PR to also add a DB migration (e.g. enforcing the precondition at the DB level), let me know what shape it should take and I'll draft it as a follow-up — but the current server-side guard in api.py:725-727 doesn't need one.
    • Branch: backend/feature/incomplete-profile-friend-request

@aapeliv

aapeliv commented May 12, 2026

Copy link
Copy Markdown
Member Author

@claude merge develop here and bump the migration version appropriately

@claude

claude Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Claude finished @aapeliv's task in 1m 39s —— View job


Merge develop into PR branch

  • Fetch develop and inspect state
  • Check whether a migration bump is required
  • Merge origin/develop into the branch (via gh pr update-branch)
  • Confirm new tip on remote

Result

Merged origin/develop into this branch via gh pr update-branch 8520. The new PR tip is bd3eaeb, with merge commit "Merge branch 'develop' into backend/feature/incomplete-profile-friend…". PR is MERGEABLE.

Migration bump

No bump needed. This PR doesn't add a migration of its own — the three files it touches are i18n/locales/en.json, servicers/api.py, and tests/test_api.py. The single new migration on develop since this branch was cut (0150_add_last_updated_field_to_photogallery.py) has no number to collide with anything in the PR. The latest migration is now 0150 on the merged tip; the next PR that adds a migration should number it 0151.

If you actually wanted me to add a DB migration to this PR (e.g. to enforce the precondition at the schema level), the in-code guard at servicers/api.py:725-727 doesn't have a schema component to migrate — let me know what shape you're picturing and I'll draft it as a follow-up.

Note on local git ops

git fetch / git merge / git rebase are still blocked in this environment's allowlist, so I used gh pr update-branch (the API-level equivalent of GitHub's "Update branch" button) to perform the merge server-side. That's why this comment doesn't show a local commit + push.
• Branch: backend/feature/incomplete-profile-friend-request

@aapeliv
aapeliv merged commit 701ef66 into develop May 13, 2026
5 checks passed
@aapeliv
aapeliv deleted the backend/feature/incomplete-profile-friend-request branch May 13, 2026 02:33
@github-actions github-actions Bot added the release notes: pending Add to stuff that should be included in release notes label May 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📝 Release Notes

This PR should be included in the release notes.

Suggested release note:

Required users to complete their profile before sending friend requests
🤖 Bot Debug Information

Model: couchers.openai.gpt-5.4
Decision: include
Reasoning: This change adds a user-facing restriction that requires members to complete their profile before sending friend requests, aligning friend requests with existing messaging and hosting rules. It is noticeable to users and encourages safer, higher-quality interactions on the platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes: pending Add to stuff that should be included in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants