Graph PR-A: one-shot physics (settle then stop), spread-start layout, camera centering, layout metrics#62
Merged
Conversation
…ering, layout metrics (PR-A) Graphs were "garbage piles" that drifted forever. Root causes (found via new metrics): the 2s poll re-kicked the sim every cycle (perpetual drift), and the force equilibrium itself was overlapping (an inward centering force compressed dense graphs into a core collision couldn't separate). - One-shot physics: the routine poll no longer reheats a placed/frozen graph; the sim settles to alphaMin and STAYS idle (no continuous drift). - Spread-start: unplaced nodes / Organize start on a clean grid (spacing > collision diameter) so physics REFINES a non-overlapping layout instead of failing to explode a pile from the origin. - Force tuning (physicsConfig): centering near-off (tiny containment only), stronger/longer-range charge, collision strength 1 + 4 iterations, faster cool-down + heavier damping → dense graphs settle to ZERO card overlaps and come fully to rest. Verified: a 90-node graph → 0 overlaps, sim stops ~13s. - Camera centers on the graph on load AND graph change (was keyed on hasNodes only with one stale global transform) — covers login, graph switch, drill-in. - Edge labels: a forced de-overlap pass runs at settle and for pinned graphs (which don't tick), so labels start de-overlapped. - Metrics (window.__layoutMetrics): atRest, alpha, TRUE card-overlap pairs, proximity pairs, label overlaps, settle time, drift — for studying the behaviour skeptically. window.__organizeGraph triggers a reflow. - New tests/diagnostics/physics-settle.spec.ts asserts: settles → 0 overlaps → fully stops, no drift. THE GATE 5/5 (grow flow unaffected by the tuning); web typecheck clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🧪 Comprehensive Test Suite
Full-stack smoke gate runs in the CI workflow. |
The defaults test pinned the old tuning (charge -60, velocityDecay 0.65, collision 0.85); PR-A intentionally retuned for a one-shot non-overlapping settle. Update the asserted values to match. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🧪 Comprehensive Test Suite
Full-stack smoke gate runs in the CI workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes "garbage piles" + continuous drift, centers the camera, and adds deep layout metrics. Studied skeptically via the metrics — full investigation in the commit.
Root causes (found via the new metrics)
simulation.alpha(0.1).restart()every cycle → the sim never rested.Changes
alphaMinand stays idle (no drift).physicsConfig.ts): centering near-off (tiny containment), stronger/longer-range charge, collision strength 1 + 4 iterations, faster cool-down + damping → dense graphs settle to zero card overlaps and come fully to rest.hasNodesonly with one stale global transform.window.__layoutMetrics()(atRest, alpha, TRUE rectangle-overlap pairs, proximity, label overlaps, settle time, drift) +window.__organizeGraph().Verified (
physics-settle.spec.ts)90-node graph: overlap → 0, sim fully stops (~13s),
idleAfterSettle: true. THE GATE 5/5 (grow flow unaffected), typecheck clean.Known follow-up: ~20 edge-label overlaps remain on very dense graphs (best-effort avoidance). PR-B re-seeds demos clean (no organize needed); PR-C minimap zoom; PR-D explorer tree.
🤖 Generated with Claude Code