Sonata — versioning, compatibility and migration
Three versions
| What | Where | Current |
|---|---|---|
| Language | sonata_ir::LANGUAGE_VERSION, the optional first line sonata 0.1 of a file |
0.1 |
| IR schema | sonata_ir::IR_VERSION, field ir_version of a serialised Program |
1 |
| Toolchain | Cargo workspace version, sonata --version |
0.1.0 |
They move independently. The language version describes what source means; the IR version describes the JSON shape exchanged between tools; the toolchain version describes a build.
The version line
A file may start with sonata MAJOR.MINOR. It is optional in 0.x.
- No line: the file is compiled as the language of the toolchain.
- Same or older version: accepted. Behaviour of older versions is preserved as described below.
- Newer version than the toolchain: error I7004. The toolchain never guesses at syntax it does not know.
The formatter keeps the line as written and never adds one.
Compatibility promise
Before 1.0 (now):
- A patch release (0.1.x) never changes the meaning of a program that compiled without
error, and never turns a valid program into an invalid one, except to fix a compiler bug that
contradicted this specification; such fixes are listed in
CHANGELOG.mdunder "Behaviour". - A minor release (0.2) may change syntax or meaning. Every such change comes with: an entry
in this page, a diagnostic that explains the old form, and, where a mechanical rewrite
exists, a fix that
sonata fmt --migrateapplies (planned with the first breaking change; there is nothing to migrate in 0.1).
From 1.0: minor releases only add; a program valid in 1.x stays valid and keeps its meaning in every later 1.y. Removals need a major version and one full minor cycle of deprecation warnings.
"Meaning" is the Musical IR: the same source, seed and registry give the same Program
(notes, times, automation, routing). Audio is defined by the engines and is covered by the
registry rules below, not by the language promise.
What can change without a language version
- The standard library may gain names. A project definition always shadows a standard one (never an error), so a new standard name cannot break a project. Standard names are not removed or redefined within a major version.
- The registry (engines, effects, patch nodes, their parameters and presets) is versioned
with the toolchain. Adding an engine, an effect, a parameter with a default, or a preset is
compatible. Renaming or removing one, narrowing a range, or changing the sound of a preset
is a behaviour change: it is listed in
CHANGELOG.md, and projects record the toolchain version that last rendered them so the studio can warn. - Diagnostics: wording, suggestions and fixes may improve at any time. Codes are stable. New warnings may appear in a minor release; warnings never fail a build.
- Quotas: defaults may be raised, never lowered, within a major version.
Randomness
seed selects a SplitMix64 stream; each track draws from its own stream derived from the seed
and the track's declaration order; composition-level code draws from a separate stream. The
generator, the derivation and the algorithms of random, random_int, choose and shuffle
are part of the language: changing any of them is a breaking change.
Consequences worth knowing: inserting a track before others changes their streams (their
order changed); adding a track after others does not. Adding a random() call in a track
shifts later draws of that track only.
IR schema
ir_version is bumped on any incompatible change of the serialised Program or graph. Readers
must refuse a newer ir_version. Fields may be added with defaults without a bump
(#[serde(default)]), so readers must ignore unknown fields.
Migration log
| Version | Change | Migration |
|---|---|---|
| 0.1 | First version. | — |