Skip to main content

Content releases

A release publishes a named set of changes atomically.

For the team workflow, see Launch several changes together.

Releases are part of authoring: an application that calls UseAuthoring has them, unless it leaves them out with authoring.WithoutContentReleases(), and only authored entity types (IVoxAuthoredEntity) are changed in them. Without releases there are no release scopes, release entity type, store, route, permission or scheduled publication of releases, and the admin has no Releases page.

A release is an authoring scope, release:{id}, beside the draft. Its changes are cells in that scope, eg at release:autumn|Language=sv, and they're merged into published content when the release is published. Reading in a release composes the entity like this, and then resolves the application contexts within it:

cell of the release
↓ otherwise
published content

So a contextual value keeps its precedence over a general change of the release: a published Swedish name is still read in Swedish in a release that only changes the general name, until the release changes or deletes the Swedish cell.

A release only stores what's changed in it: the entities changed there, with the links, references and calculated results that differ there. Everything else is read from published content, so later published changes reach every release without copying anything, and creating a release costs nothing. Lists and searches in a release are filtered by published values, and the entities that only exist in the release are listed by their status in it.

Ordinary drafts and releases are independent: an ordinary draft never appears in a release accidentally. Copying a draft into a release is an explicit operation, after which each version evolves independently. A release can change the variations of an entity too, and the entity and each of its cells keep their separate concurrency boundaries.

Releases are entities​

A release is an entity of VoxContentRelease, at api/vox-content-releases, or of the application's subclass of it, registered with options.UseAuthoring(authoring => authoring.UseContentReleases<CampaignRelease>()). It's created, read, listed, edited and deleted like any entity, and a subclass can add fields of its own, eg a campaign owner. A release isn't a context type: it's saved immediately and can't be authored itself. Its id names its scopes, so it can't contain |.

Its lifecycle fields are system-owned ([VoxSystemOwned]): Status, ScheduledForUtc, RevertScheduledForUtc, PublishedAtUtc, PublishedBy, RevertedAtUtc and PublicationError are written only by Vox. No generated action, custom action, import or API write can set them, and the admin shows them read-only.

StatusMeaning
DraftEditable and not scheduled.
ScheduledEditable and waits for a future publication time. The latest saved changes will publish.
ErrorA validation, uniqueness, or owned-field conflict blocked publication. The release remains editable.
PublishedPublished successfully. Its items are kept, and it can be reverted.
RevertedIts changes were undone.

Deleting a release retires every cell in its scopes in the transaction of the delete, so nothing reads or writes them from then on, and they're cleaned up in the background a page at a time. A release with the same id can't be created again until they are.

Creating and editing through .NET​

var release = (VoxContentRelease)await updater.CreateJsonAsync(
releaseType, JsonSerializer.SerializeToElement(new { id = "autumn", name = "Autumn launch" }, webOptions),
cancellationToken: cancellationToken);

var product = await authoringUpdater.UpdateAsync(
"rain-jacket",
VoxCellVersion.Release(release.Id, published.Version),
new ProductActions.SetName { Name = "Autumn rain jacket" },
cancellationToken: cancellationToken);

var preview = await products.GetAsync("rain-jacket", VoxContentScope.Release(release.Id), cancellationToken);

The release itself is created with IVoxEntityUpdater, and the entities in it are saved with IVoxAuthoringEntityUpdater and read with IVoxAuthoringEntityStore<Product>.

Saving to a release adds that entity to the release. Continue editing with the version that's read in the release, which is the published version until the entity is changed there.

A release has at most 1,000 items (VoxContentReleaseLimits.MaxItems, lowered with VoxAuthoringOptions.MaxReleaseItems), since it's published in one transaction. The drafts within it count too, since merging them makes them items of the release: a release with 1,000 items can't get a draft of a 1,001st entity. Every write that would add an item, also a delete, a membership, a cell at contexts or a received snapshot, is rejected with a VoxContentReleaseLimitException that names the limit, rather than failing when the release is published, and two editors adding the last item at the same time can't both add it. A release that has more items than its limit, since the limit was lowered after they were added, is refused when it's published, until items are removed from it. Larger changes go through imports. The entities of other applications that change in a release here, see Releases with the same id, have a limit of their own, 10,000 by default (VoxAuthoringOptions.MaxExternalReleaseItems). The limits are read at GET api/content-releases/limits.

  • Deletes. Deleting an entity in the release writes its existence as deleted there. It's an item of the release, and the entity is deleted with all of its cells when the release is published.
  • Drafts within a release. An editor can keep unfinished work for a release in a draft of it, the scope release-draft:<id>, which reads through to the release, saved with new VoxCellVersion(VoxContentScope.ReleaseDraft(id), version). Publishing that draft, PublishAsync(entityType, id, version, VoxContentScope.ReleaseDraft(releaseId)), merges it into the release, and it conflicts with the release's cell, or with published content where the release has none. The ordinary draft is never read in a release. A release that still has drafts within it can't be published, and the error lists them, so unmerged work never disappears with the release.

IVoxContentReleaseManager lists the items of a release, copies an ordinary draft into a release, removes an item, schedules or unschedules the release, publishes it, and reverts it; a conflict of an item is resolved with IVoxEntityPublisher.ResolveAsync in the release's scope. The items are listed a page at a time, ordered by entity type and id (ListItemsAsync(id, continuation, limit), and GET api/content-releases/{id}/items?continuation=&take= in the API), with their number from CountItemsAsync, so opening a release never reads all of it at once.

Atomic publishing and conflicts​

Publishing merges every item of the release into published content, through the same merge as a draft: Vox validates every entity in published content and checks the caller's publish permissions, then the storage provider checks the owned base version of every item and publishes every item in one transaction. Any conflict, validation failure, uniqueness violation, or concurrency failure rolls back the entire release.

A release holds only the owned values it changed, and reads every other field from published content, so a published change of a field the release didn't touch shows in the release at once. When an owned field of the published entity changes after a release changed the entity, the release item reports a conflict that lists what published content changed, with its value before and now, and marks the fields the release changed too. Only those need a choice: name the fields that take the published values; the others keep the release values. It's resolved like a draft's conflict, with IVoxEntityPublisher.ResolveAsync in the release's scope, and the admin resolves it in the entity's cell editor, opened in the release. Scheduled publication never resolves conflicts automatically: the release becomes Error, with the reason as its publication error, and its schedule is removed, so the release screen shows what to fix before it's scheduled again. The same holds for a failed validation or calculation. An error that trying again may fix, eg a deadlock with the background processing or a lost connection, leaves the release scheduled: the scheduled work tries it again after a growing delay, from 5 seconds up to an hour, as for a scheduled draft. A scheduled revert behaves the same way.

Atomicity is a storage capability. A release may contain only entities whose authoritative provider can publish the whole release transactionally. The Entity Framework provider supports this. Vox rejects unsupported providers instead of publishing part of a release.

Effects of a release​

A release changes more than its items: the calculations that read its changes run in the release, so a category edited in it can give its products and their bundles other calculated values there. The release's overview lists them with its items, each entity once: what it edits, creates or deletes, and the entities whose calculated values differ from published content because they read content in it, with their differences. Several edits can affect one result, eg a category and a product edit that a bundle both reads, and the bundle is still listed once. The calculated effects have no total, since telling whether an entity's values differ takes a comparison and a release can reach millions of entities, and they don't count towards the release's item limit; filters by entity type, kind of change, field and calculation narrow each page. The drafts within the release are listed apart, compared with the release. See Effects of drafts and releases.

Scheduling, date ranges and reverts​

A release's schedule is stored with the release, and its time is filterable, so Vox finds the releases that are due by it. The same background work as for scheduled drafts publishes them, on one processing host at a time, and a release whose time passed while no processing host ran is published when one starts. Editing a scheduled release preserves its schedule, so the newest changes go live. Publishing manually or unscheduling changes the release's status or schedule, so the old schedule does nothing when its time comes.

A release can have a date range: it's shown from its scheduled publication until its scheduled revert.

await releases.ScheduleAsync("autumn", release.Version, publishAtUtc, revertAtUtc, cancellationToken);
await releases.ScheduleRevertAsync("autumn", published.Version, revertAtUtc, cancellationToken);
await releases.RevertAsync("autumn", published.Version, cancellationToken);

Publishing records a publication: the merged cells with the values they replaced, the existence changes and the link changes. Reverting undoes exactly those changes for all of the release's items in one transaction. Entities it created are unpublished, and ones it deleted are restored. A revert only updates the fields the release changed, so it conflicts only on a field the release changed that has changed again since. A scheduled revert is found by its time and carried out like scheduled publishing. A scheduled revert that fails keeps the release published, with the reason as its publication error, and removes the revert's schedule.

Preview clients​

Use scope=release:{releaseId} on reads, with any application contexts in context, eg ?scope=release:autumn&context=language:sv. An API client can make the release its default by setting DefaultScope to it, eg release:autumn, which suits a dedicated preview deployment; writes never use the default. Reading a release needs a permission, so a delivery client can't read it, and responses in it are private and aren't stored in shared caches.

Permissions​

Creating, updating, scheduling, publishing, reverting and deleting releases requires vox:ContentReleases. Saving an entity action into a release requires both that permission and the ordinary entity create/edit/action permission. Publishing and reverting additionally require {EntityType}:Publish for every entity type with an item in the release.

Releases managed by another application​

An application that receives the releases of the application that manages them, see Synchronized contexts, binds an external release entity type with Releases<TRelease>() instead of having releases of its own. Its users and API clients preview those releases, with scope=release:{releaseId}, and the admin lists them read-only with their synchronized status, but they're created, changed, scheduled, published and reverted where they're managed. A release that's published or deleted there stops being previewable once that has been synchronized, and its cells are removed. Previewing them needs vox:Preview:Releases, and listing them the read permission of the release entity type.

Releases with the same id​

Each application publishes its own releases. Applications that work on one campaign each create a release with the same id, eg a PIM and a CMS each create autumn: the PIM changes its categories in its autumn, and the CMS its pages in its own. Each keeps the changes of the entities it receives from the other at release:autumn, so both preview scope=release:autumn with the categories and the pages. A release lists those external entities read-only with its own items (isExternal on an item); they don't count towards its limit, and publishing it merges only its own items.

The applications coordinate by giving their releases the same schedule, eg 20 November 06:00. Vox doesn't publish them together or check one application's part against the other's: if the CMS publishes at 06:00 and the PIM at 06:05, the CMS's published page refers to a category that isn't published for five minutes. Publishing, reverting or deleting a release in one application never reaches the other; once the PIM publishes its autumn, its published categories arrive in the CMS as usual and their changes in the release are removed there.

The changes at a release id are only kept by an application that has a release with that id. A change that arrives before the release is created here, eg the PIM's category before the CMS creates autumn, is dropped, and arrives again with the entity's next snapshot, or with a resynchronization of the subscription once the release exists.