import assert from "node:assert/strict"; import test from "node:test"; import { readStructuredFile } from "./src/structured-config.mjs"; const PRODUCT_CAPABILITIES = Object.freeze({ HWLAB_KAFKA_DIRECT_PUBLISH_ENABLED: "true", HWLAB_WORKBENCH_LIVE_KAFKA_SSE_ENABLED: "true", HWLAB_KAFKA_TRANSACTIONAL_PROJECTOR_ENABLED: "false", HWLAB_KAFKA_PROJECTION_OUTBOX_RELAY_ENABLED: "false", HWLAB_WORKBENCH_PROJECTION_REALTIME_ENABLED: "false" }); const LIVE_KAFKA_CONTRACT = Object.freeze({ HWLAB_KAFKA_STDIO_TOPIC: "codex-stdio.raw.v1", HWLAB_KAFKA_AGENTRUN_EVENT_TOPIC: "agentrun.event.v1", HWLAB_KAFKA_EVENT_TOPIC: "hwlab.event.v1", HWLAB_KAFKA_AGENTRUN_EVENT_GROUP_ID: "hwlab-v03-agentrun-event-direct-publish", HWLAB_KAFKA_PROJECTOR_GROUP_ID: "hwlab-v03-agentrun-event-projector", HWLAB_KAFKA_HWLAB_EVENT_GROUP_ID: "hwlab-v03-workbench-live-sse" }); test("v03 YAML keeps pure Kafka realtime capabilities independently composable", async () => { const deploy = await readStructuredFile(process.cwd(), "deploy/deploy.yaml"); const cloudApi = deploy.lanes?.v03?.services?.find((service) => service.serviceId === "hwlab-cloud-api"); assert.ok(cloudApi, "deploy.lanes.v03.services must declare hwlab-cloud-api"); for (const [name, expected] of Object.entries(PRODUCT_CAPABILITIES)) { assert.equal(cloudApi.env?.[name], expected, `${name} must be explicitly YAML-owned`); } for (const [name, expected] of Object.entries(LIVE_KAFKA_CONTRACT)) { assert.equal(cloudApi.env?.[name], expected, `${name} must preserve the pure Kafka live contract`); } assert.equal(cloudApi.env?.HWLAB_SESSION_COOKIE_DOMAIN, undefined, "internal and public origins require host-scoped session cookies"); assert.notEqual(cloudApi.env?.HWLAB_KAFKA_AGENTRUN_EVENT_GROUP_ID, "hwlab-v03-agentrun-event-bridge"); });