Skip to content

Commit efb0a28

Browse files
committed
docs(plans): private changes, explicit repository creation and safe backups are decided
Repositories are never created implicitly: the platform calls an explicit create on a private listener of the node. Changes can be made private by choice, in place of hiding them automatically. Backups stop the node, and a restored node takes back what it signed. Sign-in stays in Origin Auth while its settings, developer console and admin dashboard move to the product's frontend.
1 parent 701e54f commit efb0a28

5 files changed

Lines changed: 128 additions & 110 deletions

File tree

‎docs/plans/platform/README.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,20 @@ Every item carries one of these:
6868
| Formats | Records carry a time, a repository's identity is in its genesis, content can be redacted, and Origin has ignore files | Decided | [origin](origin.md#ignore-files) |
6969
| Origin's roadmap | Four milestones in `sourceorigin-dev/origin`, with epics as parent issues: v0.1 the prototype merged, v0.2 hostable, v0.3 daily use, v1.0 the rest | Decided | [roadmap](roadmap.md#origins-milestones) |
7070
| The open pull requests | Nothing in the stack has to change for hosting. piquel reviews and merges it from the bottom | Decided | [roadmap](roadmap.md#origin) |
71-
| Finding repositories | The server reads which repositories exist from a registry named in its configuration, one repository at a time, and caches the answer | Decided | [origin](origin.md#finding-repositories) |
72-
| Repositories | Private when created, public by the owner's choice, three per account unless an administrator changes it | Decided | [platform](platform.md#projects) |
71+
| Finding repositories | The server reads which repositories exist from a registry named in its configuration, one repository at a time, and caches the answer. Creating one is an explicit call | Decided | [origin](origin.md#finding-repositories) |
72+
| Repositories | Private when created, public by the owner's choice, three per account unless an administrator changes it. A public one can be cloned without an account | Decided | [platform](platform.md#projects) |
7373
| Colocated mode | A working copy that is an Origin workspace and a git worktree at once, so git tools can read it. Built in Origin's v0.2 | Decided | [origin](origin.md#colocated-mode) |
7474
| Encrypted remotes | The client has no TLS, which blocks a hosted node. Fixed in v0.2 | Decided | [origin](origin.md#operations) |
75-
| Backups | piqueld's backups, with a restore drill. How to copy a live store safely is proposed | Decided in part | [platform](platform.md#hosting-and-backups) |
75+
| Backups | piqueld's backups with the node stopped, a restore drill, and a restored node that takes back what it signed | Decided | [platform](platform.md#hosting-and-backups) |
7676
| Git mirror | A one-way Origin-to-git mirror, built before the web UI, for Nix, Cargo and as the fallback. It continues the existing git history | Decided | [origin](origin.md#the-git-mirror) |
7777
| CI | No automatic CI at first. Checks are run by hand, after review. A worker in a sandbox comes later | Decided | [origin](origin.md#ci) |
7878
| Deploys | piqueld builds from Origin, told by a webhook. Deploys are recorded as statements. Environments stay in piqueld | Decided | [origin](origin.md#deploys) |
7979
| Hidden paths | Only folders can be hidden, each with a nonce. Built once the mirror is no longer needed | Decided | [origin](origin.md#hidden-paths) |
8080
| Release channels | Nightly and stable map to targets for the CLI and the SDKs. The hosted service uses feature flags on one version | Deferred | [origin](origin.md#releases-and-channels) |
8181
| Frontend framework | Topcoat goes. An experiment picks between React with TanStack Start and SvelteKit. Leptos is out. The product renders on a server | Decided | [frontend](frontend.md) |
82-
| Origin Auth's pages | Which of them move to the new frontend, and where the settings and the admin dashboard live | Open | [review](review.md#the-auth-port-and-the-admin-dashboard) |
82+
| Origin Auth's pages | Sign-in, consent and recovery stay in Origin Auth. The settings, the developer console and the admin dashboard move to the product's frontend, as one admin app for both services | Decided | [review](review.md#the-auth-port-and-the-admin-dashboard) |
83+
| Between services | Calls between the node and SourceOrigin's services use private listeners, linked through piqueld | Decided | [origin](origin.md#between-services) |
84+
| Private changes | A change can be made private by choice, for sensitive fixes | Decided | [origin](origin.md#private-changes) |
8385
| Diff performance | Diffs must be as fast as Pierre's diffshub. Origin gains a diff endpoint | Decided | [frontend](frontend.md#what-pierre-provides) |
8486
| Reviewed marks | Which files a person has reviewed is private state in PostgreSQL, not statements | Decided | [platform](platform.md#marking-files-as-reviewed) |
8587
| Integrations | A worker that needs only Origin's API is an Origin plugin. One that needs accounts, tenancy or billing lives here | Decided | [platform](platform.md#integrations) |

‎docs/plans/platform/origin.md‎

Lines changed: 69 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ history exists this can't be fixed, so it is settled before then.
110110
- For solo local use, the ID is random, generated beside the node key. It is
111111
not `$USER`.
112112
- **Signing in sets the identity.** `origin login` sets who authors revisions
113-
for that remote. Cloning from SourceOrigin needs a sign-in, so the identity
114-
is right before the first revision is written.
113+
for that remote. A public repository can be cloned without an account, so
114+
work may start before anyone signs in.
115115
- **History made before signing in** is authored by the local ID, and a
116116
revision's author must be the caller, so it can't be pushed as it is. It is
117117
re-authored once, before the first push, which is only allowed while nothing
@@ -142,11 +142,11 @@ asks it.
142142
- Offline, the CLI shows the ID, or a name it last displayed. That cache is
143143
only cosmetic.
144144

145-
**Open:** who may ask. A lookup by the ID stored in every record links all of
146-
a person's history to them, which is more than a public handle reveals. The
147-
proposal is that only signed-in callers may ask. The deletion promise is also
148-
narrower than first written: the provider stops resolving the account, and
149-
anyone who looked it up before may have kept the answer.
145+
**Decided:** the lookup returns what a person's public profile shows, so it
146+
can be public. Profiles will be public pages, sourceorigin#101. An account
147+
with no public profile doesn't resolve, and its ID is shown. The deletion
148+
promise is narrower than first written: the provider stops resolving the
149+
account, and anyone who looked it up before may have kept the answer.
150150

151151
An earlier idea was **dropped**: the server keeping its own table of ID to
152152
last-seen name, refreshed from token claims. piquel wanted something better
@@ -225,48 +225,59 @@ machine. The HTTP API has no way to create one, and the platform needs to.
225225
know about each.
226226

227227
This settles how SourceOrigin manages repositories. The platform's own API
228-
creates a repository by adding it to its database, and it serves the registry
229-
from there. Origin needs no notion of who may create a repository, and what
230-
exists is recorded in one place.
231-
232-
1. **The server asks about one repository and caches the answer** for a short
233-
time. Asking on every request would add a network call to each one.
234-
2. **It looks up by the name in the URL and stores by a stable ID.** The entry
228+
creates a repository: it adds it to its database, serves the registry from
229+
there, and tells the node to create it. What exists is recorded in one place.
230+
231+
1. **The server asks about one repository and caches the answer** for about
232+
30 seconds. Asking on every request would add a network call to each one.
233+
2. **Two limits on staleness.** The cache's lifetime decides how fast a
234+
suspension applies. A second, longer limit decides how long the server
235+
keeps serving a repository when the registry can't be reached. After it,
236+
the server stops taking writes. Without it, a suspended repository would
237+
stay writable for as long as the registry is down.
238+
3. **It looks up by the name in the URL and stores by a stable ID.** The entry
235239
returns the repository's ID, which names it on disk. Renaming a repository
236240
then changes the registry only.
237-
3. **No secret keys in the registry.** See [authority keys](#authority-keys).
238-
4. **No path for now.** The server derives where a repository is from its ID,
241+
4. **A name is one or more segments separated by `/`,** each of letters,
242+
digits, `.`, `_` and `-`, so SourceOrigin can use `<owner>/<repository>`.
243+
Arbitrary text was considered and dropped: it brings look-alike characters,
244+
case folding and URL encoding, which Origin Auth's handles already had to
245+
solve.
246+
5. **No secret keys in the registry.** See [authority keys](#authority-keys).
247+
6. **No path for now.** The server derives where a repository is from its ID,
239248
so a registry can't point a name at an arbitrary directory. When other
240249
kinds of storage arrive, an entry gains a storage location in its place.
241-
5. **An entry carries the first admin and a state.** A state such as read-only
242-
lets the platform suspend a repository without touching the node.
243-
6. **The server creates a listed repository the first time a request names
244-
it.** That must be atomic: two first requests at once make it once, and a
245-
crash halfway leaves nothing behind. The first admin is read only then, so
246-
a registry that later changes it can't hand the repository to someone
247-
else.
248-
7. **`file://` first.** Milestone 1 has no platform service to answer over
250+
7. **An entry carries a state.** A state such as read-only lets the platform
251+
suspend a repository without touching the node.
252+
8. **`file://` first.** Milestone 1 has no platform service to answer over
249253
HTTP, and reading a file is the same code as reading a static list. The
250254
HTTP registry arrives with the platform's API.
255+
9. **No Valkey.** piquel suggested keeping the registry in Valkey so changes
256+
apply at once. A 30-second cache is nearly that, and Valkey would be a new
257+
service that stock Origin has to speak to.
251258

252-
**Proposed,** not answered yet:
259+
Tracked in origin#53.
253260

254-
- **Two limits on staleness.** The cache's lifetime, about 30 seconds, decides
255-
how fast a suspension applies. A second, longer limit decides how long the
256-
server keeps serving a repository when the registry can't be reached. After
257-
it, the server stops taking writes. Without the second limit, a suspended
258-
repository stays writable for as long as the registry is down.
259-
- **No Valkey.** piquel suggested keeping the registry in Valkey so changes
260-
apply at once. A 30-second cache is nearly that, and Valkey would be a new
261-
service that stock Origin has to speak to.
262-
- **A name is one or more segments separated by `/`,** each of letters,
263-
digits, `.`, `_` and `-`, so SourceOrigin can use `<owner>/<repository>`.
264-
piquel asked about arbitrary text. That brings Unicode look-alikes, case
265-
folding and URL encoding, which Origin Auth's handles already had to solve.
266-
The name no longer touches the file system, so only the API's paths change,
267-
and that is cheap before anything is hosted.
261+
### Creating a repository
268262

269-
Tracked in origin#53.
263+
**Decided.** Nothing is created implicitly. Someone calls SourceOrigin's
264+
"create" endpoint, and the platform then calls an explicit create on the
265+
node, with the repository's ID and its first admin. A request that names a
266+
repository the node hasn't created is refused, even if the registry lists it.
267+
268+
An earlier proposal was **dropped**: the node creating a listed repository the
269+
first time a request names it.
270+
271+
The create call is on a private listener of the node. See
272+
[between services](#between-services). Tracked in origin#84.
273+
274+
### Between services
275+
276+
**Decided.** Not everything goes over the public internet. Calls between the
277+
node and SourceOrigin's own services use private listeners, linked through
278+
piqueld, as the telemetry collector is linked today. That covers the
279+
registry, creating a repository, the display-name directory and the webhooks
280+
Origin sends.
270281

271282
## The git mirror
272283

@@ -444,20 +455,32 @@ few possibilities, such as `DEBUG=1`, a short token or a file copied from an
444455
open project. A reader can also see when a hidden file changes, and whether
445456
two are equal. A nonce in a folder defeats all three.
446457

458+
The descriptions, reviews and check output of hidden code stay readable to
459+
everyone who can see a change. Hiding them is a choice made for each change:
460+
see [private changes](#private-changes).
461+
447462
**Proposed,** not answered yet:
448463

449-
- **A revision is visible only to callers who can read every path it
450-
changes,** with its description and the statements about it. Today a
451-
revision is visible when it changes any path the caller reads, so the
452-
descriptions, reviews and check output of closed code stay readable. What a
453-
hidden revision landed is still visible through the target's snapshots.
454-
This is simpler than giving each statement its own audience.
455464
- Gaining read access later is a sharp edge. A local folder then sits where
456465
the real one wants to go. Origin must refuse and ask. It must not overwrite
457466
the local files, and it must not record them as edits.
458467

459468
Tracked in origin#71.
460469

470+
## Private changes
471+
472+
**Decided.** A change can be made private, by choice. Its revisions,
473+
description and statements are then visible only to the people it names, such
474+
as its author and a group of maintainers. piquel wanted this already: it lets
475+
a sensitive fix be written, reviewed and checked before the problem is public.
476+
477+
It is never automatic. A rule that hid every revision touching a hidden path
478+
was proposed and **dropped**: a change in which someone touched a hidden file
479+
by accident would vanish for everyone else.
480+
481+
To design: where the choice is recorded, who may be named, and what becomes
482+
visible when the change lands. Tracked in origin#87.
483+
461484
## Ignore files
462485

463486
**Decided.** Origin snapshots every file except `.origin` and `.git`. The

‎docs/plans/platform/platform.md‎

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ What Origin's own authorization looks like is still open. See
5353
- The web UI is a client of that API. See [the frontend](frontend.md).
5454
- **Decided:** the product's pages render on a server, for search engines. So
5555
a second process serves the frontend beside the Rust API.
56+
- **Decided:** calls between the platform and the node use private listeners.
57+
See [between services](origin.md#between-services).
5658
- **Decided:** the platform writes to Origin as the user. A review only counts
5759
if its issuer is the caller, so the platform's own credential can't issue
5860
one. Origin Auth's token exchange, sourceorigin#70, was moved from its v1.0
@@ -66,35 +68,30 @@ What Origin's own authorization looks like is still open. See
6668
[one node first](origin.md#one-node-first).
6769
- Backups use piqueld's backup features, which are in piqueld's v0.2
6870
milestone. See [the roadmap](roadmap.md#piqueld).
69-
- A scheduled job restores the latest backup into a scratch node and verifies
70-
it. A backup that has never been restored is not known to work. piqueld's
71-
restore drills, piqueld#340, were moved to its v0.2 for this.
72-
- Continuous backup is not piqueld's job. See
73-
[continuous backup](origin.md#continuous-backup).
74-
75-
The council found the first version of this unsafe. **Proposed,** not
76-
answered yet:
77-
78-
- **Stop the node to copy it.** A copy of a live store can catch a target's
79-
head before the objects it names, and a restore drill passing once says
80-
nothing about the next backup. piqueld's `stop` method already avoids this:
81-
it stops the node, copies the volume and starts it again. A few seconds of
82-
downtime at night costs one person nothing.
83-
- **Later, a consistent copy without stopping.** Origin gains a command that
84-
writes one, by reading the heads first and the objects after. Records are
85-
immutable, so everything those heads name is then in the copy.
71+
- **The node is stopped to be copied.** A copy of a live store can catch a
72+
target's head before the objects it names, and a restore drill passing once
73+
says nothing about the next backup. piqueld's `stop` method stops the node,
74+
copies the volume and starts it again. A few seconds of downtime at night
75+
costs one person nothing.
8676
- **A restored node takes back what it signed.** A restore puts the node
8777
behind acceptances that clients and the mirror already hold. If it signed
8878
new ones at the same positions, every chain would fork. So before it takes
8979
writes, it accepts back the acceptances that carry its own signature.
90-
- **The drill does more than check chains.** It runs `origin verify`, which
91-
checks that every record a record names is present, then clones, fetches
92-
and lands.
80+
Tracked in origin#85.
81+
- **A scheduled drill** restores the latest backup into a scratch node, runs
82+
`origin verify`, which checks that every record a record names is present,
83+
then clones, fetches and lands. A backup that has never been restored is
84+
not known to work. piqueld's restore drills, piqueld#340, were moved to its
85+
v0.2 for this.
9386
- **What may be lost.** With a nightly backup, landed code is safe in clients
9487
and in the mirror. Up to a day of changes in progress, reviews and check
9588
results that nobody fetched can be lost.
9689
- **The backup holds the authority key,** because piqueld's backups include
9790
secrets. The backup repository must be encrypted.
91+
- **Deferred:** a consistent copy without stopping. Origin gains a command
92+
that reads the heads first and the objects after. Tracked in origin#86.
93+
- Continuous backup is not piqueld's job. See
94+
[continuous backup](origin.md#continuous-backup).
9895

9996
## Notifications
10097

@@ -214,6 +211,11 @@ From piquel's notes, not discussed in depth:
214211
Their members are stored in policy, like everyone else.
215212
- Every environment has its own Origin node and key: production, staging and
216213
each preview start from scratch.
214+
- A public repository can be cloned without an account. Callers who aren't
215+
signed in get their own, lower rate limits. Tracked in origin#83.
216+
- When an account is deleted, the repositories it alone administers are
217+
deleted with it, after the same waiting period, unless the owner hands them
218+
to someone else first. The deletion page lists them.
217219

218220
Projects and organizations are in milestone 5.
219221

0 commit comments

Comments
 (0)