Skip to content

feat: tell API clients what kind of account each bio tag is - #1595

Draft
simonhamp wants to merge 2 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-bio-profile-types
Draft

simonhamp wants to merge 2 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-bio-profile-types

Conversation

@simonhamp

Copy link
Copy Markdown
Contributor

Summary

GET /api/v1/users/{handle} sends bio_profiles, the handles tagged in a user's bio or company that have a page here. It doesn't say whether each one is a user or an organization. The mobile app (NativePHP/dev-null-app#181) draws bio tags like the web's BioText and opens the app's own screen for them, so today it opens every tag as a user, waits for the 404, and then switches to the organization screen. Unclaimed developers end up on the organization screen and fail, because the app has no unclaimed-profile screen.

The response now also has bio_profile_types, which the app already reads when it's there:

"bio_profile_types": { "laravel": "organization", "eveline24": "user", "taylor": "unclaimed" }

Changes

BioProfilesQuery::types() returns the same lowercase handles as get(), each mapped the way /@{handle} decides in routes/web.php: user when a user has the handle, organization for an organization's profile, and unclaimed for a user profile with no user. It is one query for all the tags, withExists('user') on the profiles, and no query when the bio and company tag no one. The API controller sends it next to bio_profiles, as an object like bio_profiles so an empty one is {}, for signed and unsigned requests. One sentence in KNOWLEDGE_BASE.md under the public read API.

The response now runs two profile queries instead of one, since get() and types() each query. I kept get() as it is because the web uses it. They could share one query if you'd rather.

Validation

Local, PHP 8.5.12, PostgreSQL with its own test database:

  • tests/Unit/Queries/BioProfilesQueryTest.php, tests/Feature/Controllers/Api/UserControllerTest.php, tests/Feature/Controllers/UserControllerTest.php and tests/Feature/Controllers/UserPreviewControllerTest.php: 103 passed. New tests cover a user, an organization, an unclaimed developer, a handle not on the site and one in a code span, in one query, and the field on signed and unsigned requests.
  • pint --test on the changed files: pass
  • rector --dry-run on the changed files: pass
  • phpstan: pass, no errors
  • pest --type-coverage --min=100: 100%
  • Coverage: not run, there is no coverage driver (pcov or Xdebug) on this machine.

Visual evidence

None. This is an API field with no web UI change.

Independent review

A read-only Claude review agent with the repo's .ai/guidelines and the diff against production at 2ef29e7, head 9356ade: CODE: PASS. Its two wording notes (the knowledge base sentence and the controller docblock mentioning the company) are fixed in ded1e3e, which changes only those two lines.

Limitations

None.

GET /api/v1/users/{handle} sends bio_profiles, the tagged handles that
have a page here, but not what each one is. It now also sends
bio_profile_types, mapping each of those lowercase handles to user,
organization or unclaimed, decided the way /@{handle} decides. It is one
query for all the tags, using withExists on the profile's user.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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