Files
copilotkit__copilotkit/showcase/scripts/__tests__/redeploy-env.harness-worker-prod-scope.test.ts
Jordan Ritter e88d01a99f fix(showcase): backfill prod harness-workers into SSOT so image rebuilds bounce it
The prod `harness-workers` fleet worker (serviceId
c2aa8a0b-350e-4b76-8541-3012dfac41d0, instance
7c48ee43-6df4-457b-b977-10f1f1ac1680) runs the shared `showcase-harness`
image (`imageOf: "harness"`) but had NO `prod` env entry in the
railway-envs SSOT. `expandImageConsumers` is env-aware — a consumer only
joins an env's redeploy scope if it declares that env — so a rebuilt
`showcase-harness:latest` bounced the prod control-plane but SILENTLY
SKIPPED the prod worker, leaving it pinned to a stale 2026-06-19 image.

That stale worker image carries a 1-demo `registry.json` for
`ms-agent-harness-dotnet` (only `beautiful-chat`), so the hourly
`e2e_demos` driver running on it produced only 1 of 39 `e2e:` rows in
prod PocketBase. The other 38 feature rows were absent → `resolveD3`
exists=false → `UI` badge omitted → broken D3 rung → D0.

Backfill the live prod worker as a `prod` env entry (real
serviceInstance ID), flip `gateIgnore` off, and set `gateValidated:
true` so the env-aware `imageOf` expansion now pulls the prod worker
into the prod redeploy scope on every `showcase-harness` rebuild.
Regenerate the emitted JSON + golden fixture and update the two
gate-count assertions accordingly.
2026-06-25 22:46:32 -07:00

44 lines
2.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { expandImageConsumers } from "../redeploy-env";
import { SERVICES } from "../railway-envs";
// Regression: the prod `harness-workers` fleet worker runs the shared
// `showcase-harness` image (`imageOf: "harness"`) but had NO `prod` env entry
// in the SSOT. `expandImageConsumers` is env-aware — a consumer only joins an
// env's redeploy scope if it declares that env — so a rebuilt
// `showcase-harness:latest` bounced the prod control-plane but SILENTLY SKIPPED
// the prod worker, leaving it on a stale image (a 1-demo `registry.json` for
// `ms-agent-harness-dotnet` → missing `UI` badge → `D0`). This test exercises
// the REAL expansion against the REAL SSOT and asserts the prod worker enters
// the prod harness redeploy scope.
//
// Verified prod worker identity (Railway, READ-ONLY GraphQL):
// serviceId c2aa8a0b-350e-4b76-8541-3012dfac41d0
// prod env b14919f4-6417-429f-848d-c6ae2201e04f
// instanceId 7c48ee43-6df4-457b-b977-10f1f1ac1680
const PROD_WORKER_SERVICE_ID = "c2aa8a0b-350e-4b76-8541-3012dfac41d0";
describe("harness redeploy-scope expansion (imageOf: harness) — prod worker", () => {
it("includes harness-workers in the PROD redeploy scope when showcase-harness rebuilds", () => {
// The image-rebuild scope for `showcase-harness:latest` starts at its
// builder SSOT key, `harness`. The redeploy script expands this with
// env-aware imageOf consumers before redeploying.
const scope = expandImageConsumers(["harness"], "prod");
// The prod worker MUST be pulled in so a rebuild bounces it off its stale
// image. (RED before the SSOT backfill: the worker declares only `staging`,
// so the env filter at redeploy-env.ts:278 drops it from the prod scope.)
expect(scope).toContain("harness-workers");
// And it must resolve to the real prod worker service.
const worker = SERVICES["harness-workers"];
expect(worker.serviceId).toBe(PROD_WORKER_SERVICE_ID);
expect(Object.hasOwn(worker.environments, "prod")).toBe(true);
});
it("still includes harness-workers in the STAGING redeploy scope (no regression)", () => {
const scope = expandImageConsumers(["harness"], "staging");
expect(scope).toContain("harness-workers");
});
});