evOo-local/packages/adapters/src/github-broker-integration.test.ts
cynarAI f14b112cdd
Broker GitHub Integrations token for computer git/gh (#203)
* Broker GitHub integration token for computer git/gh

Use the Integrations GitHub MCP secret for supervisor broker sessions
so home and project computers can clone private repos without PAT prompts.
Add rakazo git/gh shims, push policy, deploy image rebuild, and tests.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: retrigger product checks after runner timeout

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: run product change detection on GitHub-hosted runners

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* style: format deployment-github-token

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: self-hosted change detection with timeout and fail-open gate

Keep Detect product changes on evoo-ci with a 10-minute cap, continue-on-error
filtering, and a fail-open product flag when detection fails. Downstream jobs
and Product CI treat a failed or timed-out changes job as full product impact.
Add job timeouts on remaining self-hosted ci jobs.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix: continueRun tests and broker home path guard

- Skip broker workspace resolution when computer homeKey is absent
- Add shared continue-run Prisma/home/secretStore test stubs
- Update computer PATH expectation and evo-deploy command sequence
- Remove unused executor imports flagged by Biome

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* style: Biome format and import order for broker CI

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix: compose YAML, typecheck for broker stubs and GitHub hint

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: retrigger Product CI after compose and typecheck fixes

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: retry Product CI queue

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: give self-hosted Web E2E a 45m job timeout

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* ci: extend Web E2E job timeout to 60m on self-hosted runners

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* fix: keep github-broker-token off the core browser barrel

Export broker HMAC helpers only from @rakazo/core/node/github-broker-token so
Vite does not pull node:crypto into the web client and break Playwright signup.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
2026-10-11 22:58:48 +02:00

37 lines
1.4 KiB
TypeScript

import { evaluateGitShellPolicy } from "@rakazo/core";
import { describe, expect, it, vi } from "vitest";
import { githubIntegrationEnvironmentForRun } from "./deployment-github-token.js";
describe("home Chief GitHub broker integration", () => {
it("exposes broker env without raw GitHub tokens when integration is set", () => {
vi.stubEnv("SANDBOX_SUPERVISOR_TOKEN", "test-supervisor-token-test-32chars");
vi.stubEnv("SANDBOX_GITHUB_BROKER_URL", "http://supervisor:7091/internal/github-broker");
const env = githubIntegrationEnvironmentForRun({
runId: "run-home",
githubToken: "ghp_integration_only",
});
expect(env.GITHUB_TOKEN).toBeUndefined();
expect(env.GH_TOKEN).toBeUndefined();
expect(env.RAKAZO_GITHUB_BROKER_RUN_TOKEN).toMatch(/^rgb1\./);
vi.unstubAllEnvs();
});
it("refuses push to the default branch even when approval was granted", () => {
const decision = evaluateGitShellPolicy({
command: "git push origin main",
defaultBranch: "main",
gitPushApprovedThisRun: true,
});
expect(decision.action).toBe("block");
});
it("requires approval before the first push in a run", () => {
const decision = evaluateGitShellPolicy({
command: "git push origin feature/login",
defaultBranch: "main",
gitPushApprovedThisRun: false,
});
expect(decision.action).toBe("require_approval");
});
});