[High] C# free-play CodeExecutionOptions dropped end-to-end on server path #58

Closed
opened 2026-05-05 04:15:17 +00:00 by spikerj · 1 comment
Owner

Severity: High (functionality)

Files:

  • SpikerSoft.Api/Domain/CodeExecution/CSharpCodeRunnerController.cs (~83-90)
  • SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommand.cs
  • SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommandHandler.cs (~87-97)
  • SpikerSoft.EventHandlers.CodeExecution/Services/CodeExecutionWorkerService.cs CompileAndExecuteAsync (~724-733)

Problem: Client sends CodeExecutionRequest.Options (e.g. useImplicitUsings), but:

  1. Controller builds ExecuteCodeCommand without options
  2. Handler builds the RabbitMQ CodeExecutionRequest without Options
  3. Worker's CompileAndExecuteAsync calls _roslynExecutor.ExecuteFreePlayAsync(code, "UserSubmission", cancellationToken) -- no options

Result: server-side C# always uses defaults regardless of client toggle. Non-C# ExecuteNonCsharpFreePlayAsync does map options correctly; only C# is broken. WASM path also works.

Fix: Thread Options through the entire chain: Controller -> Command -> Handler -> Queue payload -> Worker -> ExecuteFreePlayAsync(code, name, options, ct).

Acceptance criteria:

  • useImplicitUsings: false from client respected on server path
  • Integration test verifies options propagate Controller -> Worker for C#
  • No regression for Python/JavaScript paths
**Severity:** High (functionality) **Files:** - `SpikerSoft.Api/Domain/CodeExecution/CSharpCodeRunnerController.cs` (~83-90) - `SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommand.cs` - `SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommandHandler.cs` (~87-97) - `SpikerSoft.EventHandlers.CodeExecution/Services/CodeExecutionWorkerService.cs` `CompileAndExecuteAsync` (~724-733) **Problem:** Client sends `CodeExecutionRequest.Options` (e.g. `useImplicitUsings`), but: 1. Controller builds `ExecuteCodeCommand` without options 2. Handler builds the RabbitMQ `CodeExecutionRequest` without `Options` 3. Worker's `CompileAndExecuteAsync` calls `_roslynExecutor.ExecuteFreePlayAsync(code, "UserSubmission", cancellationToken)` -- no options Result: server-side C# always uses defaults regardless of client toggle. Non-C# `ExecuteNonCsharpFreePlayAsync` does map options correctly; only C# is broken. WASM path also works. **Fix:** Thread `Options` through the entire chain: Controller -> Command -> Handler -> Queue payload -> Worker -> `ExecuteFreePlayAsync(code, name, options, ct)`. **Acceptance criteria:** - [ ] `useImplicitUsings: false` from client respected on server path - [ ] Integration test verifies options propagate Controller -> Worker for C# - [ ] No regression for Python/JavaScript paths
Author
Owner

Resolved.

Threaded CodeExecutionOptions end-to-end on the C# server path:

  1. ExecuteCodeCommand -- added Options property
  2. CSharpCodeRunnerController.Run -- now copies request.Options into the command
  3. ExecuteCodeCommandHandler -- includes Options when serializing the queue payload
  4. CodeExecutionWorkerService.ExecuteGeneralCodeAsync -- maps options via the existing MapCodeExecutionOptions helper and passes them to CompileAndExecuteAsync
  5. CompileAndExecuteAsync -- new FreePlayCodeOptions? parameter; forwarded to _roslynExecutor.ExecuteFreePlayAsync(useImplicitUsings, useTopLevelStatements, ...)

Files changed:

  • SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommand.cs
  • SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommandHandler.cs
  • SpikerSoft.Api/Domain/CodeExecution/CSharpCodeRunnerController.cs
  • SpikerSoft.EventHandlers.CodeExecution/Services/CodeExecutionWorkerService.cs
**Resolved.** Threaded `CodeExecutionOptions` end-to-end on the C# server path: 1. `ExecuteCodeCommand` -- added `Options` property 2. `CSharpCodeRunnerController.Run` -- now copies `request.Options` into the command 3. `ExecuteCodeCommandHandler` -- includes `Options` when serializing the queue payload 4. `CodeExecutionWorkerService.ExecuteGeneralCodeAsync` -- maps options via the existing `MapCodeExecutionOptions` helper and passes them to `CompileAndExecuteAsync` 5. `CompileAndExecuteAsync` -- new `FreePlayCodeOptions?` parameter; forwarded to `_roslynExecutor.ExecuteFreePlayAsync(useImplicitUsings, useTopLevelStatements, ...)` Files changed: - `SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommand.cs` - `SpikerSoft.Business/Domain/CodeExecution/Commands/ExecuteCode/ExecuteCodeCommandHandler.cs` - `SpikerSoft.Api/Domain/CodeExecution/CSharpCodeRunnerController.cs` - `SpikerSoft.EventHandlers.CodeExecution/Services/CodeExecutionWorkerService.cs`
Sign in to join this conversation.