Commit 36a5684
committed
feat(graph): entrance choreography + seeded layout (Phase 6)
Warmup + seeded initial layout + a staggered entrance reveal for the
force-directed graph, landed across the worker and sync-fallback paths.
- worker-protocol/worker/sync: carry warmupTicks, warmupBudgetMs (default
250), initialAlpha. Worker builds the sim stopped, applies initialAlpha,
runs a warmup loop bounded by BOTH tick count AND ms budget, posts the
warmed first positions, then restart()s. Old dist workers ignore the new
fields (graceful). Sync path chunks warmup PRE-reveal (nothing renders
until warmup completes) so the main thread never freezes.
- seed.ts: FNV-1a hash32 + seedNodePositions — a pure function of
(id, seed, community) so the settled layout is reproducible and adding a
node leaves the others' start positions unchanged. Called with seed ?? 0
before SimulationManager.create.
- simulation.ts: derive the sync tick cap from alphaDecay via
ticksToAlphaMin (ceil(log(alphaMin)/log(1-alphaDecay)), ceilinged at 800),
aligning the sync path with the worker's alpha<alphaMin stop instead of a
fixed 300 that diverged under settle:'thorough'.
- entrance.ts: nodeEnterProgress (per-node reveal quantized to <=8 buckets
for fill batching) + ENTRANCE_STAGGER_MAX_NODES (3000).
- zoom.fitBounds: add a spread flag (default true); the mount passes false
after warmup so near-final bounds aren't over-inflated (would fit ~2x too
small at 10k nodes).
- graph-mount: first post-warmup tick pulls the camera back to 0.92x the
fit, optionally flies to the fit (enter.cameraFit), and drives a
mount-level entranceProgress read by buildRenderState. Warmup runs even
under reduced motion / animation:false; only the reveal/flight skip.
Resize mid-entrance cancels the fit flight and snaps to the new-viewport
fit while the reveal continues; update() finishAll()s first.
- canvas-renderer: thread entrance into GraphRenderState; ramp node
alpha/scale (0.6 + 0.4*nodeT), lag edges 30%, fade labels by progress,
preserving Phase 5 focus-crossfade + batching.
Determinism is scoped PER EXECUTION PATH (same spec + seed => identical
settled layout within a path); worker-vs-sync parity is not guaranteed.
Tests: seed determinism, warmup (alpha<1 + non-phyllotaxis spread + ms
budget via injected clock), ticksToAlphaMin, entrance stagger math, first
frame != fit / post-duration == fit, reduced-motion (warmup yes, reveal
no), resize mid-entrance, fitBounds spread:false tighter, and a source-
parity grep drift alarm across simulation.ts / simulation-worker.ts.
Deviation: seed R0 is a fixed constant, not the plan's 10*sqrt(n). An
n-dependent R0 rescales every node when one is added, violating the
"adding a node leaves others unchanged" acceptance criterion. Per-node
determinism wins; d3 charge repulsion still spreads the cloud.
Claude-Session: https://claude.ai/code/session_016rS7hi2g4bSzRBfnD1p2ji1 parent 0642d78 commit 36a5684
16 files changed
Lines changed: 1085 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
243 | 256 | | |
244 | 257 | | |
245 | 258 | | |
| |||
510 | 523 | | |
511 | 524 | | |
512 | 525 | | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
513 | 531 | | |
514 | 532 | | |
515 | 533 | | |
| |||
520 | 538 | | |
521 | 539 | | |
522 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
523 | 544 | | |
524 | 545 | | |
525 | 546 | | |
| |||
535 | 556 | | |
536 | 557 | | |
537 | 558 | | |
538 | | - | |
| 559 | + | |
539 | 560 | | |
540 | | - | |
| 561 | + | |
541 | 562 | | |
542 | 563 | | |
543 | 564 | | |
| |||
556 | 577 | | |
557 | 578 | | |
558 | 579 | | |
559 | | - | |
560 | | - | |
561 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
562 | 583 | | |
563 | 584 | | |
564 | 585 | | |
565 | 586 | | |
566 | 587 | | |
567 | 588 | | |
568 | 589 | | |
569 | | - | |
570 | | - | |
571 | | - | |
| 590 | + | |
572 | 591 | | |
573 | 592 | | |
574 | 593 | | |
| |||
584 | 603 | | |
585 | 604 | | |
586 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
587 | 676 | | |
588 | 677 | | |
589 | 678 | | |
| |||
840 | 929 | | |
841 | 930 | | |
842 | 931 | | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
843 | 936 | | |
844 | 937 | | |
845 | 938 | | |
| |||
1244 | 1337 | | |
1245 | 1338 | | |
1246 | 1339 | | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
1247 | 1350 | | |
1248 | 1351 | | |
1249 | 1352 | | |
| |||
1252 | 1355 | | |
1253 | 1356 | | |
1254 | 1357 | | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
1255 | 1367 | | |
1256 | 1368 | | |
1257 | 1369 | | |
| |||
1300 | 1412 | | |
1301 | 1413 | | |
1302 | 1414 | | |
1303 | | - | |
| 1415 | + | |
1304 | 1416 | | |
1305 | | - | |
| 1417 | + | |
1306 | 1418 | | |
1307 | 1419 | | |
1308 | 1420 | | |
| |||
1342 | 1454 | | |
1343 | 1455 | | |
1344 | 1456 | | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
1345 | 1462 | | |
1346 | 1463 | | |
1347 | 1464 | | |
| |||
Lines changed: 87 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
871 | 872 | | |
872 | 873 | | |
873 | 874 | | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments