Files
Library/docs/roadmap/MIGRATION.md
T

113 lines
8.5 KiB
Markdown

# Compatibility, migration, and rollback
Status: planned migration design. Current project version is 1.2.1 in
[CMakeLists.txt](../../CMakeLists.txt). Intentional source/behavior breaks target a major
release; exact release timing follows evidence gates, not this document's creation.
## Compatibility dimensions
| Dimension | Promise and verification |
| --- | --- |
| Source API | Existing entry points remain documented; changed types, errors, defaults and lifetimes have explicit old/new examples and deprecation or major-release handling. |
| CMake/package | Public `Void::<Module>` names and component closures are tested. C++ namespaces are not inferred from target names: `Void::Log` is a target while `Void::Logging` is an existing C++ namespace. |
| C++ binary ABI | Same-toolchain contract remains explicit; compiler, standard library, build/ABI flags, and interface versions must match where required. |
| Stable C plugin ABI | NEW versioned function tables and opaque handles have independent compatibility tests; existing C++ descriptors do not become C-compatible automatically. |
| Wire schemas | Protocol IDs, field encoding, optional/required fields and version negotiation are explicit. Unknown required semantics fail rather than being guessed. |
| Native storage formats | Every format has a version, integrity checks, recovery rules, and upgrade/rollback boundary. Unknown versions fail without rewriting data. |
| Signed update documents | Verify original bytes and preserve strict parser semantics and existing trust checks. |
| Observable behavior | Security defaults, limits, ordering, deadlines, loss policies and shutdown semantics are migration-relevant even if signatures compile. |
## Migration waves
### Wave A: establish consumer fixtures
Inventory supported public headers, namespaces, exported targets, default options and
error behavior from actual source. Add minimal installed and embedded consumers for
foundation, runtime, network, storage, plugins and test integration. Freeze representative
old-version fixtures before altering APIs. Record existing defects rather than freezing
unsafe behavior as an unconditional compatibility requirement.
### Wave B: add explicit new contracts and adapters
Introduce NEW lifetime/operation APIs beside existing conveniences where this preserves
clear semantics. Forwarding headers and deprecated wrappers may translate compatible
calls. An adapter must not hide asynchronous lifetime differences, insecure trust policy,
an unbounded queue, or a new mandatory dependency. Refuse an unsupported conversion rather
than returning success with weaker guarantees.
### Wave C: major-release transition
Group intentional breaks into a migration guide with before/after examples, diagnostics,
test updates, and capability/default changes. Consumer fixtures exercise both retained
compatibility paths and native new APIs. Removal of old entry points occurs only at the
declared version boundary; area plans name the affected signatures.
### Wave D: persistent and distributed evolution
Freeze the first native storage format before public durable-state use. Subsequent
upgrades validate source format and available disk space, write a new generation, verify
it, and switch the manifest atomically under the writer/recovery protocol. Preserve the
old generation until the declared rollback boundary and retention policy allow removal.
No blind downgrade follows new-format writes. Export/import and backup/restore provide
the explicit path when a backward-compatible downgrade is impossible.
## Area migration obligations
| Area | Old/new boundary | Required consumer evidence |
| --- | --- | --- |
| Core/Functional | Error categories, formatting adapters, foundation dependency cleanup | Existing representations and error chains; minimal consumer with optional packages absent |
| Containers/Memory | Allocator-aware variants and changed invalidation/ownership | Move-only values, allocator lifetime, stable-handle/invalidation examples, old default behavior |
| Data/Binary/Text | Exact integers, checked conversions, Unicode/limit policies | Large identifiers round-trip; overflow errors; old strict signed documents remain accepted/rejected identically |
| Async/IO | Borrowed queued handles and detached work toward structured ownership | Cancellation/parked destruction and explicit join; blocking bridge cannot deadlock its own executor |
| Net | Secure TLS defaults, total deadlines, redirect and streaming/session APIs | Private-CA correct-host tests; wrong-host failure; explicit legacy override if offered; no fallback to insecure mode |
| Service/Plugin | Reference convenience versus owning handles; new C ABI | Acquired old generation survives replacement; C/C++ paths have separate ABI tests and destruction ownership |
| Fsm/Scheduler | Terminal-state consistency and supervised children | Faulted termination, race loser cleanup, state checkpoint restore; no coroutine-frame serialization |
| Log/Observability | Bounded total memory, loss and flush semantics | Saturation counters and flush outcomes documented; context snapshots survive shared-library boundaries |
| Sqlite/Storage | SQLite integration remains independent; original engine is NEW | No implicit conversion of SQLite databases; adapters/export tools have explicit schemas |
| Archive/Update | Expanded workflows with existing safety/commit invariants | Traversal/symlink tests, exact signatures, health commit/reconcile and retention regressions |
| ShortUrl | Frozen V1 enum/member/virtual ordering | Same-toolchain V1 fixture; incompatible additions in V2 with explicit provider capability |
| Distributed | Versioned commands, membership and snapshot semantics | Mixed-version compatibility only for explicitly tested combinations; reject unsupported peers safely |
## Stable C ABI rules
Plugin owns the C boundary design and compatibility fixtures. The initial ABI includes
version and structure size, opaque instance handles, fixed-width fields, status values,
explicit buffer lengths and owner-provided release operations. Host and plugin negotiate
supported capabilities before invoking optional functions. An incompatible major ABI
fails before activation.
No STL object, C++ exception, RTTI identity, implicit ownership transfer, or allocator
pairing crosses the C boundary. Callback lifetime, threading and cancellation obligations
are contractual. Generation retirement waits for all acquired handles and owned work.
Adding a C ABI does not imply process isolation or protection from a malicious in-process
plugin; IPC isolation is a separate architecture choice.
## Rollback boundaries
- Source changes: revert an owned change only after reconciling dependent work and
preserving user modifications. Documentation never authorizes destructive Git actions.
- Plugin activation: before publication/commit, discard a failed candidate and keep the
active generation. After state has been committed externally, use compensating or
forward recovery according to that contract; do not pretend memory swapping undoes it.
- Update activation: preserve VersionStore's durable healthy-history commit marker.
Post-commit cleanup failure is retryable cleanup, not evidence to roll back healthy state.
- Storage: a committed durable batch is not rolled back by cancellation or a lost reply.
Failed migration before the manifest switch preserves the old authoritative generation;
recovery decides ambiguous switch outcomes from durable records.
- Replication: committed log history and applied position are authoritative. A node
restart or software downgrade cannot erase acknowledged committed operations.
## Tasks
| ID | Planned work | Acceptance |
| --- | --- | --- |
| X-MIG-01 | Consumer/API/default inventory and legacy fixtures | Every intentional change maps to an existing behavior and migration check. |
| X-MIG-02 | Shared adapter/deprecation policy and diagnostics | Wrappers preserve stated semantics and dependency bounds; incompatible cases fail explicitly. |
| X-MIG-03 | Major-release migration guide and examples | All source/behavior breaks have before/after instructions and tested consumers. |
| X-MIG-04 | C ABI/wire/disk compatibility matrices | Format versions and supported combinations are explicit; unknown inputs fail safely. |
| X-MIG-05 | Upgrade, recovery and rollback rehearsals | Failures at each commit boundary yield a defined authoritative state and reproducible recovery. |
These tasks depend on the area interfaces and their [contract gates](DEPENDENCIES.md).
Feature owners own compatibility tests; root owns cross-area versioning and release
composition. A documentation review cannot substitute for actual upgrade rehearsals.