Elffuss BraidHub

utopia-ia/elffuss-braid public

2da7deeea818 · 159.0 KiBSourceRawPermalink

BraidHub: the protocol

BraidHub is a braid server: repositories live on it, people and agents sign in with GitHub, and agents on any machine land on the same main. Each repository can keep a GitHub repository as its mirror. BraidHub runs at https://braidhub.elffuss.com. This document is the contract between the hub and the client (braid login, braid hub …, and braid land / braid update in a repository linked to a hub). crates/hubproto holds the types and the object stream codec that both sides use.

Status: protocol version 1. Everything here is new in braid 0.1, and the hub serves all of it.

Sections 1 to 14 are the core: accounts, repositories, objects, landing, git, mirrors, limits, the client and the web. Sections 15 to 24 are what grows around the repositories: browsing, discovery, stars and following, issues, change requests, forks, the inbox, blocks, syncing with GitHub, and the terms.

1. Conventions

Markdown

The text is CommonMark, with GitHub's tables, strikethrough (~~text~~), task lists (- [ ], - [x]) and footnotes ([^1]). What it renders to is safe on the hub's pages, whoever wrote it:

References in the prose of a text, outside code, links, images and raw HTML, link where the reader may follow them, and stay text otherwise, as a reference to something that does not exist does:

A reference stands apart from what is around it: nothing that would make it part of a word, a path, a URL, an entity or an e-mail address comes just before it (a#4, x/#4,  and ada@example.com hold none), and no letter, digit or _ comes just after it. N is 1 to 999,999,999, written without leading zeros. The first 50 different references of a text link; the rest stay text. What a reference does when a text is written is in section 18.

Closing words name the issues that a landing on the default branch closes (section 8): close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved, in any case, then spaces, then #N, outside code. Fixes #4 names issue 4, and closes#6 names nothing; a message names at most 50.

2. Authentication

Tokens. brd_<id>_<secret>: id is 8 characters and secret 52, both lowercase RFC 4648 base32 without padding (a-z 2-7); the secret holds 32 random bytes. A client sends Authorization: Bearer brd_… on every request, SSE included. Never in a URL, a query string, argv or a log: the server logs the token's id only, and keeps a keyed hash of the whole token, compared in constant time.

A token has an expiry (required, at most one year) and scopes. A scope is {"repo": "<owner>/<name>" | "<owner>/*" | "*", "rights": [<right>…]}, where a right is read, interact, write, land:<ref glob> or admin. write includes read and interact, and admin includes all three; a land:<glob> right counts only together with write. interact lets a token take part where its account reads (section 5): star, watch, open issues and change requests, comment, review, and mark its notifications; on *, it also follows and blocks accounts and changes the account's settings. It gives no read of its own, and forking also needs write where the fork goes (section 20). A token never grants more than its account has: the effective right on a repository is the token's scopes intersected with the account's own permission (section 5).

A request without Authorization is anonymous, and reads public repositories. A token that is malformed, unknown, revoked or expired, or whose account is gone or suspended (section 22), is 401 unauthorized, even on a route anonymous callers may use.

Accounts. An account is a GitHub account: its login, lowercase, names it, and it keeps GitHub's numeric id. A sign-in whose id differs from the one an account keeps is 403 forbidden: a login renamed away from, or reused after its account was deleted, does not take over that login's repositories. A GitHub account that renamed itself signs in as a new account; the old one keeps its repositories. An account made for a login before it ever signed in takes the id of its first sign-in. A suspended account's sign-ins and sessions are refused.

When the hub cannot sign people in with GitHub (sign-up is not open, or GitHub does not answer), its sign-in routes answer 503 unavailable.

Device flow (CLI and agents). braid login runs GitHub's device flow through the hub, so no browser is needed on the agent's machine:

  1. POST /v1/login/device, with an empty body or {} → {"poll", "user_code", "verification_uri", "expires_in", "interval"}. poll is an opaque id the hub keeps for the flow, 64 hex digits; GitHub's device code never leaves the hub.
  2. The person opens verification_uri anywhere and types user_code.
  3. POST /v1/login/device/poll {"poll"} every interval seconds → {"status": "pending"}, {"status": "slow_down", "interval"}, {"status": "denied"}, {"status": "expired"}, or {"status": "ok", "token", "login", "expires"}. The token has the scope {"repo": "*", "rights": ["read", "write", "land:*"]}, the note braid login, and lives 90 days. A poll id the hub does not know (it forgets flows when it restarts) or whose flow ended is expired; a second poll while one is asking GitHub is slow_down.

The GitHub token of a sign-in says who signed in, and is dropped. The client stores the hub's token and the hub URL in ~/.config/braid/hub.json, mode 0600, or reads BRAID_TOKEN and BRAID_HUB_URL from the environment.

Web. Signing up and signing in are one: the first sign-in makes the account. GET /login works as a link from anywhere: it sends a visitor who is signed out straight to GitHub's authorization page, and GitHub's answer brings them back signed in, to /, or to /-/onboarding for an account its first sign-in made (section 23); one signed in already goes to /. While sign-up is not open, GET /login answers with a page that says so (503). GET /login redirects to GitHub with a random state, which a cookie keeps for ten minutes (HttpOnly, SameSite=Lax, Path=/auth/github, signed by the hub); GitHub calls back GET /auth/github/callback, which goes on only with that cookie and that state, exchanges the code with the app's client secret, and starts a session: a random secret in the cookie braidhub_session (HttpOnly, Secure, SameSite=Lax, 30 days). The hub keeps it under a keyed hash of the secret, never the secret. Every form carries the session's CSRF token in the field csrf; an API call made with a session sends it in X-CSRF-Token. POST /logout (with csrf) ends the session. Expired sessions go with the daily purge.

GitHub access. Signing in asks GitHub for the account's identity only (read:user). Importing a private GitHub repository, mirroring to one and syncing the account's GitHub repositories (section 23) need repository access, which the account grants in a browser or with a device flow:

A grant made as another GitHub account than the one the account signed in with, and one in which GitHub granted less than was asked, are refused with 403 forbidden, and nothing changes. A grant replaces the one before; the account's mirrors that waited for one (needs_grant, section 11) go on. The device routes, and the listing and batches of section 23, act for the caller's own account: with a token that has write (or admin) on <login>/* or *, as the token of braid login has, or with a session that sends its CSRF token in X-CSRF-Token. A token that only reads or interacts, or reaches one repository only, is 403 forbidden; no token and no session is 401 unauthorized. A hub that cannot reach GitHub repositories answers them 503 unavailable.

The hub keeps the GitHub token of a grant sealed, and uses it only for the account's own imports, mirrors, webhooks and permission checks, passed to git through the environment, never in a URL or argv. If the hub's keys change, the account grants access again.

3. Accounts and tokens

4. Repositories

Every repository has an id: r_ and 26 characters of a-z and 2-7, given when it is made and never changed. No other repository ever takes it, not even one made later under the same name. What belongs to a repository (its stars, watchers, issues, change requests and the notifications about them) follows its id, so a repository deleted and made again under its name starts with none of it.

5. Permissions

An account's permission on a repository is the highest of:

The hub asks GitHub only when the rest gives the account less than a request needs: reading a public repository never asks it, and neither does anything the owner or a collaborator entry already allows. It keeps each answer ten minutes (a failure to ask, one minute). What pages and answers show (the permission of a repository, links such as the repository a fork came from, buttons, list rows) comes from what the hub knows already, and asks GitHub nothing: a permission that comes from GitHub shows once a request needed GitHub's answer, for as long as the hub keeps it, and lists include such a repository on the same terms.

GitHub limits how many requests the owner's access makes in an hour. While GitHub says fewer than 500 are left, the hub asks it nothing for other accounts until the limit resets; and one account makes at most 100 questions in any hour on the access of one owner. A question not asked gives nothing: a repository only GitHub would open answers 404, and a write only GitHub would allow answers 403. The owner's own work is not held back.

Before any of that, some repositories give nothing at all:

read covers reading: every GET and HEAD of a repository but those of its collaborators and its blocks, POST …/missing, POST …/lacks, the ref watch, and checking a change request; interact covers taking part (below); write covers uploads and managing issues and change requests (sections 18 and 19); landing on a ref needs write and a land:<glob> right whose glob matches the ref (* matches anything, release/* one level); admin covers the settings, the collaborators, the repository's blocks and deleting. A token's rights are cut down to its account's permission, never below what anyone may do: any token reads a public repository, where the rules above let anyone read it. A web session has all its account may do.

Interacting with a repository (starring, watching, opening issues and change requests, commenting, reviewing, forking) needs an account that may read it, that is not suspended and that is not blocked there (section 22), through a web session or a token with a scope that reaches the repository with interact, write or admin. A token that reads a public repository only because anyone may does not interact with it, and an anonymous caller never does (401). A repository the caller may not read answers 404 here too, as a missing one does; one it reads but may not interact with, 403. Following and blocking accounts need a web session, or a token with interact, write or admin on *.

6. Objects

Objects are immutable and named by their braid id, so every read is cacheable forever.

What a change request from another repository brings is not the target's until it lands: these routes of the target never serve it, and the request's own routes do (section 19).

7. The object stream

application/x-braid-objects: the 10 bytes BRAIDOBJ1\n, then records, then a terminator.

A reader checks every record's id against its kind and payload before using it.

8. Refs and landing

9. Git

10. Trees

GET /v1/r/{owner}/{name}/t/{tree}?prefix=src/net&depth=2 → {"tree", "prefix", "entries": [{"path", "kind", "id", "size", "truncated"}]}, where kind is file, executable, symlink, tree or gitlink, size is given for files, executables and symlinks, and truncated: true marks a directory below depth, whose entries are not listed. prefix names a directory of the tree (none for the tree itself; leading and trailing / are ignored); 404 when it is not one. depth, 1 (the default) to 64, is how many levels below the prefix are listed. Entries come in name order, each directory followed by what it holds; path starts at the tree listed, so it begins with the prefix. A gitlink's id is its commit in hex. At most 100,000 entries (413 beyond). A tree the hub does not have is 404. Immutable, like the objects. Section 15 reads a revision's files by path.

11. Mirrors

A repository with a mirror publishes its default branch there after each landing on it, with git sync --direction publish and the owner's GitHub access: the push is a fast-forward with a lease, and the remote's history is never rewritten. Publishing runs after the landing's answer, one at a time per repository: landings during a publish fold into one more. A publish that fails (git cannot reach the mirror, or the mirror moved during the push) is tried again a second later, then twice as long after each failure, at least every five minutes, until it goes through, and when the hub starts. So is one still waiting when the hub stopped: when it starts, the hub also publishes each mirror whose default branch moved since its last sync went through.

Following GitHub. A mirror can follow GitHub as well as receive the hub's landings. PATCH /v1/r/{owner}/{name} (admin) takes mirror_follow:

Repositories brought in from GitHub by syncing them (section 23) follow with merge unless the sync says otherwise. mirror_follow on a repository without a mirror is 400 invalid; a new mirror URL starts again at off, unless the same PATCH sets mirror_follow too. POST …/mirror/sync (section 23) looks at the mirror at once.

What both sides hold. The mirror keeps synced: the git commit both sides held after its last publish, follow or import. A publish runs only when the default branch moved since, and a follow only when GitHub's head is another commit: the push the hub makes itself, coming back from GitHub, changes nothing, so the two sides never chase each other.

A rewritten history is never merged back. When GitHub's branch no longer descends from synced, someone rewrote its history (a force push). The hub records rewritten, stops following and publishing, tells the admins, and merges nothing, since a merge would bring back what the rewrite took out; POST …/mirror/follow refuses it as well, with the same outcome. The way out is on GitHub: put the commit synced names back in the branch's history (push it again, or merge it in), then sync now (section 23); or point the mirror at another repository, or take it off.

One repository here per repository there. A GitHub repository, named in any case, with or without .git or a trailing /, is the mirror of at most one repository of the hub: setting it as the mirror of another, with POST /v1/repos or PATCH, is 409 exists, until the repository that holds it lets it go or is deleted. The GitHub repository's numeric id counts too, so that a renamed repository stays one: a repository that names a renamed GitHub repository's new address before the hub has found the rename is marked duplicate once it does, and the repository that held it keeps it.

How the hub hears of pushes. A mirror that follows gets a webhook on the GitHub repository when the owner administers it there; otherwise the hub asks GitHub now and then: every ten minutes, hourly once GitHub's branch has not moved for a week, every six hours while a webhook works, and less often after failures. A webhook only says when to look: what is taken in is fetched from GitHub, as always. When the mirror stops following, moves to another repository, or its repository is deleted, the hub deletes its webhook.

The owner's access. The hub reaches GitHub with the access the owner granted (section 2). When GitHub refuses it (revoked, expired, or not reaching that far), the outcome is needs_grant, the account's mirrors neither publish nor follow, not even by POST …/mirror/follow, and the account is told; granting access again, at /auth/github/repo-access, lets them go on, and what waited is published.

Renames. A mirror whose address finds nothing is looked up on GitHub by its id: renamed or transferred, the mirror follows the new name, and url says it; deleted, or no longer shown to the owner's access, the outcome is gone and the hub stops following it.

GET /v1/r/{owner}/{name} reports the mirror in mirror:

settings.mirror_follow (admins) says the policy too. What the hub imports or takes in from a mirror counts as admitted.

Git runs with none of the machine's or the user's settings, no prompt or credential helper, no redirect, HTTPS only, no hooks, and in bare repositories only: nothing of a repository runs on the hub. The owner's GitHub token reaches git as an Authorization header for https://github.com/ alone, through the environment.

12. Limits

Per token, and per address for requests without one: requests per minute, bytes served per day, and open watches. A limit reached answers 429 rate_limited, with retry_after seconds in the body and in Retry-After. The limits are 6,000 requests a minute for a token and 600 for an address, refilled evenly (one back every sixtieth of the limit); 100 GiB a day for a token and 10 GiB for an address, counted as answers are sent, over a day that starts with the first byte; 64 open watches for a token and 16 for an address. A request counts for its token when the hub has that token (a made-up one counts for its address). The address is the one the request came from. GET /healthz is never limited. Counts start again when the hub restarts.

Some requests count for more than one against the requests a minute, for the work they cost the hub: explore, search and topics, their pages and their routes (GET /v1/explore, /v1/topics, /v1/topics/{topic}), 10; diffs and comparisons (…/changesets/{rev}/diff, …/compare, the diff of a change request, the pages that compare a head for a new request, and their pages), 10; the log (…/log) and the pages of commits, 5; checking and landing a change request (…/requests/{n}/check, …/requests/{n}/land), 20. A request that costs more than a whole minute's limit waits for the whole minute's budget, and then goes through. Webhook deliveries (POST /v1/hooks/github/{key}) are not limited per address, since GitHub sends every delivery from a few addresses: their route limits them per hook (section 23). A request that shows a token counts for its token there too.

Account quotas. Anyone with a GitHub account may sign up, so each account owns at most 100 repositories (POST /v1/repos is 403 quota beyond), and its repositories store at most 10 GiB together, counted for the owner whoever uploads: an upload (PUT …/o/{id}, POST …/objects) or an import that would pass it is 403 quota. What an account stores is the size of the files of its repositories, their git mirrors included, and of the repositories it deleted, until the purge erases them (section 4); it is measured at most every half minute per account, with what was uploaded since added on top, a body without Content-Length by what it carried. An upload counts from its start, with its body's Content-Length (one without counts as its route's size), so that uploads at once do not pass the cap together; one under way may pass it by its own size. An import that fails or is refused leaves nothing behind. A fork's job reserves, from the account's storage, what its upstream stores, from when it is asked for until it ends, and the jobs and imports under way count toward the repositories it owns (sections 20 and 23). What a change request from another repository brings counts for the request's author until it lands (section 19).

Social writes. Each account may make so many of each kind of social write. Every token and the web session of an account spend one budget, so that more tokens buy no more writes. The hourly limits refill evenly, one write back every hour-th of the limit, so a burst need not wait for the hour to turn; the daily ones count per UTC day. An account made on the hub less than seven days ago, or whose GitHub account is less than thirty days old, gets a quarter of each limit, and at least one write. A limit reached answers 429 rate_limited, with retry_after the seconds until the write would go through.

WritesLimit
Starring and unstarring120 an hour, 1,000 a day
Following and unfollowing60 an hour, 500 a day
Changing what is watched120 an hour
New issues20 an hour, 100 a day
Comments, reviews and edits of their text, together60 an hour, 500 a day
New change requests20 an hour, 100 a day
Updates of change requests120 an hour
Forks10 an hour, 30 a day
Labels, assignees, states and settings300 an hour
Blocking and unblocking60 an hour
Marking notifications600 an hour
Batches of repositories synced from GitHub6 an hour

How each write counts: a star taken back as a star, an account unfollowed as a follow; a level of watching changed, and a thread followed or muted, as a watch (sections 17 and 21); a comment, a review, and a change of a title or a text as a comment; a change of state, labels, assignees or lock, a comment hidden or deleted, a label made or deleted, a draft marked ready, reviewers asked, a change request deleted, a retry of a sync, and a change of an account's or a repository's settings or collaborators as an edit (sections 3, 4, 18, 19 and 23); a change request's update as a request update; marking notifications read or done as a mark.

Besides, a repository takes at most 100 new threads (issues and change requests together) an hour from the accounts that cannot write to it, between them, so that many accounts cannot bury its issues. Accounts with write on it are not counted, whatever the scopes of the token they use. The 429 says how long until the repository takes another. Such an account has at most 100 open threads in one repository (403 forbidden past it, until it closes some).

Sizes. A body whose Content-Length is over its route's size is refused at once, before the hub reads any of it. The sizes, each answered 413 too_large, and given by GET /v1 (section 1): an object through PUT, 64 MiB; a request body, 256 MiB (an object stream, and each of its records); a JSON body, 4 MiB; a list of ids (lacks, want, have, a stack), 10,000; the path prefixes of /missing, 1,000; a /missing page, 100,000 entries, and its walk, 1,000,000 objects; a tree listing, 100,000 entries; the repositories GET /v1/repos lists, an account's tokens and a repository's collaborators, 1,000. braid_hubproto::limits holds them.

The sizes of browsing and of the social features, which limits.social of GET /v1 gives: a page of a list, 100 entries (page); a page of a directory, 1,000 entries (dir_page); a file shown as text, 1 MiB (text_view); a title, 256 characters (title); a text, 64 KiB (text); a repository's topics, 20 (topics), each of at most 50 characters (topic); a repository's labels, 100 (labels), and a thread's, 20 (thread_labels); a thread's assignees, 10 (assignees); a thread's comments, 2,500, at which it locks itself (comments_per_thread); the line comments of one review, 100 (review_comments); the mentions of one text that notify, 10 (mentions), and the references of one text that link, 50 (references); the changesets of a change request, 1,000 (request_changesets), and what one brings from another repository, 256 MiB (request_bytes).

The sizes of diffs: a page of a diff, a changeset's files and a comparison's files hold at most 300 files; a version larger than 256 KiB is not diffed; the hunks of one file stop after 5,000 lines; a whole diff as text holds at most 8 MiB; and the lines of one page as much, each line counting 64 bytes more than it holds, so that a page of short lines holds fewer of them.

13. The client

Those of the commands below that act on one repository of the hub take it as -R OWNER/NAME (--hub-repo), else the one the repository braid runs in is linked to (braid hub request takes, in a fork's clone, the repository it was forked from). Each takes --json, which prints what the hub answered, as its section gives it, unless it says otherwise below. Their exit status is 0 when the hub did it, 1 when it refused (a repository, revision, path or thread that is not there or that the caller may not read, a write not allowed, a limit), with its reason on standard error, 2 for conflicts where a command says so, and 3 when the hub could not be reached or failed. Without --json, what anyone wrote and the hub gives (names, descriptions, topics, titles, texts, comments, logins, labels, a README) is printed with its control characters escaped (\u{1b}, \n), line breaks and tabs of texts kept, so that it can neither drive the terminal nor print a line that looks like braid's; --json and braid hub cat give the exact text. The texts they send carry the global --agent (or BRAID_AGENT) as agent, unless it is cli. Commands that open, comment or review send an Idempotency-Key (section 1), and send the request once more with the same key when the answer was lost, so that nothing is done twice; when it is lost twice, the error says that the hub may have done it all the same, and which command shows whether it did.

Reading without cloning (section 15).

Finding repositories and accounts (section 16). Neither needs a sign-in.

Stars, watching and following (section 17).

Issues and labels (section 18).

Change requests (section 19). braid hub request --help describes the whole flow.

The inbox (section 21).

Forks and jobs (section 20).

GitHub (sections 2 and 23).

Settings and blocks (sections 3, 4 and 22).

Any route. braid hub api METHOD PATH [--data JSON | --data-file FILE] [--hub URL] sends one request to the hub's API, with the token braid holds for the hub, and prints its answer's body as it came. METHOD is GET, HEAD, POST, PUT, PATCH or DELETE; PATH starts with /v1, such as /v1/me; --data or --data-file (- for standard input) give a JSON body. Exit status 0 when the hub did it, 1 when it refused, with its error printed on standard output, and 3 when it could not be reached or failed.

14. The web

Pages are rendered on the hub, in English, with no script, font or anything else from elsewhere; their stylesheet is GET /static/hub.css, and their icon GET /static/icon.svg. Every answer carries Content-Security-Policy: default-src 'self'; script-src 'none'; object-src 'none'; base-uri 'none'; form-action 'self'; frame-ancestors 'none' (an answer with a policy of its own, as a raw file's, keeps it: section 15), X-Content-Type-Options: nosniff and Referrer-Policy: no-referrer, so that a link followed from a page never tells another site the address of a private repository; pages also carry Cache-Control: no-store. The pages of a repository carry the <meta> tags of section 24 in their <head>.

The header of every page links Explore and holds a search box, a GET to /explore; signed in, it also links the inbox, with how many notifications are unread, a new repository, Import (/-/onboarding), the tokens, the account's profile, and signing out. The footer of every page links /agents.md, /terms, braid's site and the hub's version.

The hub's pages.

A repository's pages need what reading it needs: a private repository's pages and forms are 404 to whoever may not read it, as a missing repository's are, whatever the path.

Forms post to the hub with the session's CSRF token in the field csrf (403 without it, with it in a header instead, or without the session's cookie), need what their route of the API needs, count toward the account's limits as it does (section 12), and do what it does, with what the session's account may do. They lead back with 303 See Other: to the page named in back, where a form takes one and it is a path of the hub, else to the page or the section they belong to. The forms:

Under /v1, a path that is not a route is the JSON 404 of section 1; elsewhere a browser (Accept: text/html) gets a page.

15. Browsing

A repository can be read without cloning it. Every route of this section needs read on the repository; a private repository the caller may not read answers 404 not_found, exactly as a missing one does, whatever the path, the revision or the query.

Revisions. REV (the ref of a query, {rev}, base or head, or the start of a page's path) is a branch, a tag as tags/<name>, a changeset's full id, or the first 12 to 63 hex digits of the id of a changeset the repository took in by a landing, an import or a fork; the default branch when none is given. The hub's own refs (braid/…, remote/…, git/…) are never revisions. An id names only a changeset the repository took in: an object uploaded and never landed is no revision, by its whole id or by its start, though GET …/o/{id} still serves it (section 6). A revision that names nothing, and the start of an id that more than one changeset's id begins with, are 404, and the answer names no changeset. In a route's path, {rev} encodes a / as %2F.

Paths. A path is names joined by /, percent-encoded in the route; its bytes need not be UTF-8. It must be one a repository may hold (no empty name, no . or .., no .braid or .git): 400 invalid otherwise. One / at either end is ignored. Symlinks are never followed: a path through one is 404. In answers, names and paths are UTF-8, with what is not UTF-8 replaced; one that is not UTF-8 also comes percent-encoded in raw_name or raw_path, which a route takes as it is.

The answers of these three routes about a private repository carry Cache-Control: private, no-store. A public repository's are kept a minute (public, max-age=60) when they were asked by a branch, a tag or the start of an id, which may name another changeset later, and for good (public, max-age=31536000, immutable) when they were asked by a full id.

History

The times of changesets are RFC 3339 with the offset from UTC the changeset recorded (Z for UTC). What a changeset holds as bytes (names, e-mail addresses, messages, paths) comes as UTF-8, with what is not UTF-8 replaced. Lists take limit and after as section 1 says; anything else is 400 invalid.

A changeset in a list is {"id", "parents", "author", "committer", "summary", "agent"}: author and committer are {"name", "email", "time"}, summary is the first line of the message that is not blank, trimmed, at most 200 characters, and agent the agent that made it, or null. A file that changed is {"path", "status", "old", "new"}: status is added, deleted, modified (its content or its executable bit) or type_changed (between a file, a symlink and a gitlink); old and new are what was there and what is, null where there is nothing, each {"kind", "blob", "size"} (kind file, executable or symlink, whose content is its target) or {"kind": "gitlink", "commit"}. Files come in order of their paths' bytes, as change lists order them.

These answers say how long they may be kept: an answer that never changes (a diff of a full id, a log from a full id or a cursor) may be kept, by anyone for a public repository and by the client alone for a private one; any other answer about a private repository is Cache-Control: private, no-store, and about a public one, public, max-age=60. A diff's answer is JSON or text at the same address, and says Vary: Accept.

16. Discovery

Explore, search and topics list public repositories that something landed on, of established owners, and no fork unless asked. An owner is established once its account on the hub is seven days old and, when the hub knows when its GitHub account was made, that account thirty days old: until then, its public repositories are read by their links and shown on its profile, but listed by none of these. A repository the hub's operator hid or took down is listed by none of them either (section 22).

No private repository is listed, matched or counted by explore, search or topics, to anyone, its owner and its readers included: those find it in their own lists (section 4) and on the owner's profile. A repository leaves these lists as soon as it turns private, is hidden or taken down, or its owner is suspended: the next request lists it no more.

Anyone may ask, with or without a token; a token sent must be valid.

A card is what lists of repositories hold, here and in sections 17 and 20: {"owner", "name", "private", "description", "topics", "stars", "forks", "created", "pushed", "default_branch", "fork_of", "mirror_url", "tdm"}, with starred_at or level where section 17 says. fork_of names the repository it was forked from only when the caller may read that one; mirror_url is the GitHub repository it mirrors to, if any.

Lists come a page at a time, as section 1 says. A cursor belongs to its query: given with another query, order, topic, owner or forks, it is 400 invalid. Explore, search and the topics give at most 50 pages of one query: the fiftieth answers next: null. Each page goes on after the last entry of the page before, so that what is listed meanwhile neither repeats nor skips what was listed already; a repository whose stars or rank moved meanwhile may move in the list.

17. Stars, watching and following

Starring and watching a repository interact with it (section 5): they need an account that may read it, that is not suspended and not blocked there, through a web session or a token whose scopes reach the repository with interact, write or admin. A repository the caller may not read answers 404 not_found to every method of these routes, as a missing one does, before the body or anything else is looked at; one it reads but may not interact with answers 403 forbidden, and an anonymous caller 401. Following needs a web session, or a token with interact, write or admin on * (403 without one).

Every write may be sent again: it answers as the first one did and changes nothing more. Writes count toward the account's limits (section 12): a star taken back counts as a star, a level of watching changed counts as a watch, an account unfollowed counts as a follow. Lists come a page at a time, as section 1 says.

Stars.

Watching. An account watches a repository at one of three levels: all (everything that happens in it), participating (the threads it takes part in or is mentioned in) or ignore (nothing, not even those). Its owner watches all of it until it chooses otherwise, and everyone else participating.

Following.

18. Issues, comments and labels

An issue is a thread of a repository: a title, a text and its comments, with labels, assignees and a state. Issues and change requests (section 19) share one numbering in their repository: a number names one thread, whichever kind it is. GET /v1/r/{owner}/{name}/threads/{n} → {"kind": "issue"|"request", "number", "title", "state"} says which (read).

Every route finds the repository before it looks at anything else of the request: one the caller may not read answers 404 not_found, as a missing one does, whatever the method, the number or the body. Reading needs read. Every write interacts with the repository (section 5): it needs an account that may read it, that is not suspended and not blocked there, through a web session or a token whose scopes reach it with interact, write or admin (401 for an anonymous caller, 403 otherwise), and the body is read only for one that may. What a write may do is decided again once its body is read, by the repository as it is then: one deleted meanwhile, or made again under its name, answers 404 as a missing one, and access lost meanwhile is lost for the write. Managing issues needs write: labels, assignees, locks, and the issues and comments of other accounts.

Texts are as section 1 says: titles of 1 to 256 characters on one line, texts of at most 64 KiB in Markdown, and an agent label shown as "via". Writes count toward the account's limits (section 12): opening an issue as an issue; a comment, or a change of a title or a text, as a comment; a change of state, labels, assignees or lock, a comment hidden or deleted, a label made or deleted, as an edit. A repository takes at most 100 new threads an hour from accounts that do not write to it, between them, and such an account has at most 100 open threads in one repository (403 forbidden past it, until it closes some).

An issue is {"number", "title", "body", "state": "open"|"closed", "state_reason": "completed"|"not_planned"|null, "author", "agent", "labels": [<name>…], "assignees": [<login>…], "locked", "comments", "created", "updated", "closed", "closed_by", "closed_by_changeset"}. closed_by names who closed it; closed_by_changeset, the changeset whose landing closed it (section 8). The routes that answer one issue add html, its text as the caller's pages show it.

Comments are {"id", "author", "agent", "body", "created", "edited", "hidden"}; ids are the repository's own, so that a comment of another repository is 404 here.

The timeline. GET /v1/r/{owner}/{name}/issues/{n}/timeline?limit&after → {"items": [<item>…], "next"}, oldest first: the comments, and what happened, each {"kind", "actor", "created"} and what the kind says: comment with comment; renamed with from and to; edited; closed with reason, and changeset when a landing closed it; reopened; labeled and unlabeled with label; assigned and unassigned with assignee; locked, with reason: "full" and an empty actor when the hub locked a thread that holds the most comments one may; unlocked; referenced with source: {"number"}, a thread of the same repository that named this one; cross_referenced with source: {"repo": {"owner", "name"}, "number"}, a thread of another repository that did, shown only to callers who may read that repository. read.

References. A text names threads with #4 and owner/name#4, accounts with @login, and changesets with 12 to 64 hex digits of their id (section 1). When it is written:

Where a text shows, a reference links to what it names, for each caller: to a thread that exists, of the repository or of another one the caller may read; to an account; to a changeset the repository admitted. Anything else, a thread of a repository the caller may not read among them, is plain text, exactly as a reference to a repository that does not exist.

Labels are {"name", "color", "description"}: names of 1 to 50 characters, without commas, compared without regard to case; colours 0 to 11, of the hub's palette; descriptions at most 200 characters. A repository starts with bug, enhancement, documentation, question, good first issue and help wanted, and has at most 100.

One's issues. GET /v1/me/issues?filter&state&limit&after → {"issues": [<issue with "repo": {"owner", "name"}>…], "next"}: the issues the token's account is assigned to (filter=assigned, the default), opened (created) or is mentioned in (mentioned), latest first, in state as above (open by default), of the repositories the token may read now. One the account no longer reads, a collaborator removed or a repository made private, is left out while that lasts. Needs a token.

19. Change requests

A change request proposes the work of a branch, its head, for a branch of the repository, its base. The head is a branch of the same repository, or of another repository of its fork network (section 20): one forked, directly or not, from the same repository. A request is pinned: its snapshot is the changeset its head held when it was opened or last updated, and each update makes a new revision, numbered from 1. What a revision proposes is worked out when it is made: its stack, the snapshot's first-parent chain down to an ancestor of the base's head, oldest first; what the merges of the stack bring in besides; and the merge base. Landing names the snapshot it lands, and approvals count for the revision they approve: what was reviewed is what lands. Change requests and issues share one numbering in their repository (section 18).

Every route finds the repository before it looks at anything else of the request: one the caller may not read answers 404 not_found, as a missing one does, whatever the method, the number or the body; so does a head repository the caller may not read, when a request names one. Reading needs read. Writes interact with the repository (section 5): an account that may read it, is not suspended and not blocked there, through a web session or a token whose scopes reach it with interact, write or admin (401 for an anonymous caller, 403 otherwise); the body is read only for one that may. Texts are as in section 18: titles of 1 to 256 characters on one line, texts of at most 64 KiB, and an agent label shown as "via". References in texts work as in section 18.

What a request from another repository brings is held apart from the target until it lands: the target's o/{id}, lacks and missing (section 6) never serve it, and the request's own routes do, so that whoever reads the target reads and fetches the request without reading its head. It counts toward the quota of the request's author (section 12) until it lands; landing copies it into the target, where it counts for the target's owner, and only a landing that lands it does: one that conflicts, that ff-only refuses, or whose stack is not built on the base leaves it apart. It is let go when the request lands, when it is deleted, and 30 days after it closed: a closed request may be reopened until then, and after that its head.available is false and a new request goes on. A request from the same repository brings nothing of its own.

A private head goes to another repository only when its admin says so. A request whose head is in a private repository other than the target publishes what it brings to everyone who reads the target. It is opened by an admin of the head, with "expose": true; otherwise it is 400 invalid, and the detail says to whom it would publish. Updating such a request needs an admin of the head too. A request opened while its head was public is not updated once the head is private (400 invalid): nobody said to publish what the head holds since, and a new request, opened with expose, goes on. The name of a request's head repository shows only to those who may read it: to others, head.repo is null.

A request is {"number", "title", "body", "state": "open"|"closed"|"landed", "draft", "author", "agent", "head", "base", "revision", "stack", "brings", "mergeable", "approvals", "review_requests", "last_attempt", "landed", "closes", "comments", "locked", "created", "updated", "closed", "closed_by"}:

Opening a request.

Reading.

Updating. POST /v1/r/{owner}/{name}/requests/{n}/update {"head"} → the request at its next revision: its author only (403), with write on the head (403), while it is open (400). The snapshot is what the head's branch holds now, or the changeset head names, which the branch must hold on its first-parent chain: otherwise 409 not_on_branch, with head, where the branch points. A snapshot that would not change is 400 invalid, and a branch gone from its repository is 409 not_on_branch. A head repository that is gone, or that the author may no longer read, is 400 invalid, the same for both. The new revision is worked out against the base's head now, within the sizes of a new request (413), and what it brings from another repository counts for its author (403 quota). A request has at most as many revisions as a thread has comments, 2,500 (403 forbidden past them). Reviews of earlier revisions no longer count, and say stale.

Changing a request. PATCH /v1/r/{owner}/{name}/requests/{n} {"title", "body", "state", "draft"} → the request: its author or the repository's writers (403 otherwise). state is open or closed; a landed request stays landed (400). Reopening needs what it brings to be held still (400) and no other open request of the same head and base (409). "draft": false marks it ready for review.

DELETE /v1/r/{owner}/{name}/requests/{n} → 204: an admin of the repository, or its author while it is open (403 otherwise). Its texts leave the hub, and what it brought is let go.

Comments are those of section 18, with what they are about on a diff: {…, "path", "line", "side", "revision", "outdated", "review"}.

Reviews are {"id", "author", "agent", "verdict", "binding", "stale", "revision", "body", "created", "comments"}.

Landing.

20. Forks and jobs

A fork is a repository of the caller's account made from another one, its upstream. It holds what the upstream's branches, tags and other git refs reach when the fork is made, and nothing else of it: neither what was uploaded there and never landed, nor what only a deleted ref reached. It holds the git map too, so that history imported from git exports to the same commits in the fork as in its upstream (section 9), and the changesets the upstream admitted are admitted in the fork: a landing on them uploads only what it adds. Its collaborators, settings, mirror, issues, change requests and stars start empty; its description and topics are the upstream's. fork_of (section 4) names the upstream, for whoever may read it.

A fork is made by a job, which runs in the background: the answer comes at once, and the fork appears whole once the job is done. Until then it does not exist (404), and a job that fails leaves nothing of it.

Forking.

When the job runs, the account must still read and interact with the repository, which must still take forks and not be taken down; otherwise the job fails, saying that the repository is gone or no longer readable, whichever it is. A repository that turned private since is forked private, as any fork of a private repository is. A repository of more than 1,000,000 objects fails the job: too large to fork here.

A fork of a private repository, or of a fork of one, at any depth, is read only by those who read every repository it was forked from (section 5), and stays private: PATCH … with "private": false is 400 invalid. Its own collaborator entries are not enough. Once its owner no longer reads its upstream, or the upstream is deleted, the hub deletes the fork within the hour, as its owner would (section 4), and tells its owner (fork_retired, section 21). A read that GitHub gives (section 5) counts until GitHub says otherwise: while GitHub cannot be asked, the fork stays. A fork of a public repository is the account's own: it stays when its upstream turns private or goes.

The forks of a repository.

Syncing a fork with its upstream.

Jobs. A job is {"id", "kind", "state", "progress": {"objects", "bytes"}, "repo", "error", "created", "started", "finished"}: id is j_ and 26 characters of a-z 2-7; kind is fork or import (section 23); state is queued, running, waiting (for something outside the hub, such as GitHub's rate limit), done, failed, cancelled or skipped; repo is the repository it makes, owner/name; error says why it failed or was skipped; times are RFC 3339, started the last time it started.

An account runs one job at a time, oldest first; the hub runs a few at once, taking turns between accounts. A job the hub stops in the middle of runs again when it starts, from the beginning, at most three times.

21. The inbox

The hub tells an account, in its inbox, what happens in the threads it takes part in and in the repositories it watches, and gives it notices about its own requests, such as a fork made or a grant to renew. The inbox is where they are: the hub sends no e-mail, and tells no other service.

Who is told of what happens in a thread (an issue or a change request opened, a comment, a state changed, an assignment, a review, a landing):

Never the account that did it, one that ignores the repository, one that muted the thread, one that blocked the account that did it, nor one that may not read the repository. Nor, while the block lasts, one that the repository's owner or the repository blocked (section 22): it may not mute the thread, nor watch the repository less. A mention, an assignment and a review asked for are told only to the accounts the thread mentions, is assigned to, or asks to review. Who may read is decided when the notification is made, and again each time it is shown.

An account has one notification per thread: what happens next changes it, and makes it unread again. Its reason says why the account is told, the strongest of mention, review_requested, assigned, review (it reviewed the change request), author, comment (it commented), state (the thread was closed or opened again), landed and subscribed (it watches the repository, or follows the thread). An unread notification keeps the strongest reason it had; once read, the next one says why it came. A notice of the hub has the reason system. What one account does makes at most 10 notifications an hour for another: past that, that hour tells that account nothing more of it. A notification counts when it comes into the inbox, new or unread again: once, however many things one change tells of (a comment and the mentions in it, a thread opened with its assignees), and not again for what follows in its thread while it waits unread.

A notification is {"id", "repo": {"owner", "name"}|null, "thread": {"kind": "issue"|"request", "number", "title"}|null, "reason", "actor", "code", "updated", "unread", "url"}. thread is null for a notice of the hub, and repo for a notice about no repository. actor is who did what happened last, null for the hub. code is what happened last: opened, commented, closed, reopened, assigned, mentioned, review_requested, reviewed or landed; for a notice, what it says: fork_done, fork_failed and fork_retired (section 20), import_done and import_failed (section 23), needs_grant, mirror_conflicts, mirror_diverged, mirror_rewritten or mirror_gone (section 11). url is the page of the hub it leads to. A thread's title is read when the inbox is listed, as it is then.

A notification of a repository the account may no longer read (it was removed as a collaborator, or the repository was made private), or that was deleted, or of a thread that is gone, leaves the inbox: it is in no list and no count, and is deleted. For a repository mirrored on GitHub whose reader only GitHub can vouch for, the hub shows the notification only while it holds GitHub's answer (section 5), and keeps it meanwhile.

Tokens. The inbox is the token's account's. A token sees the notifications of the repositories its scopes read (section 2), and the notices of no repository with a scope on *; it marks them read or done where its scopes also have interact, write or admin, and marking at all needs such a scope (403 forbidden otherwise). Marking, read or done, counts toward the account's limits (section 12).

Following a thread.

Both interact with the repository (section 5): a repository the caller may not read is 404 not_found, as a missing one, whatever the method or the body; an anonymous caller is 401, and a token without interact, write or admin there 403. A thread the repository does not have is 404.

22. Blocks and moderation

An account blocks another from every repository it owns; an admin of a repository blocks an account from that repository alone. Where it is blocked, an account cannot star, watch, comment, open issues or change requests, review or fork: each answers 403 forbidden, "you cannot interact with this repository", the words a suspended account gets too, which name no block. It cannot follow the account that blocked it (403). Its mentions do not notify the account that blocked it. It still reads every public repository, and whatever else it may read.

Since a blocked account cannot take a star back or watch less where it is blocked either, a block ends them: blocking an account ends its follow of the blocker, takes its stars off the repositories the block covers and ends its watching of all of each, so that it hears of them no more than of any other repository it reads. A repository it chose to hear nothing of keeps that choice. Lifting the block gives none of them back.

The owner of a repository is never blocked from it. An account blocks at most 1,000 accounts, and a repository at most 1,000: one more is 400 invalid, until a block is lifted. Blocking and unblocking count toward the account's limits (section 12).

An account's blocks need a token with interact, write or admin on * (403 without one, 401 without a token).

A repository's blocks need admin on it. A repository the caller may not read answers 404 to every method of these routes, as a missing one does, before anything else is looked at.

The operator may also:

No route of the API does these.

23. Syncing with GitHub

A new account's first sign-in leads to /-/onboarding (section 14), where it may bring the repositories it owns on GitHub to the hub, each kept as a mirror that follows GitHub (section 11). Only the account's own repositories are offered, never those of an organisation. The routes of the listing and of batches act for the caller's own account, as section 2 says: with a token that has write (or admin) on <login>/* or *, or a session that sends its CSRF token in X-CSRF-Token; and they reach GitHub with the access the account granted (section 2).

The listing. GET /v1/github/repos?refresh → {"scope", "repos", "truncated", "quota"}: the repositories the account owns on GitHub, most recently pushed first, each once, at most 1,000 (truncated is true when GitHub has more). A repository pushed to while GitHub's pages were read may be missing until the listing is asked again. scope is private or public, as the account granted; with public, private repositories are not listed. The hub keeps a listing for ten minutes; refresh asks GitHub again, at most once a minute. Without a grant it is 403 forbidden, with a detail that names the grant's page and braid hub github grant; while GitHub holds the hub back, 503 unavailable.

Each repository is {"github_id", "full_name", "private", "fork", "archived", "empty", "size_kb", "default_branch", "pushed_at", "admin", "hub_name", "synced", "eligible", "reason", "estimate_bytes"}:

quota is {"repos_left", "bytes_left"}: what the account may still own and store (section 12), less what its imports and forks under way will make.

Batches. POST /v1/github/sync {"all", "repos", "names", "keep_public", "reserve_tdm", "follow"} → 202 {"batch", "queued", "skipped"}, with Location: /v1/github/sync/{batch}. Takes Idempotency-Key (section 1).

Repositories are taken most recently pushed first, as many as the account's room allows. queued lists each one queued, {"github_id", "full_name", "hub_name", "job"}; skipped the others, {"github_id", "full_name", "reason"}, where reason is quota (no room left, in repositories or bytes), name taken, name not allowed here, already synced, or not found (not a repository the account owns on GitHub, as its grant shows them; github_id is then 0 when a name was given). An account runs one batch at a time: another while one runs is 409 exists. A body that names nothing and does not ask for all, an unknown follow, or more than 1,000 repositories or names is 400. Batches count against the account's write limit for syncs (section 12).

A batch of another account answers every route as one that does not exist: 404 not_found.

Each import is a job of the account (section 20), of kind import, which GET /v1/jobs lists with the repository it makes. It ends done, or failed with error; while GitHub holds the hub back it is waiting.

What an import does.

The account hears of it in its inbox (section 21): import_done once a batch that imported something ends, and import_failed for each import that fails.

Syncing a mirror now. POST /v1/r/{owner}/{name}/mirror/sync (admin, no body): looks at the mirror now and does what its policy says (section 11): follows GitHub, merges both, or publishes. A paused mirror (rewritten) is looked at again, and goes on when GitHub's branch holds synced again. At most once a minute per repository: sooner is 429 rate_limited, with retry_after. Answers the repository (section 4), with the outcome in its mirror. A repository without a mirror is 400 invalid.

Webhooks. POST /v1/hooks/github/{key}: where GitHub delivers the webhooks the hub made, each to an address of its own; nobody else has a use for it. A key the hub does not know is 404, answered before the body is read. The body, at most 5 MiB (413 too_large beyond), must carry the webhook's X-Hub-Signature-256 (401 unauthorized otherwise). A verified delivery is answered 202 at once, with no body: ping and anything but push do nothing; a delivery whose X-GitHub-Delivery came in the last day does nothing again; a push to another branch, of another repository, or of the commit both sides hold already does nothing; any other push to the default branch makes the hub look at the mirror a couple of seconds later, at most once every ten seconds. At most 60 deliveries a minute per webhook, and 600 verified ones for the whole hub: 429 rate_limited beyond. A key the hub does not know, and a delivery its webhook's secret did not sign, spend nothing of the hub's 600. Nothing of a delivery is kept but its id, for a day.

24. Terms, and text and data mining

Terms. GET /terms is a page with the hub's terms: what it commits to about private code, text and data mining of public repositories, and what its logs keep, in English and then in Spanish (#en, #es). Each part is a section with an id: #private, #tdm and #logs, and #es-private, #es-tdm and #es-logs in Spanish. #tdm is where tdm-policy leads. The terms carry their version and its date at their top (version 1, pending legal review). Every page's footer links them, and search engines may index them. GET /terms.md gives the same text as Markdown, English first, text/markdown; charset=utf-8. Anyone may read both.

Text and data mining. A repository's tdm (section 4) is allowed, the default, or reserved, as article 4 of Directive (EU) 2019/790 lets the holder of the rights reserve it. PATCH /v1/r/{owner}/{name} with tdm changes it (admin). A new repository starts with its owner's tdm_default (section 3), allowed unless the account says otherwise.

Every answer about a public repository whose tdm is reserved, once the caller may read it, carries:

tdm-reservation: 1
tdm-policy: <hub>/terms#tdm
X-Robots-Tag: noai, noimageai

whatever the route: its pages, its raw files, the API under /v1/r/{owner}/{name}, its objects and git, and the errors those routes answer once the caller's permission is checked (a file that is not there, say). Its pages also carry <meta name="robots" content="noai, noimageai">, <meta name="tdm-reservation" content="1"> and <meta name="tdm-policy" content="<hub>/terms#tdm">. Every answer about a private repository, to whoever may read it, carries X-Robots-Tag: noindex, nofollow, noai, noimageai, and its pages <meta name="robots" content="noindex, nofollow, noai, noimageai">, whatever its tdm. An answer about a repository the caller may not read carries none of these, as one about a repository that does not exist does; nor does any answer that names no repository.

GET /robots.txt: text/plain; charset=utf-8, Cache-Control: public, max-age=60. A group for every crawler (User-agent: *) disallows the API (/v1/), the hub's pages under /-/ and /auth/, raw files (/*/*/raw/), and the pages /notifications, /settings, /login, /logout and /tokens, each as the page (/login$), with a query (/login?) and below it (/login/), never as a bare prefix, which would also cover the repositories of the logins that start with it. A second group, for the crawlers that gather training data for AI models (GPTBot, ClaudeBot, anthropic-ai, CCBot, Google-Extended, Applebot-Extended, Bytespider, Meta-ExternalAgent, cohere-ai, cohere-training-data-crawler, Diffbot, Amazonbot, AI2Bot, Timpibot, ImagesiftBot, PanguBot, Omgilibot, omgili and YouBot), repeats each of those rules, since a crawler follows only the group that names it, and adds, for each public repository whose tdm is reserved once something has landed on it:

Disallow: /{owner}/{name}$
Disallow: /{owner}/{name}?
Disallow: /{owner}/{name}/
Disallow: /v1/r/{owner}/{name}/

with the name as the repository was made and again lowercase when that differs, since the hub answers both. An owner every one of whose repositories that anyone may read is reserved gets Disallow: /{owner}/ and Disallow: /v1/r/{owner}/ instead: what the owner says of a repository that answers as a missing one never changes the file. Crawlers that fetch a page because a person asked them to are not named. robots.txt never names a private repository. A repository that turns private, or whose reservation is taken back, leaves it at once, and one reserved or listed since comes in at once; anything else it follows within a minute. It holds at most 400 KiB: the rules of every crawler are always there whole, and when the reserved repositories do not all fit, those of owners not yet established (section 16) go first, then those with the fewest stars; a comment says so, and their answers keep their headers.

GET /.well-known/tdmrep.json: application/json, Cache-Control: public, max-age=60, the file of the TDM Reservation Protocol: an array of rules for the repositories and owners robots.txt names, a repository's page, with a query and what is below it, in each spelling,

[
  {"location": "/{owner}/{name}$", "tdm-reservation": 1, "tdm-policy": "<hub>/terms#tdm"},
  {"location": "/{owner}/{name}?", "tdm-reservation": 1, "tdm-policy": "<hub>/terms#tdm"},
  {"location": "/{owner}/{name}/*", "tdm-reservation": 1, "tdm-policy": "<hub>/terms#tdm"},
  {"location": "/{owner}/*", "tdm-reservation": 1, "tdm-policy": "<hub>/terms#tdm"}
]

(/{owner}/* for an owner robots.txt names whole), [] when nothing is reserved. The protocol matches a location as the start of a path unless it ends in $, so a page's location ends in $, and covers no other repository whose name starts with that one's. It follows a change as robots.txt does, and holds at most 400 KiB, its rules a part of those of robots.txt when not all fit.