You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memos/server/router/api/v1
Steven 65a19df4be fix(backend): correct generic type parameter in withHeaderCarrier helper
Problem:
The withHeaderCarrier generic function had a type mismatch that caused compilation
errors in CI. The function used `T proto.Message` constraint, but Connect's Response
type expects the non-pointer message type while protobuf methods return pointers.

Error from CI:
  type T of resp does not match *T (cannot infer T)

This occurred because:
- Connect methods expect: *connect.Response[v1pb.CreateSessionResponse]
- Service methods return: (*v1pb.CreateSessionResponse, error)
- Old signature: fn func(context.Context) (T, error) with T proto.Message
- This caused T to be inferred as *v1pb.CreateSessionResponse
- Leading to return type: *connect.Response[*v1pb.CreateSessionResponse] (wrong!)

Solution:
Changed generic signature to explicitly handle the pointer/non-pointer distinction:
- New signature: fn func(context.Context) (*T, error) with T any
- T is now the non-pointer type (e.g., v1pb.CreateSessionResponse)
- fn returns *T (e.g., *v1pb.CreateSessionResponse)
- Return type is correctly: *connect.Response[T] (e.g., *connect.Response[v1pb.CreateSessionResponse])

Also removed unused "google.golang.org/protobuf/proto" import and improved documentation
to clarify the T vs *T distinction.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
7 months ago
..
test refactor: migrate to connect-rpc (#5338) 7 months ago
acl.go fix(backend): implement protocol-agnostic header setting for dual gRPC/Connect-RPC support 7 months ago
acl_config.go refactor: migrate to connect-rpc (#5338) 7 months ago
activity_service.go chore: fix linter 8 months ago
attachment_service.go chore: fix some typos in comments (#5332) 7 months ago
auth_service.go fix(backend): implement protocol-agnostic header setting for dual gRPC/Connect-RPC support 7 months ago
auth_service_client_info_test.go chore: fix linter 11 months ago
common.go refactor: remove unused constants 9 months ago
connect_handler.go refactor: migrate to connect-rpc (#5338) 7 months ago
connect_interceptors.go fix(backend): implement protocol-agnostic header setting for dual gRPC/Connect-RPC support 7 months ago
connect_services.go fix(backend): correct generic type parameter in withHeaderCarrier helper 7 months ago
header_carrier.go fix(backend): correct generic type parameter in withHeaderCarrier helper 7 months ago
health_service.go refactor(store): remove deprecated migration_history table and backward compatibility code 7 months ago
idp_service.go fix(security): add missing authorization checks to various services (#5217) 8 months ago
instance_service.go refactor: simplify theme/locale to user preferences and improve initialization 7 months ago
logger_interceptor.go
memo_attachment_service.go fix(security): implement security review recommendations (#5228) 8 months ago
memo_relation_service.go fix(security): implement security review recommendations (#5228) 8 months ago
memo_service.go fix(api): implement custom memo ID support in CreateMemo (#5234) 8 months ago
memo_service_converter.go refactor: rename workspace to instance throughout codebase 8 months ago
memo_service_filter.go
reaction_service.go fix(security): implement security review recommendations (#5228) 8 months ago
resource_name.go refactor: rename workspace to instance throughout codebase 8 months ago
shortcut_service.go refactor: remove unused constants 9 months ago
user_service.go refactor: migrate to connect-rpc (#5338) 7 months ago
user_service_stats.go fix: implement tag suggestions functionality 8 months ago
v1.go refactor: migrate to connect-rpc (#5338) 7 months ago