Commit Graph

9 Commits

Author SHA1 Message Date
Jordan Ritter c804fb7f51 fix(showcase): un-skip hitl-in-app downgrade test + remove networkidle from beautiful-chat 2026-05-19 05:39:50 -07:00
Jordan Ritter ea380292d6 fix(showcase): resolve 7 FIXTURE_GAP e2e test failures in LGP + LGT
Remove fragile systemMessage gates from shared-state fixtures in
d5-all.json and feature-parity.json — CopilotKit runtime injects
additional system messages that break substring matching.

Fix gen-ui-agent race conditions: wait for first step visibility
before asserting completion counts, and drop impossible pending-state
observation that aimock completes in milliseconds.

Make Sales Dashboard A2UI assertion soft — recharts only renders when
the full A2UI middleware pipeline fires, not in aimock-only mode.

Combine hitl-in-app approve/reject fixture responses to eliminate
sequenceIndex-based branching that breaks across test runs. Add
.first() to strict-mode-violating getByText selectors.

Sync all 4 fixed test files from LGP to LGT.
2026-05-17 11:36:38 -07:00
Tyler Slaton c41c2dec71 fix(showcase/beautiful-chat): pin canvas to "beautiful-chat" agent id so shared state renders
`<CopilotKit agent="beautiful-chat">` routes the chat to agent id
"beautiful-chat", but ExampleCanvas called `useAgent()` with no args and
fell back to DEFAULT_AGENT_ID ("default"). The frontend's agent registry
tracks state per id, so `manage_todos` state-deltas from the chat run
landed on "beautiful-chat" and never reached the canvas's "default"
subscription — the Task Manager pill auto-flipped the panel to App mode
but the To Do column stayed empty. Drop the unused "default" alias from
the runtime route and pin the canvas to `useAgent({ agentId:
"beautiful-chat" })` so both halves share one ProxiedCopilotRuntimeAgent
instance. Adds a Playwright regression test asserting the 3 verbatim
todo titles render after the pill click, plus 3 aimock fixtures for the
multi-turn flow (enableAppMode -> manage_todos -> confirmation).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:04:50 -07:00
Alem Tuzlak 5c0a87e18b Merge branch 'main' into test/lgp-a2ui-regression-coverage 2026-05-11 13:12:38 +02:00
Tyler Slaton 59eb245a1c fix(showcase/langgraph-python): align e2e specs + QAs with current demos
The specs and QA markdowns had drifted from the demos they describe.
This commit brings every test contract into line with the actual demo
source — eliminating false-greens, false-fails, and stale assertions.

False-fail spec assertions (would fail every run):
- `agentic-chat.spec.ts` — rewrote from the old `change_background` /
  `weather-card` / `useAgentContext` flow that no longer exists. New
  spec exercises the vanilla `<CopilotChat>` + three suggestion pills
  contract the simplified demo actually exposes.
- `gen-ui-tool-based.spec.ts` — asserted on UI text ("Use the sidebar
  to generate charts", "Chart Generator") that doesn't exist; switched
  to suggestion-pill assertions and scoped the SVG check to inside the
  assistant-message bubble (was matching CopilotChat's send-button
  SVG).
- `agent-config.spec.ts` — asserted heading "Agent Config Object" but
  the demo has "Agent Config".
- `multimodal.spec.ts` — asserted a non-existent "Multimodal
  attachments" heading; switched to the `multimodal-demo-root` testid.
- `chat-slots.spec.ts` — asserted `[data-testid="custom-assistant-
  message"]` and the bare text "slot" — neither exists. The actual
  signal is `data-slot-label="MessageView.AssistantMessage"` from the
  SlotMarker wrapper.
- `reasoning-default.spec.ts` — asserted `[data-testid="copilot-
  reasoning-message"]` and `[data-message-role="reasoning"]`; neither
  is emitted by `CopilotChatReasoningMessage`. Switched to the text-
  based "Thinking…/Thought for…" header label.

False-green spec assertions (passed for the wrong reason):
- `shared-state-read.spec.ts` — was a complete false-green: asserted
  on "Sales Pipeline", "Total Pipeline", "Active Deals" but the demo
  has been a Recipe Editor for some time. Rewrote against the
  recipe-card / ingredients-container / instructions-container testids.
- 11 specs (agent-config, beautiful-chat, frontend-tools-async,
  gen-ui-tool-based, gen-ui-agent, gen-ui-interrupt, hitl-in-chat,
  hitl-in-app, multimodal, readonly-state-agent-context, voice) used
  `[data-role="assistant"]` to gate "agent responded" — but the v2
  react-core bundle never emits that attribute (it ships
  `data-testid="copilot-assistant-message"`). Mechanical sweep to the
  correct testid.
- Deleted `shared-state-write.spec.ts` (route consolidated into
  `shared-state-read-write` earlier on this branch — spec targeted a
  removed demo) and `renderer-selector.spec.ts` (asserted on a radio-
  pill UI that no longer exists; the four "Declarative UI" variants
  are now separate manifest demos).

QA drift:
- `qa/gen-ui-tool-based.md` documented a "Haiku Generator" demo with
  haiku-card / japanese-line / english-line / haiku-image testids — a
  demo that doesn't exist anywhere on this branch. Rewrote to match
  the chart-rendering demo's actual testids and pill prompts.
- `qa/chat-slots.md` referenced "Custom Slot" pill / "Welcome to the
  Slots demo" heading / "This welcome card is rendered via the
  welcomeScreen slot." body text — all of which the slot-wrappers
  refactor on this branch removed. Updated to match the
  `custom-welcome-message` sub-slot that's actually rendered. Also
  fixed max-w-4xl → max-w-5xl to match the page.
- `qa/shared-state-read.md` said default instruction is "Preheat oven
  to 350 F" but the source has "Preheat oven to 350°F (175°C)".
- `qa/agentic-chat.md` rewrote to match the simplified vanilla-chat
  demo (the previous QA documented `change_background` / `WeatherCard`
  flows that no longer exist).
- `qa/reasoning-default.md` cited `kind: "testing"` in feature-
  registry.json for the `reasoning-default` entry; the registry entry
  has no `kind` field. Rewrote without the false cross-file claim.
- Deleted 4 orphan QA files for demos that don't exist:
  `agentic-chat-reasoning.md`, `hitl.md`, `hitl-in-chat-booking.md`,
  `shared-state-write.md`.
- Renamed `qa/reasoning-default-render.md` → `qa/reasoning-default.md`
  to match the manifest cell name.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 15:16:42 -07:00
Alem Tuzlak ccc2eabfc2 test(showcase/langgraph-python): regression coverage for A2UI middleware-intercept + display_flight loop
Three classes of regression are now pinned:

1. Secondary-LLM tool name doesn't collide with the A2UI middleware's
   default intercept list (`render_a2ui`). New
   `src/agents/test_a2ui_internal_tools.py` parametrises over
   `beautiful_chat._design_a2ui_surface`, `a2ui_dynamic._design_a2ui_surface`,
   and `a2ui_fixed.display_flight` and asserts none match the
   middleware's `a2uiToolNames` default. Catches accidental rename
   reverts that would re-enable the bypass.

2. `generate_a2ui` force-pins the canonical `catalog_id` even when the
   secondary LLM hallucinates a wrong one. The new test stubs
   `ChatOpenAI` with a fake response carrying a bogus catalogId and
   asserts the surface op carries the module's `CUSTOM_CATALOG_ID`.

3. `generate_a2ui` short-circuits with a clean error string when the
   LLM emits a root component without a `component` field — never
   feeds the renderer the partial tree that surfaced as the "Cannot
   create component root without a type" infinite-loop.

7 unit tests, all green locally (`pytest src/agents/test_a2ui_internal_tools.py`).

E2E tests on the same fixes now also assert:
- No `A2UI render error: Catalog not found` banner on the page after
  Beautiful Chat → Sales Dashboard, Declarative Gen UI → BarChart, and
  A2UI Fixed Schema → Find SFO → JFK round-trips.
- No `Cannot create component … without a type` banner on the same
  three pills.
- Exactly ONE flight card on A2UI Fixed Schema (was 6+ on deploy
  pre-fix from the `display_flight` loop) — `Flight Details` count
  pinned to 1, `Book flight` count pinned to 1.
- At most one ResponsiveContainer on the BarChart pill (loops would
  stack multiple).
- At most two ResponsiveContainers on Beautiful Chat → Sales Dashboard
  (one pie + one bar = single dashboard render).
2026-05-08 19:07:52 +02:00
Alem Tuzlak c91a9c9aff fix(showcase/langgraph-python): A2UI fixed-schema loop + propagate rename to shared tools and aimock
Two follow-up fixes layered on the previous internal-tool rename:

(1) `a2ui_fixed.py` — fixed-schema demo infinite loop on deploy. The
`display_flight` tool returns the raw `a2ui.render(...)` JSON descriptor
as its tool result. gpt-4o-mini reads that opaque blob, can't tell the
flight was rendered, and re-calls `display_flight` indefinitely (visible
on the deployed showcase as 6+ duplicate flight cards stacked under
repeated assistant text). Local was just lucky.

Hardened the docstring + system prompt to spell out: the JSON return
value is the surface descriptor, the card is already rendered, do NOT
call again, reply with one short confirmation and stop.

(2) Rename `render_a2ui` → `_design_a2ui_surface` in shared and
langgraph-python parity copies of `tools/generate_a2ui.py` (+
`tools/__init__.py` re-export `RENDER_A2UI_TOOL_SCHEMA` →
`DESIGN_A2UI_SURFACE_TOOL_SCHEMA`), and in `showcase/shared/typescript/
tools/generate-a2ui.ts`. These shared helpers were the source-of-truth
for the secondary-LLM tool name across integrations; renaming here keeps
parity with the langgraph-python agents already renamed in
`beautiful_chat.py` / `a2ui_dynamic.py`. Other framework integrations
keep their own `render_a2ui` for now (separate parity sweep).

(3) `showcase/aimock/feature-parity.json` — added a sibling fixture
matching `toolName: "_design_a2ui_surface"` for the beautiful-chat Sales
Dashboard pill so the langgraph-python e2e suite still hits a
deterministic mock on Railway. The original `render_a2ui` fixture is
kept above it so other integrations whose secondary LLM still requests
`render_a2ui` continue to match.

(4) Comment update in `beautiful-chat.spec.ts` to name the new internal
tool.
2026-05-08 18:49:53 +02:00
Alem Tuzlak 8c7ea92bb1 fix(showcase/beautiful-chat): render A2UI surfaces (fixed + dynamic schema)
Search Flights and Sales Dashboard pills both produce visible surfaces
on the langgraph-python beautiful-chat demo. Three independent bugs were
masking each other:

- Flight TypedDict required `id` + `statusIcon`, which the aimock fixture
  doesn't supply. langchain rejected the call with `flights.0.id: Field
  required` and the agent surfaced the error string as the tool result.
  Made the type permissive (only the fields `_build_flight_components`
  reads need to be there).
- search_flights now expands flights into literal-children FlightCard
  components server-side instead of relying on the structural-children
  template form (the binder doesn't reliably expand it for our custom
  catalog — sibling demos avoid the form for the same reason).
- Sales Dashboard pill went into a tool-call loop because the
  userMessage+toolName fixtures matched both the initial call and the
  post-tool turn. Hoisted the toolCallId fixture above them so the
  follow-up turn returns content and breaks the loop.

Custom Row/Column reintroduced with `gap` support — the basic catalog's
versions ignore it, leaving cards squished. Children are array-of-strings
only (matches what the agent and fixture emit).

Two new e2e tests cover both pills end-to-end. 3s wait in beforeEach so
the v2 chat provider hydrates before the click dispatches. Full spec:
7/7 green.
2026-05-05 16:38:43 +02:00
Jordan Ritter dd06dd89d1 refactor(showcase): rename packages/ to integrations/
The showcase framework directories better reflect their role as
integration examples rather than distributable packages.
Renames showcase/packages/ -> showcase/integrations/ and updates
the test docker-compose file reference accordingly.
2026-04-28 07:47:35 -07:00