Skip to contents

Maintains 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.

Usage

mod_spec_controls_server(id, spec_rv, last_diff_rv = NULL, history = NULL)

Arguments

id

Module namespace ID.

spec_rv

A shiny::reactiveVal holding the current validated spec_ir.

last_diff_rv

Optional shiny::reactiveVal holding the latest spec_diff.

history

Optional spec_history() object; created automatically from the initial spec_rv() when NULL.

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
  }
)