Skip to content

Arch: stub runtimes in production source tree #1478

Description

@nick-pape

Category: Code Smell / Architectural Issue

Problem

StubRuntime (583 lines) and StubMcpRuntime live in packages/powerline/src/runtimes/, registered alongside production runtimes in main():

registerRuntime(new StubRuntime());       // Test double
registerRuntime(new StubMcpRuntime());    // Test double
registerRuntime(new GenAIScriptRuntime()); // Real runtime
registerRuntime(new ClaudeCodeRuntime());  // Real runtime

Consequences:

  • A client requesting provider: "stub" gets a test harness, not an error
  • Stub MCP integration logic is tangled with scenario-execution logic
  • 583 lines of test doubles ship in the production bundle
  • Test runtimes are indistinguishable from production runtimes to PowerLine's handlers

Proposed Fix

  1. Move to packages/powerline/test-fixtures/ or a separate @grackle-ai/runtime-stub package
  2. Make registration conditional:
    if (process.env.GRACKLE_ENABLE_TEST_RUNTIMES) {
      registerRuntime(new StubRuntime());
    }
  3. Document that stub is for testing only

Impact

Low — works fine today, but test code in prod is a maintenance and security smell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    powerline@grackle/powerlinerefactorCode improvement, no behavior change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions