Visual regression testing for documents first (PDFs and their pages), plus browser and mobile screenshots. The
design is in docs/design.md; read it before changing the architecture, and update it in the same change when you do.
- Never push to
main; every change goes through a pull request. A ruleset onmainrequires the CI jobs and the VisualCI check, which stays pending until the PR's VisualCI build is reviewed. Before you merge:- Wait for CI. Then review the PR's build over VisualCI's MCP server (
list_buildsfor the branch,get_build,get_snapshot;contact_sheetfor many screenshots), the way our customers' agents do. - Approve changes the PR meant to make (
review). Fix the code and push again for anything it didn't mean: a page that looks broken is a regression even when CI is green. - Merge with
scripts/agents/merge-pr.sh(below) once every check is green. If it stops because a VisualCI build waits for review, that's the review you skipped. Never bypass the ruleset. (1 Dec 2026, unreviewed builds let a CSS break from three merges reach production.)
- Wait for CI. Then review the PR's build over VisualCI's MCP server (
- Git hooks format your commits: install them once per clone with
mise install && lefthook install(the hooks live in the clone's shared.git/hooks, so its worktrees all get them;lefthook.ymllists them). The pre-commit hook runs the formatters on the staged files and stages what they change. CI has no format check (Nathan, 5 Dec 2026, sc-9611), so a commit made without the hooks lands unformatted: never commit with--no-verify. - Workflows, secrets, spelling, JS/TS and shell scripts are checked by CI's
securityjob and the pre-commit hook: actionlint, zizmor, Betterleaks, typos (_typos.toml), oxlint (.oxlintrc.json) and ShellCheck (scripts/ci/shellcheck.sh); mise.toml pins them. The typos hook only checks (it never rewrites what you tested): fix what it names, or runmise run fix-typos. Keep a misspelling a test needs on purpose with aspellchecker:disable-linecomment as the very last thing on its line (# ...or// ..., the reason before it); for a word used in many places, or a file without#or//comments (Markdown, CSS, HTML), anextend-ignore-reentry in_typos.tomlwith the reason. Encode test bytes in the test (STANDARD.encode(b"…")) rather than pasting base64, which typos reads as words. - Source files stay under 500 lines (1,000 for tests and migrations;
scripts/ci/check_file_length.py). The files that were already longer have their own caps inscripts/ci/file_lengths.txt: split one rather than grow it past its cap, never raise a cap (CI fails until you lower one whose file shrank), and delete its line once it's under the limit. Every lint suppression (#[allow(...)],@ts-expect-error,# noqa, a zizmor ignore and the rest) is listed inscripts/ci/suppressions.txtwith its reason, added in the change that adds it (scripts/ci/check_suppressions.py). Fix what a lint finds before you reach for a suppression. - Unused code fails CI: cargo-shear fails on unused Rust dependencies in the three workspaces (
lintjob; its unlinked-file warnings don't fail), and Knip on unused files and dependencies infrontend/(knip.jsonc,clientsjob; unused exports are reported only, for now). Delete what they find; ignore something only in their config, with the reason beside it. - Links are checked by lychee (
lychee.toml): CI'sclientsjob checks every page, file and#anchorthe built site links to, offline, so a broken internal link fails the build that makes it. The Audit workflow checks every link on the live site, outside ones included, each night. Exclude a link inlychee.tomlonly with the reason beside it. - CLI releases carry build provenance: release.yml's build job attests each archive
(
actions/attest-build-provenance), sogh attestation verify visualci-<target>.tar.gz -R DocSpring/visualciproves a download was built by this repo's release workflow. The commit it names is main's tip when the release started, which can be later than the commit built if someone pushed meanwhile. Keep the attestation step when changing how the archives are built or named. Allow a word or turn a lint rule off for a file only in those files, with the reason beside it. Pin every action by commit SHA with its version in a comment (pinact rundoes it). Ignore a zizmor finding only inline (# zizmor: ignore[audit]) with the reason beside it; allow a made-up value in.betterleaks.tomlonly with a description of what it is. A real secret that reached a commit is revoked, not allowlisted. - Dependencies are audited by the Audit workflow (on pull requests and daily on main): cargo-deny for the Rust
workspaces (a
deny.tomlbeside each manifest: advisories, licences, sources) and Trivy for every lockfile. Fix a finding by upgrading. An ignore says why it doesn't apply: indeny.tomlwith areason, in.trivyignore.yamlwith astatementand anexpired_atat most six months out. A new dependency licence goes intodeny.toml's allow list only after a look (no copyleft in the CLI or the images). Indeny.toml, ignores and licences nothing uses any more fail the job: remove them. - Images are linted and scanned. hadolint checks the Dockerfiles (
.hadolint.yaml), and Trivy scans the built images in CI's images job: fixable HIGH/CRITICAL vulnerabilities and forbidden licences fail a pull request (on main they only report, and the Audit workflow scans the live app image daily). The Dockerfiles'FROMlines keep plain tags: CI replaces each with the digest-pinned mirror copy (build-contexts,.github/mirror.txt), whose digests are linux/amd64 only, so pinning them inFROMwould break local builds on arm64. The app's runtime stage takes Debian's security updates on every build. The renderer doesn't: its packages (fonts, MuPDF, Java and their libraries) come from snapshot.debian.org atDEBIAN_SNAPSHOTindocker/renderer.Dockerfile, so a rebuild installs the same versions and can't move pixels by itself (sc-10019). Moving that date, or editing anything that changes how a page is drawn (docker/renderer/, PDFBox's version), means adocker/renderer.versionbump, which redraws every customer's PDFs (their bases too): compare the old and new images' PNGs byte for byte on real PDFs first. - Merge only with
scripts/agents/merge-pr.sh <pr>, run in the background from the PR's checkout; its header gives the steps and exit codes. Runscripts/agents/merge-pr.sh <pr> --gowhen the pushed commit'sVisualCIcheck run orCIworkflow run completes, whichever comes last. A PR must be up to date withmainto merge, so each merge sends every other PR back through CI. The script holds Fleetlayer's main-merge lock from the last rebase to the merge, for one CI run, and releases it however it ends (3 Dec 2026: two agents' merges kept making each other's green PRs out of date). What it can't do for you:- Start it only when the PR is green and its latest VisualCI builds are reviewed, never to wait for a review or a fix. (5 Dec 2026: a lock held two hours while a PR stayed red stopped every other merge.)
- When the rebased commit's
CIrun finishes, look at its VisualCI builds at once (VisualCI's MCP:list_buildswithwaiting_for_review, orwhoami) and review them: theVisualCIcheck stays pending until then, and waiting on it let the lock run out (5 Dec 2026, #278). Changes your PR didn't make (main's, inherited) are reviewed after a--release, outside the lock. - Don't merge any other way: no bare
fleetlayer lease acquire(a lock that expires unreleased pages Fleetlayer for 30 minutes; 4 and 5 Dec 2026) and nogh pr merge --delete-branch. The repository deletes a merged branch itself, and GitHub then moves a PR stacked on it ontomain; a branch the client deletes closes that PR instead (5 Dec 2026, #259 closed when #257 merged).
- Experiment on a local VisualCI, never on production. Run replays, load tests and odd inputs (broken PDFs, huge builds, long MCP waits) against a VisualCI on docspring-dev or an agent box, not app.visualci.com. When production is the only way, tell the coordinator first and silence or annotate the alerts it will fire. (5 Dec 2026: three production alerts, Sentry VISUALCI-PROD-SERVER-7 and -8 and VisualCIRendersFailing, came from our own replays.)
- Wait on CI through Fleetlayer's messages; never poll GitHub. Every agent's
ghshares Nathan's one GitHub account and its 5,000 API calls an hour, and on 4 Dec 2026 polling used them up and blocked every session'sgh. Nogh run watch,gh pr checks --watchor loop ofghcalls, however slow. After a push,fleetlayer subscribe ci --commitin the checkout brings each workflow's result as a message, ends by itself, and says so if nothing came within 45 minutes. merge-pr.sh subscribes to the branch's check runs itself. Don't act on VisualCI's check suite completing: it can arrive before the last build's check has posted. - A change people using VisualCI can see (a feature, a fix they'd notice, a CLI release, a setting, a price) gets a
changelog entry in the same PR: its own file in
frontend/content/changelog/, whichnode scripts/changelog-entry.mjs <slug> "<text>"(infrontend) names with New Zealand's date and time. The build assembles the days (scripts/changelog.mjs), so entries from parallel PRs never conflict; don't editfrontend/content/changelog.md, which holds only the intro. CI fails a PR whose new entry is dated before yesterday: rename it to today's date and time before it merges. Internal work (tests, CI, refactors, staff tools) doesn't get one. - No backwards compatibility before launch. There are no old setups to keep working: rename, change formats and drop old behaviour outright, with no redirects, aliases, fallbacks or shims for the old way (Nathan, 1 Dec 2026).
plugin/skills/is generated from the docs pages withskill:front matter. After editing such a page, runnode scripts/skills.mjsinfrontendand commitplugin/and the files it writes; CI fails when they differ. The plugin has no version to bump: Claude Code versions it by its commit, so every commit to main is a new version (installed plugins pick it up with auto-update orclaude plugin update), and--checkfails whenplugin.jsongets a version back.plugin/may hold only Markdown, text, JSON, YAML and images: the Claude plugin directory refuses anything else from an unverified organization.- A change to the CLI (crates/visualci-cli or crates/visualci-core) bumps the workspace version in Cargo.toml and
Cargo.lock's visualci-* entries, and the version defaults in clients/github-action/action.yml and
clients/circleci-orb/orb.yml. CI's
cli-versionjob fails without them; once CI passes on main, the release workflow publishes it once production serves that commit (it waits up to 20 minutes, then fails). The docs never name a CLI version: they write{{cli_version}}(VISUALCI_VERSION={{cli_version}},github-action@v{{cli_version}}), which the site build fills in with the newest published release (frontend/scripts/cli-version.mjs), so they never pin an old CLI or one nobody can download yet. - Fixtures are test data only: synthetic values, or blank template PDFs someone has checked. Never commit a real customer's document or data.
- Build Rust in CI or on a build machine (docspring-dev), not on small agent VMs. The server is app/ (Laravel Rust,
visualci-appin the root workspace, with the CLI and its crates in crates/, whose tests need no database).scripts/on-dev testruns the crates' tests. app/'s (cargo test -p visualci-app) need Postgres and a blob store: run them withscripts/on-dev runnamingVISUALCI_APP_TEST_DATABASE_URL=postgres://...@127.0.0.1:55433/visualci_app_test_<story>. On docspring-dev that's its own Postgres (a database of your own per story). On a pool box the run starts its own Postgres and RustFS in Docker, points the command at them, and removes them when it ends. - VisualCI dev ports on docspring-dev: the app 5250 (
SERVER_PORT=5250, which the Vite proxy defaults to), Vite 5173, previews 5180–5199. 5150 is Talira's dev server: never use it (on 1 Dec 2026 a VisualCI dev server took it, and Talira's localhost and MCP reached VisualCI instead). Production listens on 5150 inside its cluster, which is separate. - Any UI design (the landing page, the review UI, emails): load the
hallmarkskill and the frontend design skills before writing markup or CSS. - A test never skips quietly. When a service it needs (the blob store, Postgres, a forge stub) is missing, it fails
with a message naming the service: a test that returns early passes in CI. (3 Dec 2026: the server tests that need
blobs returned early in CI's
testjob, which runs no S3, and passed without checking anything.) - Migrations run before the rollout, so for a few seconds the previous release serves against the new schema. A
migration must work with the code before it: add the new column and copy the data in one change, stop reading the
old one in the same change, and drop or rename it in a later change. A required column gets a default. CI's
migrationsjob runs scripts/ci/migration_safety.py, which fails a new migration that drops, renames or retypes anything main's code still names. This is deploy safety, not backwards compatibility: the old column still goes, one release later. (4 Dec 2026, a dropped organizations column failed every request for ~20 s, a new user's first build among them.) - Migrations run in file-name order and the database records each by name. Name a new one
YYYY_MM_DD_HHMMSS_snake_case.rswith a timestamp after every migration on main, and never rename or delete one that is on main. If another branch's migration merged first with a later timestamp, rename yours to a newer one before merging. A migration on main is never edited either (deployed databases won't run it again): fix it with a new one. scripts/ci/check_migrations.sh checks all of this in CI'smigrationsjob. - New migrations are linted by Squawk (
.squawk.toml,scripts/ci/squawk_migrations.sh, in the hook and themigrationsjob): start each withSET LOCAL lock_timeout = '5s';, and add a foreign key to an existing tableNOT VALID, thenVALIDATEit in a later migration. Silence a finding only with-- squawk-ignore <rule>above the statement, listed with its reason inscripts/ci/suppressions.txt. - The server connects with sqlx's prepared-statement cache off (
config::without_statement_cache): a migration that adds a column makes Postgres refuse an old pod's cachedSELECT table.*("cached plan must not change result type"). Keep it off.tests/rollouts.rsfails if it comes back on. (4 Dec 2026, #178's rollout.) - Every background process (workers, renderers, scheduled jobs) ships with a health check or heartbeat that checks the work is done, not just that the process is up, in the same change.
- Production reads its secrets from 1Password through the cluster's ExternalSecrets (talira-ai/infra,
k3s/resources/visualci/secrets.yaml). Before moving, renaming or deleting one of those items, or changing a field
name, tell the
talira infra@agents-talirasession so the ExternalSecret changes first: a missing item fails every deploy until it does (1 Dec 2026, a vault move held back three releases). - Deploys: CI pushes the image digest to talira-ai/infra, and ArgoCD polls it every 60 s. A release normally reaches
production (
https://api.visualci.com/statuscommit) within about 3 minutes of CI's deploy job. Only call a rollout stuck after that, and then asktalira infra@agents-talira. The API is on api.visualci.com: the app host returns 404 for/api/v1/*on purpose. - Renderers handle untrusted input: they run only on the render node, under gVisor, with no network and no service-account token.
- serde_json's
arbitrary_precisionfeature is on in app/'s build, so a number inside#[serde(untagged)]or#[serde(flatten)]fails to deserialize (it arrives as a map, not a number). Read such bodies throughserde_json::Value(domain::lenient). Tests that build the struct directly won't catch it (4 Dec 2026, visualci.yml thresholds and update_project floats). - Code in a bare
tokio::spawntask has no app context:laravel::now(), the database and the cache panic there. Uselaravel::task::spawnorcontext.scope, andspawn_blockingonly for pure CPU work on plain data (decoding images). Integration tests run inside an app context and won't catch it. - Before building something other Laravel Rust apps also need (R2 presigned uploads, API key hashing or metering, sitemaps, OG images, cookie consent, PostHog, Resend, Polar billing), search Talira and check kitze's packages (github.com/kitze/laravel-rust-*) first. Keep VisualCI's own OAuth and MCP code (Nathan, 4 Dec 2026).
- Dependency updates come from self-hosted Renovate (.github/workflows/renovate.yml, renovate.json), signed in as the
DocSpring GitHub App "DocSpring Renovate": its client ID in the repo variable
RENOVATE_APP_CLIENT_ID, private key in the secretRENOVATE_APP_PRIVATE_KEYand in 1Passworddocspring-renovate-app-private-key(nathans-ai-agents). The app is installed only on repos that use it; another DocSpring repo opts in by being added to the installation and copying the workflow. Updates wait 7 days after release, and routine PRs open on Tuesday mornings (Auckland). Nothing automerges: merge a Renovate PR like any other (CI, the VisualCI review, the main-merge lease). Base images are bumped by hand in .github/mirror.txt, as is the Rust toolchain. Rust dependency updates wait for a tick on the dependency dashboard, because any change to the root Cargo.toml or Cargo.lock rebuilds the renderer.