Merge remote-tracking branch 'origin/main' into feat/docs_registrys
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m6s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 8s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m6s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 8s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
# Conflicts: # OKF_Nuxt/log.md
This commit is contained in:
commit
c00db55f98
12 files changed
+388
-255
No files matched your search
@@ -229,229 +229,3 @@ jobs:
|
||||
# Dockerfile/base image checks are covered by the droast job
|
||||
snyk code test \
|
||||
--severity-threshold=high
|
||||
|
||||
# -------------------------------------------------------- ai code review --
|
||||
review:
|
||||
name: AI code review (opencode)
|
||||
runs-on: ubuntu-latest
|
||||
container: node:22-bookworm
|
||||
# Draft PRs don't get a (paid) review yet. The event_name check is
|
||||
# load-bearing: manual (workflow_dispatch) triggers - which exist to
|
||||
# run the paused snyk job - must NOT launch a paid review, which on
|
||||
# a dispatch event has no PR to post to.
|
||||
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
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 "#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
|
||||
# review - pnpm audit already covers dependencies. Excluding the
|
||||
# lockfile also keeps the diff small enough to hand to the model.
|
||||
# The diff goes to a file IN the workspace so the agent can read it
|
||||
# with its file tools (passing 190KB as a CLI argument fails with
|
||||
# "Argument list too long", MAX_ARG_STRLEN is 128KiB).
|
||||
git diff --merge-base "origin/${{ github.base_ref }}" \
|
||||
-- . ':(exclude)pnpm-lock.yaml' > .pr-review-diff.patch
|
||||
wc -c .pr-review-diff.patch
|
||||
|
||||
- name: Run opencode review
|
||||
env:
|
||||
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
||||
run: |
|
||||
# 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:
|
||||
# a config file in the checkout would hold the API key in
|
||||
# plaintext, readable by the agent - a malicious PR diff could
|
||||
# prompt-inject the agent into quoting the key in the review
|
||||
# comment (publicly visible). Env vars are invisible to file reads.
|
||||
# Permissions live in a global config OUTSIDE the checkout (no
|
||||
# secrets in it, so nothing can leak). OpenCode v2 schema: the
|
||||
# field is "permissions" (plural) - an ordered array of
|
||||
# {action, resource, effect}; "bash" was renamed "shell" in v2.
|
||||
# The singular v1 "permission" object is ignored by the v2 CLI
|
||||
# (verified empirically: shell commands executed despite deny).
|
||||
# Denying shell/edit/webfetch/websearch/external_directory means
|
||||
# no headless permission prompts can hang or kill the run, and
|
||||
# the reviewer physically cannot modify the repo or browse
|
||||
# attacker-controlled URLs.
|
||||
mkdir -p "$HOME/.config/opencode"
|
||||
printf '{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"permissions": [
|
||||
{ "action": "edit", "resource": "*", "effect": "deny" },
|
||||
{ "action": "shell", "resource": "*", "effect": "deny" },
|
||||
{ "action": "webfetch", "resource": "*", "effect": "deny" },
|
||||
{ "action": "websearch", "resource": "*", "effect": "deny" },
|
||||
{ "action": "external_directory", "resource": "*", "effect": "deny" }
|
||||
]
|
||||
}' > "$HOME/.config/opencode/opencode.json"
|
||||
# --print-logs: surface auth/provider errors in the CI log instead
|
||||
# of failing with an opaque exit code
|
||||
EXIT_CODE=0
|
||||
opencode run \
|
||||
--print-logs \
|
||||
--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.
|
||||
|
||||
The full PR diff is in the file .pr-review-diff.patch in the repo
|
||||
root. Read it first with your file tools.
|
||||
|
||||
pnpm-lock.yaml is deliberately excluded from that patch to keep it
|
||||
small, not forgotten. It is committed in the PR, pnpm audit covers
|
||||
the dependencies, and CI runs `pnpm install --frozen-lockfile`.
|
||||
Do not report a missing lockfile or a frozen-install drift.
|
||||
|
||||
## Project context
|
||||
- Stack: Nuxt 4 (Vue 3, TypeScript) SSR web app in the repo root.
|
||||
Backend/API services are being added in Golang.
|
||||
- Deployment target: a personal production CV website.
|
||||
- Already covered by other CI jobs, do NOT repeat their findings:
|
||||
ESLint (style), vue-tsc (types), gitleaks (secrets in git history),
|
||||
pnpm audit (dependency CVEs), droast (Dockerfile lint).
|
||||
- Your job is everything those tools CANNOT see: logic, security,
|
||||
architecture, correctness.
|
||||
|
||||
## Nuxt / Vue / TypeScript focus
|
||||
- SSR pitfalls: window/document/localStorage access without
|
||||
<ClientOnly> or process.client guards; hydration mismatch risks
|
||||
(Date.now(), Math.random(), locale formatting in render path).
|
||||
- useAsyncData/useFetch: missing or colliding keys, duplicate
|
||||
requests between server and client, wrong caching/refresh setup.
|
||||
- Reactivity bugs: destructuring reactive objects losing reactivity,
|
||||
missing await on async setup, watch on getters vs refs.
|
||||
- Security: v-html with unsanitized data, user input flowing into
|
||||
meta/URLs, open redirects, missing validation in /server/api and
|
||||
Nitro route handlers, auth checks on both page and API level.
|
||||
- Config hygiene: server-only runtime config (no NUXT_PUBLIC_
|
||||
prefix) leaking secrets into the client bundle.
|
||||
|
||||
## Golang focus (when Go code is in the diff)
|
||||
- Errors: unchecked errors, errors discarded, wrapping with %w,
|
||||
sentinel vs typed errors, panic in library code.
|
||||
- Concurrency: goroutine leaks (missing context cancellation),
|
||||
data races (shared state without mutex/channel), WaitGroup
|
||||
misuse, defer in loops.
|
||||
- Resources: unclosed response bodies/files/rows, missing
|
||||
timeouts on http.Client, unbounded buffering.
|
||||
- Correctness: slice aliasing surprises, copy vs reference
|
||||
semantics, nil map writes, integer truncation.
|
||||
|
||||
## Cross-cutting
|
||||
- API contract mismatches between Nuxt frontend and Go backends
|
||||
(field names, nullability, status codes, date formats).
|
||||
- Missing authorization checks on new endpoints or pages.
|
||||
- Secrets/credentials ending up in logs or client-visible output.
|
||||
- Performance on the critical render path (heavy components,
|
||||
unoptimized images, blocking Nitro middleware).
|
||||
|
||||
## Output format (strict)
|
||||
Review the diff in .pr-review-diff.patch. For every finding:
|
||||
[BLOCKER] file:line - what and why + concrete fix suggestion
|
||||
[WARN] file:line - what and why + concrete fix suggestion
|
||||
[NIT] file:line - optional improvement
|
||||
BLOCKER = must fix before merge (security, data loss, broken
|
||||
behavior). WARN = should fix soon. NIT = optional.
|
||||
If a finding cannot be localized to a file, prefix [BLOCKER-GENERAL].
|
||||
No compliments, no summaries of what the diff does, no style nits.
|
||||
Keep it under 400 words unless there are more than 10 findings.
|
||||
If the diff contains no reviewable code (docs/config only), say so
|
||||
in one line.
|
||||
|
||||
End your response with a final verdict line, exactly one of:
|
||||
VERDICT: APPROVE (no BLOCKER findings)
|
||||
VERDICT: REQUEST_CHANGES (at least one BLOCKER)" \
|
||||
> /tmp/review.md 2>&1 || EXIT_CODE=$?
|
||||
# always show the output - never swallow the error text
|
||||
cat /tmp/review.md
|
||||
# The posting gate is the OUTPUT CONTRACT, not the exit code:
|
||||
# a completed review always ends with a VERDICT line - error
|
||||
# dumps never do. opencode can exit 1 on benign tool denials
|
||||
# even after a full review, so a present verdict means post;
|
||||
# anything else means the review did not complete.
|
||||
# Anchored to the tail: the prompt itself contains VERDICT
|
||||
# lines, so scanning the whole file could pass on echoed
|
||||
# prompt text or injected quotes - only the last lines count.
|
||||
if tail -n 5 /tmp/review.md | grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)'; then
|
||||
[ "$EXIT_CODE" -ne 0 ] && echo "::warning::opencode exited ${EXIT_CODE} but produced a valid verdict - posting review"
|
||||
echo "Review completed with verdict."
|
||||
else
|
||||
# fail closed: no verdict = no review. exit 1 unconditionally -
|
||||
# falling back to EXIT_CODE would exit 0 when opencode succeeded
|
||||
# but produced no review, and the job would go green.
|
||||
echo "::error::opencode produced no valid review (exit ${EXIT_CODE:-1}) - NOT posting this output as a review comment"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Post review as PR comment
|
||||
continue-on-error: true # token missing/expired must not fail the build
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.PR_GITEA_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
REPO: ${{ github.repository }}
|
||||
# Gitea sets GITHUB_API_URL, e.g. https://gitea.example.com/api/v1
|
||||
run: |
|
||||
# re-verify the output contract here: never post anything that is
|
||||
# not a completed review, regardless of how the previous step ended
|
||||
if ! tail -n 5 /tmp/review.md | grep -qE '^VERDICT: (APPROVE|REQUEST_CHANGES)'; then
|
||||
echo "::error::no verdict in review output - nothing to post"
|
||||
exit 1
|
||||
fi
|
||||
# jq is not in the node image - use node for JSON encoding
|
||||
BODY=$(node -e 'process.stdout.write(JSON.stringify(require("fs").readFileSync("/tmp/review.md","utf8")))')
|
||||
HTTP_CODE=$(curl -s -o /tmp/comment-response.json -w "%{http_code}" \
|
||||
-X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"body\": ${BODY}}" \
|
||||
"${GITHUB_API_URL}/repos/${REPO}/issues/${PR_NUMBER}/comments")
|
||||
echo "POST status: ${HTTP_CODE}"
|
||||
cat /tmp/comment-response.json
|
||||
case "$HTTP_CODE" in
|
||||
200|201) echo "Review comment posted." ;;
|
||||
*) echo "::error::Failed to post review comment (HTTP ${HTTP_CODE}) - check PR_GITEA_TOKEN scope and expiry" ;;
|
||||
esac
|
||||
@@ -7,7 +7,9 @@ name: Renovate
|
||||
# Manual setup: create a bot account with its full name and email set, give
|
||||
# it write access to this repository, and store a token with
|
||||
# repository read/write, issue read/write, user read and organization read
|
||||
# as the RENOVATE_TOKEN Actions secret.
|
||||
# as the RENOVATE_TOKEN Actions secret. Release notes also need a github.com
|
||||
# token (any account, read-only, no scopes for public repositories) as the
|
||||
# RENOVATE_GITHUB_COM_TOKEN secret.
|
||||
on:
|
||||
schedule:
|
||||
# Daily at 04:00 UTC. Gitea only schedules workflows that exist on the
|
||||
@@ -35,6 +37,10 @@ jobs:
|
||||
# default branch through this endpoint.
|
||||
RENOVATE_ENDPOINT: https://git.noelsabia.dev/api/v1
|
||||
RENOVATE_TOKEN: ${{ secrets.RENOVATE_TOKEN }}
|
||||
# github.com is only used to fetch release notes and other public
|
||||
# metadata. Anonymous requests are rate-limited, which is why the
|
||||
# PR body warned that release notes were skipped.
|
||||
RENOVATE_GITHUB_COM_TOKEN: ${{ secrets.RENOVATE_GITHUB_COM_TOKEN }}
|
||||
# This workflow lives in the repository it updates, so scope the bot
|
||||
# to it instead of every repository its account can see.
|
||||
RENOVATE_REPOSITORIES: CV_Website/CV_Site_Nuxt
|
||||
|
||||
Reference in new issue
Block a user