Skip to content

refactor: call the handle a handle in the API - #1179

Merged
mnapoli merged 1 commit into
productionfrom
refactor/api-handle
Oct 26, 2026
Merged

mnapoli merged 1 commit into
productionfrom
refactor/api-handle

Conversation

@mnapoli

@mnapoli mnapoli commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

The API sent each user's handle twice, as handle and as username for older clients, and the who-to-follow filter took it as ?username=. It now only says handle. Breaking for API clients, on purpose: no compatibility kept.

  • User resources (everywhere a user appears) drop username.
  • Mention positions (mentions on commits, messages and commit previews) drop username.
  • GET /api/v1/suggested-users takes ?handle= instead of ?username=. An old client sending username now gets the plain suggestions.
  • PRODUCT.md, KNOWLEDGE_BASE.md and DESIGN.md say handle, including the /@{handle} paths.

Validation

Local, isolated Postgres:

  • composer test:lint, composer test:type-coverage: pass
  • bun run test:unit: 190/190, tsc --noEmit: clean
  • pest --parallel --ci --coverage --exactly=100.0: 4492/4492, 100% coverage

Independent review

Agent review of the rename: CODE: PASS. No other place in the API sends or accepts username for the handle (GitHub logins and the Open Graph profile:username tag are left alone). Visual review not applicable.

Limitations

The mobile app must read handle before this ships.

Summary by CodeRabbit

  • Changes
    • User and author data in API responses now use handle instead of username. Mention data includes handle, offset, and length; the duplicate username field is no longer returned.
    • Suggested-user profile lookups now use handle as the query parameter.
  • Documentation
    • Updated profile, activity, API, feed, and commit-page examples to use {handle} terminology.

The API sent each user's handle twice, as handle and as username for older
clients, and the who-to-follow filter took it as username. It now only
says handle: user resources and mention positions drop username, and the
suggestions filter is ?handle=.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 72aacf6a-e34f-4280-bc89-1af60894dda3
Commits

Reviewing files that changed from the base of the PR and between d3fc1df and 41f72a4.

Files selected for processing: 16
  • DESIGN.md
  • KNOWLEDGE_BASE.md
  • PRODUCT.md
  • app/Http/Requests/ListApiSuggestedUsersRequest.php
  • app/Http/Resources/UserResource.php
  • app/Services/Mentions.php
  • tests/Feature/Controllers/Api/CommitControllerTest.php
  • tests/Feature/Controllers/Api/ConversationMessageControllerTest.php
  • tests/Feature/Controllers/Api/CurrentUserControllerTest.php
  • tests/Feature/Controllers/Api/LogControllerTest.php
  • tests/Feature/Controllers/Api/NotificationControllerTest.php
  • tests/Feature/Controllers/Api/RemoteCandidateControllerTest.php
  • tests/Feature/Controllers/Api/SuggestedUserControllerTest.php
  • tests/Feature/Controllers/Api/SuggestionDismissalControllerTest.php
  • tests/Feature/Controllers/Api/UserControllerTest.php
  • tests/Unit/Services/MentionsTest.php
Files with no reviewable changes: 5
  • tests/Feature/Controllers/Api/CurrentUserControllerTest.php
  • tests/Feature/Controllers/Api/RemoteCandidateControllerTest.php
  • tests/Feature/Controllers/Api/NotificationControllerTest.php
  • tests/Feature/Controllers/Api/UserControllerTest.php
  • app/Http/Resources/UserResource.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

The API now uses handle for suggested-user profile lookups and user payloads. User resources and mention results no longer include username. Documentation and tests reflect the updated names.

Changes: Handle-based API contract

Layer / File(s) Summary
Handle-based requests and lookup
app/Http/Requests/ListApiSuggestedUsersRequest.php, tests/Feature/Controllers/Api/SuggestedUserControllerTest.php, tests/Feature/Controllers/Api/SuggestionDismissalControllerTest.php, DESIGN.md, KNOWLEDGE_BASE.md, PRODUCT.md
Suggested-user validation and profile lookup use handle instead of username. Documentation uses {handle} in profile, API, feed, activity-graph, and commit-page URLs, and describes the login as a handle.
Handle-only response payloads
app/Http/Resources/UserResource.php, app/Services/Mentions.php, tests/Feature/Controllers/Api/*, tests/Unit/Services/MentionsTest.php
User resources and mention results no longer include username. API response and mention test expectations use handle and retain the existing mention offset and length fields.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: nunomaduro, taldres

Merge Risk: Minimal · up to 41f72

The change renames the API's user handle field and the suggested-users filter without a compatibility layer. No in-repo caller still depends on the old name. Clients outside this repository, notably the mobile app, must read handle before this ships, as the author states. That coordination is a release-timing matter and does not block the merge.

Security architecture risk: Low · up to 41f72

This intentionally breaks older API clients. The inspected changes preserve existing lookup and access-control behavior, but readiness of the mobile client and other external consumers has not been verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected security-relevant reach is the existing authenticated suggestion-selection path and existing user and mention response consumers. The renamed request key reaches the same profile identity set as before; removal of a duplicate response key does not itself add identity data or authority.

Trust Boundaries and Controls

  • observed — The suggested-users route remains under required signed-request authentication. The unchanged query retains blocked-context clearing, candidate exclusions, and viewer-visible commit filtering. Profile-context lookup itself lacks a viewer visibility predicate, but the base username lookup had the same behavior and exposure.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 8 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main API change: replacing username with handle.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 8 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@mnapoli

mnapoli commented Oct 26, 2026

Copy link
Copy Markdown
Member Author

I opened #1178 with a question and Nuno said we don't want to provide BC, so cleaning up after #1178

@mnapoli
mnapoli merged commit 411fa56 into production Oct 26, 2026
10 checks passed
@mnapoli
mnapoli deleted the refactor/api-handle branch October 26, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant