Tests and checks
make check#
make check is what CI runs on every pull request. Run it before you push, or at least the parts you touched:
| Target | What it checks |
|---|---|
make lint |
go vet and the web type check |
make web-lint |
ESLint: Rules of Hooks, effect dependencies, functions over 250 lines, no fixed waits in tests; then knip (npm run knip, config web/knip.json) in production and default mode: no unused files, exports, types or dependencies and no duplicate exports; an export only tests or stories read carries /** @internal */ |
make staticcheck |
Go static analysis, after make deadcode and make modernize |
make deadcode |
no Go function unreachable from the commands and tests (deadcode -test) |
make modernize |
no finding from Go's modernize analyzer; the same command with -fix applies them |
make test |
go test ./..., the web tests (vitest), the extension and the Obsidian plugin |
make fmt-check |
gofmt |
make ui-lint |
design-system rules: tokens, <Icon>, no untranslated English in JSX |
make i18n-check |
every catalog complete, placeholders and plurals match |
make docs-check |
front matter, links, anchors, images, spec coverage, help screens, the generated roadmap and keyboard guides |
make templates-check |
project templates |
make openspec-validate |
every spec and change, strict |
make deploy-check |
the platform templates under deploy/ |
make repo-check |
repository rules: the migration matrix, shared contracts, budgets, the make targets these pages name, the changelog fragments in changelog.d/, no open OpenSpec change with every task ticked (stale changes are listed as warnings) |
The Go tests that import the embedded web app need it built once: make web.
One test#
go test ./internal/sync -run TestApplyIsIdempotent
cd web && npx vitest run src/lib/ops.test.ts
cd web && npx vitest run -t "keeps the outbox"
Web tests never reach the network: mock fetch with mockFetch from web/src/ui/test-utils.tsx. Interaction tests opt into // @vitest-environment happy-dom and wait with waitFor, never a fixed sleep. Module-level state is reset before each test by resetModuleState() (web/src/lib/moduleState.ts); a module with a top-level let registers with resettable().
The notes link grammar (linksIn, behind Linked references) is timed in the ordinary web tests by web/src/lib/notesHotPaths.test.ts, so a slowdown of it fails on its own pull request rather than only in the nightly performance budgets. Milliseconds vary too much between CI runners, so it is timed beside a plain line scan of the same 1 MB of generated notes, and the median ratio of seven interleaved pairs is held to its MAX. To change a MAX on purpose, run the file a few times with --silent=false, read the printed ratios, set the new ratio × 1.5 and say why in the pull request.
A client generated from the OpenAPI description must type-check: web/scripts/openapi-client.test.mjs generates TypeScript types from docs/openapi.json with openapi-typescript and runs tsc on a small client (web/scripts/openapi-client/example.ts: /me, tasks, one sync call, the error envelope), so a renamed, removed or loosened field fails the Web job. openapi-typescript (pinned exactly) is a devDependency for this test only, never in the bundle or the binary: it is the generator most third-party clients use, so the test sees the description as they do. Its peer range stops at TypeScript 5, so web/package.json overrides that one peer to our TypeScript.
The client's sync code also runs against the real server: npm run test:contract in web/, after make server.
Shared fixtures#
Logic that runs both in Go and in TypeScript (recurrence, filters, quick add, encryption, the op schema, …) is pinned by one fixture both test suites read. The list is Shared contracts; adding one is Add a shared contract.
Changing the public surface (a route, a field, an error code, an MCP tool, an ot flag) also updates the v1 snapshot: go test ./internal/httpapi -run TestV1SurfaceIsAdditive -update. The snapshot may only grow; see Stability and compatibility.
Screens#
To see the app with realistic data, run make preview: it builds, starts a server on http://127.0.0.1:8090 filled with the account every screen check uses (two people, nested projects, tasks in every state, comments, views, a dashboard), and prints the sign-in. make shots SCREENS=today,inbox:task-detail photographs screens of it at 1280 and 390 px, light and dark, into shots/ (make shots LIST=1 names the screens and overlays). AI agents follow the same loop through the ui skill and the ui-reviewer agent in .claude/.
make layout-check: every screen and overlay in a browser, including axe-core accessibility. A new screen or overlay is added toscripts/e2e-layout.mjs. Below 768 px it shows the phone screens, and fails when a screen of the app has neither the phone header nor a phone screen.make safe-area-check: the same screens and overlays as the installed app on an iPhone with a Dynamic Island (insets emulated, portrait and landscape); fails when a control sits under the island, the home indicator or a rounded side, or when a screen draws text under the status bar or lacks the opaque backdrop that keeps Safari from blurring it (at load, after an overlay closes and after a cold start).make screens: PNGs of the core screens at 1280×800 and 390×844, light and dark. Run it onmainwithOUT_DIR=dist/screens-before make screens, then on your branch, and attach the pairs your change affects.make storybookandmake ui-check: the shared components inweb/src/ui, each with stories.make bundle-budget: the first load of the web app againstweb/bundle-budget.json.
Every browser script starts its own throwaway server on a free port and a fresh data directory, and shares Playwright, contexts and screen sizes through scripts/lib/harness.mjs (scripts/README.md); a new script uses it rather than its own copy. Playwright's version is in .playwright-version, read by the Makefile and every workflow; install it with npm i -g playwright@$(cat .playwright-version).
CI tiers#
CI runs the jobs a change's paths need (scripts/ci-changes.sh): the checks always; for code, the web, server and image jobs and one binary; a Chromium layout and end-to-end job when the app or server changes; Storybook checks for web/src; Android, iOS, extension and Obsidian jobs for their own directories. A change to web/ also runs the accessibility gate on every real screen.
A pull request, draft or not, runs the fast part of that: the checks, web, server, image and the small packages. The merge queue runs all of it, the layout, Storybook, accessibility, phone, binary and site bundle jobs included, and nothing reaches main unless that run passes. When one of them fails in the queue, the change leaves the queue; the failed queue run has the reports (for example ui-check-report-<shard> with the new screenshots). To run them before queueing, start the CI workflow by hand on your branch with base: main.
A push to main runs the fast part again and publishes the image; the heavy jobs already ran in the queue on the same code. A newer push cancels the run before it. A run by hand with a base branch runs all of them against that branch, like the queue (the UI baselines fold starts one for its own pull request). A release tag, the nightly CI run and a run by hand without one run every job: WebKit, German and French layouts, all binaries. A red nightly on main is fixed first, like a red main. Every night CI also runs the race detector, the upgrade check, the full accessibility matrix, fuzzing and the performance budgets; a failed night opens an issue labelled ci-nightly.