Add D518 HWLAB v0.3 target

This commit is contained in:
Codex
2026-06-27 11:13:28 +00:00
parent 52a93ed535
commit 04b196fdcf
3 changed files with 503 additions and 0 deletions
+26
View File
@@ -352,6 +352,7 @@ export const HWLAB_NODE_LANE_CONFIG_PATH = "config/hwlab-node-lanes.yaml";
interface HwlabLaneConfig {
readonly id: HwlabRuntimeLane;
readonly node: string;
readonly activeTarget?: string;
readonly minor: number;
readonly version: string;
readonly sourceBranch: string;
@@ -572,6 +573,7 @@ function laneConfig(id: HwlabRuntimeLane, raw: Record<string, unknown>): HwlabLa
return {
id,
node: stringField(raw, "node", `lanes.${id}`),
activeTarget: optionalStringField(raw, "activeTarget", `lanes.${id}`),
minor,
version,
sourceBranch: stringField(raw, "sourceBranch", `lanes.${id}`),
@@ -639,6 +641,7 @@ function laneTargetConfig(id: HwlabRuntimeLane, nodeId: string, baseRaw: Record<
observability: mergeOptionalRecord(baseRaw.observability, targetRaw.observability),
};
delete merged.targets;
delete merged.activeTarget;
return laneConfig(id, merged);
}
@@ -1160,6 +1163,16 @@ function readHwlabNodeLaneConfig(): HwlabNodeLaneConfig {
if (defaultLane === undefined || defaultLane.node !== defaultTarget.node) {
throw new Error(`${HWLAB_NODE_LANE_CONFIG_PATH}.defaults must reference a declared lane target`);
}
for (const lane of Object.values(lanes)) {
if (lane.activeTarget === undefined) continue;
if (nodes[lane.activeTarget] === undefined) {
throw new Error(`${HWLAB_NODE_LANE_CONFIG_PATH}.lanes.${lane.id}.activeTarget references missing node ${lane.activeTarget}`);
}
const target = laneTargets[lane.id]?.[lane.activeTarget];
if (target === undefined && lane.node !== lane.activeTarget) {
throw new Error(`${HWLAB_NODE_LANE_CONFIG_PATH}.lanes.${lane.id}.activeTarget must reference lanes.${lane.id}.targets.${lane.activeTarget}`);
}
}
return { defaultTarget, requiredNoProxy, nodes, lanes, laneTargets, networkProfiles, downloadProfiles };
}
@@ -1270,6 +1283,19 @@ export function hwlabDefaultRuntimeTarget(): { readonly node: string; readonly l
return { ...HWLAB_NODE_LANE_CONFIG.defaultTarget };
}
export function hwlabRuntimeActiveTarget(lane: HwlabRuntimeLane): { readonly node: string; readonly lane: HwlabRuntimeLane } {
const config = HWLAB_NODE_LANE_CONFIG.lanes[lane];
return {
node: config.activeTarget ?? config.node,
lane,
};
}
export function hwlabRuntimeActiveLaneSpec(lane: HwlabRuntimeLane): HwlabRuntimeLaneSpec {
const target = hwlabRuntimeActiveTarget(lane);
return hwlabRuntimeLaneSpecForNode(target.lane, target.node);
}
export function hwlabRuntimeLaneConfigPath(): string {
return HWLAB_NODE_LANE_CONFIG_PATH;
}