~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.17.0 Latest 2 packages, 1 image

1
10

Docs: design pages from their facts, and an API reference

Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:docs/facts
.claude/skills/docs/context.mdnew+58−0
@@ -0,0 +1,58 @@
# Context to give a writer
Copy what the page needs into its context file. Give only the glossary
terms its facts use: a writer given more atproto than that teaches the
protocol instead of the page.
## knotless in three lines
- A git repository is a few kinds of record in its owner's atproto account:
one record per ref (with a generation counter), and git packs. Pushing
writes records to the owner's PDS. Nothing else is the source of truth.
- Pulls, issues, comments and pull states are records in each author's own
account. An optional server, knotless-serve, indexes them (the
"appview"), caches git data, and draws the web pages.
- Collaborators can't write to the owner's account, so they push through a
"gateway" the owner delegates to. A repository record lists its
`collaborators`, and its `runners`: the accounts whose checks readers show.
## The reader
Someone who knows git and CI well, and knows roughly what atproto is:
accounts keep records on a server called a PDS. They do not know
atproto's details. Explain an atproto term the first time it matters, in
a clause, and link to https://atproto.com for more.
## Glossary
- **PDS**: the server that holds an account's records and blobs, and signs
its repo. The owner's PDS is the authority on where a ref points.
- **DID**: an account's permanent ID (`did:plc:…`). A **handle**
(`alice.example.com`) is a changeable name that resolves to it.
- **record / record key (rkey)**: a JSON document in a collection (an NSID
such as `dev.knotless.ref`) in an account, addressed by a key. Keys sort
as strings, so a shared prefix can be listed with one `listRecords` scan.
- **TID**: a time-ordered record key.
- **AT-URI**: `at://<did>/<collection>/<rkey>`, the address of one record.
- **blob**: binary data stored beside records (large packs, logs, images).
- **`applyWrites`**: one call that writes several records together, or none.
- **Jetstream / firehose**: public streams of every account's record
changes. Jetstream is a JSON relay whose frames are unsigned.
- **appview**: a service that indexes records across accounts.
- **service token**: a short-lived signed token one account's PDS issues
for calling another service as that account.
- **OAuth session**: a grant an account gives a client to write as it,
within a scope.
- **space**: the permissioned-data alpha's private record store, which
only its members read.
- **lexicon**: the schema for a record type (`lexicons/dev/knotless/`).
- **label**: a moderation tag a labeler publishes about a record or account.
## Pages to link
Design: `README.md` (overview), `storage.md`, `gateway.md`, `access.md`,
`identity.md`, `collaboration.md`, `merge-queue.md`, `runner.md`,
`serve.md`, `security.md`, `prior-art.md`. Reference: `../reference/cli.md`,
`api.md`, `mcp.md`, `workflows.md`, `performance.md`,
`runner-internals.md`. Guides under `../guide/`. Link to them rather than
restating them.
.claude/skills/docs/questions.mdnew+87−0
@@ -0,0 +1,87 @@
# The questions each design page answers
In roughly the order a reader asks them. Start a page's context from
its list, and add what the facts raise. A page with no list here gets
one written the same way: what the thing is, what problems shape it,
then one question per mechanism.
## storage.md
1. What is a knotless repository, physically, in an atproto account?
2. What limits of a stock PDS shape the design, and what does each force?
3. How are records keyed, and why does that make one repository one prefix scan?
4. How does a push work, round trip by round trip, and how is it safe against a concurrent push to the same ref without locking the account?
5. How are large packs stored?
6. How does a fetch find what it needs, and how does it survive a compaction mid-walk?
7. Why and how are packs compacted, and what do old claims and grace periods protect?
8. How do commits without a checkout work, and how do they handle a moved branch?
9. What does a client cache locally, and how do processes share it safely?
10. What does the git remote helper refuse, and why: fetch first, forced pushes, a handle that changes owner?
## serve.md
1. What is knotless-serve, and why is it optional? What is the source of truth if not it?
2. What problems shape it? Reads must be fast though PDSes are far away. Pulls and issues live in many accounts and need an index. Collaborators can't write to the owner's account. Moderation needs a place to happen. It must be cheap to run, and safe to run by anyone.
3. How does the cache stay fresh: TTL, feeds, Jetstream vs firehose, and the trust each one implies?
4. How are git and the object API served from it?
5. What does the appview index, how is it filled and rebuilt, and what does it answer?
6. How do takedowns, reports and labels work here?
7. What does the gateway role add? Keep this to a summary and link to gateway.md.
8. How do the web pages get their data (/_data, the SvelteKit app), and what do they do to stay fast and safe: highlighting, diffs, Markdown and Mermaid, raw files, caching?
9. How are social cards drawn and cached?
10. What do /_status and /mcp do?
11. With --private, what changes, and why does it refuse to listen beyond loopback?
## collaboration.md
1. Where do pulls, issues, comments and reviews live, and why there?
2. How do records refer to a repository so they survive renames? Summary only; link to identity.md.
3. What is an item's state, who may change it, and how is the current one decided?
4. How does a client list everything said about a repository, public and private, and see an item opened a moment ago?
5. How does merging work, step by step, into normal and linear branches, directly and through the gateway?
6. What does a merge record, and how do closing keywords close issues?
7. How are pulls compared and diffed?
8. How do branch renames and retargeting keep pulls attached?
9. How do forks work, including private ones?
10. How does moderation work: the owner's hides and blocks, reports, takedowns and labels, and who applies which?
11. How do the merge gate and merge queue touch merging? One paragraph each, linking to runner.md and merge-queue.md.
## merge-queue.md
1. What problem does the merge queue solve, compared with merging pulls one at a time?
2. How does a pull join, leave, or get ejected, and who may do each? Where is that recorded?
3. How does a runner build a batch, check it, and land it?
4. What happens when a batch fails (halving), and when a pull conflicts?
5. How does the next batch run ahead, and what happens when the one under it fails or changes?
6. How quickly is a newly queued pull noticed, and from where?
7. What happens when the branch, a pull's head, or the queue moves while a batch is being checked?
8. How does the queue interact with other runs: priority, pulls not in the queue, reuse of passes?
9. What does landing write: the merged state, closed issues, deleted branches?
## runner.md
1. What is knotless-run, and what does it produce?
2. What problems shape its design? Events that can't be trusted. Pull code
from strangers. Deploys that must not be cut off. Many pulls retesting
on every merge. Caches that must not leak between trust levels. A runner
that stops and starts.
3. How does it find out something changed, and why does it never run what
an event claims?
4. What exactly does it run for a push, and for a pull? Which commit, which
workflows?
5. Whose code runs automatically, and whose waits for the owner?
6. In what order do runs get a job, and why that order?
7. What happens to a run when a newer commit arrives, and what is different
for deploys (`superseded: finish`)?
8. What happens when the runner stops or crashes, and when it starts again?
9. Where and how does a step run: executors, checkout, environment, time
limits?
10. How do caches stay fast without leaking between trust levels?
11. How do secrets reach a step, and how are they kept out of logs and away
from branches?
12. What does a check record hold, how is it keyed, and why are only some
accounts' checks shown?
13. How do reruns and run-by-name work?
14. How does `knotless merge` use checks (the merge gate)?
15. How does the merge queue use the runner? Keep this to a short summary
and a link to merge-queue.md.
.claude/skills/docs/SKILL.mdnew+81−0
@@ -0,0 +1,81 @@
---
name: docs
description: Write, rewrite or check a page of knotless's docs (docs/, README.md) against the code. Use when a change alters what a doc page says, when asked to write or rewrite a page, or to audit pages for drift. Facts come from the code first; the page is then written from the reader's questions, never by editing old prose.
---
# Writing knotless's docs
Rewriting a page by editing it keeps its shape and its mistakes. These
pages are written from facts instead: gather what the code does, decide
what the reader asks, and write the page fresh with no old prose in view.
Then check it against the facts.
`docs/` is a small wiki, one kind of page per directory:
- `docs/design/`: why it works the way it does. One mechanism per page,
each explained as the answer to a problem.
- `docs/guide/`: how to do one thing, in steps.
- `docs/reference/`: every flag, method, field and message, to look up.
The map from code to pages is in AGENTS.md, under Docs.
## Which job
- A small change to what a page says (a new flag, a changed limit): edit
the page and the reference that lists it, in the pull that makes the
change. Check the edit against the code it describes. Steps 1 and 4
below are enough.
- A page to write or rewrite: all four steps.
- An audit (are these pages still true?): steps 1 and 4 for each page,
then fix what is wrong, or file an issue when the code is what's wrong.
## 1. Facts
Have an agent read the code the page covers, and the page as it stands,
and write a fact inventory to a scratch file. Each fact is one line,
tagged:
- `[code]` read in the code (name the file and function)
- `[doc]` said by a page, not found in the code
- `[both]`
- `[DOC WRONG]` a page says something the code contradicts: give both
A section headed Quirks lists what looks like a bug, with file and line.
Those are filed as issues (`knotless issue`), not written up as design.
Drop `[doc]` facts the code does not bear out.
## 2. Context
Write a short context file for the writer:
- The reader: who they are, what they already know (git, CI, roughly what
atproto is), and why they came to this page.
- knotless in three lines (see context.md beside this file).
- A glossary of only the atproto and knotless terms the facts use.
- The pages it may link to, by path.
- The questions the page answers, in the order a reader asks them. The
lists for the design pages are in questions.md beside this file; start
from those and add what the facts raise.
## 3. Write
Give a fresh agent only the facts and the context, and tell it not to
read `docs/`, `README.md` or `AGENTS.md`. It may read code to settle a
doubt, and says so. The brief, with the style rules, is writer.md beside
this file.
It reports the facts it left off and where each belongs. Place those in
the reference pages and guides yourself (or with another agent), checking
each against the code as you go: details belong there, not on a design
page.
## 4. Check
- Every fact on the page against the inventory, and any doubt against the
code. Agents drop true facts no source stated, and keep false ones a
page did: read the diff of what was there before.
- Pages that state the same thing agree. `security.md` and the overview
draw on the others, so check them last.
- `just docs`: links, anchors, and every Mermaid block draws with Pele
(`npm ci` in `web/` first). The `docs` check runs it on the pull.
- Read the page once as its reader would, top to bottom.
.claude/skills/docs/writer.mdnew+57−0
@@ -0,0 +1,57 @@
# Brief for the writer
Fill in the brackets and hand it to a fresh agent.
---
Write knotless's [design page / guide / reference page] for [topic] from
scratch, as one Markdown file at [scratch path]. It will become [docs path].
## Your inputs
These two files are your only sources. Read them in full before writing:
- [context file]: the reader, background, a glossary, the pages you may
link to, and the questions the page answers, in order.
- [facts file]: the facts, from the code and the old pages.
`[DOC WRONG]` means an old page was wrong: write what the code does,
without mentioning the old page. Leave out what the Quirks section lists,
but never state the opposite of a quirk as design: describe the intended
rule.
Do not read existing documentation: README.md, docs/, AGENTS.md. You may
read code only to settle a doubt about a fact, and say so in your report.
## How to write it
- Lead with the problem: [what the page's subject is up against]. Explain
each mechanism as the answer to a problem, so a reader knows why a rule
exists by the time they meet it. Put the lowest-level details in a
short plain list headed "Details" at the end of their section.
- Define before use.
- Plain technical prose: present tense, active voice, one idea per
sentence, exact names in backticks, short paragraphs. A list only for
truly parallel items, a table only for tabular data.
- Don't number the problems and refer back to them; let the structure
make the connection.
- Avoid the marks of machine writing:
- inflated significance ("plays a crucial role", "serves as")
- "not just X but Y", and reflexive groups of three
- trailing "-ing" commentary
- bold-headed bullet lists (`- **Thing.** text`)
- bold for emphasis, em dashes, title case in headings
- slogans, and summary sentences that repeat the paragraph above
- the words delve, robust, seamless, leverage, comprehensive, powerful
- Diagrams: at most [n] Mermaid diagrams, only where a picture shows what
prose can't. Each must draw with Pele (`just docs` checks it).
- Links: only the paths the context file lists.
- Length: about [n] lines. Command syntax and flags belong in
`../reference/cli.md` and the guides.
## Report back
1. The headings, one line each.
2. Facts you left off, and where each belongs.
3. What you checked in the code, and what you found.
4. The page length in lines.
.knotless/workflows/deploy.yml+3−3
@@ -94,10 +94,10 @@ steps:
- name: checks done
run: |
[ ! -e ~/.moved ] || exit 0
# 25 minutes over all five, and never a failure: the next step judges.
# 25 minutes over all six, and never a failure: the next step judges.
unless-moved on-host '
end=$(($(date +%s) + 1500))
for wf in check test web lexicons shots; do
for wf in check test web lexicons shots docs; do
left=$((end - $(date +%s)))
[ "$left" -gt 0 ] || break
knotless checks "$REPO" --commit "$SHA" --workflow "$wf" --wait "$left" || true
@@ -108,7 +108,7 @@ steps:
[ ! -e ~/.moved ] || exit 0
if ! on-host '
end=$(($(date +%s) + 1500))
for wf in check test web lexicons shots; do
for wf in check test web lexicons shots docs; do
left=$((end - $(date +%s)))
[ "$left" -gt 0 ] || left=1
out=$(knotless checks "$REPO" --commit "$SHA" --workflow "$wf" --wait "$left")
.knotless/workflows/docs.ymlnew+24−0
@@ -0,0 +1,24 @@
# The docs, as `just docs` checks them: every relative link and anchor
# lands, and every Mermaid block draws with Pele, as the pages draw it
# (harness/docs.mjs). Pele comes from web/'s packages, kept between runs
# and installed again only when the lockfile changes.
image: node:24.22.1
# Every push to main, and pulls into it, at their heads merged with it,
# that change the docs, their check, Pele's version or this file. A pull
# changing none passes at once, noted as skipped.
on:
push: {refs: [refs/heads/main]}
pull:
base: [refs/heads/main]
paths: [docs/**, README.md, AGENTS.md, deploy/README.md, harness/docs.mjs, web/package-lock.json, .knotless/workflows/docs.yml]
cache: [web/node_modules]
steps:
- name: packages
run: |
cd web
lock=$(sha256sum package-lock.json)
[ "$(cat node_modules/.lock 2>/dev/null)" = "$lock" ] && exit 0
npm ci --no-audit --no-fund
echo "$lock" > node_modules/.lock
- name: docs
run: node harness/docs.mjs
deploy/README.md+3−3
@@ -19,14 +19,14 @@ cd deploy && terraform apply # DNS, once (terraform.tfvars from the .
### From a push to main to the site running it
`.knotless/workflows/deploy.yml` deploys each push to main, once its five
`.knotless/workflows/deploy.yml` deploys each push to main, once its six
checks pass, and builds the image while they run:
1. **build**: `deploy.sh build` builds `knotless:build-<commit>`, a
candidate, which nothing runs: `knotless:current` and the containers
stay as they are. It removes any candidate an earlier deploy left.
2. **checks done**, **checks pass**: waits for check, test, web, lexicons
and shots at this commit, in one container on the host for all five.
2. **checks done**, **checks pass**: waits for check, test, web, lexicons,
shots and docs at this commit, in one container on the host for all six.
One that fails removes the candidate, and the deploy fails.
3. **deploy**: if main is still at this commit, `deploy.sh up` tags the
candidate `knotless:current`, removes the candidate's tag, and rolls
docs/design/access.md+21−8
@@ -54,7 +54,7 @@ knotless asks only for what it does, rather than for the whole account as
| Scope | For |
| --- | --- |
| `repo:` | each `dev.knotless.*` record it writes |
| `blob:` | packs |
| `blob:` | packs, and profile pictures (PNG or JPEG) |
| `rpc:` | the service tokens it gets to call gateways (`pushRefs`, `createCommit`, `putDelegation`, `getDelegation`) and moderation services (`createReport`), at any audience, since anyone can run a gateway |
| `space` | private repositories |
@@ -73,9 +73,22 @@ A private repository is the space
and member-list read and write policies. Its records are the same as a
public repository's, written with the space's `applyWrites` into the
owner's repo inside the space. A create on an existing key fails there too,
so the claim [compare-and-swap](storage.md#compare-and-swap) works
so the claim [compare-and-swap](storage.md#compare-and-swap-through-claims) works
unchanged.
The calls differ from a public repository's only in their names and
arguments:
- A write is the same batch, sent to `com.atproto.space.applyWrites` as
`{space, repo, writes}`, with each write's `$type` rewritten from
`com.atproto.repo.` to `com.atproto.space.`.
- A pack's blobs are read with `com.atproto.space.getBlob`, carrying the
credential, rather than `com.atproto.sync.getBlob`.
- A read with a credential carries it, and its `getRecord` also asks for a
MAC header.
- A listing's cursor is the record's full URI,
`<space uri>/<did>/<collection>/<rkey>`, not the bare record key.
Spaces are in the reference PDS's permissioned-data alpha. A PDS without
them answers the space methods as unknown, and every repository on it is
public.
@@ -87,19 +100,19 @@ sequenceDiagram
participant M as Member's knotless
participant MP as Member's PDS
participant OP as Owner's PDS
M->>MP: delegation token (signed with a fresh P-256 key, RFC 9421)
M->>MP: delegation token (with the member's session)
MP-->>M: token
M->>OP: exchange for a space credential
M->>OP: exchange for a space credential bound to a fresh P-256 key
OP-->>M: credential (cached until a minute before expiry)
M->>OP: read records, with credential + audience naming the repo
M->>OP: read records, with credential + audience naming the repo,<br/>signed with that key (RFC 9421)
```
The owner reads their own repo in the space with their session. Everyone
else exchanges a delegation token from their own PDS for a space credential
from the owner's, and so does the owner when reading another member's repo.
Both requests are signed with a fresh P-256 key (RFC 9421, as the alpha
specifies). Reads then carry the credential and an audience naming the repo
being read.
The credential is bound to a fresh P-256 key, named in the exchange. Reads
then carry the credential and an audience naming the repo being read,
signed with that key (RFC 9421, as the alpha specifies).
App passwords cannot mint delegation tokens, so reading someone else's
private repository takes an OAuth login. The credential and its key are
docs/design/collaboration.md+327−169
496 lines changed: not loaded until asked for.
docs/design/gateway.md+78−30
@@ -5,8 +5,10 @@ to the owner's account directly. A gateway is a `knotless-serve` with
`--public-url` that the owner has delegated to. It checks who is asking,
then writes as the owner.
A gateway is identified as the `did:web` of its host, and serves its own
DID document with a `#knotless_gateway` service.
A gateway is identified as the `did:web` of its host (a port's `:` as
`%3A`), and serves its own DID document at `/.well-known/did.json`, with a
`#knotless_gateway` service and an `#atproto_labeler` one, both at its
public URL. `--public-url` is `http(s)://host[:port]`, with no path.
```mermaid
sequenceDiagram
@@ -32,16 +34,34 @@ ID is `/oauth-client-metadata.json` on its public URL. It authenticates to
authorization servers with a P-256 key kept in its config directory
(`oauth-client-key`) and published in that metadata.
The metadata names the redirect `<public-url>/oauth/callback`,
`private_key_jwt` with `ES256`, DPoP-bound tokens, the grant types
`authorization_code` and `refresh_token`, `client_name` `knotless
gateway` and `application_type` `web`.
1. `knotless delegate` calls `dev.knotless.putDelegation` with a service
token.
2. The gateway pushes an authorization request for the owner, and returns
its URL. The owner approves it in a browser.
2. The gateway pushes an authorization request for the owner at their
PDS, and answers `{url, state}`. The owner approves it in a browser. A
delegation still waiting after 15 minutes is dropped when the next one
starts.
3. The browser comes back to the gateway's `/oauth/callback`. The gateway
keeps the session, and refreshes it as that client.
4. Meanwhile `knotless delegate` waits on `dev.knotless.getDelegation`.
The grant is narrow: the four knotless record types, blobs, and those
collections in the owner's own spaces. A confidential client's session
keeps the session, and refreshes it as that client. The page says `The
gateway now writes for you. You can close this tab.`, or `The gateway
was not delegated to: <error>`; a `state` nobody is waiting on is 400
`no delegation is waiting for this`.
4. Meanwhile `knotless delegate` calls `dev.knotless.getDelegation?state=`,
which waits up to 25 seconds. It answers `{done: false}` to ask again,
`{done: true}` once approved, 403 if the authorization failed, and 404
`no such delegation` for a state the caller did not start.
The grant is narrow: the four record types a push writes (`repo`, `ref`,
`claim` and `pack`), blobs, and those collections in the owner's own
spaces. `redirect` is left out, since a gateway never renames a
repository. The scope is `atproto
repo:dev.knotless.repo repo:dev.knotless.ref repo:dev.knotless.claim
repo:dev.knotless.pack blob:*/*
space:*?authority=self&collection=dev.knotless.repo&collection=dev.knotless.ref&collection=dev.knotless.claim&collection=dev.knotless.pack`. A confidential client's session
lasts up to two years if it is used at least every three months. The owner
revokes it from their PDS's account settings.
@@ -51,28 +71,53 @@ Sharing a repository for writing records the gateway in its `repo` record.
Every call to the gateway carries a service token from
`com.atproto.server.getServiceAuth`, with the gateway as audience and the
method as `lxm`. The gateway checks the token against the signing key in
the issuer's DID document (Multikey, or the legacy secp256k1 type that PLC
still returns). Then it checks that the issuer is the owner or a
collaborator.
method as `lxm`. A call without one is 401 `a service token is
required`, and one with a bad token 401. The gateway checks the token
against the signing key in the issuer's DID document (Multikey, or the
legacy secp256k1 type that PLC still returns). Then it checks that the
issuer is the owner or a collaborator, else 403 `<caller> is not a
collaborator on <url>`, and that the owner has delegated to it, else 403
`<owner> has not delegated writes to this gateway`.
## Push
`dev.knotless.pushRefs` takes a JSON header line, naming the repository and
the ref updates, followed by the pack. The gateway indexes the pack into
its mirror and pushes as the owner, with the same
[compare-and-swap](storage.md#compare-and-swap) as any push.
the ref updates, followed by the pack, as `application/x-knotless-push`, at
most 512 MiB. Each update's `src` is a 40-character lowercase hex hash, or
absent for a deletion, and its `dst` starts `refs/`; else the push is 400
`bad update of <dst>`.
Pushes to one repository take turns, under a lock in the process. The
gateway syncs its mirror, indexes the pack into it, and refuses a tip the
pack does not bring (400 `the pack does not hold <sha>`). It then pushes
as the owner, with the same
[compare-and-swap](storage.md#compare-and-swap-through-claims) as any push. It answers
`results`, a `{name, error?}` per ref: each update lands or is refused on
its own, and the client fails on the first one refused.
## Commit
`dev.knotless.createCommit` takes path changes and an optional `base`, the
commit they were made against.
Commits to one branch queue up. Whichever request takes the branch's turn
drains the queue, builds the commits as a chain, and lands them in one push.
If the branch moved, the chain is rebuilt on the new tip, up to eight
times. A change to a path that also changed since its `base` is a conflict
(409) for that commit alone.
commit they were made against. One with no branch or message is 400 `a
commit needs a branch and a message`. Whether the caller may write is
checked before the commit is queued, so a batch holds only commits that
may land.
Commits to one branch queue up, per owner, repository and branch.
Whichever request takes the branch's turn, a lock of its own, drains the
queue, builds the commits as a chain on the tip, and lands them as one
forced ref update against the generation it read. If the branch moved, the
chain is rebuilt on the new tip, up to eight times with no pause between,
and then every commit in it fails 409 `<ref>: <reason>`. A change to a
path that also changed since its `base` is a conflict (409) for that
commit alone; the rest land. A build error fails the whole batch: 400 for
bad input, else 500.
Each answer is `{sha, parent, changed, batched}`, where `batched` is how
many commits went out in the write that carried it. A commit that names no
author is authored with the name `knotless` and the owner's
`<did>@knotless.invalid`. The client
reports `attempts` as 1 for a commit through a gateway, as it pushed once.
This way many agents can commit to one branch without each losing races:
the gateway turns many writers into one.
@@ -82,11 +127,13 @@ the gateway turns many writers into one.
A `rules` entry on the repository record protects a branch. The gateway
refuses a push to it that:
- deletes the branch;
- moves it anywhere but forward;
- when the rule's `history` is `linear`, brings it a merge commit. That is
any commit with two parents between the branch's tip and the new one (or
in all of its history, for a branch that does not exist yet), even if the
- deletes the branch: `protected branch: it is not deleted`;
- moves it anywhere but forward: `protected branch: it only moves
forward`;
- when the rule's `history` is `linear`, brings it a merge commit:
`protected branch: no merge commits; squash or rebase`. That is any
commit with two parents between the branch's tip and the new one (or in
all of its history, for a branch that does not exist yet), even if the
commit is already on other branches.
Commits through `createCommit` build on the tip with one parent, so they
@@ -97,8 +144,9 @@ A `history` value this version does not know reads as `linear`, so a rule
that a newer client wrote is held at least as strictly. A client rewriting
the record keeps the fields it does not know.
The owner writes their own records without any gateway, so the rules bind
the owner only as far as their own client keeps to them.
The rules hold whoever pushes through the gateway, the owner too. But the
owner writes their own records without any gateway, so the rules bind the
owner only as far as their own client keeps to them.
## Trust
docs/design/identity.md+25−10
@@ -15,10 +15,10 @@ key. Readers match on the URI's owner and the key, never on the name. So
those records follow a rename, and never attach to a later repository that
takes the same name.
A `knotless://handle/name` remote resolves the handle on every use. The
helper records the DID the remote first resolved to, in
`remote.<name>.knotlessdid`, and refuses to push or fetch if the handle
later names another account.
A `knotless://handle/name` remote resolves the handle on every use, from a
cache kept for `KNOTLESS_IDENTITY_TTL_SECS`. The helper records the DID the
remote first resolved to, in `remote.<name>.knotlessdid`, and refuses to
push or fetch if the handle later names another account.
## Renames
@@ -35,6 +35,8 @@ A lookup by name that finds no `repo` record reads the `redirect` under that
name and follows it. Clone URLs, remotes and links made with the old name
keep working, and `git` is told the new name. A redirect is followed only
within the account, and only to a record with the key the redirect names.
A lookup follows up to four redirects: one is the rule, and the rest let a
read race a rename.
Creating a repository under a name that holds a redirect replaces the
redirect. Deleting a repository deletes its redirects.
@@ -66,6 +68,9 @@ another account in two steps:
2. The recipient accepts. The repository is copied into their account with
the same key, and with `transferredFrom` naming the old place.
Only a public repository can be offered: a private one's pulls and issues
are in its space, which cannot move.
```mermaid
sequenceDiagram
participant A as Old owner
@@ -80,12 +85,20 @@ sequenceDiagram
A move holds only when both sides say so:
- A reader following the old name goes to the new place only if the new
`repo` record names the old one.
`repo` record names the old one in `transferredFrom`. The old place
leads there by its `transfer` offer, or, once the old copy is deleted,
by a redirect into the other account. A redirect to another account is
never followed as a rename.
- Records about the old repository count for the new one only if the old
owner's offer leads there, or the redirect they leave when they delete
the old copy does.
- State changes the old owner made before the new `repo` record was created
still count. Later ones do not.
the old copy does. The appview's `getForge` then returns them with the
new repository's own.
- State and merge-queue records the old owner made before the new `repo`
record was created still count as a maintainer's. Later ones do not.
Moves are followed across accounts up to four times. The remote helper
follows a moved or renamed repository and prints the `git remote set-url
<remote> <new url>` to point the remote at it.
When the old copy is deleted, its name and redirects become redirects into
the new account.
@@ -121,8 +134,10 @@ the commits they got merged.
A commit knotless makes for an account that names no author is authored as
`<did>@knotless.invalid`, which needs no claim.
The first push from a machine claims the address git authors commits as
there, if the account has made no claim yet, and says so. After that,
The first push from a machine that lands a ref claims the address git
authors commits as there, if the account has made no claim yet, and says
so. The cache's `emails.json` remembers which accounts were looked up, so
it is asked once per machine. After that,
`knotless email add` and `remove` change the list. An address taken back
stays taken back.
docs/design/merge-queue.md+308−142
450 lines changed: not loaded until asked for.
docs/design/README.md+75−65
docs/design/security.md+219−48
docs/design/serve.md+344−236
580 lines changed: not loaded until asked for.
docs/design/storage.md+349−163
512 lines changed: not loaded until asked for.
docs/guide/collaborating.md+33−9
docs/guide/private.md+4−2
docs/reference/api.mdnew+290−0
docs/reference/cli.md+125−36
docs/reference/mcp.md+13−0
docs/reference/performance.md+10−0
docs/development.md+26−2
docs/README.md+2−0
harness/docs.mjsnew+88−0
AGENTS.md+32−5
Justfile+4−0