Files
CV_Site_Nuxt/OKF_Nuxt/decisions/pr-pipeline-layering.md
T
Noel Sabia 7bf649cba6
PR Check / Dockerfile lint (droast) (pull_request) Skipped
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / ESLint (pull_request) Successful in 36s
PR Check / Typecheck (pull_request) Successful in 38s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 5s
PR Check / Dependency audit (pull_request) Successful in 9s
PR Check / AI code review (opencode) (pull_request) Failing after 13s
docs(okf): record CI/CD, AI review, release and secrets decisions
Four new decision documents covering the pipeline work: layering,
AI review setup (provider prefix, v2 CLI, env-only auth, verdict
gate), release engineering (release-please manifest mode), and the
Snyk pause with the token scope policy. Index grouped, log extended,
open questions updated.
2026-10-18 18:19:59 +02:00

75 lines
3.3 KiB
Markdown

---
type: Decision
title: PR pipeline layering
description: Three layers - pre-commit hooks for cheap deterministic checks, Gitea Actions for thorough checks, an AI reviewer for judgment - and the rule that decides what runs where.
tags: [decision, ci, gitea-actions, pre-commit, security]
status: draft
generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T16:05:00Z }
verified: { by: human:noel, at: not yet }
sources:
- id: pr-checker
resource: .gitea/workflows/pr-checker.yml
title: PR Check workflow
- id: pre-commit
resource: .pre-commit-config.yaml
title: Pre-commit guardrails
---
# Decision
Every pull request is checked by three layers, ordered by cost:
1. **Pre-commit hooks** (local, seconds, deterministic): gitleaks, file
hygiene, conventional-commit check, actionlint, eslint --fix on staged
files. A commit that fails here never exists.
2. **Gitea Actions** (per PR push, minutes): ESLint, vue-tsc typecheck,
gitleaks over full history, pnpm audit (blocking), droast Dockerfile
lint, Snyk (currently disabled).
3. **AI code review** (per PR push): opencode with a plan-covered model,
verdict-based, posted as a PR comment.
The split rule: anything that finishes in seconds and auto-fixes goes in
pre-commit; anything slow, network-bound or quota-bound goes in CI; anything
that produces judgment rather than a pass/fail is the AI review. Nothing
slow lives in pre-commit — one slow hook gets bypassed with `--no-verify`
once and is dead weight forever.
# Why
Each layer catches what the previous one cannot. Pre-commit sees the commit
before it exists; CI sees the whole PR on a clean machine; the AI review
sees intent, contracts and cross-file consequences that no linter can. The
ordering also protects the budget: the AI review only runs for code that
already passed the deterministic gates.
# What the pipeline bought us in practice
Recorded so the reasoning survives: during the first week the pipeline
caught leaked secrets in history (gitleaks), a review model configured
against the wrong provider account, a Dockerfile-lint job that silently
never ran (`hashFiles` evaluating empty in the act runner), a review that
completed but exited non-zero, and an attacker-relevant credential
exposure in the review setup — each fixed where it was cheapest.
# Failure modes deliberately designed against
| Failure seen | Guard now in place |
|---|---|
| Error logs posted as review comments | Posting gate is the output contract (a `VERDICT:` line), not the exit code |
| Vendor container images without arm64 manifests | Binaries installed arch-aware in `node:22-bookworm`, never vendor CI images |
| `hashFiles()` silently empty in the act runner | File discovery via `find` in a step, not workflow expressions |
| Silent advisory failures | `continue-on-error` removed everywhere; a failed check is red |
| Supply-chain (curl-piped binaries) | Pinned versions, checksums pinned in the workflow |
# Not verified
* That the Snyk job still works when re-enabled — it was disabled while
the free quota was the binding constraint.
* That the pipeline behaves on Gitea runner versions other than v0.6.1.
# Revisit when
* A second repository needs the same pipeline (extract a reusable
workflow include).
* The Go plan's usage limits are hit by review traffic.