
Compute a structured semantic diff between two spec_ir objects
Source: R/spec-diff.R
diff_spec_ir.RdCompares two spec_ir specifications path-by-path and returns a structured
spec_diff report suitable for CLI auditing and live visual diff badges in
dynamic Shiny UIs.
Arguments
- old
Previous
spec_irobject (orNULLwhen comparing against empty state).- new
Updated
spec_irobject.- ignore_rationale
Logical; if
TRUE(default), ignores changes indefaults_rationale.- ignore_metadata
Logical; if
TRUE, ignores changes inmetadata. Defaults toFALSE(tracksmetadata$titleandmetadata$description).
Value
An S3 object of class spec_diff with elements:
changes: data.frame (path,section,field,change_type,old_value,new_value,summary).changed_paths: character vector of changed dotted paths.changed_sections: unique character vector of changed top-level sections.n_changes: integer number of semantic changes.has_changes: logical scalar.
Examples
s1 <- new_spec_ir(hierarchy = list(levels = 1L, n_obs = 100L))
s2 <- new_spec_ir(hierarchy = list(levels = 1L, n_obs = 250L))
diff_spec_ir(s1, s2)
#>
#> ── spec_diff (1 change across 1 section)
#> • hierarchy.n_obs: 100 -> 250