SPB Git

Repository Public

compatibility.md 4.0 KB 87 lines markdown

1<!--2ORIX Sonata3File: Documentation/spec/compatibility.md4Author: Simon-Pierre Boucher5Contact: contact@spboucher.ai6-->7# Sonata — versioning, compatibility and migration89## Three versions1011| What | Where | Current |12|---|---|---|13| Language | `sonata_ir::LANGUAGE_VERSION`, the optional first line `sonata 0.1` of a file | 0.1 |14| IR schema | `sonata_ir::IR_VERSION`, field `ir_version` of a serialised Program | 1 |15| Toolchain | Cargo workspace version, `sonata --version` | 0.1.0 |1617They move independently. The language version describes what source means; the IR version18describes the JSON shape exchanged between tools; the toolchain version describes a build.1920## The version line2122A file may start with `sonata MAJOR.MINOR`. It is optional in 0.x.2324* No line: the file is compiled as the language of the toolchain.25* Same or older version: accepted. Behaviour of older versions is preserved as described below.26* Newer version than the toolchain: error I7004. The toolchain never guesses at syntax it does27  not know.2829The formatter keeps the line as written and never adds one.3031## Compatibility promise3233Before 1.0 (now):3435* A **patch** release (0.1.x) never changes the meaning of a program that compiled without36  error, and never turns a valid program into an invalid one, except to fix a compiler bug that37  contradicted this specification; such fixes are listed in `CHANGELOG.md` under "Behaviour".38* A **minor** release (0.2) may change syntax or meaning. Every such change comes with: an entry39  in this page, a diagnostic that explains the old form, and, where a mechanical rewrite40  exists, a fix that `sonata fmt --migrate` applies (planned with the first breaking change;41  there is nothing to migrate in 0.1).4243From 1.0: minor releases only add; a program valid in 1.x stays valid and keeps its meaning in44every later 1.y. Removals need a major version and one full minor cycle of deprecation45warnings.4647"Meaning" is the Musical IR: the same source, seed and registry give the same `Program`48(notes, times, automation, routing). Audio is defined by the engines and is covered by the49registry rules below, not by the language promise.5051## What can change without a language version5253* **The standard library** may gain names. A project definition always shadows a standard one54  (never an error), so a new standard name cannot break a project. Standard names are not55  removed or redefined within a major version.56* **The registry** (engines, effects, patch nodes, their parameters and presets) is versioned57  with the toolchain. Adding an engine, an effect, a parameter with a default, or a preset is58  compatible. Renaming or removing one, narrowing a range, or changing the *sound* of a preset59  is a behaviour change: it is listed in `CHANGELOG.md`, and projects record the toolchain60  version that last rendered them so the studio can warn.61* **Diagnostics**: wording, suggestions and fixes may improve at any time. Codes are stable.62  New warnings may appear in a minor release; warnings never fail a build.63* **Quotas**: defaults may be raised, never lowered, within a major version.6465## Randomness6667`seed` selects a SplitMix64 stream; each track draws from its own stream derived from the seed68and the track's declaration order; composition-level code draws from a separate stream. The69generator, the derivation and the algorithms of `random`, `random_int`, `choose` and `shuffle`70are part of the language: changing any of them is a breaking change.7172Consequences worth knowing: inserting a track *before* others changes their streams (their73order changed); adding a track *after* others does not. Adding a `random()` call in a track74shifts later draws of that track only.7576## IR schema7778`ir_version` is bumped on any incompatible change of the serialised Program or graph. Readers79must refuse a newer `ir_version`. Fields may be added with defaults without a bump80(`#[serde(default)]`), so readers must ignore unknown fields.8182## Migration log8384| Version | Change | Migration |85|---|---|---|86| 0.1 | First version. | — |87
Files main
Menu

Theme