Skip to content

Detach generate_plugin_args() output from its testServer session#198

Merged
nbenn merged 1 commit into
mainfrom
196-plugin-args-snapshot
Jun 4, 2026
Merged

Detach generate_plugin_args() output from its testServer session#198
nbenn merged 1 commit into
mainfrom
196-plugin-args-snapshot

Conversation

@nbenn

@nbenn nbenn commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • shiny's upcoming module-scoped reactive cleanup (rstudio/shiny#4372) tears down session-scoped reactives when testServer() closes. generate_plugin_args() returned the board's live reactiveValues (and the nested block reactives), so callers that read them after the helper returns will hit "its module session has been destroyed."
  • Re-create the returned reactive parts on a NULL reactive domain (new internal snapshot_reactives()), so they outlive the setup session — the issue's snapshot suggestion combined with its withReactiveDomain(NULL, …) mechanism, applied in the helper rather than in the production board_server().
  • Keep types intact (reactiveValues stays reactiveValues, not plain data): blockr.dock reads server$cond via reactiveValuesToList(), which the literal isolate(reactiveValuesToList(rv)) suggestion would break.
  • Defer errors from not-yet-evaluable reactives (e.g. a block with unset inputs) to read time, matching the lazy behaviour of the live reactive — eager evaluation during the snapshot would otherwise fail the whole call.

I also ran the downstream consumers of this helper (blockr.code, blockr.dock's board_args tests) against the patched core; both stay green.

Fixes #196

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
R/utils-tests.R 94.91% <100.00%> (+1.43%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

shiny's upcoming module-scoped reactive cleanup tears down
session-scoped reactives when testServer() closes, which would break
callers that read the returned plugin args afterwards (issue #196).
Re-create the reactive parts on a NULL reactive domain, preserving
reactiveValues/reactiveVal types so downstream uses such as
blockr.dock's reactiveValuesToList(server$cond) keep working. Errors
from not-yet-evaluable reactives are deferred to read time, as the
live reactive would have raised them.
@nbenn nbenn force-pushed the 196-plugin-args-snapshot branch from d98dda3 to 6d58f9a Compare June 4, 2026 15:54
@nbenn nbenn marked this pull request as ready for review June 4, 2026 16:04
@nbenn nbenn added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 565c6df Jun 4, 2026
9 checks passed
@nbenn nbenn deleted the 196-plugin-args-snapshot branch June 4, 2026 16:10
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.

Heads-up: shiny session cleanup affects generate_plugin_args() tests (temporarily deferred for 1.14.0)

1 participant