Drafts and slots
A draft is a version of the site that the owner can look at before it goes live.
A draft is unlisted and it is noindex.
Its forms work. A message sent on a draft is a draft message: it is kept
apart from the live site's, it is mailed to the site's owner only with
[Draft] in the subject, and it uses none of the live form's limits.
Slots
A site has one draft slot, slot 1. It keeps one draft address, and each new draft replaces the one before it.
A slot can own a branch: refs/heads/slot-1. No slot owns a branch
by default. The first write with that slot starts one. A read with
a slot reads the site, because looking is not starting.
Approval
A draft reaches the public when somebody publishes it: the agent, after the
owner says yes in the chat, or a person on the draft's review page in the
app. Publishing a draft moves the slot's branch into main.
Publishing needs approval
The owner can turn on Publishing needs approval for a site, on its
Settings tab in the app. Then no agent and no API token puts the site live:
every publish, activate and restore answers needs_approval (409). The
agent makes a draft and sends the owner its review_url. The owner, or
somebody who works on the site, compares the draft with the live site on
that page and publishes it there. A restore is done on the site's versions
page.
Only the owner changes the setting, and only in the app. It is off for a new site. The app's home page lists the drafts that wait for an answer only for sites where it is on.
- If the live site has not moved, the move is a fast-forward.
- If the live site has moved, Clave refuses, and the agent answers with
one of two calls:
- merge combines the two and builds a page nobody has seen yet;
- catch-up brings the site into the slot, so the owner looks again.
Then Clave builds the approved commit again for the live site. A draft is built with its own address and its own posts, so the live site cannot use its bytes. The source is the same, so the pages are the same. A draft that has no source commit (a build from a laptop) goes live as it is.
main never takes a conflict marker. A slot's branch can, because there
is no working copy here to hold a half-done merge.
Posts on a draft
The posts repository has a slot line too: refs/heads/slot-1. The draft
shows the posts on that line. The live site shows the posts on main.
- A write with a slot to the posts writes to the slot's line. The first
one starts the line from
main. - Approval does not move posts. To put a post live, write it on
main. - Catch-up brings the posts on
maininto the slot's line too. - Discard removes the slot's line. A post on it that
maindoes not have counts as work, so the discard needs a confirmation.
A post marked draft: true stays off the live site, and a draft shows it.
Discard
Discarding a draft takes it offline and removes the slot's branch. The slot keeps its address and its store. A slot that holds work needs a confirmation before it is discarded. That is the one destructive act here.
Archiving a site takes its draft offline too, and keeps the slot. The next draft after the site comes back answers at the same address.
Draft data in the app
The Enquiries, Mail and Files tabs of a site show the live data first. The Live | Draft control above each list shows the draft's. The counts on the tabs and the account's inbox are live only, so test data never asks for attention.
The site's page has two controls on the draft, each with a confirmation:
- Reset draft data empties the draft's store and runs the migrations and the draft seeds again.
- New draft address moves the draft. The old address stops answering.