diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d8097..e295a02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,43 @@ ## Unreleased -### v0.5.0 (prepared; not yet published) +### v0.5.1 + +OpenStatSpec `v0.5.1` is a documentation patch. It clarifies wording and +records, as informative notes, behavior on which the published implementations +already agree. It adds no normative requirement and changes no conformance +artifact, schema, manifest, case count or hash; a later minor release may make +the noted diagnostics normative. The questions were found while building an independent Rust +implementation (Statscraft). + +- Recorded `v0.5.0` as published in the README, the Database I/O policy + status and the changelog, and removed its preparation notes from + `RELEASING.md`. +- Documented the conformance manifest keys in `conformance/README.md`, + including `expected_plan_case_0_1` (a Frontend 0.1 case id), binding cases + that give no plan or data, and the generated preflight fixture width. +- Frontend `RECODE` (informative): a reversed numeric range returns `invalid_numeric_range` + under Frontend 0.1 and 0.2 and `invalid_variable_range` under 0.3; + `HIGHEST THRU number` and `number THRU LOWEST` return `spss_syntax_error`; + an existing `INTO` target returns `target_already_exists`; a clause that + mixes a value list with a range or `SYSMIS`, or joins two ranges, returns + `spss_syntax_error`. +- SAV/ZSAV 1.0 (informative): a `LOWEST` or `HIGHEST` missing-range endpoint leaves the + matching `numeric_lower` or `numeric_upper` NULL. +- SPSS profile (informative): quoting every identifier is one way to meet the + reserved-word preflight requirement. +- In-place binding (informative): a Plan 0.1 create carries no string width; + the published bindings refuse a string create target before mutation, and + one that creates it should document its width rule. Added a runner note on + evidencing the Dolt completion check from a second session. +- Added an informative note that MySQL, MariaDB and Dolt catalog column types + are implementation-declared. + +## v0.5.0 - 2026-09-07 + +OpenStatSpec `v0.5.0` publishes the optional Database I/O Execution Policy v1 +at immutable specification commit `864e84479f554b8ee250ffed44c4dfb963750d4a`. +The release tag is the immutable specification identity for this release. - Add normative optional `openstatspec-database-io-v1`, explicitly selected by capability field `database_io_policy`. Reads, validation and export perform diff --git a/README.md b/README.md index e18a60a..af79cc7 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ remains an explicitly unsupported [future dialect](docs/mssql-dialect-roadmap.md ## Optional database I/O execution policy -Prepared for specification `v0.5.0`, the normative optional +Published in specification `v0.5.0`, the normative optional [Database I/O Execution Policy v1](docs/database-io-policy-v1.md) is explicitly selected with `database_io_policy: "openstatspec-database-io-v1"`. It requires database-read-only reads, validation and exports (including errors @@ -23,8 +23,8 @@ and loss diagnostics), and permits default Dolt writes on packaged exact tested 2.2.2/2.2.3 policy backed by adapter release CI, without user evidence files. External declarations remain an optional advanced override. Unselected adapters retain existing requirements; SAV 1.0 semantics, schemas, fixtures and canonical -Plan/Frontend/Binding contracts are unchanged. Publication and downstream -adapter support remain separately gated. +Plan/Frontend/Binding contracts are unchanged. Downstream adapter support +remains separately gated. ## Core contract diff --git a/RELEASING.md b/RELEASING.md index 3e6fd6d..95df955 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -12,27 +12,6 @@ Package tags use the `package-vX.Y.Z` convention; specification tags use `vX.Y.Z`. A specification tag MUST NOT publish the package, and a package tag MUST match the version declared in `pyproject.toml`. -## Prepared v0.5.0 scope - -This release prepares the normative optional -[Database I/O Execution Policy v1](docs/database-io-policy-v1.md). It is not -published until the gates below complete. Release notes MUST identify explicit -`database_io_policy` selection, database-read-only export with returned loss -diagnostics, and packaged exact tested Dolt 2.2.2/2.2.3 write policy with optional -external evidence. Existing unselected-profile requirements, SAV 1.0 semantics -and fixtures, schemas, and canonical Plan/Frontend/Binding artifacts are unchanged. -This is a pre-1.0 minor optional addition under [VERSIONING](VERSIONING.md). - -Run `python -m pytest` and `python tools/validate_repository.py` at the selected -commit. Adapter package release CI supplies real exact-version write and -read-only/failure-path evidence under the new policy; neither fabricated -repository declarations nor user-supplied evidence files are release substitutes. -Python `v0.8.0` and PHP `v0.7.0` are downstream adapter release targets, not -conformance claims made by this specification. Their pins and publication are -managed separately. The companion `openstatspec-specification` distribution -remains `0.1.0`: no package API, schema or validator contract change requires a -package release for this documentation policy addition. - ## Before preparing a release - Choose an exact reviewed commit on the appropriate branch and record its diff --git a/conformance/README.md b/conformance/README.md new file mode 100644 index 0000000..ef534c2 --- /dev/null +++ b/conformance/README.md @@ -0,0 +1,99 @@ +# Conformance manifests + +Each JSON file in this directory is the machine-readable conformance manifest +of one profile. This page describes the manifest keys and how a runner reads +them. It adds no requirement; the profile documents remain normative. + +## Common keys + +- `manifest_version`, `profile` (display name) and `contract` (the exact + contract identifier under test; the SAV/ZSAV manifest has none). +- `schema`, `request_schema`, `plan_schema`, `plan_schemas` and `audit_schema` + are paths relative to the manifest file. +- `cases`: ordered case objects. `id` is unique within the manifest, also after + inherited cases are expanded. `expected_error` is the stable diagnostic code + the case must return, or null (or absent) for a successful case. + +## Transformation Plan manifests + +`transformation-plan-0.1.json` and `transformation-plan-0.2.json`: each case +gives the `plan` object under test and its `expected_plan_hash` (lowercase +SHA-256 of the canonical plan bytes), which is null for a failing case. + +## SPSS syntax frontend manifests + +`spss-syntax-frontend-0.1.json`, `-0.2.json` and `-0.3.json`: each case gives +the complete frontend `request` (`contract`, `input_alias`, `input_schema`, +`source_text`) and the `expected_source_hash`. A successful case declares +exactly one expected plan with one of these keys: + +- `expected_plan`: the expected plan inline. +- `expected_plan_case`: a case `id` in a Transformation Plan manifest + (`transformation-plan-0.1.json` for Frontend 0.1 cases, + `transformation-plan-0.2.json` for Frontend 0.2 cases). The expected plan + and hash are that case's `plan` and `expected_plan_hash`. +- `expected_plan_0_1`: an exact Plan 0.1 object inline, used in the 0.2 and + 0.3 manifests for programs that stay inside the Plan 0.1 subset. +- `expected_plan_case_0_1`: a case `id` in the Frontend 0.1 manifest + `spss-syntax-frontend-0.1.json`, not in a plan manifest. Used only in the + 0.2 and 0.3 manifests. The expected plan is that Frontend 0.1 case's + resolved expected plan (its inline `expected_plan`, or the plan named by its + `expected_plan_case`). + +`expected_plan_contract` optionally names the expected plan's contract. +`expected_plan_hash`, when present, is the hash of the resolved expected plan. +`expected_output_metadata` lists variable metadata expected after the plan is +applied. + +The 0.3 manifest has `inherited_manifests`. Each entry names an older frontend +`manifest` whose cases also run under Frontend 0.3, the +`request_contract_override` written into every inherited request, and +`superseded_cases`, which maps an inherited case id to the declared 0.3 case +that replaces it. Inherited case ids are prefixed with their source version, +for example `0.1/recode-labels-and-value-labels`. + +## In-place binding manifests + +`in-place-transformation-0.1.json` and `in-place-transformation-0.2.json`: +each case names its `database_profile`. A case states its input as +`source_text` (0.1) or as the paired `applied_plan_case` and +`applied_frontend_case` (0.2), which name a Transformation Plan 0.2 case and a +Frontend 0.2 case that lower to the same plan. Dolt context is given by +`expected_context`/`observed_context` (0.1) or `expected_branch`, +`expected_head` and `working_set_clean` (0.2). Other keys describe the stated +state and expectations: `actor`, `target_mode`, `target_preprovisioned`, +`before`, `after`, `before_rows`, `after_rows`, `after_failure`, +`expected_audit`, `required_audit_fields`, `forbidden_artifacts`, +`mutation_started`, `failure_point`, `completion_context` and +`rollback_probe`. + +Some cases give no plan (`source_text` or `applied_plan_case`) and no data, +for example `mysql-create-target-fails-before-mutation`, +`mariadb-create-target-fails-before-mutation`, +`dolt-create-target-fails-before-mutation`, +`dolt-empty-actor-fails-before-mutation` and the 0.1 `reject-dolt-*` cases. +They test a check made before mutation. A runner may run such a case with any +valid plan of the stated `target_mode` against a synthetic dataset; the +expected diagnostic and `mutation_started` do not depend on that choice. When a +case states no `target_mode`, as `dolt-empty-actor-fails-before-mutation` +does, a runner can use a `replace` plan, so that no create-target refusal +(such as `schema_change_not_atomic` on Dolt) comes before the check the case +names. For the completion check in +`dolt-context-changed-after-mutation-rolls-back`, see the runner note in +[In-Place Transformation Binding 0.2](../docs/transformation-plan-sql-binding-0.2.md). + +## SPSS SAV/ZSAV manifest + +`spss-sav-zsav-1.0.json` lists `required_capabilities`, the round-trip +`comparison` and `fixtures`. Each fixture gives `id`, `source` (relative to +this directory), `directions`, `expects` and, where given, `expected_catalog`. +The `preflight-failure` source `fixtures/preflight-too-wide.sav` is not +committed: as [`fixtures/README.md`](fixtures/README.md) states, the runner +generates it with one more variable than the target profile permits. + +## SQL Transformation Workflow manifest + +`sql-transformation-workflow-0.1.json` gives the `hash_profile`, input +`fixtures`, workflow `cases`, `recovery_cases` and `canonicalization_cases` +defined by the +[SQL Transformation Workflow Profile 0.1](../docs/sql-transformation-workflow-profile-0.1.md). diff --git a/docs/database-io-policy-v1.md b/docs/database-io-policy-v1.md index 6b7229e..a478de0 100644 --- a/docs/database-io-policy-v1.md +++ b/docs/database-io-policy-v1.md @@ -1,7 +1,7 @@ # Optional Database I/O Execution Policy v1 -Status: normative optional addition prepared for OpenStatSpec `v0.5.0`; -publication remains subject to [RELEASING](../RELEASING.md). +Status: normative optional addition released in OpenStatSpec `v0.5.0` at +immutable specification commit `864e84479f554b8ee250ffed44c4dfb963750d4a`. Terms **MUST**, **MUST NOT**, **SHOULD**, and **MAY** are normative. ## Explicit selection and precedence diff --git a/docs/spss-profile.md b/docs/spss-profile.md index 8aa8081..c94f885 100644 --- a/docs/spss-profile.md +++ b/docs/spss-profile.md @@ -23,7 +23,7 @@ This profile defines a source-faithful mapping for unencrypted SPSS `.sav` and ` An implementation must retain an exact source variable name in `variable.source_name`. A dialect profile may use that name as the physical column identifier only when it is safe. Otherwise it generates a deterministic unique identifier and records it in `variable.physical_name`. -This is not a loss of fidelity: source identity is represented by the recorded total mapping, not by coincidental identifier equality. Profiles must detect SQL reserved words, case-folding, collisions, identifier-length limits, and the reserved __ technical prefix during preflight. +This is not a loss of fidelity: source identity is represented by the recorded total mapping, not by coincidental identifier equality. Profiles must detect SQL reserved words, case-folding, collisions, identifier-length limits, and the reserved __ technical prefix during preflight. Informative note: quoting every physical identifier with the profile's quoting rule is one way to meet the reserved-word requirement. ## Required preflight diff --git a/docs/spss-sav-zsav-profile-1.0.md b/docs/spss-sav-zsav-profile-1.0.md index 4b5f07c..909eaa7 100644 --- a/docs/spss-sav-zsav-profile-1.0.md +++ b/docs/spss-sav-zsav-profile-1.0.md @@ -70,6 +70,8 @@ For every supported SAV/ZSAV import/export, the following dictionary semantics M - multiple-response sets, including name, label, MD/MC kind, ordered members, numeric or string MD counted value, category-label behavior, and label source; and - long UTF-8 string values, their declared widths, labels, and supported missing metadata without truncation. +Informative note: in a `missing_rule` range, the published implementations record a `LOWEST` endpoint in `lower_special` with `numeric_lower` NULL, and a `HIGHEST` endpoint in `upper_special` with `numeric_upper` NULL; the other endpoint holds its finite value. + A reader or writer that cannot preserve one of these items MUST declare the capability absent. An importer MAY retain unknown source extensions in a namespaced extension payload, but it MUST report a fidelity event rather than claim full profile fidelity. ## SAV and ZSAV diff --git a/docs/spss-syntax-frontend-profile-0.1.md b/docs/spss-syntax-frontend-profile-0.1.md index a97f04a..e7ead11 100644 --- a/docs/spss-syntax-frontend-profile-0.1.md +++ b/docs/spss-syntax-frontend-profile-0.1.md @@ -34,6 +34,15 @@ A selector is a comma-separated typed literal list, an inclusive numeric `lower THRU upper` range, or `SYSMIS`. A result is a typed literal, `SYSMIS`, or `COPY`. `ELSE = result` is permitted once and must be the final clause. +Informative note: the published implementations agree on these `RECODE` +diagnostics, which a later profile revision may make normative. An `INTO` +target that already exists case-insensitively (the command's own source, a +variable created by an earlier command, or a target repeated in the same +`INTO` list) returns `target_already_exists`. A comma that joins a literal list +with a range or `SYSMIS`, or joins two ranges, returns `spss_syntax_error`. A +range whose `lower` is greater than its `upper` returns `invalid_numeric_range`; +equal bounds are valid. The same diagnostics apply under Frontend 0.2. + With `INTO`, each plan operation uses `target_mode=create`; without it each source is also its target and the mode is `replace`. An omitted `ELSE` lowers to explicit `system_missing` for create and explicit `copy` for replace. An diff --git a/docs/spss-syntax-frontend-profile-0.3.md b/docs/spss-syntax-frontend-profile-0.3.md index 6ff32d0..6808896 100644 --- a/docs/spss-syntax-frontend-profile-0.3.md +++ b/docs/spss-syntax-frontend-profile-0.3.md @@ -111,8 +111,12 @@ is not included in an open range. Open ranges are inclusive and lower to the existing ordered `recode` range representation. Non-finite values, malformed finite numbers, and reverse ranges are rejected with `spss_syntax_error` or `invalid_variable_range` as -applicable. The finite-number token remains the exact ASCII grammar inherited -from Frontend 0.2 and is interpreted as an exact base-ten value before +applicable. Informative note: under this profile the published +implementations return `invalid_variable_range` for a reversed numeric range +such as `5 THRU 3` (Frontend 0.1 and 0.2 return `invalid_numeric_range` for the +same input), and `spss_syntax_error` for `HIGHEST THRU number` and +`number THRU LOWEST`, which are outside the open-range grammar. The finite-number token remains the exact ASCII grammar +inherited from Frontend 0.2 and is interpreted as an exact base-ten value before ties-to-even binary64 conversion. ## ADD VALUE LABELS diff --git a/docs/transformation-plan-sql-binding-0.1.md b/docs/transformation-plan-sql-binding-0.1.md index 1a2236e..2d5a3bf 100644 --- a/docs/transformation-plan-sql-binding-0.1.md +++ b/docs/transformation-plan-sql-binding-0.1.md @@ -23,6 +23,12 @@ For every successful apply: created; and - normal completion leaves no temporary physical object. +Informative note: a Plan 0.1 create operation carries no string width. The +published bindings refuse a create operation whose determined storage kind is +string before mutation, each with its own documented error code. A binding that +creates such a target documents the rule that sets its declared width. This +note adds no requirement. + OpenStatSpec does not version successful data states and does not implement rollback on any engine. A deployment uses its database's own transaction, backup, or version-control facilities. On Dolt, history, branching, diff, merge, diff --git a/docs/transformation-plan-sql-binding-0.2.md b/docs/transformation-plan-sql-binding-0.2.md index 4c8c835..f7c7d8d 100644 --- a/docs/transformation-plan-sql-binding-0.2.md +++ b/docs/transformation-plan-sql-binding-0.2.md @@ -58,6 +58,18 @@ before successful completion. Stable diagnostics are `dolt_context_required`, `dolt_branch_mismatch`, `dolt_head_mismatch`, `dolt_working_set_dirty`, and `dolt_context_changed`. +Conformance runner note (informative): inside an open Dolt transaction, +`HASHOF('HEAD')` and `dolt_branches` read from the applying session show that +transaction's snapshot, so a same-session read does not see a commit made +concurrently. A runner therefore evidences the completion check in +`dolt-context-changed-after-mutation-rolls-back` by fault injection: it makes +the concurrent commit from a second session at the case's `failure_point` and +supplies the resulting branch and HEAD to the adapter's completion check. The +case therefore checks the comparison, not how the adapter reads its completion +values: the existing completion check is only meaningful when that read +observes commits made after the apply transaction began, and this case does +not verify that read. This note adds no requirement. + The apply remains on the same branch and MUST NOT commit, switch, merge, reset, tag, or create a persistent recovery object. A successful apply leaves one inspectable Dolt working-set diff. The audit's before and after HEAD identities diff --git a/sql/dialect-profiles.md b/sql/dialect-profiles.md index e74c888..6a42afb 100644 --- a/sql/dialect-profiles.md +++ b/sql/dialect-profiles.md @@ -107,6 +107,13 @@ The profile applies only when all OpenStatSpec catalog and data tables use an engine with the declared behavior. An adapter MUST reject a non-transactional or incompatible storage configuration rather than claiming atomic import. +Informative note: the types in [`schema-outline.sql`](schema-outline.sql) are +logical. On MySQL, MariaDB, and Dolt the physical catalog column types are +implementation-declared; on MySQL and MariaDB, for example, a `TEXT` column +cannot be a primary or unique key without a prefix length. For example, an adapter can use +`VARCHAR(255)` for keyed text, `CHAR(36)` for UUID identifiers, and +`DATETIME(6)` for timestamps. This note adds no requirement. + ## Dolt profile The explicitly selected [Database I/O Execution Policy v1](../docs/database-io-policy-v1.md)