Skip to content
Myr

Add ADRs 0001-0013 from the plan's day-0 list

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parent a781c9e · Browse files · 13 files+266 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

13 files+266 added−0 removed

  • other:+266 added−0 removed

13 files+266 added−0 removed

added:docs/adr/0001-bun-workspaces-and-turborepo.md+18 added
added:docs/adr/0002-wrangler-deploys-every-worker.md+49 added
added:docs/adr/0003-rpcgroup-is-the-one-schema.md+29 added
added:docs/adr/0004-git-gateway-owns-custody.md+18 added
added:docs/adr/0005-rules-read-from-the-landed-sha.md+12 added
added:docs/adr/0006-landing-is-a-parse.md+20 added
added:docs/adr/0007-visibility-boundary-is-the-repo-boundary.md+18 added
added:docs/adr/0008-claims-are-exclusive-by-default.md+15 added
added:docs/adr/0009-env-shape-is-env-schema.md+19 added
1---2status: accepted3---45# The env shape is the project's `.env.schema`, parsed and never resolved67A project's env shape is its committed `.env.schema`, in the [@env-spec](https://github.com/dmno-dev/varlock/discussions/17) format that varlock reads. The platform parses it at the landed SHA with `@env-spec/parser` and never resolves it: no `exec`, no plugins, and no imports from outside the repo. Function-valued flags count as sensitive. Values are stored only for `@sensitive` items, as write-only values, envelope-encrypted in the Project DO under a master key held as a Worker secret. Unlanded code sees a placeholder for every `@sensitive` item. For a `@proxy` item, the platform swaps the real value in on matching outbound HTTPS requests ([Sandbox outbound interception](https://developers.cloudflare.com/sandbox/network/call-an-authenticated-api/)).89## Considered Options1011- **An `env.ts` in the config folder.** Only the platform would read it, while the app kept its own env loading, and the two shapes would drift. One file now serves the app, local tools, agents and the platform.12- **Cloudflare Secrets Store for project values.** It holds [up to 100 secrets per account, in one store](https://developers.cloudflare.com/secrets-store/manage-secrets/).1314## Consequences1516- `.env.schema` and committed `.env.*` files, except `*.local`, are in the judge closure. An answer cannot add or change an env item, such as adding a `@proxy` domain or turning off `@sensitive`; a decider lands it.17- This repo's own env uses varlock. Tools run through `varlock run`. Workers deploy through `varlock-wrangler` ([`@varlock/cloudflare-integration`](https://varlock.dev/integrations/cloudflare/)), which passes non-sensitive values as `--var` and sensitive ones through `--secrets-file`. Agents read the env only through `varlock load --agent`, with values redacted.18- No Worker imports varlock's runtime. Its `init` patches `console` and the global `Response` and scans every streamed body, and the gateway streams git packs.19- The format is varlock's, and the README credits it.
added:docs/adr/0010-no-inbound-github-sync.md+12 added
1---2status: accepted3---45# No inbound or two-way GitHub sync67A project can be imported from GitHub once, to start it. After that, nothing flows in from GitHub, and nothing syncs both ways. Inbound sync would be a second way onto `main` that skips the gate.89## Consequences1011- Export is `git clone`. Code, asks and credit trailers leave with a clone, and verdicts need one more fetch of `refs/notes/*`. The README says so.12- A one-way push mirror of `main` to GitHub is on the roadmap for after the competition, not in it.
added:docs/adr/0011-the-fence.md+19 added
1---2status: accepted3---45# The fence: compiler first, then lint; verify is the authority67Each rule this repo keeps is held by the strongest enforcer available. First, make the mistake unrepresentable in types; then catch it with lint; then with a test; prose is the last rung. Git hooks are early feedback only; `bun run verify` and CI are the authority. The repo is built fast and mostly by agents, and a rule nothing checks drifts under that load. The fence also dogfoods the product: its judge closure, weakening and ratchet apply to this repo first.89## Considered Options1011- **The full test suite in pre-commit.** Too slow for an agent sprint. Hooks run lint, format check and typecheck; tests run in `verify` and CI.12- **A `no-comments` lint rule.** Rejected: agents need room for workaround notes.1314## Consequences1516- Every escape (`oxlint-disable`, `@effect-diagnostics`, `@ts-expect-error`) carries a reason after ` -- `. `scripts/debt.ts` counts escapes against `debt.baseline.json` in `verify`, and the count rises only with the maintainer's sign-off.17- One hook policy refuses the usual ways around hooks: `--no-verify`, `commit -n`, `core.hooksPath` overrides, `LEFTHOOK=0` and `lefthook uninstall`. It is wired into each agent harness the repo uses.18- A deploy is never a way around a red gate: `infra/deploy.ts` refuses without an explicit stage and runs smoke tests after.19- `AGENTS.md` lists each principle with the check that holds it. Where the check and the prose disagree, the check wins.
added:docs/adr/0012-lifecycles-are-pure-transitions.md+15 added
1---2status: accepted3---45# Lifecycles are pure transitions run per DO call67Claim and landing state are each a lifecycle: a pure `transition(state, command, now)` function (`ClaimLifecycle`, `LandingLifecycle`). Each Durable Object call hydrates state, runs one transition, persists the row and an outbox entry, then settles side effects. Deadlines run on DO alarms, never on in-memory timers. Pure transitions can be model-tested over generated histories.89## Considered Options1011- **XState 6 with `@xstate/effect`.** Both were alphas, released on Oct 3 and Oct 1, 2026, and snapshot restore was not supported yet. Revisit after the competition.1213## Consequences1415They are called lifecycles, never "deciders", although the code pattern goes by that name elsewhere: in the glossary a **Decider** is a person.
added:docs/adr/0013-provenance-copy-with-attribution.md+22 added
1---2status: accepted3---45# Provenance: copy with attribution67Code from other projects enters as ports: it is copied with attribution into our own files, and from then on it is ours to change. The repo has its own history from the first commit. It is not a fork, a template or a vendor commit of another project, and it holds no third-party prose or artwork. `PROVENANCE.md`, `LICENSES/` and `UPSTREAM.md` record every port: its source, commit, licence and our changes. Upstream `main` is never synced in. The competition's [Official Rules](https://www.cloudflare.com/documents/build-next-gen-git-platform-competition-terms.pdf) (§4) require "Entrant's own original content and creation" with no "third-party copyrighted material or artwork without the copyright holder's permission", and originality is half the score (§6). So credited plumbing is fine, and the centre of the product must be ours.89## Considered Options1011- **Fork or template Rat Stack.** A fork carries several hundred commits of someone else's history. A template marks the repo "generated from" its source and brings about 85k lines.12- **A 25% derived and 15% near-verbatim ceiling.** That was sized for adopting a whole stack, not for grafting plumbing.1314## Consequences1516- Derived lines stay under 15% of the codebase and near-verbatim lines under 10%, with a target of about 5%. `scripts/provenance.ts` measures both.17- Planned ports:18 - from [Rat Stack](https://github.com/joelhooks/rat-stack) at `fba26d8` (MIT): the CLI and MCP projections (ADR 0003), `no-module-level-mutable-state`, the debt ledger, and `vendor-agent-sources.sh`;19 - from t3code (MIT), via Rat Stack: `no-manual-effect-runtime-in-tests`;20 - from [anti-slop](https://github.com/dmmulroy/anti-slop) at `c44ef22` (MIT): its oxlint plugins, installed by its own vendoring script.21- Ideas taken without code, such as cf's merged command catalog, are credited in `PROVENANCE.md` as ideas.22- Credits live in the README and `PROVENANCE.md`, not on screen in the demo.