Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Jan 5, 2026

Summary by cubic

Use Bun for the MCP mock test server to simplify setup and execution. The server now uses a cross-platform Bun shebang, tests launch it directly, and install steps are removed.

  • Migration
    • Run the server with: ./tests/mocks/serve.ts [port] or bun run tests/mocks/serve.ts [port].
    • Requires Bun in PATH; dependencies install automatically.

Written for commit 7ad3f54. Summary will update on new commits.

Copilot AI review requested due to automatic review settings January 5, 2026 17:50
@ryoppippi ryoppippi changed the title test: use bun for mcp server test: use bun for mcp server mock Jan 5, 2026
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 migrates the MCP mock server from using pnpm to bun as the runtime and package manager. The change simplifies the development environment setup by removing the shellHook dependency installation logic and leveraging bun's capabilities.

Key changes:

  • Added shebang and direct execution usage example to tests/mocks/serve.ts
  • Removed pnpm installation logic from the Nix flake shellHook (dependency installation now handled at runtime in conftest.py)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/mocks/serve.ts Added shebang for direct script execution and updated documentation with new usage examples
flake.nix Removed automatic pnpm dependency installation from shellHook, relying on runtime installation via conftest.py instead

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,8 +1,11 @@
#!/usr/bin/env bun run
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shebang is incorrect. The env command doesn't support passing arguments like this - it will look for a binary called "bun run" instead of executing "bun" with "run" as an argument. The correct shebang should be #!/usr/bin/env bun since bun can execute TypeScript files directly without needing the "run" subcommand in the shebang.

Suggested change
#!/usr/bin/env bun run
#!/usr/bin/env bun

Copilot uses AI. Check for mistakes.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="tests/mocks/serve.ts">

<violation number="1" location="tests/mocks/serve.ts:1">
P2: The shebang `#!/usr/bin/env bun run` is non-portable. POSIX `env` doesn&#39;t reliably handle multiple arguments, and `bun` can execute TypeScript files directly without the `run` subcommand. Use `#!/usr/bin/env bun` instead.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@@ -1,8 +1,11 @@
#!/usr/bin/env bun run
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The shebang #!/usr/bin/env bun run is non-portable. POSIX env doesn't reliably handle multiple arguments, and bun can execute TypeScript files directly without the run subcommand. Use #!/usr/bin/env bun instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At tests/mocks/serve.ts, line 1:

<comment>The shebang `#!/usr/bin/env bun run` is non-portable. POSIX `env` doesn&#39;t reliably handle multiple arguments, and `bun` can execute TypeScript files directly without the `run` subcommand. Use `#!/usr/bin/env bun` instead.</comment>

<file context>
@@ -1,8 +1,11 @@
+#!/usr/bin/env bun run
 /**
  * Standalone HTTP server for MCP mock testing.
</file context>
Suggested change
#!/usr/bin/env bun run
#!/usr/bin/env bun

✅ Addressed in a91681a

@ryoppippi ryoppippi closed this Jan 5, 2026
@ryoppippi ryoppippi reopened this Jan 5, 2026
The shebang `#!/usr/bin/env bun run` works on macOS but fails on Linux
because the `env` command doesn't split space-separated arguments by
default. Using `#!/usr/bin/env -S bun run` makes env parse the string
as multiple arguments, enabling cross-platform compatibility.

Fixes CI failures where the mock server couldn't start due to:
  /usr/bin/env: 'bun run': No such file or directory
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.

2 participants