Merge docs/w14-adrs into main
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by oscabriel · committed by oscabriel · parents 140db4f, 3a30c9a · Browse files · 3 files·+66 added−1 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+66 added−1 removed
- other:+66 added−1 removed
Provenance
- Commit
75071f7- Tree
3f809fc- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent 1
140db4f- Parent 2
3a30c9a
3 files changed+66 added−1 removed
added:docs/adr/0032-a-project-is-named-by-its-owner-and-the-forty-keep-their-keys.md+28 added
1+---2+status: accepted3+---4+5+# A project is named by its owner, and the forty keep their keys6+7+A project's name was one lowercase word, `datekit`, and that word was its address on the web (`/datekit`), at the gateway (`datekit.git`), in every contract's `project` field, and inside the platform: the Durable Object's id, the Artifacts repo's name, the code cache's key and every projection row. One flat namespace cannot hold two people's `notes`, says nothing about who a project belongs to, and gives an imported repo an address that hides where it came from.8+9+A project's name is now `<owner>/<name>`. An **owner** is a person's handle, lowercased (`oscabriel/datekit`), or a **source namespace**, the host and account a repo was imported from, from a fixed list of hosts (`github.com/pallets/click`, `codeberg.org/dnkl/fuzzel`). A name is a person or a source namespace, never both: handles hold no dot and hosts always do. Organisations will be a second kind of owner in the same place. The web serves a project at `/<owner>/<name>`, the gateway at `<platform>/<owner>/<name>.git` (a claim fork at `…/<name>--<ask>--<handle>.git`), the CLI's `--project` takes the full name, and every contract's `project` field carries it. `ProjectName` keeps its identifier and means the full name; `Owner` and `ShortName` are its parts; one parser in `packages/protocol/src/ids.ts` reads it and lowercases on the way in, and `packages/protocol/test/project-name.test.ts` holds it.10+11+Inside the platform a project keeps a flat **key**: the Durable Object's id, the repo's name, the code cache's key and the projection columns. The key is a pure function of the name: the name with `/` replaced by `_` (`oscabriel_foo`, `github.com_pallets_click`), which no handle, host, account or short name contains, so it reverses. The forty projects made before this decision keep the keys they have (`datekit`, `click`): `packages/protocol/src/legacy.ts` lists each with its name, `keyOf` and `nameOfKey` consult it first, and `ProjectName`'s decode accepts a bare legacy key and gives its name. So a stored event, a projection row, a Durable Object's own id, an old clone's remote, `--project datekit` and MCP's `project: "datekit"` all read as `oscabriel/datekit`, and nothing stored is migrated. The web answers `/<legacy>` and every address under it with a 301 to the full name; the gateway serves `<legacy>.git` and its forks as aliases, with no redirect, since git follows one only on its first request. The table is a cartridge: re-key the forty and delete it.12+13+Owning a namespace gives one right: to make projects in it. `initProject` refuses `NotYourNamespace` when the name's owner is neither the caller's handle nor the source namespace of the import's URL. Nothing else moves: deciders stay per path from the config folder, an import's importer stays its fallback decider, and `setEnv`, policy edits and custody are as they were. A namespace is not a policy right.14+15+## Considered Options16+17+- **Rename the Durable Objects and repos to the new keys.** A clean store, but a Durable Object cannot be renamed and an Artifacts repo cannot be moved: each of the forty would be copied, with its events and its storage, on two stages, days before the demo is recorded. The alias costs a table of forty lines.18+- **A registry table (D1, or one Durable Object per owner) mapping each name to a key.** It would also serve uniqueness and a person's project list, but it is a second source of truth, consulted on every call, for a mapping that is pure for every project but forty. Uniqueness is the key's: two names never share one.19+- **Keep flat names and add the owner as a field.** No address changes, but `/notes` still belongs to whoever took it first, and the user asked for `/owner/repo`.20+- **Every import under the importer's handle** (Gitea's model). Honest about who brought it, but the address then hides the source, two people's imports of one repo get two addresses, and the host-path address (ADR 0033) would need a lookup by source. The source namespace is the address and the provenance at once; a person may still import under their own handle.21+- **Give the owner policy rights** (decide everywhere, set env). Simpler to explain, but the platform's rights are per path in the config folder on `main`, where every reader can see them; a namespace right would be a second, invisible kind.22+23+## Consequences24+25+- `ProjectName`'s grammar widens; the short name allows `.` and `_` with single separators (`commander.js`), so an import keeps its own name. The first segment may not be a word the web serves its own pages at, and sign-up refuses those words as handles.26+- `repoKind`, fork names, layer repos and the well-known skill's URL carry the key, so the forty's URLs there are unchanged.27+- A projection row whose key decodes to no name (a torn-down throwaway) is skipped by the lists.28+- The demo's recorded addresses and commands stay true through the alias.added:docs/adr/0033-a-repo-is-imported-from-the-web-and-its-host-path-offers-the-import.md+25 added
12345678910111213141516171819202122232425---status: accepted---
# A repo is imported from the web, and its host path offers the import
An import (ADR 0010, ADR 0031) could be made only from the CLI, `init --project <p> --import <url>`, by someone signed in there. The platform's point is that any public repo can be brought over and worked on through the gate, and that path asked a newcomer to install a CLI first.
`/import` is a page for a signed-in reader. It takes a public HTTPS clone URL, an optional branch, the owner (a choice among the namespaces the reader may write to: their own handle, and the URL's source namespace when its host is on the list, which is then the default) and the name, prefilled from the URL's last segment. It calls the one existing contract, `initProject` with `import`, which gains the web as a surface; the platform clones any public git URL through Artifacts, so no host's API is called. A refused import reads as its refusal, with its next step.
A **host path**, `/<host>/<account>/<repo>` on the web (a trailing `.git` is stripped), is a project's address when one exists at that name (ADR 0032). When none does, the page offers the import: the same form, prefilled with the URL rebuilt from the address and the owner fixed to the source namespace; signed out, it shows the sign-in link. It never imports on a GET: a crawler following `/github.com/x/y` makes nothing. A project someone imported under their own handle is not found from its host path: there is no index by source, and the address at the source namespace stays free for a copy at its source path.
## Considered Options
- **Import on arrival at the host path.** The address the user asked for, `myr.technology/github.com/<owner>/<repo>`, would then "just work", but any link, prefetch or crawler would create projects, and a project needs a person who answers for it. The offer keeps the person's press.- **Connect GitHub and pick from a list** (the bulk import GitHub and GitLab offer). It needs OAuth scopes and a host's API per host; the clone URL covers every host at once, codeberg's included. Out until someone asks for it.- **A mirror that keeps following the source.** Declined again (ADR 0010): inbound sync is a second way onto `main` that skips the gate.- **Find a project by `importedFrom` from its host path.** It would show a handle-owned copy at `/github.com/x/y`, but then two readers would reach different projects through one address depending on who imported first, and the index is a projection the platform does not keep.
## Consequences
- `servedOn.initProject` includes the web; the contract's payload is unchanged.- A new refusal, `NotYourNamespace` (ADR 0032), can come back to the page.- An import still brings no tags (ADR 0019); the operator's backfill stands.- The import page is its own chunk, so the root's preloads do not grow.modified:GLOSSARY.md+13 added-1 removed
79 unmodified lines80 The commit the platform itself last landed on main; the only commit a project's rules are read from.81 _Avoid_: HEAD, tip of main82 83 **Import**:84-A project adopted from a public repo: a read-only copy, not run by its maintainers, whose first `main` is the source branch's tip. The source, its address and branch, stays on the project's record and is shown as where it was imported from.84+A project adopted from a public repo: a read-only copy, not run by its maintainers, whose first `main` is the source branch's tip. The source, its address and branch, stays on the project's record and is shown as where it was imported from; by default the project is named at its source namespace.85 _Avoid_: mirror, fork (of the source), sync86 87 **Outcome**:88 Where an offered answer stands: Checking, Landed, WaitingOnParent, AwaitingFinish, AwaitingDecision or Refused; only Refused carries refusals, and waiting is not a refusal.109 unmodified lines198 _Avoid_: dummy value, mock secret199 200 ## Platform201 202+**Project name**:203+A project's full name, `<owner>/<name>`: an owner, then the short name the owner chose. It is the project's address on every surface.204+_Avoid_: slug, repo name, full name, path205+206+**Owner**:207+The namespace a project is named in: a person's handle, or a source namespace. Owning a namespace is the right to make projects in it and nothing more; deciding stays with the config folder.208+_Avoid_: org, account, maintainer, admin209+210+**Source namespace**:211+An owner that is the host and account a repo was imported from, such as `github.com/pallets`, so an import's address says where it came from.212+_Avoid_: upstream, origin, mirror213+214 **Config folder**:215 The .myr/ folder on main holding the project's process as TypeScript: project.ts, kinds, asks, visibility.ts, the vouch file.216 _Avoid_: settings, workflow files217 18 unmodified lines