
Dynamic Specification Controls Shiny Module (Server)
Source:R/mod-controls.R
mod_spec_controls_server.RdMaintains loop-free bidirectional synchronization between spec_rv and the
dynamically synthesized UI widgets, backed by a spec_history() undo/redo
stack that tracks both visual widget edits and conversational updates.
Structural IR changes re-synthesize the active control layout; value-only IR
changes update active widgets in place; UI edits are validated through
patch_spec_from_control() and rejected with inline diagnostic alerts if
they violate statistical sanity guardrails.
Arguments
- id
Module namespace ID.
- spec_rv
A
shiny::reactiveValholding the current validatedspec_ir.- last_diff_rv
Optional
shiny::reactiveValholding the latestspec_diff.- history
Optional
spec_history()object; created automatically from the initialspec_rv()whenNULL.
Value
A list of reactives and accessors: descriptor, guardrail_error,
diff, history, can_undo, and can_redo.
Examples
spec_rv <- shiny::reactiveVal(new_spec_ir())
shiny::testServer(
mod_spec_controls_server,
args = list(spec_rv = spec_rv),
{
session$setInputs(n_obs = 300)
spec_rv()$hierarchy$n_obs
}
)