Repository navigation
feat(httproute): read the request's viewer from host headers - #62
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
5a9ce6a to
c197359
Compare
http_routes.v1 handlers parse X-Silo-User-Id, X-Silo-Profile-Id and the other viewer headers by hand. Add httproute.ViewerOf, which returns the signed-in account, its role, the verified profile and display names, and reports false for a request with no signed-in account. Header lookups ignore case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c197359 to
9ef5528
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Problem
http_routes.v1handlers parseX-Silo-User-Id,X-Silo-Profile-Idand the other viewer headersby hand, and each plugin handles letter case and missing headers a little differently.
Approach
httproute.ViewerOf(req)returns the signed-in account, its role, the verified profile and thedisplay names, and reports false for a request with no signed-in account. Header lookups ignore
case.
Compatibility and release
Additive Go API; no proto or host change.
Related changes
buf generate.Validation
go test ./...,go vet ./...and every example build: pass.gofmt -l .lists onlypkg/pluginsdk/runtime/scan_source_test.go, which is unformatted onmainand not touched here.
bufleaves it unchanged.make protoitself stopsat its
protoccheck on this machine, though generation doesn't useprotoc.ViewerOf.AI Disclosure
mainand applied the fixes; claude-opus-5-5 and gpt-6.2-sol (Codex) each reviewed it independently. No findings on this change.🤖 Generated with Claude Code
Note
Add
httproute.ViewerOfto read the signed-in viewer from host headershttproutepackage in the plugin SDK reads viewer info that the host supplies as headers onhttp_routes.v1requests (viewer.go)ViewerOfparses the user ID, role, username, profile, and theme headers into aViewerstruct. It returns an emptyViewerwith false when the user ID is missing, malformed, or non-positiveHeadermatches header names case-insensitively and trims surrounding whitespace from valuesMacroscope summarized 9ef5528.