Week 13 of my Google Summer of Code journey with CircuitVerse (August 17th to August 23rd) was a mix of finishing Auto Layout, working through reviews, and trying a completely new GitHub workflow for the first time.
๐งช Finishing the Editor's Picks Work
I started the week with two things on my mind: getting the Editor's Picks round-trip work through review and finishing the ELK.js Auto Layout feature I had started last week.
While I was working on Auto Layout, Aryann reviewed PR #1194 and raised a few useful edge cases:
- why two-port nets can be reconstructed directly, while 3+ port fan-out nets need their routing topology preserved
- how the Editor's Picks fixtures resolve the focused scope
- why the dependency graph only needs unique child-scope dependencies
- making sure dangling wires excluded from the canonical hash are still preserved in the saved circuit data
I addressed the required changes and clarified the remaining points in the review.
๐ Finishing Auto Layout with ELK.js
At the same time, I finished the Auto Layout feature.
The goal is pretty simple from a user's point of view: if a canonical project already contains layout data, CircuitVerse should use it exactly as it is. But if the layout is missing, the circuit should still open in a clean and readable way instead of placing everything at the same position.
For that, I used ELK.js with its layered layout algorithm.
When layout is missing, the importer first creates enough of each component to know its real size, direction and port positions. I then convert that circuit into an ELK graph and let ELK arrange the components from left to right, while keeping Inputs toward the beginning and Outputs toward the end.
I also use orthogonal routing, so generated wires follow horizontal and vertical paths instead of random diagonal lines.
The most interesting part was fan-out wiring. A CircuitVerse net can have one source connected to multiple targets, but I didn't want the ELK-specific representation to leak into our canonical format. So for Auto Layout I create a temporary zero-size junction for fan-out nets:
source โ temporary junction โ targets
ELK can then route each branch cleanly. Once it finishes, I convert the junctions and bend points back into CircuitVerse's normal intermediate routing nodes, snap the coordinates to the simulator grid, and continue through the normal import flow.
The temporary junction exists only inside the Auto Layout adapter โ the saved canonical format stays unchanged.
๐ฟ A Problem with the Pull Request Stack
Once Auto Layout was ready, I hit a Git problem rather than a circuit problem ๐
The Auto Layout branch was built on top of the Editor's Picks branch, but PR #1194 was still coming from my fork and had not been merged yet. If I opened Auto Layout directly against main, its diff would also contain all the unmerged Editor's Picks changes, making the PR much harder to review.
This was exactly the kind of situation stacked pull requests are meant for: one PR contains the base change, and the next PR is reviewed only as the layer on top of it.
The catch was that GitHub's stacked PR workflow needs the branches to live in the same repository. So I asked Aboo for push access to the CircuitVerse repository so I could move both branches there and use gh stack properly.
If you want to know more about the workflow, GitHub has a good guide to stacked pull requests.
๐ My First Stacked PRs!
After getting access, I moved the Editor's Picks branch into the CircuitVerse repository and opened PR #1221 to replace #1194. I kept #1194 as a Draft so Aryann's earlier review discussion stayed preserved.
Then I pushed the Auto Layout branch on top and opened PR #1222.
mainโ #1221 Editor's Picks fixes โ #1222 ELK Auto Layout
This was my first time using gh stack, and it kept both PRs much cleaner than putting everything into one huge diff.
๐ฎ What's Next
With the round-trip fixes and Auto Layout finally in, the next major piece is the JSON Schema and runtime validation for Canonical v1.
Time for the final stretch! โก๐ป
Top comments (0)