Compare commits

...
3 Commits
Author SHA1 Message Date
Gitea Actions [Bot] f7a092584f chore: release main
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / AI code review (opencode) (pull_request) Successful in 22s
PR Check / Lint + typecheck (pull_request) Successful in 51s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 8s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
2026-10-20 19:05:42 +00:00
Noel db04d441c9 Merge pull request 'ci: use cheaper review model and cache pipeline installs' (#15) from feat/upgrade-ci-cd-pipeline into main
release-please / release-please (push) Successful in 7s
Reviewed-on: #15
2026-10-20 19:05:35 +00:00
Noel Sabia fa8fafb7ef ci: use cheaper review model and cache pipeline installs
PR Check / Lint + typecheck (pull_request) Successful in 1m42s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / AI code review (opencode) (pull_request) Successful in 45s
- review model: opencode-go/claude-haiku-5-5#medium instead of
  deepseek-v4.1-flash#max; flash has no medium variant
- merge lint and typecheck into one job with a single pnpm install
- cache the pnpm store and opencode binary via actions/cache@v4.1.0,
  keyed on a sha256 of the lockfile (hashFiles is empty on this runner)
- update the decision records and log
2026-10-20 20:56:52 +02:00
8 changed files with 153 additions and 46 deletions

No files matched your search

+66 -33
View File
@@ -17,9 +17,13 @@ env:
APP_DIR: .
jobs:
# ---------------------------------------------------------------- lint ----
lint:
name: ESLint
# ------------------------------------------------------ lint + typecheck --
# One job, not two: both checks use the same image, the same lockfile and
# the same install, so splitting them doubled the install work (and, on the
# 2 vCPU runner, the CPU contention). They still report as separate steps,
# so a failure says which check failed.
checks:
name: Lint + typecheck
runs-on: ubuntu-latest
container: node:22-bookworm
steps:
@@ -32,6 +36,32 @@ jobs:
# missing or empty")
version: 11
- name: Resolve pnpm store and lockfile hash
id: pnpm
working-directory: ${{ env.APP_DIR }}
run: |
# hashFiles() evaluates empty in this act runner, so the cache key
# is built from a real sha256 in a shell step instead. The store
# directory's own name is the layout version (store/v11 here), so
# it is in the key: a store from another pnpm major is unusable.
store="$(pnpm store path --silent)"
echo "store=$store" >> "$GITHUB_OUTPUT"
echo "layout=$(basename "$store")" >> "$GITHUB_OUTPUT"
echo "lockfile=$(sha256sum pnpm-lock.yaml | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Restore pnpm store
# v4.1.x, not v4.2+: the runner's cache server may only speak the v1
# API (Gitea runner 2.x). v4.1 works on both v1-only and v3 runners.
# A cache outage must not turn into a red PR: install still works
# without the store, just slower.
continue-on-error: true
uses: actions/cache@v4.1.0
with:
path: ${{ steps.pnpm.outputs.store }}
key: pnpm-store-${{ runner.os }}-${{ steps.pnpm.outputs.layout }}-${{ steps.pnpm.outputs.lockfile }}
restore-keys: |
pnpm-store-${{ runner.os }}-${{ steps.pnpm.outputs.layout }}-
- name: Install dependencies
working-directory: ${{ env.APP_DIR }}
run: pnpm install --frozen-lockfile
@@ -40,25 +70,6 @@ jobs:
working-directory: ${{ env.APP_DIR }}
run: pnpm lint
# ------------------------------------------------------------ typecheck ---
typecheck:
name: Typecheck
runs-on: ubuntu-latest
container: node:22-bookworm
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
# match the pnpm major version used locally (v11.x) - older pnpm
# rejects our config-only pnpm-workspace.yaml ("packages field
# missing or empty")
version: 11
- name: Install dependencies
working-directory: ${{ env.APP_DIR }}
run: pnpm install --frozen-lockfile
- name: Typecheck (vue-tsc)
working-directory: ${{ env.APP_DIR }}
run: pnpm typecheck
@@ -234,14 +245,33 @@ jobs:
with:
fetch-depth: 0
- name: Restore opencode binary
id: opencode-cache
# The installer writes to $HOME/.opencode/bin. Caching it saves the
# ~4s download+extract per run - small next to the model call, but
# free to keep. Key includes the pinned version, so bumping the
# version below invalidates the cached binary automatically.
# As above, a cache outage falls back to the installer.
continue-on-error: true
uses: actions/cache@v4.1.0
with:
path: ~/.opencode/bin
key: opencode-v2.0.32-${{ runner.os }}
- name: Install opencode CLI
if: steps.opencode-cache.outputs.cache-hit != 'true'
run: curl -fsSL https://opencode.ai/v2/install | bash -s -- -v 2.0.32
# v2 installer is required: the classic /install URL ships only
# OpenCode 1.x (resolved to v1.19.3 on arm64), which cannot resolve
# model variants like "#max" and failed with ProviderModelNotFoundError.
# model variants like "#medium" and failed with ProviderModelNotFoundError.
# Version pinned (-v 2.0.32) so a breaking v2 release cannot fail
# the job mid-PR; bump deliberately, not automatically.
- name: Add opencode to PATH
# The installer appends the directory to $GITHUB_PATH itself, but that
# step is skipped on a cache hit. Add it unconditionally.
run: echo "$HOME/.opencode/bin" >> "$GITHUB_PATH"
- name: Get PR diff
run: |
# lockfile changes bloat the diff (175KB here) and are pointless to
@@ -258,15 +288,18 @@ jobs:
env:
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
run: |
# opencode-go/deepseek-v4.1-flash#max: switched from
# deepseek-v4-pro#max on 2026-10-20 after two consecutive runs
# failed with "Upstream request failed: Endpoint is unavailable"
# (~10 min apart; the model is still listed active, the endpoint
# just does not serve). This is the default recorded in
# OKF_Nuxt/open-questions.md for exactly this case. NOTE the
# provider prefix must be "opencode-go", NOT "opencode" (Zen is a
# different, pay-per-call provider and fails with 'Insufficient
# account funds').
# opencode-go/claude-haiku-5-5#medium: cheap ($0.10/$0.50 per M
# tokens) and, unlike deepseek-v4.1-flash, it has a #medium
# reasoning variant - flash only exposes low/high/max, so every
# review there ran at maximum effort. #medium keeps the review
# competent without paying for max reasoning on each push.
# History: deepseek-v4-pro#max -> deepseek-v4.1-flash#max ->
# haiku-5-5#medium (2026-10-20). The pro endpoint failed two
# consecutive runs with "Upstream request failed: Endpoint is
# unavailable" before the flash switch; that fallback is recorded
# in OKF_Nuxt/open-questions.md. NOTE the provider prefix must be
# "opencode-go", NOT "opencode" (Zen is a different, pay-per-call
# provider and fails with 'Insufficient account funds').
#
# Auth is env-only: the CLI picks up OPENCODE_API_KEY from the
# environment (verified headless). Deliberately NO opencode.json:
@@ -300,7 +333,7 @@ jobs:
EXIT_CODE=0
opencode run \
--print-logs \
--model opencode-go/deepseek-v4.1-flash#max \
--model opencode-go/claude-haiku-5-5#medium \
"You are a principal engineer performing a rigorous code review on a
pull request. You have tool access: read repo files for context when
the diff alone is ambiguous, but review ONLY code changed in this PR.
+1 -1
View File
@@ -1,3 +1,3 @@
{
".": "1.0.0"
".": "1.1.0"
}
+41
View File
@@ -1,5 +1,46 @@
# Changelog
## [1.1.0](https://github.com/CV_Website/CV_Site_Nuxt/compare/v1.0.0...v1.1.0) (2026-10-20)
### Features
* add nuxt application shell ([5caa345](https://github.com/CV_Website/CV_Site_Nuxt/commit/5caa3457aa8f97dfca94059b15f8330e97bfb041))
* added dockerignore, a development docker image and a qa/prod docker image ([1a78935](https://github.com/CV_Website/CV_Site_Nuxt/commit/1a78935c23ef2c756912d9f561a69569c2f45d2f))
* extend ESLint config with default rule set ([e4ea5c3](https://github.com/CV_Website/CV_Site_Nuxt/commit/e4ea5c3e7c74c4d2c700ced71372da13e031eb6c))
* merged main into this branch ([cefdb34](https://github.com/CV_Website/CV_Site_Nuxt/commit/cefdb34d7ec33a176714388a4a0805177e8c4216))
* set up ESLint and typecheck with @nuxt/eslint ([4e2a03e](https://github.com/CV_Website/CV_Site_Nuxt/commit/4e2a03eab88495cbfa9db861919189da0c4b2889))
* **ui:** homepage shell with tailwind theme, self-hosted fonts, layout and header components ([8d53daa](https://github.com/CV_Website/CV_Site_Nuxt/commit/8d53daa4a6e4e9530ccad5c1ae25052e4a811849))
* **ui:** pixel-art breathing logo and external links ([7b5c97c](https://github.com/CV_Website/CV_Site_Nuxt/commit/7b5c97c84eab5f214c9e84ac79bd6e08642defa1))
### Bug Fixes
* **ci:** address AI review findings (credentials, supply chain) ([85f488a](https://github.com/CV_Website/CV_Site_Nuxt/commit/85f488a94dd8796ea5f11c292edddd32e21398cd))
* **ci:** apply review findings round two ([a3e6aef](https://github.com/CV_Website/CV_Site_Nuxt/commit/a3e6aef901086f5f8b416e2aa7d29596517f9550))
* **ci:** close the fail-open gate, enforce read-only sandbox ([3e68e63](https://github.com/CV_Website/CV_Site_Nuxt/commit/3e68e630dff92a7abd791b7a8808eb682f37a060))
* **ci:** deny write tools, never swallow review errors ([f8d1287](https://github.com/CV_Website/CV_Site_Nuxt/commit/f8d128705faa9493202cf724ae0a451d4dc6d1e5))
* **ci:** gate the ai review to pull_request events, restore route announcer ([9be6298](https://github.com/CV_Website/CV_Site_Nuxt/commit/9be62982a4a2494351006463ae71bd99f4e49fe4))
* **ci:** give release-please git credentials for the release-branch push ([a27bbbb](https://github.com/CV_Website/CV_Site_Nuxt/commit/a27bbbb2abf0fa8ddedd20c05bba2128e88faa3a))
* **ci:** hand review diff to agent as file, not argv ([16b9291](https://github.com/CV_Website/CV_Site_Nuxt/commit/16b9291a5111b93d6e7da244f821589fa3432d87))
* **ci:** install opencode v2 for the review job ([783c9cc](https://github.com/CV_Website/CV_Site_Nuxt/commit/783c9ccda369fe5ec05ea5085488998de125045c))
* **ci:** JSON-encode review with node instead of jq ([a061fad](https://github.com/CV_Website/CV_Site_Nuxt/commit/a061fad9b1933414faa7e6a26bd3182c0ce6c9d7))
* **ci:** make droast job actually run ([cf6f209](https://github.com/CV_Website/CV_Site_Nuxt/commit/cf6f209ebf03c3a4faf4e32971ba036d60ddb36b))
* **ci:** pass --all-projects to snyk test ([7197f75](https://github.com/CV_Website/CV_Site_Nuxt/commit/7197f757a6447cf29a11f60914d89939bd647040))
* **ci:** pick gitleaks binary by CPU architecture ([88dadd5](https://github.com/CV_Website/CV_Site_Nuxt/commit/88dadd584627e963b4dee719768644626e343488))
* **ci:** point release-please at PR_GITEA_TOKEN (write scopes) ([e1192a2](https://github.com/CV_Website/CV_Site_Nuxt/commit/e1192a2014da8acfea37c5319f0b612f9f5a392e))
* **ci:** pull gitleaks from GHCR and pin version ([ce9c090](https://github.com/CV_Website/CV_Site_Nuxt/commit/ce9c090a150e448919205f9386ff61bfe77dfdb9))
* **ci:** run app jobs from repo root ([bb13f1a](https://github.com/CV_Website/CV_Site_Nuxt/commit/bb13f1a187d482b9bb55dafa303356114ece42ae))
* **ci:** run gitleaks as binary in node image ([779cf20](https://github.com/CV_Website/CV_Site_Nuxt/commit/779cf20f45ec8db009065197140067a531649401))
* **ci:** run Snyk CLI via npm on arm64 runner ([8d2a000](https://github.com/CV_Website/CV_Site_Nuxt/commit/8d2a00062e6381cbba9bdb703b210c8eb2201d92))
* **ci:** switch review model to deepseek-v4.1-flash, pause snyk via workflow_dispatch ([9b0f89e](https://github.com/CV_Website/CV_Site_Nuxt/commit/9b0f89ef38c189905869567be513dbf72e694b2d))
* **ci:** use opencode-go plan model for AI review ([8b6bcb6](https://github.com/CV_Website/CV_Site_Nuxt/commit/8b6bcb6d70d123dda551f08ef2c05dc3d50733f2))
* **ci:** use pnpm 11 in runner ([ecd0192](https://github.com/CV_Website/CV_Site_Nuxt/commit/ecd0192466f8d72b9f8532e32b1aea63ff9dd640))
* **deps:** force patched postcss-selector-parser 7.1.6 (GHSA-rj75-hqrm-r3gf) ([9995fc7](https://github.com/CV_Website/CV_Site_Nuxt/commit/9995fc75ed521ab54af59498dab7afa33f01ac23))
* pass staged filenames to the eslint pre-commit hook ([81d658a](https://github.com/CV_Website/CV_Site_Nuxt/commit/81d658a87105434835016ae20b24ef3cb7617d86))
* remove leftover merge conflict marker from pr-checker.yml ([8f36f14](https://github.com/CV_Website/CV_Site_Nuxt/commit/8f36f14720a4826fe4b4cebdf591994fa0961ae3))
* unblock the release PR - real production image, reviewed audit ignores ([f32ad07](https://github.com/CV_Website/CV_Site_Nuxt/commit/f32ad076486127a1132b754eb8258105754355bb))
## 1.0.0 (2026-10-18)
+18 -6
View File
@@ -1,7 +1,7 @@
---
type: Decision
title: AI code review setup
description: The review job runs opencode with the opencode-go plan model, env-only auth, a read-only permission set, and posts only reviews that end with a verdict line.
description: The review job runs opencode with a cheap medium-effort opencode-go model, env-only auth, a read-only permission set, and posts only reviews that end with a verdict line.
tags: [decision, ci, ai, opencode, security]
status: draft
generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T16:05:00Z }
@@ -19,7 +19,7 @@ sources:
The review job installs opencode v2 from the dedicated v2 installer,
authenticates with `OPENCODE_API_KEY` from the environment only, runs
`opencode-go/deepseek-v4-pro#max` (covered by the Go plan subscription,
`opencode-go/claude-haiku-5-5#medium` (covered by the Go plan subscription,
no per-token cost), denies `edit`/`shell`/`webfetch`/`websearch` via a
global permission config written outside the checkout, and posts the
review as a PR comment only if the output ends with a `VERDICT:` line.
@@ -29,6 +29,7 @@ review as a PR comment only if the output ends with a `VERDICT:` line.
| Piece | Why |
|---|---|
| Provider prefix `opencode-go`, not `opencode` | `opencode` is the pay-per-call Console gateway; the Go plan lives under its own provider id. The wrong prefix failed every run with "Insufficient account funds". |
| Model `claude-haiku-5-5#medium` | Cheap per token and cheap in the usage window, with a real `#medium` reasoning level. `deepseek-v4.1-flash` only exposes low/high/max, so its reviews always paid for the maximum effort. |
| The v2 installer (`/v2/install`) | The classic installer ships OpenCode 1.x (v1.19.3 on arm64), which cannot resolve model variants and failed with `ProviderModelNotFoundError` for `#max`. |
| Env-only auth, no `opencode.json` in the checkout | A config file in the workspace holds the API key in plaintext where the review agent can read it; a malicious PR diff could prompt-inject the agent into quoting the key in the publicly visible review comment. Environment variables are invisible to file reads. |
| Deny write tools via a global config outside the checkout | Headless runs cannot answer permission prompts; denials prevent both hangs and repo modification. The config file itself holds no secret, so its location leaks nothing. |
@@ -54,17 +55,28 @@ derives the verdict from the findings, so the gate and the prompt agree.
* Fresh-container replica test (node:22-bookworm, key-only auth)
reproduced the CI failure exactly, then confirmed the v2 + `#max` fix
before it was pushed.
* Model history: `deepseek-v4-pro#max` was replaced by
`deepseek-v4.1-flash#max` after two consecutive endpoint outages, then
by `claude-haiku-5-5#medium` (2026-10-20) to stop paying maximum
reasoning effort on every review. The flash model had no `#medium`
variant to fall back to.
# Not verified
* Whether `#max` still resolves after a future CLI upgrade — the variant
list comes from the model catalog, not a contract.
* Long-run behaviour of Go plan usage windows ($3 per 5 hours for
DeepSeek V4 Pro) under real review frequency.
* Whether `#medium` still resolves after a future CLI upgrade — the
variant list comes from the model catalog, not a contract.
* Whether the smaller model still catches the same class of findings as
the first flash review. The PR #14 findings are the baseline; re-run
the eval on the next few PRs.
* Long-run behaviour of Go plan usage windows under real review
frequency, now that the model is cheaper.
# Revisit when
* A PR review fails again with a new error class — check the provider
prefix, the CLI version, and the usage limits first; they caused every
failure so far.
* A flash-tier model gains a `#medium` variant and beats the current
model on the PR #14 eval set — the present pick is a cost/quality
compromise, not a permanent one.
* Go Plus or pay-as-you-go balance becomes relevant.
+22 -4
View File
@@ -22,9 +22,10 @@ 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).
2. **Gitea Actions** (per PR push, minutes): ESLint + vue-tsc typecheck
in one job (one install, cached pnpm store), 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.
@@ -42,6 +43,23 @@ 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.
# Caching
Two caches, both served by the runner's own cache server (no external
service, entries stay on the home server):
* **pnpm store**, keyed on the store layout version (v11) and a `sha256sum`
of `pnpm-lock.yaml`. Installs hardlink from the store instead of
downloading tarballs again. The key is built in a shell step because
`hashFiles()` evaluates empty in this act runner.
* **opencode binary**, keyed on the pinned CLI version (`~/.opencode/bin`).
Small next to the model call, but it removes a network fetch per review.
Lint and typecheck also share one job: same image, same lockfile, same
install. Splitting them duplicated the install and made both compete for
the runner's two vCPUs. A future `pnpm build` job reuses the same store
cache key.
# What the pipeline bought us in practice
Recorded so the reasoning survives: during the first week the pipeline
@@ -57,7 +75,7 @@ exposure in the review setup — each fixed where it was cheapest.
|---|---|
| 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 |
| `hashFiles()` silently empty in the act runner | File discovery via `find` and cache keys via `sha256sum`, both in shell steps - never 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 |
+3
View File
@@ -1,5 +1,8 @@
# Update Log
## 2026-10-20 (cheaper review model, cached installs, merged checks)
* **Update**: [pr-checker.yml](../.gitea/workflows/pr-checker.yml) - the review model is now `opencode-go/claude-haiku-5-5#medium`: cheap per token and, unlike `deepseek-v4.1-flash`, it has a real `#medium` effort level (flash exposes only low/high/max). ESLint and typecheck are merged into one `checks` job with a single `pnpm install`, and the pnpm store plus the opencode binary are restored with `actions/cache@v4.1.0` (v1 cache API, so it also works on a v1-only runner). Cache keys are built from `sha256sum pnpm-lock.yaml`, the pnpm store layout (`v11`) and the opencode version in shell steps, because `hashFiles()` evaluates empty in this act runner. See [AI review setup](decisions/ai-review-setup.md) and [PR pipeline layering](decisions/pr-pipeline-layering.md).
## 2026-10-20 (first flash review validated, two findings applied)
* **Update**: PR #14 review (flash model, `VERDICT: APPROVE`) was fact-checked finding by finding. Applied: `<NuxtRouteAnnouncer />` restored in `app.vue` (this PR's diff had dropped it with the NuxtWelcome swap), and the review job now requires `github.event_name == 'pull_request'` (manual dispatch - the new snyk trigger - would otherwise launch a paid review with no PR to post to). Rejected with evidence: the reviewer's `postcss-selector-parser` 6.1.5 override suggestion - the 6.1.5 backport exists on npm, but the blocking audit still flags it (`<7.1.6` covers 6.x), verified empirically; 7.1.6 stays. Deferred as design decisions: mobile nav, aria-current via NuxtLink, sprite-to-SVG, font fallback stacks, `borderRadius.full` token, the fall-endpoint budget in the API contract.
+1 -1
View File
@@ -17,7 +17,7 @@ generated: { by: opencode-go/glm-5.3-flash, at: 2026-10-18T12:41:52Z }
| When and how often Snyk runs once re-enabled: weekly schedule, ready-for-review gate, or per-push | re-enabling the snyk job | Stay disabled. |
| Whether the AI review job should gate merges (required status check on the verdict) or stay advisory | branch protection setup | Advisory. The review comment is information; blocking merges on an AI verdict is a policy choice, not a technical one. |
| How the opencode CLI version in CI gets upgraded: manually bump the pinned 2.0.32, or automate when a new major appears | first review failure after an opencode release | Manual bump. Pinning exists so upgrades are decisions. |
| ~~Whether the Go plan's per-model usage windows ($3 per 5 hours for DeepSeek V4 Pro) survive real review frequency, or the review model must move to `deepseek-v4.1-flash` ($80 window)~~ - **decided** (2026-10-20): review model is `opencode-go/deepseek-v4.1-flash#max`; the pro endpoint failed two consecutive review runs with `Upstream request failed: Endpoint is unavailable` (~10 min apart), so the recorded default was applied | done | — |
| ~~Whether the Go plan's per-model usage windows survive real review frequency, and which model the review should use~~ - **decided** (2026-10-20): review model is `opencode-go/claude-haiku-5-5#medium` in [pr-checker.yml](../.gitea/workflows/pr-checker.yml). Cheap per token, and it has a real `#medium` effort level; `deepseek-v4.1-flash` only exposes low/high/max, so it always paid for maximum reasoning. The earlier pro -> flash switch (two consecutive `Endpoint is unavailable` failures) is in the [log](../log.md) | done | — |
| Removing the two reviewed audit ignores when `node-forge` or `braces` ship patched releases | next dependency update round | Watch for new releases. |
# The mount trade-off, in detail
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "nuxt-app",
"version": "1.0.0",
"version": "1.1.0",
"type": "module",
"private": true,
"scripts": {