Skip to content

test(control-plane): cover run ingress, admin gate and deploy; add CI - #4

Open
nikolas-sapa wants to merge 1 commit into
mainfrom
fleet/next-milestone
Open

nikolas-sapa wants to merge 1 commit into
mainfrom
fleet/next-milestone

Conversation

@nikolas-sapa

Copy link
Copy Markdown
Owner

Summary

The control plane is Helm's core path (agent key auth -> monthly budget gate -> execution -> per-run ceiling -> metering/record, plus the admin-gated dashboard and deploy API), but it had zero tests and the repo had no CI.

  • Extract the Hono routes from apps/control-plane/src/server.ts into createApp(deps) in src/app.ts. server.ts now only loads env, builds the Convex client, and calls serve(). Route logic is moved verbatim; the only change is that runtime functions (runWithProvider, runBundle, providerFromEnv), the provisioner and the bundle-exec env are injectable, defaulting to the real implementations.
  • Add apps/control-plane/test/app.test.ts (25 tests) using app.request() with a fake Convex client: unknown agent 404, wrong/missing key 401, disabled 403, no policy 500, monthly cap 429 with zero-token budget_exceeded row and no execution, happy path metering + Convex env injection, input redaction, per-run ceiling, bundle refusal without HELM_TRUST_DEPLOYERS, docker mode fail-closed, trusted bundle execution, admin gate on all 5 admin routes (missing/wrong/agent-key tokens, no Convex calls), no keyHash/deploy key in responses, status validation, deploy provisioning failure (no agent registered), deploy hashes key and ignores body ownerId.
  • vitest.config.mts: new @helm/control-plane project. convex/_generated is gitignored, so the project aliases ../convex/_generated/api.js to a stub exporting anyApi (which is what the generated module is at runtime).
  • Add .github/workflows/ci.yml: npm ci, npm test, tsc --noEmit for packages/{core,agent,runtime,cli} on push to main and PRs. Control-plane typecheck is not in CI because it needs convex codegen against a deployment.

Security review: this touches tests around auth, the kill switch (disable) and budget gates. No behavior change intended, but please review that app.ts matches the old server.ts routes.

Observed, not changed (follow-up candidates): /a/:slug/run returns 403 "agent disabled" before verifying the key, so unauthenticated callers can learn an agent's status; isAdmin uses === rather than a constant-time compare.

Test plan

  • npm test: 14 files, 90 tests pass (65 before + 25 new)
  • Fail-check: patched app.ts so isAdmin returns true and the monthly-cap branch is skipped -> 7 tests went red; restored -> green
  • tsc --noEmit clean for all 4 packages and for apps/control-plane (with locally generated _generated)
  • Smoke: server.ts boots with a dummy CONVEX_URL; /health 200, / 200, /api/agents without token 401
  • CI workflow green on this PR
  • Not verified: end-to-end run against a real Convex deployment + Codex (no deploy performed)

Extract the Hono routes from server.ts into createApp(deps) so the
control plane's core path (key auth -> budget gate -> execution ->
metering) can be tested without a Convex deployment or LLM. server.ts
keeps env loading and serve() only; route behavior is unchanged.

Adds 25 control-plane tests and a GitHub Actions workflow running
npm test plus package typechecks.

Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@vercel

vercel Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
helm Ready Ready Preview Nov 23, 2026 5:56am UTC

This branch was successfully deployed

1 active deployment
Preview — 7b93847e Deployed Nov 23, 2026 by vercel[bot]
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.

1 participant