Skip to content

Fix high density node download lookup for Pipeline4#705

Merged
seveibar merged 2 commits intomainfrom
codex/fix-json-download-for-nodewithportpoints
Mar 23, 2026
Merged

Fix high density node download lookup for Pipeline4#705
seveibar merged 2 commits intomainfrom
codex/fix-json-download-for-nodewithportpoints

Conversation

@seveibar
Copy link
Copy Markdown
Contributor

Motivation

  • The debugger button “Download High Density Node Input (NodeWithPortPoints)” produced JSON with many null fields because it only looked at legacy solver fields and missed Pipeline 4 / TinyHypergraph outputs.
  • The intent is to reliably locate the node and port-point data across multiple pipeline solver shapes so the downloaded payload contains the actual node input used by the pipeline.

Description

  • Added a shared lookup helper lib/testing/utils/getHighDensityNodeDownloadData.ts that searches common locations for the node and port-point data, including nodeSolver.getOutput().meshNodes, uniformPortDistributionSolver.getOutput(), multiSectionPortPointOptimizer.getNodesWithPortPoints(), segmentToPointOptimizer.getNodesWithPortPoints(), unravelMultiSectionSolver.getNodesWithPortPoints(), portPointPathingSolver.getNodesWithPortPoints(), and portPointPathingSolver.getOutput().
  • Replaced the inline lookup logic in lib/testing/AutoroutingPipelineDebugger.tsx to call the new getHighDensityNodeDownloadData helper when preparing the downloaded JSON payload.
  • Included inputNodeWithPortPoints in the downloaded payload to aid debugging and added fallbacks for legacy solver collections (e.g. nodeTargetMerger.newNodes).
  • Added focused tests in tests/getHighDensityNodeDownloadData.test.ts to cover both Pipeline 4-style outputs and legacy solver outputs.

Testing

  • Ran bun test tests/getHighDensityNodeDownloadData.test.ts, but the run could not complete because Bun crashed while loading the native @resvg/resvg-js module from the repo’s test preload (native module crash in this environment).
  • Re-ran bun test with an empty preload to avoid the native crash, but the run then failed due to a missing lodash dependency pulled in via looks-same in this environment, preventing successful test execution.
  • Ran typecheck with bunx tsc --noEmit, which failed in this environment due to parse/type issues in node_modules/@types/node/stream.d.ts before project files were validated.
  • Attempted formatting with bun run format, which failed because the biome binary is not available in the container environment.

Codex Task

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
capacity-node-autorouter Ready Ready Preview, Comment Mar 23, 2026 11:34pm

Request Review

@tscircuitbot
Copy link
Copy Markdown

🏃 Benchmark This PR

Run benchmarks by commenting on this PR:

/benchmark [benchmark.sh args...]
/benchmark [solver-name|all] [scenario-limit] --concurrency <n> --effort <n> --dataset <dataset01|zdwiel|srj05>

Everything after /benchmark is forwarded directly to ./benchmark.sh.

Examples:

  • /benchmark -> AutoroutingPipelineSolver, all scenarios (default concurrency uses the benchmark runner CPU count)
  • /benchmark AutoroutingPipelineSolver -> one solver, all scenarios
  • /benchmark all 20 -> all solvers, first 20 scenarios
  • /benchmark AutoroutingPipelineSolver 20 --concurrency 8 -> one solver, 20 scenarios, 8 workers
  • /benchmark AutoroutingPipelineSolver 20 --effort 2 -> one solver, 20 scenarios, 2x effort
  • /benchmark AutoroutingPipelineSolver --dataset zdwiel -> one solver, all scenarios, zdwiel dataset
  • /benchmark AutoroutingPipelineSolver --dataset srj05 -> one solver, all scenarios, srj05 dataset
  • /benchmark all 20 --dataset dataset01 --concurrency 8 -> all solvers, 20 scenarios, dataset01, 8 workers
  • /benchmark --pipeline 4 -> same as ./benchmark.sh --pipeline 4

Any PR whose title contains [BENCHMARK TEST] will automatically run the benchmark workflow on PR updates.

@seveibar seveibar changed the title Fix high density node download lookup Fix high density node download lookup for Pipeline4 Mar 23, 2026
Comment on lines +4 to +83
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,
})
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@seveibar seveibar merged commit b3ede9d into main Mar 23, 2026
13 checks passed
@tscircuitbot
Copy link
Copy Markdown


Thank you for your contribution! 🎉

PR Rating: ⭐⭐⭐
Impact: Major

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants