Skip to contents

Tracks validated spec_ir snapshots together with semantic diff_spec_ir() transitions and human-readable labels so both programmatic pipelines and dynamic Shiny modules can undo and redo visual widget tweaks and conversational refinements seamlessly.

Usage

spec_history(initial_spec = NULL, max_entries = 50L)

Arguments

initial_spec

Optional initial validated spec_ir object.

max_entries

Positive integer maximum number of snapshots retained in the stack (defaults to 50L).

Value

An S3 object of class spec_history.

Examples

s1 <- new_spec_ir(hierarchy = list(levels = 1L, n_obs = 100L))
h <- spec_history(s1)
s2 <- refine_spec(s1, "set sample size to 250")$spec
history_push(h, s2, label = "Increase N to 250")
history_can_undo(h)
#> [1] TRUE
undone <- history_undo(h)
undone$spec$hierarchy$n_obs
#> [1] 100