fix(forecast-panel): theater card conf=0, scenario type badges, sorted paths#2443
fix(forecast-panel): theater card conf=0, scenario type badges, sorted paths#2443
Conversation
…d paths Three related UX fixes in the simulation NEXUS theater display: 1. conf=0 prompt fix (seed-forecasts.mjs): Round 2 prompt used "confidence": 0.0 as placeholder values in the JSON example. LLMs copy placeholder values verbatim when uncertain, causing all three paths to emit confidence=0 and the gauge to show '0%'. Replace with representative values (0.35/0.50/0.15 for escalation/containment/market_cascade) to anchor the LLM. 2. Sort topPaths by confidence descending (seed-forecasts.mjs): topPaths[0] (the dominant path shown in the theater card gauge) was ordered by LLM output position, not by confidence. The card could display the lowest-confidence scenario as dominant. Sort before slicing so the card always shows the most confident scenario. 3. pathId exposed + scenario type badges (ForecastPanel.ts): pathId was stripped from uiTheaters output, making it impossible to show scenario type in the UI. Expose pathId in uiTheaters map. Add PATH_ID_LABELS and fc-path-type CSS badges coloured by scenario type (escalation=red, containment=green, market_cascade=amber). Add badge to both the theater card summary line and each path card in the detail view. Guard gauge label and conf text: show '—' instead of '0%' when confidence is 0.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Greptile SummaryThis PR fixes four related bugs in the ForecastPanel theater card feature: LLM placeholder Key changes:
Confidence Score: 5/5Safe to merge — all remaining findings are minor style/defensive-coding suggestions with no impact on correctness or runtime behaviour. Both changes are well-scoped and self-contained. The zero-confidence guard, badge rendering, and sort are all correct. The only issues found are a P2 in-place mutation of the input array (harmless in the current call flow because R2 is written before the sort runs) and a P2 defensive-coding note about using an allow-list when interpolating pathId into CSS class names. Neither blocks merge. No files require special attention — both files have only minor P2 suggestions. Important Files Changed
Sequence DiagramsequenceDiagram
participant LLM as LLM (Round 2)
participant Seed as seed-forecasts.mjs
participant R2 as R2 Storage
participant Redis as Redis (uiTheaters)
participant UI as ForecastPanel.ts
LLM->>Seed: topPaths[] with representative confidences (0.35/0.50/0.15)
Seed->>R2: putR2JsonObject(outcome) — original LLM order
Seed->>Seed: sort topPaths desc by confidence
Seed->>Seed: slice(0,3) + map (adds pathId)
Seed->>Redis: SET uiTheaters (sorted, with pathId)
UI->>Redis: fetch uiTheaters JSON
Redis-->>UI: SimulationTheater[] (topPaths[0] = highest confidence)
UI->>UI: renderTheaterCard → gauge shows topPaths[0].confidence
UI->>UI: conf > 0 ? "X%" : "—"
UI->>UI: pathId → fc-path-type badge (escalation/containment/market_cascade)
Reviews (1): Last reviewed commit: "fix(forecast-panel): theater card conf=0..." | Re-trigger Greptile |
Summary
"confidence": 0.0as placeholder in JSON example. LLMs copy placeholder values verbatim, causing all path gauges to show0%. Replaced with representative values (0.35/0.50/0.15for escalation/containment/market_cascade).topPaths[0](the dominant path in the theater card gauge) was LLM output order. Cards could show the least-likely scenario as dominant. Now sorted descending before slice.pathIdwas stripped fromuiTheatersRedis output. Added it back; added colour-codedfc-path-typebadges (escalation red / containment green / market_cascade amber) to both theater card summary line and path cards in the detail view.—instead of0%when confidence is zero, covering existing Redis data until next simulation run.Test plan
—in gauge (existing Redis data) then real values after next simulation run