
Return-Shape Contracts for EventStudy Pipeline Results
Source:R/shape_contracts.R
eventstudy-shape-contracts.RdThe shape-contract system locks the column names and types of the EventStudy pipeline's result tibbles against accidental structural drift. It is designed for development and CI use only.
Default: OFF. When the option is unset (the default) the entire shape-contract path is a strict no-op — every existing caller and the full test suite are completely unaffected.
Opt-in:
options(EventStudy.shape_contracts = TRUE)
Philosophy (mirrors the degenerate-input contract):
On a column-name or type mismatch the contract emits exactly one
warning(), naming the context and the specific drift, and then
returns invisibly. It never calls stop(). The
correctly-shaped is_fitted = FALSE degenerate output (same
column names, NA-propagated values) is treated as a valid
shape and produces no warning.
Coverage:
Single-event statistics tibbles:
ART(ARTTest) andCART(CARTTest), including theiris_fitted = FALSEdegenerate variants.Multi-event AAR/CAAR statistics tibble:
CSectT(CSectTTest) and all other multi-event result tibbles, including theiris_fitted = FALSEdegenerate variants.
Configuration:
Via package option:
options(EventStudy.shape_contracts = TRUE)Default is
FALSE(off).