• Steven's avatar
    fix(backend): correct generic type parameter in withHeaderCarrier helper · 65a19df4
    Steven authored
    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: 's avatarClaude Sonnet 4.5 <noreply@anthropic.com>
    65a19df4
Name
Last commit
Last update
.github Loading commit data...
cmd/memos Loading commit data...
internal Loading commit data...
plugin Loading commit data...
proto Loading commit data...
scripts Loading commit data...
server Loading commit data...
store Loading commit data...
web Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
.golangci.yaml Loading commit data...
CLAUDE.md Loading commit data...
CODEOWNERS Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
SECURITY.md Loading commit data...
go.mod Loading commit data...
go.sum Loading commit data...