Skip to content

Conversation

@SamMorrowDrums
Copy link
Collaborator

The RepositoryResourceContentsHandler was using closure-captured deps instead of retrieving them from context at call time. This causes issues on the remote server which injects per-request deps via context.

Changes

  • Changed RepositoryResourceContentsHandler to use MustDepsFromContext(ctx) pattern consistent with tool handlers in NewTool and NewToolFromHandler
  • Removed deps parameter from function signature (now only takes resourceURITemplate)
  • Updated tests to inject deps via ContextWithDeps before calling the handler

Testing

  • All existing tests pass
  • Lint passes

The RepositoryResourceContentsHandler was using closure-captured deps
instead of retrieving them from context at call time. This causes issues
on the remote server which injects per-request deps via context.

Changed to use MustDepsFromContext(ctx) pattern consistent with tool
handlers in NewTool and NewToolFromHandler.
@SamMorrowDrums SamMorrowDrums requested a review from a team as a code owner January 9, 2026 17:27
Copilot AI review requested due to automatic review settings January 9, 2026 17:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the RepositoryResourceContentsHandler to retrieve dependencies from context at call time instead of using closure-captured dependencies. This change enables the remote server to inject per-request dependencies via context, aligning resource handlers with the existing pattern used by tool handlers.

Key Changes:

  • Modified RepositoryResourceContentsHandler to use MustDepsFromContext(ctx) instead of accepting deps as a parameter
  • Updated repositoryResourceContentsHandlerFunc to ignore the deps parameter and call the simplified handler
  • Updated all test cases to inject dependencies via ContextWithDeps before handler invocation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/github/repository_resource.go Changed handler to retrieve deps from context using MustDepsFromContext(ctx), removed deps parameter from function signature, updated doc comment
pkg/github/repository_resource_test.go Updated test setup to inject deps via ContextWithDeps, changed handler function signatures to remove deps parameter, passed context to handler calls

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.

2 participants