Skip to content

Whatif live jack#5

Merged
justin06lee merged 4 commits into
masterfrom
whatif-live-Jack
May 23, 2026
Merged

Whatif live jack#5
justin06lee merged 4 commits into
masterfrom
whatif-live-Jack

Conversation

@justin06lee

Copy link
Copy Markdown
Owner

No description provided.

Jack Zhao and others added 4 commits May 22, 2026 16:38
…hat-if

Visualization redesign (ForceGraph.tsx)
- Each node is now a 52×52 rounded-square tile holding a sector emoji
  (chosen by sector field with a label-keyword fallback). Uniform tile
  size — the n_reachable signal lives in the right-rail Ranking table.
- A 5-segment energy bar sits below each tile and encodes impact percentile
  with a discrete red → orange → yellow → lime → green palette. Pure sinks
  render as an empty 5-segment bar. The bar mirrors the level shown in the
  Ranking table so the two views stay visually consistent.
- Edges show animated green footprints walking source → target with a L/R
  perpendicular offset for a gait look. Each edge has a midpoint capsule
  showing the weight as a percentage, colored on the same red→green scale
  (so heavy dependencies pop in red even when the line is thin).
- Layout: barycenter (Sugiyama) sweep within tiers to cut edge crossings.
- Layout: dropped the MIN_*_SPACING floors so the bbox always fits the
  canvas; added a zoomToFit safety net via fgRef so first paint shows the
  whole pyramid without requiring a manual zoom-out.
- Focal company keeps the white tile border + amber ★ label.
- Cascade animation: red glow behind tiles, scaled by per-round disruption
  probability — bar stays static (impact is intrinsic), glow is dynamic.

Live What-If (4 files)
- WhatIfPanel becomes a debounced live slider (220ms): drag weight, no
  Compute button. AbortController cancels in-flight /whatif when the
  slider moves so requests don't stack.
- WhatIfState lifted to AnalysisPage so the Ranking table can render
  modified EPT inline as "1.31→2.40 (+1.09)" with green for improvement
  and red for worsening. Slider reset clears the modification atomically.
- whatif() in lib/api.ts now accepts an AbortSignal.
…sum>1.05

Before this change, pushing one edge's weight up in the What-If panel could
make the target's incoming weights exceed the §7.2 tolerance (sum > 1.05),
which the validator rejects with NormalizationError — bubbling up as a
generic HTTP 500 in the UI.

Real business semantics: if Apple shifts more orders TO one assembler, the
share given to the others necessarily shrinks. run_whatif now treats the
user-specified edges as authoritative and proportionally rescales the other
incoming edges to the same target so the sum stays at 1.0. Edge cases:
- Modified edges saturating ≥100% combined: clamp them to 1.0 (preserving
  ratio) and zero the others.
- Other siblings all originally zero but there is leftover capacity:
  distribute the remainder evenly.
- Inputs are clamped to [0,1] on entry as a safety guard.

The validator pass is kept as a no-op safety net.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justin06lee justin06lee merged commit 62d6b97 into master May 23, 2026
1 check passed
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