chore: Simplify shared Roslyn worker internals

Merged
HA
3mo ago
+177-146

Summary

  • Separate shared Roslyn worker wire framing and template rendering from process lifecycle orchestration.
  • Keep dynamic-code compilation behavior and worker protocol bytes unchanged.

User Impact

  • Execute-dynamic-code compilation, retry, timeout, cancellation, and fallback behavior remain unchanged.
  • The smaller worker host makes later lifecycle and assembly-build refactors easier to review independently.

Changes

  • Add SharedRoslynCompilerWorkerProtocol to own request encoding, response header parsing, diagnostic framing, protocol read timeout, quit marker, and worker program template token replacement.
  • Retarget existing command/template tests directly to the new owner and remove six host test wrappers.
  • Add characterization coverage for valid response headers, invalid prefixes, and non-numeric exit codes before extraction.
  • Reduce SharedRoslynCompilerWorkerHost from 988 to 865 lines while leaving retry, process lifecycle, assembly build, and shutdown state in the host.
  • The only non-move production change is passing the current worker StandardOutput reader into ReadDiagnosticLines; all compile calls run under SharedCompilerWorkerLock, and Process.StandardOutput returns the same reader instance used for the response header.
  • Preserve the existing double Path.GetFullPath application, blocking read behavior, strings, markers, timeout values, and out int exitCode contract.

Verification

  • dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)" (0 errors, 0 warnings)
  • SharedRoslynCompilerWorkerHostTests (10 passed)
  • ExternalCompilerPathResolverTests (15 passed, including worker-build fallback)
  • StaticFacadeStateGuardTests (20 passed)
  • Confirmed that removed host wrappers have zero references and the protocol has no reverse dependency on the host.
  • No IPC wire shape, CLI/package protocol version, or release input changes.