Skip to content

Conversation

@brettsam
Copy link
Member

@brettsam brettsam commented Nov 10, 2025

We have a major refactor of worker behavior planned, but in order to execute on that plan, we need to have a better decoupling of the current worker pipeline.

In order to facilitate that, this PR:

  • relocates a whole lot of the current worker-related functionality (including process management and http worker behavior) into the Script.Grpc project
  • changes all of these classes to be internal so that they are not accidentally used again in the core host code
  • wherever there were "leaks" of this behavior in host code, we've introduced new abstractions that the current behavior can use to keep them separate
  • All behavior is registered via DI wire-up in a few places. The new behavior will (eventually) replace those calls

Note that these new abstractions are not perfect and will likely go through further refinement. But we want to get this large change in first and then iterate as we go forward.

This change should not be changing how anything works today.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Copilot AI review requested due to automatic review settings November 10, 2025 19:52
@brettsam brettsam requested a review from a team as a code owner November 10, 2025 19:52
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 refactors worker-related functionality by relocating it from WebJobs.Script to WebJobs.Script.Grpc and making these classes internal to prevent accidental reuse in core host code. New abstractions are introduced where needed to decouple dependencies. The changes are primarily structural and should not affect current functionality.

  • Moved worker process management and HTTP worker behavior to Script.Grpc project
  • Changed worker classes to internal visibility
  • Introduced new abstractions like IWebHostWorkerManager, IScriptHostWorkerManager, IWorkerFunctionDescriptorProviderFactory, and IScriptHostLifecycleService
  • Registered all behavior via DI through new extension methods

Reviewed Changes

Copilot reviewed 110 out of 140 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
Various test files (TestRpc*, HttpWorkerTestUtilities, etc.) Changed test utility classes from public to internal to match new visibility patterns
DefaultWorkerProcessFactoryTests.cs Test methods changed from public to internal
FunctionMetadataManager.cs Removed HttpWorkerOptions dependency, replaced with FunctionMetadataOptions
ScriptHost.cs Removed direct FunctionInvocationDispatcher dependencies, replaced with abstraction interfaces
WebScriptHostExceptionHandler.cs Replaced IFunctionInvocationDispatcherFactory with IScriptHostWorkerManager
HostController.cs Replaced direct channel manager access with IScriptHostWorkerManager
Various Grpc project files Moved and made internal: worker processes, channels, factories, and descriptors
RpcServiceCollectionExtensions.cs New DI registration extension methods for RPC services
ScriptHostRecycleOptionsSetup.cs Split into two classes to decouple HTTP worker logic

@brettsam brettsam merged commit 90a2950 into dev Nov 13, 2025
15 checks passed
@brettsam brettsam deleted the feature/rpcupdt branch November 13, 2025 15:27
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.

4 participants