@@ -4,8 +4,13 @@ OpenStatSpec separates transformation syntax, canonical meaning, and database
44mutation. This lets multiple language frontends produce the same plan without
55coupling the executor to any one language.
66
7- The implemented frontend accepts a small SPSS-like subset: ` RECODE ` ,
8- ` VARIABLE LABELS ` , and ` VALUE LABELS ` . Stata and SAS are not implemented.
7+ The implemented bounded SPSS-like frontend accepts ` RECODE ` , sequential
8+ ` COMPUTE ` and ` IF ` , ` VARIABLE LABELS ` , ` VALUE LABELS ` , numeric ` FORMATS ` ,
9+ ` VARIABLE LEVEL ` , and ` EXECUTE ` . Predicates support typed variable/literal
10+ operands, parentheses, numeric comparisons, ` AND ` , and ` OR ` . String comparison
11+ and v0.2 string assignment fail closed until exact profile-independent
12+ collation and explicit-width semantics are available; arbitrary SPSS, Python,
13+ and SQL expressions are rejected. Stata and SAS are not implemented.
914
1015## Architecture
1116
@@ -106,9 +111,13 @@ result = openstatspec.apply_spss_in_place(
106111 dataset_id = " responses" ,
107112 actor = " agent@example.org" ,
108113 source_text = """
109- RECODE age (18 THRU 34 = 1) (35 THRU 64 = 2).
110- VARIABLE LABELS age 'Age group'.
111- VALUE LABELS age 1 '18-34' 2 '35-64'.
114+ COMPUTE target = 0.
115+ IF (source_a = 1 AND source_b = 1) target = 1.
116+ VARIABLE LABELS target 'Example label'.
117+ VALUE LABELS target 0 'No' 1 'Yes'.
118+ FORMATS target (F1.0).
119+ VARIABLE LEVEL target (NOMINAL).
120+ EXECUTE.
112121 """ ,
113122)
114123```
@@ -130,20 +139,25 @@ On Dolt, also pass `--expected-branch` and `--expected-head`.
130139Every successful apply preserves the logical ` dataset_id ` and physical
131140schema/table identity. It creates no derived dataset, output table, full-table
132141copy, staging table, snapshot, rollback artifact, or recovery/history layer.
133- Existing-target recodes use direct ` UPDATE ` ; label operations mutate existing
134- catalog rows.
135-
136- SQLite and PostgreSQL may add a numeric target where native transactions make
137- the complete operation atomic. MySQL, MariaDB, and Dolt reject target-creating
138- plans before the first mutation because implicit-commit DDL could leave a
139- partial apply. Their target column and metadata must already exist.
140-
141- Dolt is the sole history, diff, branch, and rollback layer for Dolt-backed
142- datasets. Before mutation, the executor verifies the expected branch and
143- ` HEAD ` and requires clean ` dolt_status ` . Success changes the same working set
144- without changing ` HEAD ` . OpenStatSpec does not call ` DOLT_COMMIT ` , switch
145- branches, merge, reset, tag, or create a hidden recovery commit. The caller
146- reviews ` dolt diff ` and separately decides whether to commit or restore.
142+ Assignments and recodes use ordered ` UPDATE ` statements; later operations see
143+ earlier results. Label, value-label, format, and measurement-level operations
144+ update both the normative and compatibility catalogs.
145+
146+ A numeric create target is supported atomically on SQLite and PostgreSQL.
147+ MySQL, MariaDB, and Dolt reject ` target_mode=create ` before mutation. On those
148+ profiles a separate versioned stage must first provision the nullable numeric
149+ physical column and both catalog representations; the transformation executor
150+ then sees a pre-existing target and performs no schema DDL.
151+ The public operation reports success only after physical data, both metadata
152+ representations, and the compact audit row are mutually complete.
153+
154+ Before Dolt mutation, the executor verifies the expected branch and ` HEAD ` and
155+ requires clean ` dolt_status ` . Success changes the same working set without
156+ changing ` HEAD ` ; OpenStatSpec does not call ` DOLT_COMMIT ` , ` DOLT_RESET ` , switch
157+ branches, merge, tag, or create a hidden recovery commit. It rechecks branch,
158+ HEAD, and a clean working set after locking the dataset and immediately before
159+ mutation. The caller reviews a successful ` dolt diff ` and
160+ separately decides whether to commit or restore.
147161
148162## Audit and provenance
149163
0 commit comments