[Enhancement] Rename CSharpCodeRunnerController to a language-agnostic name #285

Closed
opened 2026-06-28 21:22:34 +00:00 by spikerj · 1 comment
Owner

Summary

CSharpCodeRunnerController (route api/CSharpCodeRunner) is no longer C#-specific. It is the shared code-execution endpoint for the C#, Python, and JavaScript playgrounds — all three frontends POST to /api/CSharpCodeRunner/run and /api/CSharpCodeRunner/lesson and signal their language via metadata.language. The C#-centric name is misleading and was the proximate cause of the recent #280 regression (a dev hardcoded metadata.language = "csharp" in the controller, assuming it only served C#, which broke JS/Python lesson submissions).

Rename the controller, its route, and the related types to a language-agnostic name (suggestion: CodeRunnerController / api/CodeRunner, or CodeExecutionController / api/CodeExecution) so the shared nature is obvious and future contributors don't reintroduce language-specific assumptions.

Note: this is a follow-up to #280 (fix merged separately in spikersoft-backend). This ticket is the cleanup/rename only.

Scope

Backend (spikersoft-backend)

  • Rename SpikerSoft.Api/Domain/CodeExecution/CSharpCodeRunnerController.cs → language-agnostic controller + class name.
  • Update the [Route("api/[controller]")] so the public path changes (or keep a back-compat route — see Compatibility below).
  • Rename the test file SpikerSoft.Tests.Unit/Controllers/CSharpCodeRunnerControllerTests.cs and update references.
  • Audit CSharpCodeRunnerControllerTests, README.md, and any other backend mentions of CSharpCodeRunner.
  • Leave the sibling controllers as-is where they are genuinely language-scoped: CCodeRunnerController (api/CCodeRunner, C/C++) and SqlCodeRunnerController (api/SqlCodeRunner). Consider whether CCodeRunner should also be generalized since it serves both C and C++ — optional, lower priority.

Frontend (spikersoft-angular) — all consumers of /CSharpCodeRunner

These three runner services hardcode the controller segment and must be updated to the new path:

  • libraries/features/dev-tools-csharp-runner/src/lib/csharp-runner.service.ts (line ~66: apiUrl = \${environment.apiUrl}/CSharpCodeRunner``)
  • libraries/features/dev-tools-javascript-runner/src/lib/javascript-runner.service.ts (line ~33)
  • libraries/features/dev-tools-python-runner/src/lib/python-runner.service.ts (line ~41)

Each uses ${apiUrl}/run and ${apiUrl}/lesson.

For reference (NOT affected — they use their own controllers, listed so the rename isn't accidentally over-applied):

  • C / C++ runners go through ClangRunnerService with apiController: "CCodeRunner" (dev-tools-c-runner, dev-tools-cpp-runner).
  • SQL runner uses /SqlCodeRunner (dev-tools-sql-runner).
  • x86 and regex runners only hit /Lessons (no code-runner controller).

Compatibility / rollout

The controller route is a public API surface consumed by the deployed SPA. To avoid a hard breakage during deploy skew:

  • Option A (preferred): Add the new route while keeping api/CSharpCodeRunner as a deprecated alias for one release, ship the frontend pointed at the new route, then remove the alias in a follow-up.
  • Option B: Coordinate a simultaneous backend + frontend deploy and cut over directly.

Pick one and note it on the PR.

Acceptance criteria

  • Controller + class + tests renamed to a language-agnostic name.
  • All three frontend runner services updated to the new path.
  • No remaining references to CSharpCodeRunner except an intentional back-compat alias (if Option A).
  • C#, Python, and JavaScript playgrounds verified working for both free-play run and lesson submit after the change.
  • Sibling CCodeRunner / SqlCodeRunner controllers untouched (or generalization tracked separately).

Severity

Low (tech debt / maintainability) — but directly prevents a class of regressions like #280.

## Summary `CSharpCodeRunnerController` (route `api/CSharpCodeRunner`) is no longer C#-specific. It is the shared code-execution endpoint for the **C#, Python, and JavaScript** playgrounds — all three frontends POST to `/api/CSharpCodeRunner/run` and `/api/CSharpCodeRunner/lesson` and signal their language via `metadata.language`. The C#-centric name is misleading and was the proximate cause of the recent #280 regression (a dev hardcoded `metadata.language = "csharp"` in the controller, assuming it only served C#, which broke JS/Python lesson submissions). Rename the controller, its route, and the related types to a language-agnostic name (suggestion: `CodeRunnerController` / `api/CodeRunner`, or `CodeExecutionController` / `api/CodeExecution`) so the shared nature is obvious and future contributors don't reintroduce language-specific assumptions. > Note: this is a follow-up to #280 (fix merged separately in spikersoft-backend). This ticket is the cleanup/rename only. ## Scope ### Backend (`spikersoft-backend`) - Rename `SpikerSoft.Api/Domain/CodeExecution/CSharpCodeRunnerController.cs` → language-agnostic controller + class name. - Update the `[Route("api/[controller]")]` so the public path changes (or keep a back-compat route — see Compatibility below). - Rename the test file `SpikerSoft.Tests.Unit/Controllers/CSharpCodeRunnerControllerTests.cs` and update references. - Audit `CSharpCodeRunnerControllerTests`, `README.md`, and any other backend mentions of `CSharpCodeRunner`. - Leave the sibling controllers as-is where they are genuinely language-scoped: `CCodeRunnerController` (`api/CCodeRunner`, C/C++) and `SqlCodeRunnerController` (`api/SqlCodeRunner`). Consider whether `CCodeRunner` should also be generalized since it serves both C and C++ — optional, lower priority. ### Frontend (`spikersoft-angular`) — all consumers of `/CSharpCodeRunner` These three runner services hardcode the controller segment and must be updated to the new path: - `libraries/features/dev-tools-csharp-runner/src/lib/csharp-runner.service.ts` (line ~66: `apiUrl = \`${environment.apiUrl}/CSharpCodeRunner\``) - `libraries/features/dev-tools-javascript-runner/src/lib/javascript-runner.service.ts` (line ~33) - `libraries/features/dev-tools-python-runner/src/lib/python-runner.service.ts` (line ~41) Each uses `${apiUrl}/run` and `${apiUrl}/lesson`. For reference (NOT affected — they use their own controllers, listed so the rename isn't accidentally over-applied): - C / C++ runners go through `ClangRunnerService` with `apiController: "CCodeRunner"` (`dev-tools-c-runner`, `dev-tools-cpp-runner`). - SQL runner uses `/SqlCodeRunner` (`dev-tools-sql-runner`). - x86 and regex runners only hit `/Lessons` (no code-runner controller). ## Compatibility / rollout The controller route is a public API surface consumed by the deployed SPA. To avoid a hard breakage during deploy skew: - **Option A (preferred):** Add the new route while keeping `api/CSharpCodeRunner` as a deprecated alias for one release, ship the frontend pointed at the new route, then remove the alias in a follow-up. - **Option B:** Coordinate a simultaneous backend + frontend deploy and cut over directly. Pick one and note it on the PR. ## Acceptance criteria - [ ] Controller + class + tests renamed to a language-agnostic name. - [ ] All three frontend runner services updated to the new path. - [ ] No remaining references to `CSharpCodeRunner` except an intentional back-compat alias (if Option A). - [ ] C#, Python, and JavaScript playgrounds verified working for both free-play `run` and `lesson` submit after the change. - [ ] Sibling `CCodeRunner` / `SqlCodeRunner` controllers untouched (or generalization tracked separately). ## Severity Low (tech debt / maintainability) — but directly prevents a class of regressions like #280.
spikerj added the enhancement label 2026-06-28 21:22:34 +00:00
Author
Owner

Resolved — both halves merged to master:

  • Backend: spikersoft-backend PR #34 — renamed CSharpCodeRunnerControllerCodeRunnerController, canonical route api/CodeRunner with api/CSharpCodeRunner retained as a deprecated alias (Option A). Updated all backend references + docs.
  • Frontend: spikersoft-angular PR #83 — repointed the C#, JavaScript, and Python runner services to api/CodeRunner.

Sibling CCodeRunner / SqlCodeRunner controllers left untouched as intended. Follow-up #286 tracks removing the deprecated api/CSharpCodeRunner alias once the deprecation window passes. Closing.

Resolved — both halves merged to `master`: - Backend: spikersoft-backend PR #34 — renamed `CSharpCodeRunnerController` → `CodeRunnerController`, canonical route `api/CodeRunner` with `api/CSharpCodeRunner` retained as a deprecated alias (Option A). Updated all backend references + docs. - Frontend: spikersoft-angular PR #83 — repointed the C#, JavaScript, and Python runner services to `api/CodeRunner`. Sibling `CCodeRunner` / `SqlCodeRunner` controllers left untouched as intended. Follow-up #286 tracks removing the deprecated `api/CSharpCodeRunner` alias once the deprecation window passes. Closing.
Sign in to join this conversation.