Regexes with super-linear backtracking (S8786 x16) are rewritten to stay linear on long runs; each new pattern gives the same results as the old one on 150k-450k fuzzed inputs (except where noted) and finishes adversarial 50k-character inputs in under 3 ms: - tag-generator QUALIFIER_SUFFIX_RE starts just before a `:`/space run (`(^|[^:\s])…` + "$1"), never inside one - timeline-parser matches `line.trimEnd()` with a greedy label, and renders with trimEnd(); cleanCpuName collapses whitespace before the patterns - editor-store endings, Google Play urlPattern (lookahead for `id=`), channel-phrase punctuation, SPDX OR/AND split, legal-docs slug and link stripping (link text/URL may not contain `[`), base64url padding, and a loop for trailing slashes in the worker router Others: - S2871: sorts take the shared code-unit comparator (same order as before; THIRD_PARTY_NOTICES is unchanged) - S4822: ErrorBoundary catches the logger import with .catch(), which a try/catch never could - S3516: migrateProfilesState returns a new object - S7773: Number.parseInt (x10) - S9379: Modal takes an initialFocusRef (Radix onOpenAutoFocus), so the shortcut search box gets focus without an autoFocus attribute - S2245: generateId drops the Math.random fallback; getRandomValues exists everywhere the app runs, and a non-random ID is worse than an error - S4036: NOSONAR on the dev script's `git` call (PATH lookup by design) - S6505/S8543: every workflow installs with `npm ci --ignore-scripts`, and CI runs `npm run cf:check` instead of `npx wrangler …` - S6358: Android sets allowBackup="false" — app data is no longer copied to Google Drive backups; Backup & Restore moves it to a new phone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
107 lines
4.7 KiB
YAML
107 lines
4.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
# Least privilege. The job only reads the repo — it publishes nothing, comments
|
|
# nowhere. Declaring it explicitly also silences CodeQL's
|
|
# `actions/missing-workflow-permissions`, which otherwise flags the implicit
|
|
# (and much wider) default token scope.
|
|
permissions:
|
|
contents: read
|
|
|
|
# A force-push or a quick follow-up commit makes the older run worthless. Cancel
|
|
# it instead of paying for both — except on `main`, where every commit's result
|
|
# is a historical record the release process reads back.
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
jobs:
|
|
# `check` is the required status on `main` (ruleset "main-protection") — keep
|
|
# the job id stable.
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Actions are pinned by commit SHA (a tag can be moved; a SHA cannot).
|
|
# Dependabot keeps the SHA and the version comment up to date.
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
# No dependency lifecycle scripts, in every workflow. The only packages
|
|
# that have one (esbuild, workerd, fsevents) take their native binary
|
|
# from optionalDependencies; the script only double-checks it.
|
|
- run: npm ci --ignore-scripts
|
|
# `tsc` must be TypeScript 7 (@typescript/native). The `typescript` alias
|
|
# (@typescript/typescript6, the API typescript-eslint loads) pulls in
|
|
# TypeScript 6 as @typescript/old, which ships a `tsc` too — npm links the
|
|
# first one by path order. Fail loudly if that ever flips, instead of
|
|
# silently type-checking with 6.
|
|
- name: TypeScript 7 is the `tsc` on PATH
|
|
run: ./node_modules/.bin/tsc --version | grep -q '^Version 7\.'
|
|
|
|
# --- correctness ------------------------------------------------------
|
|
# `typecheck` covers src/ (what Vite builds); `typecheck:all` adds tests/,
|
|
# scripts/, worker/ and build-plugins/.
|
|
- name: Type check (src)
|
|
run: npm run typecheck
|
|
- name: Type check (tests, scripts, worker, build plugins)
|
|
run: npm run typecheck:all
|
|
- name: Lint
|
|
run: npm run lint
|
|
- name: Validate locales
|
|
run: npm run validate:locales
|
|
# Coverage thresholds for src/engine and worker live in vitest.config.ts.
|
|
- name: Test (with coverage thresholds)
|
|
run: npm run test:coverage
|
|
|
|
# --- consistency ------------------------------------------------------
|
|
- name: Check formatting
|
|
run: npm run format:check
|
|
- name: Check dead code
|
|
run: npm run knip
|
|
# The release ritual bumps SIX version fields by hand. This is the only
|
|
# thing that notices when one is missed — see scripts/check-version-sync.ts.
|
|
- name: Check version sync
|
|
run: npm run check:version
|
|
# tauri build refuses mismatched npm/crate minors, and CI never runs it.
|
|
- name: Check Tauri npm/crate alignment
|
|
run: npm run check:tauri
|
|
|
|
# --- licensing --------------------------------------------------------
|
|
# Every package bundled into the app has an allowed license, and
|
|
# THIRD_PARTY_NOTICES.md matches what is actually installed.
|
|
- name: Check licenses and third-party notices
|
|
run: npm run check:licenses
|
|
# NOTICE, REUSE.toml and the installers' copyright string state the
|
|
# years ("2026", later "2026-2027"). The first commit in a new year
|
|
# fails here until `npm run update:copyright` extends them.
|
|
- name: Check copyright years
|
|
run: npm run check:copyright
|
|
|
|
# --- security ---------------------------------------------------------
|
|
# Advisory-only: a fresh high-severity advisory in a transitive dep must
|
|
# not turn every unrelated PR red before Dependabot has had a chance to
|
|
# open its fix PR. The Dependabot alerts tab is the source of truth, and
|
|
# dependency-review (security.yml) blocks PRs that *introduce* one.
|
|
- name: Audit dependencies
|
|
run: npm audit --audit-level=high
|
|
continue-on-error: true
|
|
|
|
# --- build ------------------------------------------------------------
|
|
- name: Build
|
|
run: npm run build
|
|
- name: Check bundle budget
|
|
run: npm run check:bundle
|
|
# Validates wrangler.jsonc and bundles the Worker exactly as Workers
|
|
# Builds will — without deploying anything.
|
|
- name: Dry-run the Cloudflare deploy
|
|
run: npm run cf:check
|