Bundle group added to .yml generation and canvas

This commit is contained in:
2026-06-08 16:34:39 +08:00
parent 75dd78aa33
commit 7953c8b624
5 changed files with 385 additions and 107 deletions
+17
View File
@@ -63,3 +63,20 @@ assert(
!canvasHtml.includes("activePage.nodes.filter(n => n.selected && n.id !== 'page-port')"),
'copy/delete should not exclude port nodes'
);
assert(
canvasHtml.includes('Bundle Group') &&
canvasHtml.includes('bundleGroupOptions') &&
canvasHtml.includes('compatibleBundleGroupOptions'),
'route editor should expose a Bundle Group dropdown filtered by compatible xsection'
);
assert(
canvasHtml.includes('newBundleGroupName') &&
canvasHtml.includes('normalizeBundleGroupName') &&
canvasHtml.includes('onAddBundleGroup'),
'route editor should provide an add flow that sanitizes new bundle group names'
);
assert(
canvasHtml.includes('routeStyleForSettings({ xsection: option.xsection') ||
canvasHtml.includes('routeStyleForSettings({ xsection: group.xsection'),
'bundle group dropdown options should use route xsection colors'
);
+88
View File
@@ -588,9 +588,13 @@ assert.deepStrictEqual(routeDefaults, {
width: 0.45,
radius: 10,
routing_type: 'euler_bend',
bundle_group: '',
widthEdited: false
});
const groupedRouteDefaults = helpers.createRouteSettings(technologyManifest, { bundle_group: 'group_A' });
assert.strictEqual(groupedRouteDefaults.bundle_group, 'group_A');
const metalRoute = helpers.updateRouteXsection(routeDefaults, 'metal_1', technologyManifest);
assert.strictEqual(metalRoute.family, 'electrical');
assert.strictEqual(metalRoute.width, 5);
@@ -692,6 +696,90 @@ assert(freeRouteYaml.includes('points:'));
assert(freeRouteYaml.includes('x: 80.0'));
assert(freeRouteYaml.includes('y: -120.0'));
const groupedBundlesYaml = helpers.buildBundlesYaml({
nodes: [
{ id: 'a', data: { componentDisplayName: 'inst_a' } },
{ id: 'b', data: { componentDisplayName: 'inst_b' } },
{ id: 'c', data: { componentDisplayName: 'inst_c' } },
{ id: 'd', data: { componentDisplayName: 'inst_d' } }
],
edges: [
{
id: 'edge-group-a',
source: 'a',
target: 'b',
sourceHandle: 'out',
targetHandle: 'in',
data: {
route: {
xsection: 'strip',
family: 'optical',
width: 0.45,
radius: 10,
routing_type: 'euler_bend',
bundle_group: 'optical_bus'
}
}
},
{
id: 'edge-group-b',
source: 'c',
target: 'd',
sourceHandle: 'out',
targetHandle: 'in',
data: {
route: {
xsection: 'metal_1',
family: 'electrical',
width: 5,
radius: 20,
routing_type: 'standard_bend',
bundle_group: 'electrical_bus'
}
}
}
]
}, technologyManifest);
assert(groupedBundlesYaml.includes(' optical_bus:\n xsection: strip\n family: optical\n routing_type: euler_bend\n links:'));
assert(groupedBundlesYaml.includes(' electrical_bus:\n xsection: metal_1\n family: electrical\n routing_type: standard_bend\n links:'));
assert(groupedBundlesYaml.includes('from: inst_a:out'));
assert(groupedBundlesYaml.includes('from: inst_c:out'));
assert(!groupedBundlesYaml.includes('bundle_group:'), 'bundle_group should choose the YAML key, not be written inside links');
const splitFreeWireBundlesYaml = helpers.buildBundlesYaml({
nodes: [
{ id: 'a', data: { componentDisplayName: 'inst_a' } },
{ id: 'b', data: { componentDisplayName: 'inst_b' } },
{ id: 'c', data: { componentDisplayName: 'inst_c' } },
{ id: 'd', data: { componentDisplayName: 'inst_d' } }
],
edges: [
{
id: 'edge-free-strip',
source: 'a',
target: 'b',
sourceHandle: 'out',
targetHandle: 'in',
data: {
route: { xsection: 'strip', family: 'optical', width: 0.45, radius: 10, routing_type: 'euler_bend' }
}
},
{
id: 'edge-free-metal',
source: 'c',
target: 'd',
sourceHandle: 'out',
targetHandle: 'in',
data: {
route: { xsection: 'metal_1', family: 'electrical', width: 5, radius: 20, routing_type: 'standard_bend' }
}
}
]
}, technologyManifest);
assert(splitFreeWireBundlesYaml.includes(' free_wires:\n xsection: strip\n family: optical\n routing_type: euler_bend\n links:'));
assert(splitFreeWireBundlesYaml.includes(' free_wires_metal_1:\n xsection: metal_1\n family: electrical\n routing_type: standard_bend\n links:'));
assert(!splitFreeWireBundlesYaml.includes('bundle_group:'), 'free-wire bundle names should not be duplicated into link metadata');
const edgeA = {
id: 'edge-a-b',
source: 'a',
+12
View File
@@ -47,3 +47,15 @@ assert(
canvasHtml.includes('Array.from(new Set([FORGE_COMPONENT_LABEL, ...sameCategoryComponents'),
'loaded PDK selector choices should include forge and same-category library components'
);
assert(
canvasHtml.includes('Object.entries(doc.bundles || {})'),
'project and YAML loading should iterate all saved bundle groups, not only output_bus'
);
assert(
!canvasHtml.includes('doc.bundles?.output_bus?.links'),
'project and YAML loading should not hardcode bundles.output_bus.links'
);
assert(
canvasHtml.includes('bundle_group: bundleName'),
'loaded route metadata should remember the YAML bundle key as route.bundle_group'
);