Fix high density node download lookup for Pipeline4#705
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🏃 Benchmark This PRRun benchmarks by commenting on this PR: Everything after Examples:
Any PR whose title contains |
| test("getHighDensityNodeDownloadData finds pipeline 4 node data from solver outputs", () => { | ||
| const solver = { | ||
| nodeSolver: { | ||
| getOutput: () => ({ | ||
| meshNodes: [ | ||
| { | ||
| capacityMeshNodeId: "cn_1", | ||
| center: { x: 1, y: 2 }, | ||
| }, | ||
| ], | ||
| }), | ||
| }, | ||
| portPointPathingSolver: { | ||
| getOutput: () => ({ | ||
| nodesWithPortPoints: [ | ||
| { | ||
| capacityMeshNodeId: "cn_1", | ||
| portPoints: [{ portPointId: "pp1", x: 1, y: 1, z: 0 }], | ||
| }, | ||
| ], | ||
| inputNodeWithPortPoints: [ | ||
| { | ||
| capacityMeshNodeId: "cn_1", | ||
| portPoints: [{ portPointId: "pp1", connectionNodeIds: [] }], | ||
| }, | ||
| ], | ||
| }), | ||
| }, | ||
| uniformPortDistributionSolver: { | ||
| getOutput: () => [ | ||
| { | ||
| capacityMeshNodeId: "cn_1", | ||
| portPoints: [{ portPointId: "pp1", x: 3, y: 4, z: 0 }], | ||
| }, | ||
| ], | ||
| }, | ||
| } | ||
|
|
||
| expect(getHighDensityNodeDownloadData(solver, "cn_1")).toEqual({ | ||
| nodeId: "cn_1", | ||
| capacityMeshNode: { | ||
| capacityMeshNodeId: "cn_1", | ||
| center: { x: 1, y: 2 }, | ||
| }, | ||
| nodeWithPortPoints: { | ||
| capacityMeshNodeId: "cn_1", | ||
| portPoints: [{ portPointId: "pp1", x: 3, y: 4, z: 0 }], | ||
| }, | ||
| inputNodeWithPortPoints: { | ||
| capacityMeshNodeId: "cn_1", | ||
| portPoints: [{ portPointId: "pp1", connectionNodeIds: [] }], | ||
| }, | ||
| }) | ||
| }) | ||
|
|
||
| test("getHighDensityNodeDownloadData falls back to legacy solver collections", () => { | ||
| const solver = { | ||
| nodeTargetMerger: { | ||
| newNodes: [{ capacityMeshNodeId: "cn_2", source: "node-target-merger" }], | ||
| }, | ||
| portPointPathingSolver: { | ||
| getNodesWithPortPoints: () => [ | ||
| { capacityMeshNodeId: "cn_2", source: "port-point-pathing" }, | ||
| ], | ||
| }, | ||
| } | ||
|
|
||
| expect(getHighDensityNodeDownloadData(solver, "cn_2")).toEqual({ | ||
| nodeId: "cn_2", | ||
| capacityMeshNode: { | ||
| capacityMeshNodeId: "cn_2", | ||
| source: "node-target-merger", | ||
| }, | ||
| nodeWithPortPoints: { | ||
| capacityMeshNodeId: "cn_2", | ||
| source: "port-point-pathing", | ||
| }, | ||
| inputNodeWithPortPoints: null, | ||
| }) | ||
| }) |
There was a problem hiding this comment.
This test file contains 2 test() functions (lines 4 and 59), but according to the style guide rule about test file structure, a *.test.ts file may have AT MOST one test(...) function. After that, the user should split into multiple numbered files. To fix this, split the tests into separate files like 'getHighDensityNodeDownloadData1.test.ts' and 'getHighDensityNodeDownloadData2.test.ts', with each file containing only one test() function.
Spotted by Graphite (based on custom rule: Custom rule)
Is this helpful? React 👍 or 👎 to let us know.
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
Motivation
nullfields because it only looked at legacy solver fields and missed Pipeline 4 / TinyHypergraph outputs.Description
lib/testing/utils/getHighDensityNodeDownloadData.tsthat searches common locations for the node and port-point data, includingnodeSolver.getOutput().meshNodes,uniformPortDistributionSolver.getOutput(),multiSectionPortPointOptimizer.getNodesWithPortPoints(),segmentToPointOptimizer.getNodesWithPortPoints(),unravelMultiSectionSolver.getNodesWithPortPoints(),portPointPathingSolver.getNodesWithPortPoints(), andportPointPathingSolver.getOutput().lib/testing/AutoroutingPipelineDebugger.tsxto call the newgetHighDensityNodeDownloadDatahelper when preparing the downloaded JSON payload.inputNodeWithPortPointsin the downloaded payload to aid debugging and added fallbacks for legacy solver collections (e.g.nodeTargetMerger.newNodes).tests/getHighDensityNodeDownloadData.test.tsto cover both Pipeline 4-style outputs and legacy solver outputs.Testing
bun test tests/getHighDensityNodeDownloadData.test.ts, but the run could not complete because Bun crashed while loading the native@resvg/resvg-jsmodule from the repo’s test preload (native module crash in this environment).bun testwith an empty preload to avoid the native crash, but the run then failed due to a missinglodashdependency pulled in vialooks-samein this environment, preventing successful test execution.bunx tsc --noEmit, which failed in this environment due to parse/type issues innode_modules/@types/node/stream.d.tsbefore project files were validated.bun run format, which failed because thebiomebinary is not available in the container environment.Codex Task