Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ The most common defect is a change that works on the path you tested and is miss

## Verifying

- **`make check-fast` before every push (mandatory).** It runs gofmt, `go vet`, golangci-lint, the test-location check and plain `go test` (no `-race`) on only the packages your changes can affect, plus the generators whose inputs changed, the `deploy/` module (vet, lint, names and `make deploy-vars`) when it, `.env.example` or the Makefile changed, and the migration order when a migration changed (see "Migrations"). Changes mean everything that differs from the merge base with origin/main: commits, staged, unstaged and untracked files, mapped to packages by `scripts/affected.sh` (`make affected` prints them), so a shared input (go.mod, tooling, lint config, migrations) checks everything. It takes seconds (a docs-only change: under a second; a full run: under 10 s warm), so it fits machines where a full `make ci` is not allowed. Database tests skip unless `TEST_DATABASE_URL` is set; `make test` runs them with `-race` against Postgres. `make hooks` installs a pre-push hook that runs it from every worktree of the clone (`make hooks-remove` undoes it; `git push --no-verify` skips it once, for emergencies only). Anything that runs git or go from a hook drops git's repository env first (`git rev-parse --local-env-vars`), as the hook and `scripts/check-fast.sh` do.
- **`make check-fast` before every push (mandatory).** It runs gofmt, `go vet`, golangci-lint, the test-location check and plain `go test` (no `-race`) on only the packages your changes can affect, plus the generators whose inputs changed, the `deploy/` module (vet, lint, names and `make deploy-vars`) when it, `.env.example` or the Makefile changed, the migration order when a migration changed (see "Migrations"), and `make vulncheck` when a `go.mod`, `go.sum`, `package.json` or `pnpm-lock.yaml` changed. Changes mean everything that differs from the merge base with origin/main: commits, staged, unstaged and untracked files, mapped to packages by `scripts/affected.sh` (`make affected` prints them), so a shared input (go.mod, tooling, lint config, migrations) checks everything. It takes seconds (a docs-only change: under a second; a full run: under 10 s warm), so it fits machines where a full `make ci` is not allowed. Database tests skip unless `TEST_DATABASE_URL` is set; `make test` runs them with `-race` against Postgres. `make hooks` installs a pre-push hook that runs it from every worktree of the clone (`make hooks-remove` undoes it; `git push --no-verify` skips it once, for emergencies only). Anything that runs git or go from a hook drops git's repository env first (`git rev-parse --local-env-vars`), as the hook and `scripts/check-fast.sh` do.
- **Release smoke** (`make release-smoke`; run it whenever a build input changes: a Dockerfile, or code a Dockerfile's binary is built from): builds every binary that has a Dockerfile with that Dockerfile's own build-stage `ENV` and `RUN` line (`scripts/dockerfile-builds.sh` reads them, so never copy build flags elsewhere) and fails on a dynamically linked one, runs `server migrate` and `admin migrate` on fresh databases, and boots web and admin with `APP_ENV=production` and only the config production requires until `/healthz` answers 200. It catches what tests cannot: an image that will not start on distroless (a dependency that links dynamically even with `CGO_ENABLED=0`), and a production config that refuses to boot without an optional integration. A new required production setting goes in its env list.
- `make lint test` before every commit when you can run the full suite. `make ci` runs every check on the checkout as it is: build, generated-code diff (sqlc, mocks, templ), gofmt + golangci-lint, the test-location check, `go test -race` against a throwaway Postgres with per-boundary coverage floors, and the probes that prove the layering and test rules still bite (`make lint-layering lint-tests`).
- `make lint test` before every commit when you can run the full suite. `make ci` runs every check on the checkout as it is: build, generated-code diff (sqlc, mocks, templ), gofmt + golangci-lint, the test-location check, `go test -race` against a throwaway Postgres with per-boundary coverage floors, and the probes that prove the layering and test rules still bite (`make lint-layering lint-tests`). `make vulncheck` (also in `make ci`) fails on any known vulnerability in a dependency of any Go module or the mobile lockfile ([docs/CI.md](docs/CI.md#known-vulnerabilities)).
- **A pull request is verified locally, on its exact head, then attested (mandatory; [docs/CI.md](docs/CI.md)).** Run what the change needs ("What to run" there): for Go, `make lint test` scoped with `LINT_DIRS`/`TEST_PKGS` from `scripts/affected.sh`, plus `make check-generated`, `make check-migrations`, `make deploy-check`, `make actionlint` or `make release-smoke` for what you touched, `make ci` for a change to the tooling. Commit, push, then `make ci-local RAN="<what you ran>"` in the clean worktree. It runs nothing and takes seconds: it refuses a dirty, unpushed or already-failed head, posts the `local-ci` commit status and fills the PR body's "Local verification" section with your statement, which is never edited by hand. Every push or rebase needs a new attestation. Stack PRs and merge right away.
- **A failed head is final.** A failure is fixed forward with a new commit, never attested until green: a head attested as failed (`make ci-local FAILED="<what>"`) is refused for good by `make ci-local`, the `Local verification` check and `make pr-merge`. A failure in what the branch changed is fixed in the PR; any other is fixed forward at once in its own PR off `main` with a regression test that fails before the fix, and the branch rebases on it.
- GitHub runs no verification: on a PR only `Secret scan` and `Local verification` (which shows "Expected" until `make ci-local` claims the head), started by `make ci-local`'s body edit, and on `main` only `Deploy staging`, which ships a commit only when `make ci-local` attested it. Avoid adding workflow jobs: a new check is a make target the agent runs, listed in docs/CI.md "What to run". The PR jobs run only `main`'s code (`pull_request_target`) and read the head as data; never check out or run the head there ([docs/CI.md](docs/CI.md#trusted-code-only)).
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ ci: ## Every check, on this checkout as it is (make ci-local then attests a PR h
$(MAKE) lint-layering
$(MAKE) lint-tests PROFILE=.cache/coverage.out # the probes reuse make test's profile
$(MAKE) deploy-check
$(MAKE) vulncheck

# make ci-local's statements reach it unexpanded and as single arguments:
# taken raw ($(value)), exported, and quoted by the shell, so a $, a quote
Expand All @@ -138,6 +139,10 @@ pr-merge: ## Squash-merge PRs attested on their exact head: make pr-merge PR="12
secret-scan: ## gitleaks (pinned) on the files changed since the merge base, or every tracked file with ARGS=--all
$(GO) run ./scripts/cilocal secret-scan $(if $(ARGS),$(ARGS),--base $$(git merge-base HEAD $$(. scripts/branches.sh && landing_ref)))

.PHONY: vulncheck
vulncheck: ## Known vulnerabilities: govulncheck (pinned) on every Go module + pnpm audit on the mobile lockfile; exceptions in scripts/vulncheck/allowlist.txt (ARGS=-go-only)
$(GO) run ./scripts/vulncheck $(ARGS)

.PHONY: check-fast
check-fast: ## Before every push: gofmt, vet, golangci-lint, plain tests for only what your changes vs origin/main affect (seconds)
./scripts/check-fast.sh
Expand Down
6 changes: 3 additions & 3 deletions apps/mobile-app/contract/app.contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('mobile app against the Go server', () => {
const { data, error } = await app.signUp.email({ name: 'Ada', email, password })
expect(error).toBeNull()
expect(data?.user.email).toBe(email)
expect(app.authClient.getCookie()).toMatch(/^better-auth\.session_token=/)
expect(await app.authClient.getCookie()).toMatch(/^better-auth\.session_token=/)
})

it('gets the session with the stored cookie', async () => {
Expand All @@ -50,7 +50,7 @@ describe('mobile app against the Go server', () => {
it('signs out, clearing the server session and the keychain', async () => {
const { error } = await app.signOut()
expect(error).toBeNull()
expect(app.authClient.getCookie()).toBe('')
expect(await app.authClient.getCookie()).toBe('')
expect((await app.authClient.getSession()).data).toBeNull()
})

Expand Down Expand Up @@ -132,7 +132,7 @@ describe('delete account', () => {

const deleted = await app.deleteAccount()
expect(deleted).toEqual({ data: { success: true }, error: null })
expect(app.authClient.getCookie()).toBe('')
expect(await app.authClient.getCookie()).toBe('')
expect((await app.authClient.getSession()).data).toBeNull()

const again = await app.signIn.email({ email, password })
Expand Down
11 changes: 9 additions & 2 deletions apps/mobile-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"test:contract": "vitest run --config vitest.contract.config.mts"
},
"dependencies": {
"@better-auth/expo": "1.6.29",
"better-auth": "1.6.29",
"@better-auth/expo": "1.7.14",
"better-auth": "1.7.14",
"expo": "~57.0.13",
"expo-constants": "~57.0.11",
"expo-linking": "~57.0.6",
Expand All @@ -41,5 +41,12 @@
"packageManager": "pnpm@10.27.0",
"engines": {
"node": ">=22"
},
"pnpm": {
"overrides": {
"node-forge@^1": "^1.4.1",
"glob@^13": "^14.0.2",
"minimatch@^10": "^11.0.1"
}
}
}
Loading
Loading