diff --git a/.github/AGENTS.md b/.github/AGENTS.md new file mode 100644 index 000000000..8baf4eda5 --- /dev/null +++ b/.github/AGENTS.md @@ -0,0 +1,9 @@ +# .github + +Actions are named by release tag; the commit lives in +`.github/workflows/actions.lock`. After changing any `uses:` (workflows or +`.github/actions/`), run `gh-actions-lock` (dev shell) and commit the lockfile +with it; GitHub runs the locked commit and `check-generated` fails a stale +lockfile. Same-repo actions are written `$/.github/actions/...`, not `./`, so the +lockfile covers what they use. Never pass `--accept-moved`: a moved release tag +needs a human. diff --git a/hscontrol/db/AGENTS.md b/hscontrol/db/AGENTS.md new file mode 100644 index 000000000..61d630a57 --- /dev/null +++ b/hscontrol/db/AGENTS.md @@ -0,0 +1,17 @@ +# hscontrol/db + +## Migrations + +Violating these corrupts production databases. Migrations start at 0.29.0; +`checkMinimumMigration` (`versioncheck.go`) refuses older databases. + +1. Never reorder or edit committed migrations. Append new ones to the end. +2. Never disable foreign keys. +3. ID format `YYYYMMDDHHMM-short-description`, e.g. + `202607241200-clear-tagged-node-expiry`. +4. Never `AutoMigrate` in a migration; write explicit DDL. +5. Run multi-statement migrations in `tx.Transaction` so a failure leaves the + database retryable. + +Some races surface only on SQLite or only on PostgreSQL; run integration tests +with `--postgres` too. diff --git a/integration/AGENTS.md b/integration/AGENTS.md new file mode 100644 index 000000000..f77e35ecf --- /dev/null +++ b/integration/AGENTS.md @@ -0,0 +1,10 @@ +# integration + +Read `README.md` here before writing a test and `../cmd/hi/README.md` before +running one. Never guess `hi` flags. + +- Every test function starts with `IntegrationSkip(t)`. +- External calls (`client.Status`, `headscale.ListNodes`, …) go inside + `EventuallyWithT`; state-mutating commands (`tailscale set`) never do. +- Prefer `hscontrol/servertest/` when a test does not need Docker. +- A run writes ~100 MB of logs under `control_logs/{runID}/`; prune old runs. diff --git a/tools/bump/AGENTS.md b/tools/bump/AGENTS.md new file mode 100644 index 000000000..d698f2a8b --- /dev/null +++ b/tools/bump/AGENTS.md @@ -0,0 +1,31 @@ +# tools/bump + +`go run ./tools/bump plan` reports stale pins and changes nothing; +`go run ./tools/bump verify` exits non-zero when pins disagree. A hand-written +bump follows the same rules: + +1. `modernc.org/libc` moves only to the version `modernc.org/sqlite` requires; + `gvisor.dev/gvisor` only to the version `tailscale.com` requires. Read both + off the owner's `go.mod` via `proxy.golang.org`, never guess. If the partner + cannot be resolved, neither half moves. `go mod tidy` can detach the `go.mod` + NOTE comments explaining this; check they are still attached. +2. Any `go.mod`/`go.sum` change needs `go run ./cmd/vendorhash update`. +3. `go.mod`'s `go` directive must not exceed nixpkgs' Go. `go get` raises it + silently and local builds download a toolchain; nix builds use + `GOTOOLCHAIN=local` and fail. `bump verify` reports it; the tool never + edits the directive. +4. Actions: see `.github/AGENTS.md`. + +Not encoded in the tool: `github.com/libdns/*` providers and +`github.com/caddyserver/certmagic` must share the `github.com/libdns/libdns` +major version. One provider instance serves both, so a provider on another +major waits until certmagic moves. + +Servertest Terraform tests run the newest three `tailscale/tailscale` provider +releases from `terraformProviderVersions` (`hscontrol/servertest/apiv2_test.go`). +The list is committed, so new releases arrive as bump PRs. A test of a provider +feature calls `requireProvider` with the first release that has it. + +`Dockerfile.tailscale-HEAD` and `Dockerfile.derper` build an unpinned tailscale +branch: their builder image is a floor (≥ upstream's `go` directive), and +`GOTOOLCHAIN=auto` turns an upstream bump into a slower build, not a broken one.