Skip to main content

Embed the model source and apply Studio's changes

Studio works with the source code of an application's model: the files that declare its entity types, calculations, imports, commands and the rest. A deployed application usually has no checkout of its repository, so the build embeds that source in the application's assemblies, with each file's path in the repository and the revision it was built from. The build can also embed skills, folders of Markdown that describe the application's conventions.

For the team workflow, see Work with an assistant.

Before you start

You need a Vox application that's built from a Git repository, or a build that knows where the repository root is.

Opt in each project​

Reference CommerceMind.Vox.Studio.Source from every project whose source Studio should see, and set VoxEmbedModelSource:

Shop.Catalog.csproj
<PropertyGroup>
<VoxEmbedModelSource>true</VoxEmbedModelSource>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommerceMind.Vox.Studio.Source" Version="..." />
</ItemGroup>

The package adds no runtime, web, Entity Framework or AI dependency, so a model library can reference it on its own. To opt in several projects at once, set the property in their Directory.Build.props.

Opt in the entry project too, even if its model lives in libraries. It records where the proposal manifests go, vox-proposals next to the project unless VoxProposalsDirectory says otherwise.

The project is the boundary. A project that doesn't opt in embeds nothing, even when an opted-in project references it. If ShoeSize is declared in Shop.Common, Studio sees ShoeSize.cs only when Shop.Common opts in as well.

What's embedded​

Every authored C# file of an opted-in project, Program.cs included, is embedded whole, with its original line endings, its path relative to the repository root, eg src/Shop.Catalog/Entities/Product.cs, and its SHA-256. The build also records the revision it was built from, the repository root on the build machine, the project's directory, and which files declare each type.

Left out are:

  • Generated files: files named *.g.cs or *.generated.cs, files under the project's obj/ and bin/, and the output of source generators. A file the application owns is embedded even when its header says it was generated, eg a template an import tool created once.

  • Files you exclude, with item metadata, eg web code in the entry project:

    <ItemGroup>
    <Compile Update="Controllers/**" VoxModelSource="false" />
    </ItemGroup>

    Exclude a file that holds a secret, including Program.cs if it does.

  • Files with a calculation whose source is excluded with [VoxCalculationDocumentation(EmbedSource = false)], on the class or the assembly, see Calculations and their source. The build warns with VOX017, listing the files. With the attribute on the assembly, every file with a calculation is left out and the project's other files are still embedded. A helper with a secret is excluded with the item metadata.

  • Files outside the repository root, eg one linked from another folder. The build warns with VOX016.

Anyone who has the DLLs can read the embedded source. Studio's readers need the permission vox:ReadSource, the same one that reading the source of a calculation through MCP needs.

The text of a file is stored as UTF-8 in the assembly's data, so a large model doesn't reach the compiler's limit of 16 MB of strings. Only the build of an opted-in project pays for it: embedding 300 files of 5 KB adds about 0.25 s to a full compile and 1.5 MB to the DLL.

The repository root​

The build takes the repository root from Git, the same place the build revision comes from. A build without the .git folder, eg a Docker build that leaves it out of its context, sets the root itself, relative to the project:

<VoxRepositoryRoot>../..</VoxRepositoryRoot>

A build that finds no root embeds no source, and warns with VOX015. Such a build usually has no build revision either.

Hand skills to Studio​

A skill is a folder with a SKILL.md and any other files, eg references and examples. Embed it with a VoxSkill item in a project that references the package; it doesn't need to opt into embedding its source:

<ItemGroup>
<VoxSkill Include="skills/shop-conventions" />
</ItemGroup>

Every file of the folder is embedded as the resource vox-skills/shop-conventions/{its path in the folder}. A folder without a SKILL.md gets the warning VOX019. Vox's own modelling skill, vox-modelling, ships with Studio and is the one Studio's assistant reads, even when the application embeds a skill with the same name. Give the application's skills names of their own, eg shop-conventions.

Enable Studio in the host​

Enable the runtime add-on, CommerceMind.Vox.Studio:

Program.cs
builder.AddVox(/* ... */)
.AddVoxStudio();

IVoxModelSourceReader lists the embedded files and skills and reads them. It reads the application's assemblies: the entity assemblies, the assemblies of the model's entity types and calculations, and the entry assembly, with the opted-in assemblies they reference. It follows references only through assemblies that embed source, so an opted-in library that's reached only through a library that doesn't opt in isn't found. Other loaded assemblies, eg of tests, aren't read. The reader doesn't check permissions; code that shows the source to a user checks vox:ReadSource.

Studio needs Entity Framework storage, since it keeps the changes that users propose in the same database. Without it, AddVoxStudio() fails at startup with "Studio stores proposals in the Entity Framework database; add Entity Framework storage." Its tables, Vox_StudioProposals, Vox_StudioProposalFiles, Vox_StudioProposalReviews, Vox_StudioProposalMessages, Vox_StudioSubmissions and Vox_StudioBuilds, are created and upgraded by Vox's own schema migration at start, like Vox's other tables, also on a host that requires an applied model.

Register Studio on every host

Call AddVoxStudio() on every host that shares the Vox database, also on a processing host that never serves Studio. A host without it sees Studio's tables as no longer used: with AllowDestructiveMigrations it drops them, and every proposal with them, at its next start. See add-ons with tables of their own.

Proposals of changes​

Studio's forms and its assistant don't change the repository directly. They write a proposal: the new text of the files they change, a list of the changes in the order they were made, the conversation with the assistant, and a review of the current files. For example, adding Care instructions to Product with Studio's Add field form puts the new property into src/Shop/Catalog/Product.cs in the user's proposal.

  • The open draft. Each user has one draft that Studio's "Your changes" shows: of their drafts that haven't been sent for review, the one they opened most recently. Every form change and every request to the assistant goes into it. It's created at the user's first change or message, so a draft can hold only a conversation, eg a question about the model.
  • Versions. Every save that changes a draft's files or its list of changes raises its version by one. A save based on an older version is refused with a conflict, and the form or the assistant reads the draft again and retries. A save that changes files deletes the draft's review.
  • Sending for review is optional and needs file changes. A sent draft is frozen: neither forms nor the assistant change it, so the reviewer sees what was sent. Sending also closes it as the open draft, so the next change starts a new one.
  • Taking back a sent draft makes it the open draft again. It's allowed only when the user's current open draft has no file changes and no list of changes. That empty draft is deleted, unless it has messages, in which case it stays as an older draft.
  • Deleting removes the proposal, its files, its review and its conversation. Source, commits and builds aren't touched.
  • Stale paths. Every edit and removal records the hash of the deployed file it was based on. When a proposal is read, the paths whose file the running build no longer has with that hash, and the additions at paths that the build now has a file at, are returned as stale paths, eg when another change to Product.cs went live first.

A draft may only edit or remove files of the embedded model source, at the hash of the embedded text, and add C# files inside the directory of an embedded project. Project and build files (*.csproj, Directory.Build.*, *.props, *.targets, nuget.config, global.json), appsettings*.json, Properties/launchSettings.json, the proposals directory, .git/, .github/workflows/, .github/actions/, azure-pipelines*.yml, bin/ and obj/ are always refused. Paths are relative to the repository root with forward slashes; a path with .., a leading slash, a drive letter or a backslash is refused.

Who may propose​

Reading and proposing need both vox:ProposeChanges and vox:ReadSource, since proposals contain source. Such a user lists their own drafts and every draft that has been sent for review, and can open any proposal by its id. Only the proposer changes, sends and takes back their draft. The proposer can delete their own proposal, and a user who also has vox:ApplyChanges can delete anyone's. Studio offers these permissions only when the application embeds model source.

Proposing needs a signed-in user with an email address, since applying a proposal names the proposer as the author of its commit. Anonymous requests and API clients are refused, also on a host without user management, where every principal may do everything. With Vox's user management, the email is the user's; with the host's own authentication, it's the email claim or ClaimTypes.Email. A user without one gets "Your account has no email address, which Studio needs to name you as the author of your changes."

Applying proposals​

A user with vox:ApplyChanges reads a draft's review and diff and presses Apply. Studio checks that every file the draft edits or removes is unchanged since the running build, writes the files and a manifest of the proposal into the application's source through a source change target, and marks the proposal submitted. The proposal becomes applied when a host starts serving a build that contains its manifest: applied means "this code is running", not "someone pressed a button".

For example, applying the Care instructions proposal writes src/Shop/Catalog/Product.cs and src/Shop/vox-proposals/0193d6c4-....json into the checkout and commits exactly those two files with the proposer as the author. When a developer restarts the application, Studio finds the manifest in its own build at startup and marks the proposal applied.

What Apply does.

  1. Check. The caller may apply it; it's a draft with file changes at the version the caller reviewed; the file rules still pass; and the target finds no file that changed since the running build. If anything fails, Apply names the files and writes nothing, and the proposer starts again from fresh source.
  2. Claim. The draft's version moves on and Apply records its claim, so a second Apply of the same version fails. Until it's submitted, a claimed draft can't be changed, sent, taken back or deleted.
  3. Deliver. The target writes the change and returns a receipt, eg the commit. A failure is recorded on the proposal, and pressing Apply again resumes: the target skips what it already did and never delivers a change twice. When the target is sure it delivered nothing, the claim is released and the proposal is an ordinary draft again.
  4. Hand over. Steps registered after delivery run in order, eg the local rollout runner, which saves the proposal for the host to build and restart on. A required step's failure leaves the proposal unsubmitted, and Apply again resumes at it.
  5. Submitted. The proposal records who applied it and when.

Abandoning Apply. When Apply again keeps failing, a user with vox:ApplyChanges can abandon it. The claim is released and the proposal is an ordinary draft again, which can be changed, applied again or deleted. Studio doesn't undo what the target already delivered: files written into a checkout, or a commit, stay there for a developer to keep or revert. A delivered manifest that goes live later doesn't mark an ordinary draft applied, so delete or revert it along with the files.

Turning down. A user with vox:ApplyChanges can turn down a submitted proposal with a note, eg "We already have washing for this". Studio doesn't close a pull request, and closing one doesn't tell Studio.

Expiry. A submitted proposal is shown as expired once a proposal created after it has gone live, whoever proposed it, and Vox:Studio:ExpiryInterval (14 days by default) has passed since the later of that time and its own submission. When later work has gone live and this one still hasn't, it probably never will. Expiry only changes the list it's shown in: an expired or turned-down proposal still becomes applied if its manifest turns up in a running build.

Stale drafts on a new build. When a draft is read and the running build no longer matches some of its files, a registered IVoxProposalRewriter can write its changes again on the new source, as Studio's forms do, see Changes from forms. It's called only on a host whose build started serving after the draft's own base build. During a rolling deployment, old and new hosts serve side by side, and an old host would otherwise write the draft back onto the old source. Studio records when each build revision first serves in Vox_StudioBuilds.

Who may apply​

Applying needs vox:ApplyChanges. Such a user can apply anyone's draft, sent or not, their own included, and applying authorizes everything the target and the hand-off do, which may include a push or a build and restart. People with this permission are trusted to review and deploy application code: the safety gate is the person who applies, not the file list. A proposal can change any embedded C# file, eg imports, validators or commands, and can add a new Controllers/PriceExportController.cs with [AllowAnonymous] or a file with a [ModuleInitializer]. Reading the diff is what catches those. The file rules keep a proposal to files the assistant can read, and away from places that do harm before anyone could review them: project files can run code during the build, settings hold secrets, another proposal's manifest would mark it applied, and CI definitions run with the repository's secrets on a pushed branch.

Setup files need vox:ApplySetupChanges as well, since broken setup stops the whole host from starting. A changed file is setup when its embedded or its proposed text has top-level statements or a static Main; an extension method of IServiceCollection, IHostApplicationBuilder, WebApplicationBuilder, WebApplication, IApplicationBuilder, IEndpointRouteBuilder or VoxServiceCollectionRegistration; or a [ModuleInitializer] method. The file name doesn't matter, so a ServiceCollectionExtensions.cs counts too. The check reads the syntax only and can be evaded, eg with a using alias: it sends a proposal to the right approver and isn't a security boundary. A proposal tells the UI which of its files are setup, and whether the caller may apply it.

Where applied changes go​

Apply hands the proposal to the source change target that Vox:Studio:Source:Target names. Without one, Apply is refused with "Studio doesn't know where to send changes; set Vox:Studio:Source:Target." An unknown target fails at startup.

  • LocalCheckout writes the files into a checkout on the host, commits them when it's a Git repository, and can push the commit. Single-host installations and developers use it, and local rollout builds from it.
  • GitHub and AzureDevOps commit the change through the provider's REST API and, by default, open a pull request. No host needs a checkout, so installations with several hosts behind a load balancer, or that deploy with a pipeline, use them. See hosted repository targets.

Choosing a target. A single host that restarts itself on the change uses the local checkout. Several hosts, or a deployment pipeline, use a hosted repository: the change goes through the same review and pipeline as a developer's.

Only Git targets exist. The contract, IVoxSourceChangeTarget, has no branches or commits, but another source control system would also need the embedded source to record its revision and repository root, which come from Git today.

Local-first means no pull requests. With the local checkout target the change runs at once, and the commit records what was applied; a problem found afterwards is fixed by a new change on top. An installation that wants a review before a change runs uses a hosted repository target with pull requests and a pipeline. To build and restart on the change on the same host, see roll out Studio's changes on a single host.

The local checkout target​

appsettings.json
{
"Vox": {
"Studio": {
"Source": {
"Target": "LocalCheckout",
"LocalCheckout": {
"Root": "/srv/shop",
"CommitToGit": true,
"Push": { "Remote": "origin", "Branch": "main" }
}
},
"Git": { "CommitterName": "Shop host", "CommitterEmail": "host@shop.example" }
}
}
}
  • Root is the absolute path of the checkout, which a production host sets. Without it, Studio uses the repository root that the build recorded, if that directory exists on the machine and contains the entry project: a developer running the application from the checkout it was built from. Without either, Apply is refused with "Studio doesn't know where the checkout is; set Vox:Studio:Source:LocalCheckout:Root."
  • The check compares each edited and removed file in the checkout with the running build's hash, requires each new file's path to be vacant, and refuses a path through a symbolic link or junction. Files are written through a temporary file that's renamed over the target, and the manifest last. Everything runs under a lock file in the temp directory, so the serving host and the rollout runner never write the same checkout at once.
  • CommitToGit, on by default, commits with the git program on the host, so its credential helpers, SSH keys, safe.directory settings, hooks and line-ending settings apply as they do for a developer. Studio commits exactly the proposal's files and its manifest with git commit --only, so whatever else is staged or changed in the checkout is left as it was. The author is the proposer, the committer is Vox:Studio:Git:CommitterName and CommitterEmail (or Git's own configuration), and the message is the proposal's title with the trailers Vox-Proposal: <id> and Vox-Submitted-By: <name>. Vox:Studio:Git:Executable names git when it isn't on the PATH, and Vox:Studio:Git:Timeout (5 minutes by default) stops a Git command that runs longer. If the repository can't be used, eg a lock file or a conflict in progress, Apply records Git's message; fix the checkout and press Apply again. Repositories that require signed commits aren't supported.
  • In a developer's clone, turn committing off. Otherwise Apply commits on whatever branch is checked out, in the middle of the developer's own work. Set CommitToGit to false in appsettings.Development.json, so trying Studio leaves the change as ordinary unstaged edits to review, keep or discard.
  • Push pushes the commit with git push <Remote> <commit>:refs/heads/<Branch>, with the credentials the checkout already uses, so the next build includes Studio's changes. A failed push doesn't fail Apply, since the change was delivered: it's a warning on the proposal, eg when the branch moved on. Studio never forces a push. Sort out the branch, then retry the push.
  • When Apply again stops at a file, someone changed that file in the checkout after an earlier attempt wrote other files. The proposal stays claimed, so it can't be changed or deleted. Put the named file back to the running build's text or to the proposal's text, eg with git checkout, and press Apply again, or abandon Apply and clean up the checkout.

Hosted repository targets​

The GitHub and Azure DevOps targets commit a proposal through the provider's REST API, so no host needs a checkout. For example, with three Shop.Api hosts built and deployed by an Azure DevOps pipeline from main, applying the Care instructions proposal on host 2 creates a commit with Product.cs and the manifest on a branch of its own and opens a pull request. Once it's merged, the pipeline deploys, and the first host to start with the manifest marks the proposal applied.

appsettings.json
{
"Vox": {
"Studio": {
"Source": {
"Target": "GitHub",
"GitHub": {
"Repository": "shop-co/shop",
"Branch": "main",
"Mode": "PullRequest",
"LineEndings": "Lf",
"Token": "<from user secrets, an environment variable or a vault>"
}
},
"Git": { "CommitterName": "Shop host", "CommitterEmail": "host@shop.example" }
}
}
}
  • GitHub has Repository (owner/name), Branch, Mode, LineEndings, Token and, for GitHub Enterprise Server, ApiBaseUrl, eg https://github.shop.example/api/v3/.
  • Azure DevOps ("Target": "AzureDevOps", settings under AzureDevOps) has Organization, Project and Repository instead of Repository as owner/name, and the same Branch, Mode, LineEndings and Token. For Azure DevOps Server, ApiBaseUrl is the server's URL with the collection as the organization, eg https://devops.shop.example/tfs/ and "Organization": "DefaultCollection".
  • A missing repository, branch or token fails at startup with a message that names the setting.
  • The committer is Vox:Studio:Git:CommitterName and CommitterEmail when both are set. Otherwise the provider chooses: GitHub records the author as the committer. The author is the proposer, with the time of Apply, and the message is the proposal's title with the trailers Vox-Proposal: <id> and Vox-Submitted-By: <name>. The commit has the changed files and the manifest, and nothing else.
  • Mode:
    • PullRequest (the default): every proposal gets a branch of its own, eg vox/proposals/care-instructions-on-products-1c5d4b10, and a pull request into Branch with the proposal's description, the review's size and what to check, who proposed and applied it, and a link to the proposal's Technical details in Studio, eg Open in Vox Studio: https://pim.shop.example/vox/admin/studio/sets/<id>/technical. The link is made from VoxApiOptions.PublicBaseUrl and the path of the admin UI that the host registered with AddAdminUI(); a host without either, eg one that serves only the API, writes no link. Merging the pull request is what triggers the deployment. Closing it doesn't tell Studio: turn the proposal down in Studio instead.
    • Push: the commit goes straight onto Branch, for a branch without required reviews whose pipeline deploys every commit. A protected branch refuses the update, and Apply fails with the provider's message: use PullRequest mode there.
  • LineEndings, Lf (the default) or CrLf, are the line endings of every file Studio writes, edited or added, and of the manifest. The embedded text has the line endings the compiler saw: a Windows build of a repository that stores LF has CRLF there, and writing it back as it is would turn every edit into a whole-file diff. Files are written as UTF-8, and a file that starts with a byte order mark in the repository keeps it.

Builds must come from pushed commits. A hosted target works from the running build's revision, the commit the build was made from, which the embedded source records. Hosts deployed by a pipeline run CI builds of pushed commits, so they meet this. A developer's machine often doesn't, so configure the hosted target per environment, eg in appsettings.Production.json, and use the local checkout target in development. The revision is the last dot-separated part of the build metadata in the informational version, which the .NET SDK sets from Git, eg 3f2c1a9e... in 1.2.3+build.42.3f2c1a9e....

  • A build without a revision, eg one made outside Git, is refused: "This build has no source revision. Hosted repository targets need builds made from pushed commits."
  • A revision the repository doesn't have, eg a local build of unpushed commits, is refused: "The running build was made from 3f2c1a9, which shop-co/shop doesn't have. Push it, or build from a pushed commit."
  • A build made from uncommitted changes is caught by the check below, which names the files.

The check reads, at the running build's revision, each file the proposal edits or removes and each path it adds. It compares the files with the embedded text, ignoring a byte order mark and the difference between CRLF and LF, and names a file that differs, a file that doesn't exist, and an added path that already exists. Nothing is written. It reads one file per changed path, so it costs what the proposal does, not what the repository does.

Where the commit starts. There's no merge: the commit starts at the tip of Branch when that's safe, and at the running build's revision when it isn't.

  • At the tip, when every file the proposal edits or removes is the same object at the tip as at the build's revision, and every path it adds is still free there. If only Order.cs changed on main since the build, the commit starts at the tip.
  • At the build's revision, in PullRequest mode, when one of those files changed on Branch. For example, the assistant changed Product.cs, and a developer has since changed Product.cs on main too: the pull request starts from the deployed commit and shows the conflict, which whoever handles the pull request resolves.
  • Refused, in Push mode, since a push has to build on the tip: "src/Shop/Catalog/Product.cs has changed on main since the running build. Make the change again once the new build is running." Nothing is delivered, so the proposal is an ordinary draft again.

Concurrency is handled by the provider: a branch is only created, or moved, from the value Studio read. Azure DevOps compares the branch with that value; GitHub refuses an update that isn't a fast forward, so a branch reset backwards in the same moment isn't caught. Two hosts applying different proposals at the same moment create two branches. In Push mode, a host that finds Branch moved since it read the tip chooses where the commit starts again and tries once more; if the branch moves again, Apply fails and nothing is delivered.

Resuming. Applying again after an interruption doesn't create a second commit or pull request.

  • Studio finds its commit by the Vox-Proposal: trailer among the latest 50 commits of the proposal's branch, or of Branch in Push mode, and only when the files and manifest there have the proposal's text. It opens a pull request only when the branch has none.
  • When Branch already has the proposal's manifest and files, eg its pull request was merged and the branch deleted before Apply finished, the change counts as delivered, with the tip of Branch as the receipt.
  • When the running build no longer embeds the text a file was changed from, eg Apply is resumed days later on a newer build, Apply is refused and nothing is delivered, so the proposal can be started again from fresh source.
  • Reads that fail with a 5xx answer or a timeout are tried once more. Writes aren't, and Apply again resumes instead. A branch write that the provider refuses with a 4xx answer delivered nothing; one that fails with a 5xx answer or no answer may have gone through, so the proposal stays claimed and Apply again finds out.

Abandoning Apply with a hosted target leaves what was delivered where it is. Before applying the edited draft again, close the pull request and delete the proposal's branch, or in Push mode revert the commit. Otherwise Apply is refused: "The branch vox/proposals/... has an earlier version of these changes", or the manifest "is already on main ... with other files than these changes".

The receipt has the commit's SHA, the branch name (or main@3f2c1a9 in Push mode), the commit's page and the pull request's page. The proposal is submitted once the commit exists and, in PullRequest mode, the pull request is open; it becomes applied when a host starts with the manifest.

Tokens.

  • GitHub: a fine-grained token with "Contents: read and write", plus "Pull requests: read and write" for PullRequest mode.
  • Azure DevOps: a personal access token with "Code: read and write"; Azure DevOps has no narrower scope that allows creating pull requests.

The token is read like any other setting, so it can come from user secrets, environment variables or a vault. It never appears in a receipt, a log line or an error: a failed request is reported with its status and the provider's message.

Pipeline triggers. In PullRequest mode, leave the vox/proposals/ branches out of the branch triggers if they shouldn't build. An installation that builds from Branch but doesn't want to deploy every Studio change on its own can skip Studio's commits in a condition on the job or step, since trigger filters can't match a commit message. In Azure Pipelines:

azure-pipelines.yml
jobs:
- job: Deploy
condition: not(contains(variables['Build.SourceVersionMessage'], 'Vox-Proposal:'))

In GitHub Actions, the same condition is if: ${{ !contains(github.event.head_commit.message, 'Vox-Proposal:') }}.

Manifests​

Each applied proposal adds one file, <proposals directory>/<proposal id>.json, eg src/Shop/vox-proposals/0193d6c4-7a1e-7c3b-9f00-2a9e1c5d4b10.json:

{
"id": "0193d6c4-7a1e-7c3b-9f00-2a9e1c5d4b10",
"title": "Care instructions on products"
}

The proposals directory is the entry project's, vox-proposals next to it unless VoxProposalsDirectory says otherwise. The build embeds its manifests in the entry assembly as resources named vox-proposals/<file name>, and rebuilds the assembly when one is added or removed, so a manifest alone takes effect. A developer can add "status": "changed" and a "note" before the change goes live, eg "note": "renamed the field to care before merging", which history shows. The manifest leaves out the proposer, the times and the paths, which the commit and the database have.

When a host starts serving, Studio marks the proposals of its build's manifests applied, with the time, the build revision and the note. vox migrate, --plan and --preflight never do. The first host of a deployment records the result and the others find nothing left; a proposal keeps its first result, and manifests with unknown ids, eg promoted from another environment's repository, are ignored. A manifest can be deleted once its proposal is applied: a later build without it leaves the result as it is, so the folder doesn't have to grow forever.

The settings are read from Vox:Studio; AddVoxStudio(options => ...) can set them in code.

The API​

The proposals are served at /vox/api/studio/proposals:

Method and pathWhat it does
GET /vox/api/studio/proposals?list=mine|review|live|history&proposer=&cursor=&limit=&rolloutFailed=A page of the caller's own drafts, with the open draft flagged; of the drafts sent for review; of the submitted proposals going live that haven't expired, newest submission first; or of history: the applied, turned-down and expired proposals and those that didn't go live, newest submission first. rolloutFailed=true limits history to those that didn't go live. All but the first can be of one proposer. Pages have up to 200 proposals, 50 by default.
GET /vox/api/studio/proposals/openThe caller's open draft, or 204 if they have none.
GET /vox/api/studio/proposals/countsFor Studio's tray and the badge of its top bar item: the number of changes in the caller's open draft and, for a caller with vox:ApplyChanges, the number of other users' sets sent for review. Each is counted to 99, and moreWaitingForReview says there are more.
GET /vox/api/studio/proposals/recent-changes?limit=20For Studio's Recently changed: the most recently applied proposals, newest first, up to 50, each with its changes' descriptions and entity types, who proposed and applied it and when it went live. Neither files nor messages are read.
GET /vox/api/studio/proposals/{id}/diffFor Technical details: each changed file's proposed text and the text it was written on (baseText), read from the running build's embedded source while the embedded file still has the hash the change was written on. Otherwise baseChanged is true and there's no base text.
GET /vox/api/studio/proposals/{id}A proposal with its files, list of changes, review and stale paths, its setup files (setupPaths, changesSetup), whether the caller may apply it (canApply), its submission with the receipt, and whether it has expired, and with local rollout, what came of its rollout (rollout).
GET /vox/api/studio/proposals/{id}/messages?after=&limit=A page of the conversation, in order.
POST /vox/api/studio/proposals/{id}/send with { "version": 3 }Sends the draft for review, as of the version the user looked at.
POST /vox/api/studio/proposals/{id}/take-backTakes a sent draft back.
POST /vox/api/studio/proposals/{id}/apply with { "version": 3 }Applies the draft, or resumes its submission with the version the claim moved it to. Returns 202 with the submission, 409 for a version conflict or files that changed (naming them), and 403 for a setup change without vox:ApplySetupChanges.
POST /vox/api/studio/proposals/{id}/turn-down with { "note": "..." }Turns down a submitted proposal.
POST /vox/api/studio/proposals/{id}/apply/abandonAbandons Apply of a draft whose submission hasn't finished, so it's an ordinary draft again.
POST /vox/api/studio/proposals/{id}/push/retryPushes the local checkout target's commit again after a failed push.
DELETE /vox/api/studio/proposals/{id}Deletes the proposal, unless its submission is in progress.

Apart from the forms' endpoints, no endpoint edits a draft: Studio's forms and assistant write drafts in the host, through VoxProposalWorkflow. The TypeScript client has the calls in @commerce-mind/vox-client's studio module.

Each entry of a proposal's list of changes can carry modelChanges, a JSON array of typed changes to the model, eg { "type": "addField", "entityType": "Product", "path": "careInstructions", "displayName": "Care instructions", "group": "Content", "kind": "text" }, with changeField, removeField, addEntityType and addRelation too, and a size. A changeField that moves a field that isn't live into or out of a group class also has newPath, eg care.ironing, since the move changes its path. Studio draws a change's preview and the marks on a type's page from them, and a set without a review whose changes all come from forms with a size takes the largest. The review's effects use the same shapes.

Changes from forms​

Studio writes the simple changes to the model itself, at once, without the assistant or a language model, so they work in an installation without one. Each is a change in the user's open draft like any other, which is reviewed, sent and made live the same way.

  • Add field, on a type's page: a field in one of the groups editors fill, with the options below.
  • A field's settings, from its row: its name and help text, whether it's required, filterable, sortable and found by search, and its group. A field that isn't live yet can also get another unit and move into any group editors fill. A field the forms don't make, eg a C# enum or a text per market, only gets a new name, help text and group.
  • New list, on the overview: a list with its options, and the field of a type that picks from it.
  • New kind of item, in an area of the overview: a type with a name field, and the fields of other types that link to it.

What the forms write​

Studio edits the C# of the declaring class in the embedded source: the group's class, eg ProductContent for Content, the entity class for General or a named group, the base class of a family such as ProductBase, or a field set's template interface. It only edits syntax, never compiles or runs code, and leaves every other line of the file as it was. A new property goes after the group's last property, copies its neighbours' modifiers and line endings, and is named after the display name in PascalCase, eg Care instructions becomes CareInstructions.

What it holdsOne valueSeveral
Textstring?, or VoxVarying<IVoxLanguage, string> when translated
Formatted textVoxRichText, or VoxVarying<IVoxLanguage, VoxRichText> when translated
A numberdecimal?, or int? with whole numbers only
Yes or nobool?
A dateDateTimeOffset?
A choice from a listVoxReference<Fabric>?List<VoxReference<Fabric>>
Links to other itemsVoxReference<Brand>?List<VoxReference<Brand>>
ImagesList<VoxReference<Image>>, of the asset type the type's other images use, else the application's only asset type, or the only one that implements IVoxImageAsset, eg Image beside Document
In the formWhat Studio writesOffered for
Name and help text[Display(Name = "...", Description = "...")]every field
Unit, eg W or dB[VoxUnit("dB")]a number
Translatedthe VoxVarying<IVoxLanguage, ...> shape above, with the [VoxVarying] settings that most of the group's translated texts havea text or formatted text outside a field set, when the application has a language type
Required[Required]every field editors fill
Editors can filter on it[VoxFilterable]a text, number, yes or no or date, and in a field set's template a choice or links
Lists can be sorted by it[VoxSortable]a text, number, yes or no or date
Found by search[VoxSearchable]a text or formatted text

Links and choices on a type's own fields are always filterable through their relation, and get Vox's default relation names, eg merchandising.fabric. A filterable or sortable text is indexed up to 256 characters. Filtering, sorting and search are built in the background for every item after the change goes live.

A new list follows the application's lists: a one-line subclass of the shared list base, eg public class Fabric : CatalogChoice;, in the file with the most of them, or a new file shaped like the application's standalone list. A new kind of item is a new file shaped like the simplest authored type of its area, with [VoxArea] and [Display(Name, GroupName)] naming its place in the menu. Vox finds new entity classes by scanning, so neither touches the application's setup.

What goes to the assistant​

Everything else a field can be is code that the model assistant writes when asked, since it needs judgement, repairs data, or needs other code than the field itself: a value per market or channel, uniqueness, validation, who may read or edit the field, fields an import fills and calculations, C# enums, rows of several values, choices from code, presentation in code, relation names, and renaming, removing or changing what a field holds, with the migrations that move the stored values. So does changing the unit of a live field, since Vox never converts what's stored: changing W to kW would turn a 1,500 W kettle into a 1,500 kW one. A field that's live in a group class stays there, since moving it moves what editors wrote in it. A field that several templates of a field set declare gets only Required here, since the templates must declare it with the same attributes apart from [Required], so the assistant changes it in each of them.

When Studio can't write a form, eg the class isn't in the embedded source, the file doesn't parse, or templates already declare a field of that name, the form says so with the reason, and whether the assistant could make the change instead.

Size, Undo and new source​

Each change records its description, eg "Products: adds Care instructions, an optional translated text, under Content", its typed model change, its form, and its size. A change that makes a field required is Worth a look at any number of items, since items without a value can't be saved until someone fills it in. A change that adds a field that's filterable, sortable or found by search, or makes one so, is Worth a look on a type with more than 10,000 items, since Vox builds that index over every item, and Studio counts the items once, when it writes the change. Every other change is Small.

Undo writes the draft's files again from the embedded source with the draft's other form changes, in their order. A change that no longer fits, eg a move of a field that's gone, is marked Needs your attention with the reason. A file the assistant also changed can't be written again from forms alone, so Undo of a form change in it is refused, and the assistant can make it instead.

When a newer build changed a file of a draft, Studio writes the draft's form changes again on the new source the same way, as a new version. A form change that no longer fits needs attention, and the assistant's edits of that file are dropped, with the assistant's change marked Needs to be made again.

The options of a new list​

A new list's options are data, which can't be created until a build with the list runs. They wait in the change until the proposal is applied. The next time the proposer opens Studio, it creates them through the entity API as the proposer, when the list is live under the name the change wrote, and asks which list should get them when it was changed during review. Anyone who may create the list's items sees the waiting options on the list's page with Add them now. An environment that the build reached by promotion, where the proposal is unknown, gets its options by hand or by an import.

The forms' API​

Method and pathWhat it does
POST /vox/api/studio/changes with { "proposalId": null, "form": { "addField": { ... } } }Writes one form, addField, changeField, newList or newKind, into the caller's open draft, or the draft proposalId names, creating the open draft at the first change. Returns the draft's id, its new version and the change's entry, or 422 with reason and assistantCould. A save that loses a race reads the draft again and writes the form once more.
DELETE /vox/api/studio/changes/{proposalId}/{changeId}Undoes a change from a form, and returns the draft's new version, or 422 as above.
GET /vox/api/studio/follow-ups?mine=trueThe caller's waiting follow-ups of applied proposals: the options of a new list, and the assistant's questions for once a change is live (kind Question, with the question).
GET /vox/api/studio/follow-ups?entityType=FabricA list's waiting options, for a caller who may create its items.
POST /vox/api/studio/follow-ups/{proposalId}/{changeId}/done with { "createdIn": "Fabric", "created": ["Linen"] }Marks a follow-up done, by its proposer or a user who may create the list's items; a question of the assistant only by its proposer. 409 when someone did it first.

The changes need vox:ProposeChanges and vox:ReadSource, like the rest of proposing.

Following changes in Studio​

Studio's admin screens follow a set of changes from the first change until it's live, in the words editors use: no screen but Technical details names a file, class, version or commit.

  • The tray, a purple bar at the bottom of every Studio page, shows how many changes the user's open draft has, eg "2 changes · not live yet", with See changes, and Make them live for a user with vox:ApplyChanges or else Send for review. While a form or the assistant writes into the draft, it says "Saving…".
  • Your changes (/studio/changes) shows the set's size in one line, what to check and the review's suggestions as questions, then each change with Show, which previews the fields it adds or changes under their group's heading, drawn as the editing form draws them. The size comes from the review; without one, from the changes when every change is from a form with a size; otherwise it's "Not reviewed", treated as needing careful review. With a language model, a version without a review has Review it, and Show of a change without model changes of its own, eg the assistant's, previews those of the review's effects on its files. The size only changes what Studio recommends: for a set that needs careful review or isn't reviewed, Send for review is the main button, with "Best to let someone else look first". A changed file that no change or effect mentions is a warning that links to Technical details. Make them live asks once, inline. Sending or applying closes the draft, and the next change starts a new one.
  • Waiting for review (/studio/review, for users with vox:ApplyChanges) lists the sets sent for review, newest first, with their size (the review's, or without one changesSize, the largest size of a set made only of form changes), and shows the chosen one with Make them live. A set that changes a setup file can't be made live without vox:ApplySetupChanges. Apply sends the version the user looked at: when Studio wrote the set again on newer source while the page was open, the page says it changed and asks for another look, and an outdated page gets a conflict, never a silent apply. The top bar's Studio item counts the sets waiting for the user's review.
  • Following a set to live. After Make them live, the page reads the proposal every 3 seconds for 2 minutes, then every 30 seconds for up to 30 more minutes, and only while it's open. After that it says "Still going live" with Check again. When the proposal is applied, Studio reloads the model's metadata, so the new field shows everywhere. An interrupted Apply, eg after a reload, shows that it didn't finish, and Make them live resumes it.
  • History (/studio/history) lists sets newest first, filtered to All, Yours, Live or Didn't go live, each with who made it, its size and its status: Waiting for review (in Yours), Going live (submitted), Live (applied), Didn't go live (the local rollout failed), Turned down or Never went live (expired). A pipeline's failed deployment is invisible to Vox, so such a set stays Going live until someone turns it down or it expires. The chosen set shows the note of whoever turned it down or the developer's note from its manifest, with Take back for the proposer's own set that waits for review while their tray is empty, Turn down with a note for a set going live, and Delete, which asks first since it can't be undone.
  • Undo. In Your changes, each change from a form in the user's open draft has Undo, and a change that needs attention shows why. A new list's change says what became of its options, eg "Linen, Wool and Cotton were added to Fabric".
  • Technical details (/studio/sets/<id>/technical) shows every changed file with its line diff, computed in the browser, setup files first and then grouped like the review's effects, the draft's version, the build it's based on, its stale paths, and Apply's receipt with the rollout's result and output.
  • Marks. Fields in the user's open draft show on the type's page marked Not live yet, Changed or Removed, and fields in their sets that were sent or are going live are marked Waiting for review or Going live. A type with such changes gets a dot in Studio's sidebar. On the overview of a large model, Recently changed lists the latest changes that went live, with who and when.

These screens need Studio's full mode: vox:ProposeChanges and vox:ReadSource with the Studio package registered.

Check that it works​

Build the entry project. Warnings VOX015 to VOX019 say what was left out and why; they never fail the build, also with warnings as errors. Then call IVoxModelSourceReader.ListFiles() in the running application and look for the paths you expect.

Next steps​