Skip to content
Open
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
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ jobs:
- run: python3 scripts/ci/check_orb.py

# The workflows and actions: actionlint (with shellcheck on their scripts) and zizmor (.github/zizmor.yml, with its
# online audits: impostor commits, actions with known vulnerabilities); and secrets in the commits this push or pull
# online audits on pull requests: impostor commits, actions with known vulnerabilities); the Dockerfiles (hadolint);
# spelling (typos), JS/TS (oxlint) and shell scripts (ShellCheck); and secrets in the commits this push or pull
# request adds (Betterleaks, .betterleaks.toml). mise.toml pins the tools, and the pre-commit hook runs the same ones.
security:
runs-on: ubuntu-latest
Expand All @@ -178,8 +179,12 @@ jobs:
fetch-depth: 0
- uses: jdx/mise-action@924e7c586e33d7d4bae9c14e26c5d22e2beb6e78 # v5.3.0
with:
install_args: actionlint shellcheck zizmor betterleaks hadolint
install_args: actionlint shellcheck zizmor betterleaks hadolint typos oxlint
- run: actionlint
# Spelling (_typos.toml), JS/TS lint (.oxlintrc.json) and every shell script (scripts/ci/shellcheck.sh).
- run: typos
- run: oxlint --deny-warnings .
- run: scripts/ci/shellcheck.sh
# The renderer's two warnings (a `cd` and a pipe in the PDFBox download step) wait for its next rebuild: any edit
# to renderer.Dockerfile rebuilds the renderer image (its inputs hash), so it isn't touched for lint alone.
- run: hadolint docker/app.Dockerfile && hadolint --ignore DL3003 --ignore DL4006 docker/renderer.Dockerfile
Expand Down
18 changes: 18 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// oxlint (JS/TS lint), run by the pre-commit hook and CI's security job with --deny-warnings. Turn a rule off for a
// file here only with the reason beside it.
{
"$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
"ignorePatterns": ["**/node_modules/**", "**/dist/**", "**/dist-ssr/**", "**/dist-site/**", "target/**", "tmp/**"],
"overrides": [
{
// The URL checks reject control characters (\x00-\x20, \x7f) on purpose.
"files": ["clients/gallery/js/src/model.ts"],
"rules": { "no-control-regex": "off" }
},
{
// Sprockets needs its manifest to exist; this example's has only a comment.
"files": ["clients/gallery/ruby/examples/rails/app/assets/config/manifest.js"],
"rules": { "unicorn/no-empty-file": "off" }
}
]
}
6 changes: 4 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ design is in `docs/design.md`; read it before changing the architecture, and upd
live in the clone's shared `.git/hooks`, so its worktrees all get them; `lefthook.yml` lists 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 and secrets are checked** by CI's `security` job and the pre-commit hook: actionlint, zizmor and
Betterleaks (mise.toml pins them). Pin every action by commit SHA with its version in a comment (`pinact run` does
- **Workflows, secrets, spelling, JS/TS and shell scripts are checked** by CI's `security` job and the pre-commit
hook: actionlint, zizmor, Betterleaks, typos (`_typos.toml`), oxlint (`.oxlintrc.json`) and ShellCheck
(`scripts/ci/shellcheck.sh`); mise.toml pins them. 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 run` does
it). Ignore a zizmor finding only inline (`# zizmor: ignore[audit]`) with the reason beside it; allow a made-up
value in `.betterleaks.toml` only with a description of what it is. A real secret that reached a commit is revoked,
not allowlisted.
Expand Down
36 changes: 36 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# typos (spelling), run by the pre-commit hook (`typos -w` fixes what it's sure of) and CI's security job. Allow a
# word here only with the reason beside it.

[default]
extend-ignore-re = [
# Misspelled on purpose: tests and docs that check an unknown setting or field is caught (envschema's "did you
# mean", visualci.yml's unknown fields).
"APP_S3_REGOIN",
"APP_WAITLSIT",
"MYAPP_DATABSE_POOL",
"\"thresold\"",
"\"thresold: ",
# Possessives in Rust identifiers (close_the_branchs_builds, each_repositorys_collaborators); still typos in prose.
"\\w+_(branchs|repositorys)_\\w+",
]

[files]
# Binary files: typos skips them when it walks the tree, but checks (and -w rewrites) any file named on the command
# line unless it's excluded here (the hook passes --force-exclude).
extend-exclude = ["*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.ico", "*.pdf", "*.woff", "*.woff2", "*.ttf", "*.otf", "*.zip", "*.gz"]

[default.extend-identifiers]
# The plural of PNG, which typos splits into PN + Gs.
PNGs = "PNGs"
# A PDF dictionary key (/DecodeParms).
DecodeParms = "DecodeParms"

[default.extend-words]
# Postgres's block range index.
brin = "brin"
# PDF's /FlateDecode compression.
flate = "flate"
# Test text: "café" with the accent escaped.
caf = "caf"
# A correct spelling too.
unparseable = "unparseable"
15 changes: 14 additions & 1 deletion lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@
# Formatters fix what they find and stage the result (stage_fixed). CI has no format gate: formatting is never a
# reason for a red build (Nathan, 5 Dec 2026, sc-9611).
pre-commit:
parallel: true
# One at a time: rustfmt and typos both rewrite staged files (and stage them), and two fixers on one file at once
# would lose an edit. The whole hook takes a few seconds.
parallel: false
commands:
# Each file through stdin: given a path, rustfmt also formats (and must parse) every module file it declares, so
# a half-written unstaged module would be rewritten or would refuse the commit. `cat >` keeps the file's mode.
rustfmt:
glob: "*.rs"
run: for f in {staged_files}; do rustfmt --emit stdout <"$f" >"$f.fmt" && cat "$f.fmt" >"$f"; s=$?; rm -f "$f.fmt"; [ $s = 0 ] || exit 1; done
stage_fixed: true
# Spelling: fixes what it's sure of and stages it; anything else fails until fixed or allowed in _typos.toml.
# --force-exclude: typos checks (and -w rewrites) every file it's given by name, images included, unless excluded.
typos:
run: typos -w --force-exclude {staged_files}
stage_fixed: true
oxlint:
glob: "*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,astro,vue,svelte}"
run: oxlint --deny-warnings {staged_files}
shellcheck:
glob: "{*.sh,scripts/*,scripts/**/*,**/bin/*}"
run: scripts/ci/shellcheck.sh {staged_files}
# The workflows and actions: actionlint (with shellcheck on their scripts) and zizmor (.github/zizmor.yml).
actionlint:
glob: ".github/workflows/*.{yml,yaml}"
Expand Down
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ betterleaks = "1.10.1"
cargo-deny = "0.22.3"
trivy = "0.77.0"
hadolint = "2.15.1"
typos = "1.53.0"
oxlint = "1.96.0"
23 changes: 23 additions & 0 deletions scripts/ci/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# ShellCheck on every shell script in the repository (each tracked file whose first line is a sh/bash shebang, and
# every *.sh), at warning level and up. Run by CI's security job, and by the pre-commit hook on just the staged files it
# names (`scripts/ci/shellcheck.sh <file>...`). mise.toml pins ShellCheck.
# GitHub Actions' run: scripts are actionlint's (it runs ShellCheck on them), and the CircleCI orb's are
# scripts/ci/check_orb.py's.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
files=()
while IFS= read -r -d '' f; do
[ -f "$f" ] || continue
case $f in
*.sh) files+=("$f") ;;
*)
first=
IFS= read -r first <"$f" || true
[[ $first =~ ^\#!.*[/\ ](bash|dash|sh)([[:space:]]|$) ]] && files+=("$f")
;;
esac
done < <(if [ $# -gt 0 ]; then printf '%s\0' "$@"; else git ls-files -z; fi)
[ ${#files[@]} -gt 0 ] || exit 0
shellcheck --severity=warning "${files[@]}"
echo "ShellCheck: ${#files[@]} scripts clean"
2 changes: 1 addition & 1 deletion scripts/ci/visual.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ EOF
rm -f "$out/site/visualci.schema.json"
fi
# The link-preview cards the prerender drew (scripts/og.mjs), so a broken card template shows up in review.
rm -rf "$out/og" && cp -r "$root/frontend/dist/og" "$out/og"
rm -rf "$out/og" && cp -R "$root/frontend/dist/og" "$out/og"
# Component snapshots, written fresh: the baselines are on VisualCI.
cd "$root/frontend"
find src -name __snapshots__ -type d -prune -exec rm -rf {} +
Expand Down
2 changes: 1 addition & 1 deletion scripts/on-dev
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ sync() {
# app/build.rs lists the migrations when database/migrations changes, but rsync keeps a new file's old mtime, so cargo
# would build the old list in: touch the folder when a migration was added or removed (not on every sync, which
# would rebuild the app each time).
if printf '%s\n' "$changes" | grep -qE '^([<>]f\+{9}|\*deleting) +app/database/migrations/'; then
if grep -qE '^([<>]f\+{9}|\*deleting) +app/database/migrations/' <<<"$changes"; then
ssh "$host" "touch '$remote/app/database/migrations'"
fi
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/screenshots/lightbox.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function checkLightbox(browser, base) {
const ctx = await browser.newContext({ baseURL: base, viewport: { width: 1440, height: 900 }, deviceScaleFactor: 2 })
try {
await ctx.route('https://app.visualci.com/g/**', async (route) => {
if (/-2x\.png$/.test(new URL(route.request().url()).pathname)) await new Promise((r) => setTimeout(r, SLOW_MS))
if (new URL(route.request().url()).pathname.endsWith('-2x.png')) await new Promise((r) => setTimeout(r, SLOW_MS))
await route.fulfill({ status: 200, contentType: 'image/png', body: PNG }).catch(() => {})
})
const page = await ctx.newPage()
Expand All @@ -48,7 +48,7 @@ export async function checkLightbox(browser, base) {
await page
.waitForFunction(() => {
const img = document.querySelector('dialog.vg-box .vg-box-view img')
return img && img.complete && /-2x\.png$/.test(img.currentSrc)
return img && img.complete && img.currentSrc.endsWith('-2x.png')
}, null, { timeout: SLOW_MS + 5000 })
.catch(async () => {
throw new Error(`lightbox: opening "${first.title}": its image never showed (${JSON.stringify(await shown())})`)
Expand Down
Loading