mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
02a66490a6
## Summary The beautiful-chat demo's "Calculator App (Open Generative UI)" pill rendered a calculator whose "=" key was inert: the fixture's `jsFunctions` called `Websandbox.connection.remote.evaluateExpression`, a host-bridge function only the open-gen-ui-advanced demo registers — beautiful-chat never does, so the call could never resolve. While fixing it, review and live verification surfaced four more behavioral defects in the same fixture family, all fixed here across all 18 integrations: - **Self-contained evaluation**: `jsFunctions` now evaluates in-sandbox via an allowlist-gated strict-mode `Function()` (digits/operators/`eE` only; failures → `err`). No host bridge required. - **Fixture shadowing**: the specific "with standard buttons" pair is ordered before the generic "build a modern calculator" pair (aimock is first-match-wins by load order), so the intended fixture actually serves the pill. - **Chained evaluation**: results in exponential notation (e.g. `1.728e+18`) re-evaluate instead of wiping to `err` (regex allows `eE`). - **Interleaved pills**: removed the thread-global `hasToolResult` gate that made the calculator fall through to the live proxy (502) when clicked after any tool-producing pill; toolCallId-anchored follow-ups (ordered first) disambiguate legs instead. - **Repeat clicks**: distinct `tool_call_id`s per click via `sequenceIndex` variants + a non-sequenced fallback, fixing the second-widget collapse (duplicate id collapsed both renders into one slot, wiping state). Scoping caveats (per-X-Test-Id counters, cross-integration co-increment, DEFAULT_TEST_ID degradation floor = pre-fix behavior) are documented in the fixture comments and GOTCHAS. Also: SUPERSEDED annotations on the unreachable recorded.json calculator entries, GOTCHAS corrections (sequenceIndex scoping, hasToolResult semantics, statelessness claim), and a routing-invariant unit test pinning the entry ordering structurally and behaviorally for all 18 integrations (55 tests). ## Test plan - [x] Local Playwright red-green on the built stack (langgraph-python): broken "=" reproduced pre-fix; post-fix visual proof of render, `7+8=15`, chained exponent math, calculator-after-dashboard interleave, and two independent working widgets across repeat clicks - [x] aimock version bisect (1.28.0/1.29.0/1.30.0) ruling out an aimock regression before the fixture root-cause - [x] `showcase/scripts` vitest suite: 51 files / 1899 tests green (incl. new `calculator-fixture-routing.test.ts` 55/55, red-proofed via mutation) - [x] validate-parity 19/19; harness aimock-fixture-coverage 3/3; oxfmt/oxlint/commitlint clean - [ ] CI green on PR HEAD Follow-ups (readonly-state matcher shadowing parity across 15 integrations, sibling-pill interleave gates, GOTCHAS accuracy pass, aimock sequenceIndex scoping) are tracked in the showcase follow-up ledger. 🤖 Generated with [Claude Code](https://claude.com/claude-code)