Skip to content

fix: run Shiny E2E apps as subprocesses (demonstrate shinychat main issue) - #279

Merged
cpsievert merged 5 commits into
mainfrom
fix/e2e-shiny-app-subprocess
Aug 27, 2026
Merged

fix: run Shiny E2E apps as subprocesses (demonstrate shinychat main issue)#279
cpsievert merged 5 commits into
mainfrom
fix/e2e-shiny-app-subprocess

Conversation

@cpsievert

@cpsievert cpsievert commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

The first commit pins shinychat to git main to demonstrate that shinychat main alone (specifically posit-dev/shinychat#280) breaks the Shiny sidebar E2E tests: the in-process threaded uvicorn fixtures share Shiny's process-global, loop-bound reactive lock across apps, and the second app's session dies on lock contention.

The second commit rewrites the Shiny Playwright fixtures to use shiny.pytest.create_app_fixture, which runs each app as a subprocess (matching Shiny's own test suite and our Streamlit fixtures), eliminating the shared-lock hazard.

Expected: E2E fails on the first commit (sidebar title tests), passes after the second.

Later commits adapt the viz Playwright suites (test_10–12) to shinychat main's tool-result DOM (routed results render as .shiny-tool-card inside .shiny-chat-tool-group; the .shiny-tool-result wrapper is now fallback-only) — moved here from #274 — and fix test_13 to use ShinyAppProc.url.

Demonstrates that shinychat main alone breaks the Shiny sidebar E2E
tests (test_03_sidebar_apps.py title tests) due to a timing regression
introduced in posit-dev/shinychat#280 interacting with the in-process
app servers used by the Playwright fixtures.
…_fixture

The threaded in-process uvicorn fixtures shared Shiny's process-global,
loop-bound reactive lock across apps. When two apps on different event
loops contended for the lock, the session's message handler crashed
with 'bound to a different event loop' and the chat message was dropped,
hanging the sidebar title tests. shinychat main (posit-dev/shinychat#280)
widened that race window enough to fail CI reliably.

create_app_fixture runs each app in its own subprocess (as Shiny's own
test suite does), giving each app its own loop and lock. This matches
how the Streamlit fixtures already work.
@cpsievert

Copy link
Copy Markdown
Contributor Author

Update: the pin-only commit (bf87e71) hit the 30-minute E2E timeout as expected — failed tests included both sidebar title tests (the reactive-lock race) and the test_10 viz inline tests (main's viz tests expect shinychat 0.6.x tool-result DOM; those test updates live in #274).

The fixture-rewrite commit (89caac3) should fix the sidebar title failures. The viz inline failures are expected to remain here since this PR doesn't include #274's test updates.

shinychat main (176a8fc) replaced the conditional send/cancel/spinner
button classes with a single button using data-state. The
.shiny-chat-btn-cancel class no longer exists.
@cpsievert

Copy link
Copy Markdown
Contributor Author

Follow-up: the cancel-test failures in the post-fix runs were not caused by the fixture change. The @main pin moved from dev38 (a17dbf3) to dev40 (909ed8c) between CI runs, and dev40 includes posit-dev/shinychat#350, which replaced the .shiny-chat-btn-cancel class with a data-state attribute on the send button. Verified locally that dev40 breaks those tests with both the old threaded and new subprocess fixtures. The third commit updates the selectors. Remaining expected red: the test_10/11/12 viz tests, which need #274's updates for shinychat main's tool-result DOM.

shinychat main (#283) renders routed tool results as .shiny-tool-card
inside .shiny-chat-tool-group; the .shiny-tool-result wrapper is now
fallback-only. Update the viz Playwright suites to match.

Moved from #274, where these changes were mixed with the framed
presentation feature.
app_01_hello is now a create_app_fixture (ShinyAppProc), so page.goto
needs .url. Missed in 89caac3.
@cpsievert
cpsievert merged commit dc47e3c into main Aug 27, 2026
7 checks passed
@cpsievert
cpsievert deleted the fix/e2e-shiny-app-subprocess branch August 27, 2026 00:06
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