S60: REST GitHub-compat envelopes (user, labels, base/head, /users/{name})#301
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bundles four audit findings from the 2026-05-17 dogfood pass
(A01-dogfood-audit) — all "server REST shape doesn't match
GitHub-compat" — into a single response-envelope refresh. Unblocks
six broken CLI flows in one PR.
author_id: 1(flat FK) was the only author signal onissue/PR/comment responses; the CLI's
user.{login,id}decoderrendered every author as "ghost". Each response now ships a
user: {id, login, type, html_url}envelope alongside the legacyauthor_id. List endpoints batch-resolve the unique author setvia
ListUsersByIDsso we don't fan out one query per row.labels: ["bug"](string array) made the CLI'sstrongly-typed
issues.Label{Name, Color, …}decoder panic onevery labeled issue.
issue view,issue close, andissue reopenwere all unusable as a result. Now emits[{id, name, color, description}]via a sharedpresentLabelEnvelopeshelper.base_ref/head_ref/base_oid/head_oidon the PR response left
shithub pr viewrenderingbase: ← head:(empty). Added nestedbase: {ref, sha}/head: {ref, sha}envelopes; flat fieldsretained for one release cycle.
GET /api/v1/users/{username}(the gh-compatpublic-profile lookup, distinct from
/userwhich is theauthenticated own-profile path). Returns a trimmed envelope
(no email-verified flag, no plan, no admin markers).
user:readscope. Capability list grew a
usersentry./api/v1/useritself now emits bothusername(legacy) andlogin(gh-canonical) so transitional clients reading either field work.
The shared helpers live in a new
internal/web/handlers/api/envelopes.go. Single-issue / createpaths use
resolveUserEnvelope(one extraGetUserByID); listendpoints use
resolveUserEnvelopesBatch(oneListUsersByIDswith a dedup pass).
Test coverage:
TestIssues_UserEnvelope— create + get + comment exercise bothresolveUserEnvelope paths.
TestPulls_CreateAndGetextended — asserts nestedbase/headuserenvelope alongside the existing legacy assertions.TestCrossCutting_UsersByNamehappy path + 404 case.TestIssues_PatchAttachLabelAndMilestoneupdated to readLabels[0].Name(object shape) instead of the bare string.Test plan
go build ./...SHITHUB_TEST_DATABASE_URL=... go test ./... -count=1(green across the repo)scripts/lint-migration-versions.sh+scripts/lint-unused.sh(clean)gofumpt -lclean on touched filesFollow-ups
Paired CLI sprint (C25b in the audit doc) picks up the remaining
ergonomics items (success-line messages, completion positional arg,
template newline, etc.). The mergeability worker is its own
sprint (A17/A20).