fix: remove legacy simulator runtime defaults
This commit is contained in:
@@ -62,12 +62,8 @@ const servicePorts = new Map([
|
||||
["hwlab-cloud-web", 8080],
|
||||
["hwlab-agent-mgr", 7410],
|
||||
["hwlab-agent-worker", 7411],
|
||||
["hwlab-device-pod", 7601],
|
||||
["hwlab-gateway", 7001],
|
||||
["hwlab-gateway-simu", 7101],
|
||||
["hwlab-box-simu", 7201],
|
||||
["hwlab-patch-panel", 7301],
|
||||
["hwlab-router", 7401],
|
||||
["hwlab-tunnel-client", 7402],
|
||||
["hwlab-edge-proxy", 6667],
|
||||
["hwlab-cli", 7420],
|
||||
["hwlab-agent-skills", 7430]
|
||||
|
||||
@@ -81,6 +81,6 @@ test("deploy contract check does not require python3 tomllib", async () => {
|
||||
const plan = JSON.parse(result.stdout);
|
||||
|
||||
assert.equal(plan.status, "pass");
|
||||
assert.equal(plan.summary.frpProxies, 3);
|
||||
assert.equal(plan.summary.frpProxies, 2);
|
||||
assert.deepEqual(plan.diagnostics, []);
|
||||
});
|
||||
|
||||
@@ -34,11 +34,6 @@ const defaultServiceIds = Object.freeze([
|
||||
"hwlab-agent-worker",
|
||||
"hwlab-device-pod",
|
||||
"hwlab-gateway",
|
||||
"hwlab-gateway-simu",
|
||||
"hwlab-box-simu",
|
||||
"hwlab-patch-panel",
|
||||
"hwlab-router",
|
||||
"hwlab-tunnel-client",
|
||||
"hwlab-edge-proxy",
|
||||
"hwlab-cli",
|
||||
"hwlab-agent-skills"
|
||||
@@ -688,10 +683,6 @@ function transformWorkloads({ workloads, deploy, catalog, source, registryPrefix
|
||||
});
|
||||
}
|
||||
}
|
||||
if (serviceIdForWorkload(item, null) === "hwlab-tunnel-client" && typeof item.spec?.replicas === "number") {
|
||||
item.spec.replicas = 0;
|
||||
}
|
||||
|
||||
const podTemplate = item?.spec?.template;
|
||||
if (!podTemplate?.spec?.containers) continue;
|
||||
const templateServiceId = serviceIdForWorkload(item, podTemplate.spec.containers[0]);
|
||||
@@ -771,12 +762,6 @@ function transformWorkloads({ workloads, deploy, catalog, source, registryPrefix
|
||||
if (serviceId === "hwlab-cli") {
|
||||
upsertEnv(container.env, "HWLAB_CLI_ENDPOINT", runtimeEndpoint);
|
||||
}
|
||||
if (serviceId === "hwlab-tunnel-client") {
|
||||
upsertEnv(container.env, "HWLAB_TUNNEL_MODE", "disabled-g14-gitops");
|
||||
upsertEnv(container.env, "HWLAB_FRP_SERVER_ADDR", "");
|
||||
upsertEnv(container.env, "HWLAB_FRP_PUBLIC_PORT", "0");
|
||||
upsertEnv(container.env, "HWLAB_FRP_WEB_PUBLIC_PORT", "0");
|
||||
}
|
||||
}
|
||||
rewritePodSecretRefs(podTemplate.spec, profile);
|
||||
}
|
||||
|
||||
@@ -71,9 +71,7 @@ export const checkProfiles = Object.freeze({
|
||||
{ id: "check-046-cloud-api-run-bun", group: "cloud-api", command: ["node","scripts/run-bun.mjs","build","cmd/hwlab-cloud-api/provision.ts","--target=bun","--packages=external","--outdir=/tmp/hwlab-ts-check"] },
|
||||
{ id: "check-047-cloud-api-run-bun", group: "cloud-api", command: ["node","scripts/run-bun.mjs","build","cmd/hwlab-cloud-api/migrate.ts","--target=bun","--packages=external","--outdir=/tmp/hwlab-ts-check"] },
|
||||
{ id: "check-048-runtime-services-run-bun", group: "runtime-services", command: ["node","scripts/run-bun.mjs","test","cmd/hwlab-edge-proxy/main.test.ts","cmd/hwlab-device-pod/main.test.ts","cmd/hwlab-agent-mgr/main.test.ts","cmd/hwlab-agent-worker/main.test.ts","cmd/hwlab-codex-api-responses-forwarder/main.test.ts","cmd/hwlab-deepseek-responses-bridge/main.test.ts"] },
|
||||
{ id: "check-055-repo-main", group: "repo", command: ["node","--check","cmd/hwlab-box-simu/main.mjs"] },
|
||||
{ id: "check-056-repo-main", group: "repo", command: ["node","--check","cmd/hwlab-gateway/main.mjs"] },
|
||||
{ id: "check-057-repo-main", group: "repo", command: ["node","--check","cmd/hwlab-gateway-simu/main.mjs"] },
|
||||
{ id: "check-058-tools-hwlab-gateway-shell", group: "tools", command: ["node","--check","tools/hwlab-gateway-shell.mjs"] },
|
||||
{ id: "check-059-tools-hwlab-gateway-tran", group: "tools", command: ["node","--check","tools/hwlab-gateway-tran.mjs"] },
|
||||
{ id: "check-060-tools-tran", group: "tools", command: ["node","--check","tools/tran.mjs"] },
|
||||
@@ -105,8 +103,6 @@ export const checkProfiles = Object.freeze({
|
||||
{ id: "check-084-smoke-rpt004-mvp-e2e-harness", group: "smoke", command: ["node","--check","scripts/rpt004-mvp-e2e-harness.mjs"] },
|
||||
{ id: "check-085-smoke-run-bun", group: "smoke", command: ["node","scripts/run-bun.mjs","build","scripts/src/rpt004-mvp-e2e-harness.mjs","--target=bun","--packages=external","--outdir=/tmp/hwlab-ts-check"] },
|
||||
{ id: "check-086-smoke-rpt004-mvp-e2e-harness-test", group: "smoke", command: ["node","--check","scripts/src/rpt004-mvp-e2e-harness.test.mjs"] },
|
||||
{ id: "check-087-smoke-validate-dev-m3-cardinality", group: "smoke", command: ["node","--check","scripts/validate-dev-m3-cardinality.mjs"] },
|
||||
{ id: "check-088-smoke-validate-dev-m3-cardinality-test", group: "smoke", command: ["node","--check","scripts/validate-dev-m3-cardinality.test.mjs"] },
|
||||
{ id: "check-089-deploy-validate-artifact-catalog", group: "deploy", command: ["node","--check","scripts/validate-artifact-catalog.mjs"] },
|
||||
{ id: "check-090-deploy-refresh-artifact-catalog", group: "deploy", command: ["node","--check","scripts/refresh-artifact-catalog.mjs"] },
|
||||
{ id: "check-091-deploy-refresh-artifact-catalog-test", group: "deploy", command: ["node","--check","scripts/refresh-artifact-catalog.test.mjs"] },
|
||||
@@ -138,7 +134,6 @@ export const checkProfiles = Object.freeze({
|
||||
{ id: "check-116-dev-runtime-dev-runtime-hotfix-audit-test", group: "dev-runtime", command: ["node","--check","scripts/src/dev-runtime-hotfix-audit.test.mjs"] },
|
||||
{ id: "check-117-dev-runtime-dev-runtime-hotfix-audit-test", group: "dev-runtime", command: ["node","--test","scripts/src/dev-runtime-hotfix-audit.test.mjs"] },
|
||||
{ id: "check-118-smoke-l2-runtime-contract-smoke", group: "smoke", command: ["node","--check","scripts/l2-runtime-contract-smoke.mjs"] },
|
||||
{ id: "check-119-smoke-patch-panel-runtime-smoke", group: "smoke", command: ["node","--check","scripts/patch-panel-runtime-smoke.mjs"] },
|
||||
{ id: "check-120-smoke-l6-cli-web-smoke", group: "smoke", command: ["node","--check","scripts/l6-cli-web-smoke.mjs"] },
|
||||
{ id: "check-121-tools-hwlab-agent-runtime-cli", group: "tools", command: ["node","--check","skills/hwlab-agent-runtime/scripts/hwlab-agent-runtime-cli.mjs"] },
|
||||
{ id: "check-122-smoke-m3-io-skill-client", group: "smoke", command: ["node","--check","skills/hwlab-agent-runtime/scripts/src/m3-io-skill-client.mjs"] },
|
||||
@@ -149,7 +144,6 @@ export const checkProfiles = Object.freeze({
|
||||
{ id: "check-127-repo-run-bun", group: "repo", command: ["node","scripts/run-bun.mjs","scripts/validate-contract.mjs"] },
|
||||
{ id: "check-128-dev-runtime-validate-dev-gate-report", group: "dev-runtime", command: ["node","scripts/validate-dev-gate-report.mjs"] },
|
||||
{ id: "check-129-repo-report-lifecycle-test", group: "repo", command: ["node","scripts/report-lifecycle.test.mjs"] },
|
||||
{ id: "check-130-smoke-validate-dev-m3-cardinality", group: "smoke", command: ["node","scripts/validate-dev-m3-cardinality.mjs"] },
|
||||
{ id: "check-131-deploy-validate-artifact-catalog", group: "deploy", command: ["node","scripts/validate-artifact-catalog.mjs"] },
|
||||
{ id: "check-132-deploy-run-bun", group: "deploy", command: ["node","scripts/run-bun.mjs","scripts/deploy-desired-state-plan.mjs","--check"] },
|
||||
{ id: "check-133-dev-runtime-run-bun", group: "dev-runtime", command: ["node","scripts/run-bun.mjs","scripts/dev-runtime-provisioning.mjs","--check"] },
|
||||
|
||||
@@ -6,17 +6,13 @@ import {
|
||||
DEV_CODE_AGENT_PROVIDER_CONTRACT,
|
||||
codeAgentSecretRefPlaceholder
|
||||
} from "../../internal/cloud/code-agent-contract.ts";
|
||||
import {
|
||||
HWLAB_M3_IO_API_BASE_URL_ENV,
|
||||
HWLAB_M3_IO_DEV_SERVICE_BASE_URL
|
||||
} from "../../skills/hwlab-agent-runtime/scripts/src/m3-io-skill-client.mjs";
|
||||
import { HWLAB_M3_IO_API_BASE_URL_ENV } from "../../skills/hwlab-agent-runtime/scripts/src/m3-io-skill-client.mjs";
|
||||
|
||||
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const expectedPorts = Object.freeze({ frontend: 16666, api: 16667 });
|
||||
const codeAgentBackendTimeoutMs = "1200000";
|
||||
const codeAgentTransportTimeoutMs = "1260000";
|
||||
const legacyPublicPorts = new Set([6666, 6667]);
|
||||
const duplicateMappingAllowed = new Set(["hwlab-box-simu", "hwlab-gateway-simu"]);
|
||||
const tomlBareKeyPattern = /^[A-Za-z0-9_-]+$/u;
|
||||
|
||||
function parseArgs(argv) {
|
||||
@@ -226,19 +222,14 @@ function validateSource(ctx, manifest) {
|
||||
expectEqual(ctx, manifest.profiles?.dev?.endpoint, endpoints.api?.url, "$.profiles.dev.endpoint", "DEV profile endpoint");
|
||||
|
||||
const cloudApi = servicesById.get("hwlab-cloud-api");
|
||||
const tunnelClient = servicesById.get("hwlab-tunnel-client");
|
||||
const cli = servicesById.get("hwlab-cli");
|
||||
const patchPanel = servicesById.get("hwlab-patch-panel");
|
||||
const cloudWeb = servicesById.get("hwlab-cloud-web");
|
||||
const edgeProxy = servicesById.get("hwlab-edge-proxy");
|
||||
expectEqual(ctx, cloudApi?.env?.HWLAB_PUBLIC_ENDPOINT, endpoints.api?.url, "$.services.hwlab-cloud-api.env.HWLAB_PUBLIC_ENDPOINT", "cloud API public endpoint env");
|
||||
validateCloudApiDbSource(ctx, cloudApi?.env ?? {});
|
||||
validateCloudApiCodeAgentSource(ctx, cloudApi?.env ?? {});
|
||||
validateCodeAgentProxyTimeoutSource(ctx, { cloudApi, cloudWeb, edgeProxy });
|
||||
validateM3PatchPanelSource(ctx, patchPanel);
|
||||
expectEqual(ctx, cli?.env?.HWLAB_CLI_ENDPOINT, endpoints.api?.url, "$.services.hwlab-cli.env.HWLAB_CLI_ENDPOINT", "CLI endpoint env");
|
||||
expectEqual(ctx, tunnelClient?.env?.HWLAB_FRP_PUBLIC_PORT, String(expectedPorts.api), "$.services.hwlab-tunnel-client.env.HWLAB_FRP_PUBLIC_PORT", "tunnel API public port env");
|
||||
expectEqual(ctx, tunnelClient?.env?.HWLAB_FRP_WEB_PUBLIC_PORT, String(expectedPorts.frontend), "$.services.hwlab-tunnel-client.env.HWLAB_FRP_WEB_PUBLIC_PORT", "tunnel frontend public port env");
|
||||
|
||||
const proxies = manifest.frp?.proxies ?? [];
|
||||
const proxyNames = new Set();
|
||||
@@ -265,7 +256,7 @@ function validateSource(ctx, manifest) {
|
||||
mappingNames.add(mapping.name);
|
||||
expect(
|
||||
ctx,
|
||||
!mappingIds.has(mapping.serviceId) || duplicateMappingAllowed.has(mapping.serviceId),
|
||||
!mappingIds.has(mapping.serviceId),
|
||||
"duplicate_source",
|
||||
`${basePath}.serviceId`,
|
||||
`duplicate k3s mapping ${mapping.serviceId}`
|
||||
@@ -278,78 +269,6 @@ function validateSource(ctx, manifest) {
|
||||
return { manifest, endpoints, servicesById, proxies, serviceMappings, healthPath: manifest.health?.path };
|
||||
}
|
||||
|
||||
function requiredM3Route() {
|
||||
return {
|
||||
fromResourceId: "res_boxsimu_1",
|
||||
fromPort: "DO1",
|
||||
patchPanelServiceId: "hwlab-patch-panel",
|
||||
toResourceId: "res_boxsimu_2",
|
||||
toPort: "DI1"
|
||||
};
|
||||
}
|
||||
|
||||
function parseJsonEnv(ctx, value, jsonPath, label) {
|
||||
try {
|
||||
return JSON.parse(String(value ?? ""));
|
||||
} catch (error) {
|
||||
addDiagnostic(ctx, "invalid_json", jsonPath, `${label} must be JSON`, {
|
||||
actual: error instanceof Error ? error.message : String(error)
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function validateM3PatchPanelSource(ctx, patchPanel) {
|
||||
const route = requiredM3Route();
|
||||
expectEqual(ctx, patchPanel?.m3Route?.fromResourceId, route.fromResourceId, "$.services.hwlab-patch-panel.m3Route.fromResourceId", "patch panel first-class M3 source resource");
|
||||
expectEqual(ctx, patchPanel?.m3Route?.fromPort, route.fromPort, "$.services.hwlab-patch-panel.m3Route.fromPort", "patch panel first-class M3 source port");
|
||||
expectEqual(ctx, patchPanel?.m3Route?.patchPanelServiceId, route.patchPanelServiceId, "$.services.hwlab-patch-panel.m3Route.patchPanelServiceId", "patch panel first-class M3 route owner");
|
||||
expectEqual(ctx, patchPanel?.m3Route?.toResourceId, route.toResourceId, "$.services.hwlab-patch-panel.m3Route.toResourceId", "patch panel first-class M3 target resource");
|
||||
expectEqual(ctx, patchPanel?.m3Route?.toPort, route.toPort, "$.services.hwlab-patch-panel.m3Route.toPort", "patch panel first-class M3 target port");
|
||||
|
||||
const endpointMap = parseJsonEnv(
|
||||
ctx,
|
||||
patchPanel?.env?.HWLAB_PATCH_PANEL_ENDPOINT_MAP,
|
||||
"$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_ENDPOINT_MAP",
|
||||
"patch panel endpoint map"
|
||||
);
|
||||
expectEqual(
|
||||
ctx,
|
||||
endpointMap?.res_boxsimu_2,
|
||||
"http://hwlab-box-simu-2.hwlab-dev.svc.cluster.local:7201",
|
||||
"$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_ENDPOINT_MAP.res_boxsimu_2",
|
||||
"patch panel M3 target endpoint"
|
||||
);
|
||||
|
||||
const wiring = parseJsonEnv(
|
||||
ctx,
|
||||
patchPanel?.env?.HWLAB_PATCH_PANEL_WIRING_CONFIG,
|
||||
"$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG",
|
||||
"patch panel wiring config"
|
||||
);
|
||||
const connection = wiring?.connections?.[0];
|
||||
expectEqual(ctx, wiring?.status, "active", "$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.status", "patch panel M3 wiring status");
|
||||
expectEqual(
|
||||
ctx,
|
||||
wiring?.constraints?.propagation,
|
||||
"patch-panel-only",
|
||||
"$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.constraints.propagation",
|
||||
"patch panel M3 wiring propagation"
|
||||
);
|
||||
expectEqual(
|
||||
ctx,
|
||||
wiring?.constraints?.localLoopbackSubstituteAllowed,
|
||||
false,
|
||||
"$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.constraints.localLoopbackSubstituteAllowed",
|
||||
"patch panel M3 wiring forbids loopback substitute"
|
||||
);
|
||||
expectEqual(ctx, connection?.from?.resourceId, route.fromResourceId, "$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.connections[0].from.resourceId", "patch panel M3 source resource");
|
||||
expectEqual(ctx, connection?.from?.port, route.fromPort, "$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.connections[0].from.port", "patch panel M3 source port");
|
||||
expectEqual(ctx, connection?.to?.resourceId, route.toResourceId, "$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.connections[0].to.resourceId", "patch panel M3 target resource");
|
||||
expectEqual(ctx, connection?.to?.port, route.toPort, "$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.connections[0].to.port", "patch panel M3 target port");
|
||||
expectEqual(ctx, connection?.mode, "exclusive", "$.services.hwlab-patch-panel.env.HWLAB_PATCH_PANEL_WIRING_CONFIG.connections[0].mode", "patch panel M3 route mode");
|
||||
}
|
||||
|
||||
function validateCloudApiDbSource(ctx, env) {
|
||||
const alias = DEV_DB_ENV_CONTRACT.dns;
|
||||
expectEqual(ctx, env.HWLAB_CLOUD_DB_URL, "secretRef:hwlab-cloud-api-dev-db/database-url", "$.services.hwlab-cloud-api.env.HWLAB_CLOUD_DB_URL", "cloud API DB URL Secret reference");
|
||||
@@ -397,9 +316,9 @@ function validateCloudApiCodeAgentSource(ctx, env) {
|
||||
expectEqual(
|
||||
ctx,
|
||||
env[HWLAB_M3_IO_API_BASE_URL_ENV],
|
||||
HWLAB_M3_IO_DEV_SERVICE_BASE_URL,
|
||||
undefined,
|
||||
`$.services.hwlab-cloud-api.env.${HWLAB_M3_IO_API_BASE_URL_ENV}`,
|
||||
"cloud API Code Agent Skill CLI HWLAB API service-local base URL"
|
||||
"legacy M3 Skill CLI HWLAB API base URL is removed from default cloud-api config"
|
||||
);
|
||||
expectEqual(ctx, env.HWLAB_CODE_AGENT_CODEX_STDIO_ENABLED, "1", "$.services.hwlab-cloud-api.env.HWLAB_CODE_AGENT_CODEX_STDIO_ENABLED", "cloud API Codex stdio adapter enabled flag");
|
||||
expectEqual(ctx, env.HWLAB_CODE_AGENT_CODEX_STDIO_SUPERVISOR, "repo-owned", "$.services.hwlab-cloud-api.env.HWLAB_CODE_AGENT_CODEX_STDIO_SUPERVISOR", "cloud API Codex stdio supervisor mode");
|
||||
@@ -548,6 +467,8 @@ function validateK3sArtifacts(ctx, source, rendered, services, workloads, health
|
||||
expectEqual(ctx, masterEdge.endpoint, source.endpoints.api?.url, "deploy/master-edge/health-contract.json.endpoint", "master edge endpoint");
|
||||
flagLegacyPublicPort(ctx, "deploy/master-edge/health-contract.json.reverseLink.publicPort", masterEdge.reverseLink?.publicPort, expectedPorts.api, "master edge API");
|
||||
flagLegacyPublicPort(ctx, "deploy/master-edge/health-contract.json.reverseLink.webPublicPort", masterEdge.reverseLink?.webPublicPort, expectedPorts.frontend, "master edge frontend");
|
||||
expectEqual(ctx, masterEdge.reverseLink?.direction, "edge-proxy-only", "deploy/master-edge/health-contract.json.reverseLink.direction", "master edge reverse link no longer models a tunnel-client service");
|
||||
expectEqual(ctx, masterEdge.reverseLink?.client, undefined, "deploy/master-edge/health-contract.json.reverseLink.client", "master edge reverse link does not name removed tunnel-client");
|
||||
expectEqual(ctx, masterEdge.prodAcceptance, false, "deploy/master-edge/health-contract.json.prodAcceptance", "master edge PROD acceptance");
|
||||
}
|
||||
|
||||
@@ -606,9 +527,9 @@ function validateCloudApiCodeAgentArtifacts(ctx, workloads) {
|
||||
expectEqual(
|
||||
ctx,
|
||||
env.get(HWLAB_M3_IO_API_BASE_URL_ENV)?.value,
|
||||
HWLAB_M3_IO_DEV_SERVICE_BASE_URL,
|
||||
undefined,
|
||||
`deploy/k8s/base/workloads.yaml.hwlab-cloud-api.env.${HWLAB_M3_IO_API_BASE_URL_ENV}`,
|
||||
"cloud API workload Code Agent Skill CLI HWLAB API service-local base URL"
|
||||
"legacy M3 Skill CLI HWLAB API base URL is removed from default cloud-api workload"
|
||||
);
|
||||
expectEqual(ctx, env.get("HWLAB_CODE_AGENT_CODEX_STDIO_ENABLED")?.value, "1", "deploy/k8s/base/workloads.yaml.hwlab-cloud-api.env.HWLAB_CODE_AGENT_CODEX_STDIO_ENABLED", "cloud API workload Codex stdio adapter enabled flag");
|
||||
expectEqual(ctx, env.get("HWLAB_CODE_AGENT_CODEX_STDIO_SUPERVISOR")?.value, "repo-owned", "deploy/k8s/base/workloads.yaml.hwlab-cloud-api.env.HWLAB_CODE_AGENT_CODEX_STDIO_SUPERVISOR", "cloud API workload Codex stdio supervisor mode");
|
||||
|
||||
@@ -54,11 +54,6 @@ const serviceSpecificPaths = Object.freeze({
|
||||
"hwlab-agent-worker": ["cmd/hwlab-agent-worker/", "internal/agent/", "internal/db/", "internal/audit/", "skills/"],
|
||||
"hwlab-device-pod": ["cmd/hwlab-device-pod/", "internal/device-pod/"],
|
||||
"hwlab-gateway": ["cmd/hwlab-gateway/"],
|
||||
"hwlab-gateway-simu": ["cmd/hwlab-gateway-simu/", "internal/sim/"],
|
||||
"hwlab-box-simu": ["cmd/hwlab-box-simu/", "internal/sim/"],
|
||||
"hwlab-patch-panel": ["cmd/hwlab-patch-panel/", "internal/patchpanel/"],
|
||||
"hwlab-router": ["cmd/hwlab-router/"],
|
||||
"hwlab-tunnel-client": ["cmd/hwlab-tunnel-client/"],
|
||||
"hwlab-edge-proxy": ["cmd/hwlab-edge-proxy/", "internal/dev-entrypoint/"],
|
||||
"hwlab-cli": ["tools/hwlab-cli/"],
|
||||
"hwlab-agent-skills": ["skills/"]
|
||||
|
||||
@@ -11,10 +11,7 @@ import {
|
||||
DEV_CODE_AGENT_PROVIDER_CONTRACT,
|
||||
codeAgentSecretRefPlaceholder
|
||||
} from "../internal/cloud/code-agent-contract.ts";
|
||||
import {
|
||||
HWLAB_M3_IO_API_BASE_URL_ENV,
|
||||
HWLAB_M3_IO_DEV_SERVICE_BASE_URL
|
||||
} from "../skills/hwlab-agent-runtime/scripts/src/m3-io-skill-client.mjs";
|
||||
import { HWLAB_M3_IO_API_BASE_URL_ENV } from "../skills/hwlab-agent-runtime/scripts/src/m3-io-skill-client.mjs";
|
||||
import {
|
||||
ENVIRONMENT_DEV,
|
||||
SERVICE_IDS,
|
||||
@@ -170,9 +167,13 @@ const deployServicesById = new Map(deployManifest.services.map((service) => [ser
|
||||
assert.equal(deployServicesById.has("hwlab-agent-mgr"), true);
|
||||
assert.equal(deployServicesById.has("hwlab-agent-worker"), true);
|
||||
assert.equal(deployServicesById.has("hwlab-agent-skills"), true);
|
||||
for (const removedServiceId of ["hwlab-gateway-simu", "hwlab-box-simu", "hwlab-patch-panel", "hwlab-router", "hwlab-tunnel-client"]) {
|
||||
assert.equal(deployServicesById.has(removedServiceId), false, `${removedServiceId} is removed from default deploy services`);
|
||||
assert.equal(getWorkload(k8sWorkloads, removedServiceId), null, `${removedServiceId} is removed from default workload manifests`);
|
||||
assert.equal(listItems(k8sServices).some((item) => item?.metadata?.labels?.["hwlab.pikastech.local/service-id"] === removedServiceId), false, `${removedServiceId} is removed from default service manifests`);
|
||||
}
|
||||
|
||||
const cloudApi = deployServicesById.get("hwlab-cloud-api");
|
||||
const patchPanel = deployServicesById.get("hwlab-patch-panel");
|
||||
const cloudApiWorkload = getWorkload(k8sWorkloads, "hwlab-cloud-api");
|
||||
const cloudApiContainer = cloudApiWorkload?.spec?.template?.spec?.containers?.find((entry) => entry.name === "hwlab-cloud-api");
|
||||
const cloudApiWorkloadEnv = getWorkloadEnv(k8sWorkloads, "hwlab-cloud-api");
|
||||
@@ -182,7 +183,6 @@ cloudApiWorkloadEnv.__podContainers = cloudApiWorkload?.spec?.template?.spec?.co
|
||||
cloudApiWorkloadEnv.__initContainers = cloudApiWorkload?.spec?.template?.spec?.initContainers ?? [];
|
||||
cloudApiWorkloadEnv.__deploymentStrategy = cloudApiWorkload?.spec?.strategy ?? null;
|
||||
cloudApiWorkloadEnv.__workspacePvc = getWorkload(k8sWorkloads, DEV_CODE_AGENT_PROVIDER_CONTRACT.workspace.claimName);
|
||||
const patchPanelWorkloadEnv = getWorkloadEnv(k8sWorkloads, "hwlab-patch-panel");
|
||||
assert.equal(deployManifest.health.path, "/health/live", "deploy health source path");
|
||||
assert.equal(deployManifest.publicEndpoints.frontend.url, "http://74.48.78.17:16666", "deploy frontend endpoint");
|
||||
assert.equal(deployManifest.publicEndpoints.api.url, "http://74.48.78.17:16667", "deploy api endpoint");
|
||||
@@ -203,6 +203,10 @@ assert.equal(
|
||||
assert.equal(cloudApi.env.HWLAB_CLOUD_DB_CONTRACT, "dev-redacted-presence-only", "cloud-api DB contract marker");
|
||||
assert.equal(cloudApi.env.HWLAB_CLOUD_RUNTIME_ADAPTER, "postgres", "cloud-api runtime durable adapter");
|
||||
assert.equal(cloudApi.env.HWLAB_CLOUD_RUNTIME_DURABLE, "true", "cloud-api runtime durable flag");
|
||||
assert.equal(cloudApi.env.HWLAB_M3_IO_CONTROL_ENABLED, "false", "legacy M3 IO control is disabled in default deploy config");
|
||||
assert.equal(cloudApi.env.HWLAB_M3_GATEWAY_SIMU_1_URL, undefined, "legacy gateway simulator URL is removed from default deploy config");
|
||||
assert.equal(cloudApi.env.HWLAB_M3_GATEWAY_SIMU_2_URL, undefined, "legacy gateway simulator URL is removed from default deploy config");
|
||||
assert.equal(cloudApi.env.HWLAB_M3_PATCH_PANEL_URL, undefined, "legacy patch-panel URL is removed from default deploy config");
|
||||
assert.equal(
|
||||
cloudApiWorkloadEnv.HWLAB_CLOUD_DB_SSL_MODE?.value,
|
||||
DEV_DB_ENV_CONTRACT.nonSecretDefaults.HWLAB_CLOUD_DB_SSL_MODE,
|
||||
@@ -210,6 +214,10 @@ assert.equal(
|
||||
);
|
||||
assert.equal(cloudApiWorkloadEnv.HWLAB_CLOUD_RUNTIME_ADAPTER?.value, "postgres", "cloud-api workload runtime durable adapter");
|
||||
assert.equal(cloudApiWorkloadEnv.HWLAB_CLOUD_RUNTIME_DURABLE?.value, "true", "cloud-api workload runtime durable flag");
|
||||
assert.equal(cloudApiWorkloadEnv.HWLAB_M3_IO_CONTROL_ENABLED?.value, "false", "legacy M3 IO control is disabled in default workload config");
|
||||
assert.equal(cloudApiWorkloadEnv.HWLAB_M3_GATEWAY_SIMU_1_URL, undefined, "legacy gateway simulator URL is removed from default workload config");
|
||||
assert.equal(cloudApiWorkloadEnv.HWLAB_M3_GATEWAY_SIMU_2_URL, undefined, "legacy gateway simulator URL is removed from default workload config");
|
||||
assert.equal(cloudApiWorkloadEnv.HWLAB_M3_PATCH_PANEL_URL, undefined, "legacy patch-panel URL is removed from default workload config");
|
||||
assert.equal(cloudApi.env.HWLAB_CLOUD_DB_SERVICE_NAME, undefined, "cloud-api DB alias service name is optional");
|
||||
assert.equal(cloudApi.env.HWLAB_CLOUD_DB_SERVICE_NAMESPACE, undefined, "cloud-api DB alias namespace is optional");
|
||||
assert.equal(cloudApi.env.HWLAB_CLOUD_DB_HOST, undefined, "cloud-api DB alias host is optional");
|
||||
@@ -235,8 +243,8 @@ assert.equal(
|
||||
);
|
||||
assert.equal(
|
||||
cloudApi.env[HWLAB_M3_IO_API_BASE_URL_ENV],
|
||||
HWLAB_M3_IO_DEV_SERVICE_BASE_URL,
|
||||
"cloud-api Code Agent Skill CLI HWLAB API base URL must use service-local cloud-api DNS"
|
||||
undefined,
|
||||
"legacy M3 Skill CLI HWLAB API base URL is removed from default cloud-api config"
|
||||
);
|
||||
assert.equal(cloudApi.env.HWLAB_CODE_AGENT_CODEX_STDIO_ENABLED, "1", "cloud-api Codex stdio adapter enabled flag");
|
||||
assert.equal(cloudApi.env.HWLAB_CODE_AGENT_CODEX_STDIO_SUPERVISOR, "repo-owned", "cloud-api Codex stdio supervisor mode");
|
||||
@@ -254,7 +262,6 @@ assert.notEqual(
|
||||
);
|
||||
assert.equal(cloudApi.env.OPENAI_API_KEY, codeAgentSecretRefPlaceholder(), "cloud-api Code Agent OpenAI key must be a Secret reference placeholder");
|
||||
assertCodeAgentProviderWorkloadContract(cloudApiWorkloadEnv);
|
||||
assertM3PatchPanelDeployContract(patchPanel, patchPanelWorkloadEnv);
|
||||
assertDbForbiddenInvalidHostContract();
|
||||
assertValidationDoesNotExposeSecretValues(cloudApi.env, cloudApiWorkloadEnv);
|
||||
|
||||
@@ -314,8 +321,8 @@ function assertCodeAgentProviderWorkloadContract(env) {
|
||||
);
|
||||
assert.equal(
|
||||
env[HWLAB_M3_IO_API_BASE_URL_ENV]?.value,
|
||||
HWLAB_M3_IO_DEV_SERVICE_BASE_URL,
|
||||
"cloud-api workload Code Agent Skill CLI HWLAB API base URL must use service-local cloud-api DNS"
|
||||
undefined,
|
||||
"legacy M3 Skill CLI HWLAB API base URL is removed from default cloud-api workload"
|
||||
);
|
||||
assert.equal(env.HWLAB_CODE_AGENT_CODEX_STDIO_ENABLED?.value, "1", "cloud-api workload Codex stdio adapter enabled flag");
|
||||
assert.equal(env.HWLAB_CODE_AGENT_CODEX_STDIO_SUPERVISOR?.value, "repo-owned", "cloud-api workload Codex stdio supervisor mode");
|
||||
@@ -439,49 +446,6 @@ function assertCodeAgentWorkspaceContract(env, contract) {
|
||||
assert.equal(env.__deploymentStrategy?.type, workspace.rolloutStrategy, "cloud-api uses Recreate rollout for single-writer workspace PVC");
|
||||
}
|
||||
|
||||
function assertM3PatchPanelDeployContract(manifestService, workloadEnv) {
|
||||
const route = {
|
||||
fromResourceId: "res_boxsimu_1",
|
||||
fromPort: "DO1",
|
||||
patchPanelServiceId: "hwlab-patch-panel",
|
||||
toResourceId: "res_boxsimu_2",
|
||||
toPort: "DI1"
|
||||
};
|
||||
assert.deepEqual(manifestService.m3Route, route, "patch-panel deploy manifest first-class M3 route");
|
||||
const manifestEndpointMap = JSON.parse(manifestService.env.HWLAB_PATCH_PANEL_ENDPOINT_MAP);
|
||||
const workloadEndpointMap = JSON.parse(workloadEnv.HWLAB_PATCH_PANEL_ENDPOINT_MAP?.value ?? "{}");
|
||||
assert.equal(
|
||||
manifestEndpointMap.res_boxsimu_2,
|
||||
"http://hwlab-box-simu-2.hwlab-dev.svc.cluster.local:7201",
|
||||
"patch-panel deploy manifest M3 endpoint"
|
||||
);
|
||||
assert.deepEqual(workloadEndpointMap, manifestEndpointMap, "patch-panel workload M3 endpoint map");
|
||||
|
||||
const manifestWiring = JSON.parse(manifestService.env.HWLAB_PATCH_PANEL_WIRING_CONFIG);
|
||||
const workloadWiring = JSON.parse(workloadEnv.HWLAB_PATCH_PANEL_WIRING_CONFIG?.value ?? "{}");
|
||||
assert.deepEqual(workloadWiring, manifestWiring, "patch-panel workload first-class M3 wiring config");
|
||||
assert.equal(manifestWiring.status, "active", "patch-panel M3 wiring status");
|
||||
assert.equal(manifestWiring.constraints.propagation, "patch-panel-only", "patch-panel M3 wiring propagation");
|
||||
assert.equal(
|
||||
manifestWiring.constraints.localLoopbackSubstituteAllowed,
|
||||
false,
|
||||
"patch-panel M3 wiring loopback substitute"
|
||||
);
|
||||
assert.deepEqual(manifestWiring.connections, [
|
||||
{
|
||||
from: {
|
||||
resourceId: route.fromResourceId,
|
||||
port: route.fromPort
|
||||
},
|
||||
to: {
|
||||
resourceId: route.toResourceId,
|
||||
port: route.toPort
|
||||
},
|
||||
mode: "exclusive"
|
||||
}
|
||||
], "patch-panel M3 wiring route");
|
||||
}
|
||||
|
||||
function assertDbForbiddenInvalidHostContract() {
|
||||
const invalidHost = parseDbUrlContract("postgres://user:password@hwlab-dev-db.invalid:5432/hwlab");
|
||||
assert.equal(invalidHost.ok, false, "DEV DB contract must reject .invalid runtime hosts");
|
||||
|
||||
Reference in New Issue
Block a user