Skip to content

Keep a Main loop's children under it in the sidebar - #258

Merged
scgopi merged 1 commit into
mainfrom
fix/main-loop-children-flat
Sep 3, 2026
Merged

scgopi merged 1 commit into
mainfrom
fix/main-loop-children-flat

Conversation

@scgopi

@scgopi scgopi commented Sep 3, 2026

Copy link
Copy Markdown
Owner

The bug

Create child loops from a Main loop and they list as top-level rows beside their parent, not under it — and collapsing the parent leaves them on screen. Only Main-parented loops are affected; every other loop type nests correctly.

Why

LoopGraph.startAnchors picks entry points from non-sketch nodes (a Main loop is .sketch on disk), then walks out from them; anything the walk never reaches is treated as a headless component and promoted to an anchor of its own.

A Main loop is never an entry, so the walk never started at one — its children came back unreached and each got promoted. sidebarRoots is startAnchors plus untargeted sketches, so the children landed at depth 0 as siblings, and flattenedNodeRows' collapse only hides rows that are actually nested.

The fix

Seed the walk with the sketches sidebarRoots actually rows. A targeted sketch stays out of it deliberately: it has no row of its own, so it cannot be the beginning its subtree is reached through — covering it would strand that subtree with no row at all (the handoff-ring case, pinned by the second test).

startAnchors has no other production caller — canvas entry ports come from entryPoints/cycleOnlyNodeIDs — so the canvas is unaffected.

Verification

Check Result
xcodebuild test ✅ 1508 tests in 156 suites passed (+2 new)
make check ✅ 0 serious violations, format clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01AoiYAyXWLj4b8xMumkDCNT

A sketch is deliberately not an entry point, so the startAnchors walk never
started at one: every loop a Main loop handed off to came back unreached, was
read as a headless component, and was promoted to an anchor — a top-level
sidebar row beside its parent that collapsing the parent could not hide.

Seed the walk with the sketches sidebarRoots actually rows. A targeted sketch
stays out of it: it has no row for its subtree to be reached through.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AoiYAyXWLj4b8xMumkDCNT
@scgopi
scgopi merged commit c3456d1 into main Sep 3, 2026
1 check passed
@scgopi
scgopi deleted the fix/main-loop-children-flat branch September 3, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant