chore(evals): vitest-evals Select suite + release-gated CI - #729
chore(evals): vitest-evals Select suite + release-gated CI#729mattrothenberg wants to merge 7 commits into
Conversation
Replace promptfoo-based Select evals with vitest-evals: - Eval harness (Cloudflare AI Gateway, direct Workers AI fallback) - Deterministic AST assertions (parse-only, no code execution) - Public-context loader (docs + generated registry) - Select eval suite (8 cases) + vitest.evals.config.ts - Root scripts: evals, evals:select, evals:ci, evals:ui - Release workflow job gated to cloudflare org + kumo-evals environment, runs on Version Packages PR and posts a summary comment
|
/bonk can you please do an initial but thorough security review of this? |
Security Review: PR #729Overall Assessment: Generally well-designed with good security fundamentals, but 2–3 items need attention before merge. ✅ What's done well
|
commit: |
Docs PreviewCommit: |
- Gate raw upstream error body behind KUMO_EVAL_DEBUG to avoid leaking gateway/account metadata into CI logs - Encode model path per-segment (preserving '/' separators) to neutralize '?'/'#'/traversal chars in a KUMO_EVAL_MODEL override
|
Thanks @ask-bonk — addressed the two code items in f9c553c: 1. Error-body leak (medium) — ✅ Fixed. Raw 2. Model URL interpolation (low) — ✅ Fixed, but with a correction. The suggested const encodedModelPath = model.split("/").map(encodeURIComponent).join("/");3. Informational items (new |
|
/bonk re-review |
Re-review: PR #729 — SecurityStatus: LGTM (modulo the pre-merge environment settings blocker). ✅ Previous findings — verified fixed
🔍 Fresh review — no new security blockersArchitecture checks
Workflow review
Dependency
|
|
/bonk one more review please |
Security Review: PR #729 — Third PassStatus: Changes requested — 1 critical, 1 medium 🔴 Critical: Missing
|
| Control | Status |
|---|---|
workflow_dispatch only (no automatic triggers) |
✅ Correct |
Owner gating (github.repository_owner == 'cloudflare') |
✅ Correct |
Least-privilege permissions (contents: read, pull-requests: write) |
✅ Correct |
| PR validation (branch, title, file list, source repo) | ✅ Thorough |
Error-body redaction (gated behind KUMO_EVAL_DEBUG=1) |
✅ Correct |
| URL per-segment encoding | ✅ Correct |
Parse-only assertions (no eval, new Function, dynamic import) |
✅ Confirmed |
| Public context sources only | ✅ Confirmed |
evals/.generated/ gitignored |
✅ Confirmed |
| Artifact comment does not leak raw model output | ✅ Failure messages are hardcoded assertion reasons |
ℹ️ Minor notes
- The PR description references
.github/workflows/release.ymlfor the evals job, but the actual change is a new standalone.github/workflows/evals.yml. Updating the description avoids confusion. - The
evals:ciscript correctly omits--env-file=.env.local, ensuring CI does not depend on a local file. concurrencygroup isgithub.workflow + github.ref, which forworkflow_dispatchdefaults to the branch the workflow runs on. This is fine.
Pre-merge blockers
- BLOCKER: Add
environment: kumo-evalsto theevalsjob. - BLOCKER: Configure
kumo-evalsenvironment with required reviewers. - BLOCKER: Move
CF_AI_GATEWAY_*secrets to environment scope. - Recommended: Pin
vitest-evalsto exact version inpackage.json.
Please re-request review once the environment declaration is added.
|
/bonk updated |
Security Re-review: PR #729Status: LGTM. All code-level blockers resolved. ✅ Previous blockers — verified fixed
🔍 Architecture re-check — no regressionsWorkflow (
Secrets
Execution model
Context & artifacts
ℹ️ Remaining pre-merge items (GitHub settings, not code)The environment gate now works in the workflow, but the repository admin must still ensure the below are configured before the first run succeeds. These are not additional blockers for this PR — they are the same infrastructure tasks already flagged in the PR description.
SummaryThe critical code gaps from the last review (missing environment declaration, loose version range) are closed. The design is sound: secrets are behind an approval gate, generated code is parse-only, and the trigger model correctly avoids Approved for merge once the |





































































Summary
Replaces the promptfoo-based Select evals with
vitest-evals. Adds an eval harness, deterministic assertions, a public-context loader, an 8-case Select suite, and a release-gated CI job that runs the evals against the "Version Packages" PR and posts a summary comment.What's included
evals/harness/cloudflare-ai.ts): calls Cloudflare AI Gateway (same org secrets Bonk uses) with a direct Workers AI fallback for local dev.evals/assertions/select.ts): parses generated TSX with@babel/parserand validates the Select API via AST. Parse-only — generated model code is never executed.evals/context/select.ts): builds prompt context from public sources only (shipped registry JSON, public docs.mdx, public demo). No private data.evals/select.eval.ts) +vitest.evals.config.ts.evals,evals:select,evals:ci,evals:ui..github/workflows/release.yml): newevalsjob,if: github.repository_owner == 'cloudflare',environment: kumo-evals, least-privilege perms (contents: read,pull-requests: write). Uploads results artifact (30d) and comments pass/fail on the Version Packages PR.Safety notes
push: main(neverpull_request/pull_request_target) — forks cannot reach the AI Gateway secrets.evals/.generated/is gitignored; result JSON verified to contain no secrets.test/typechecknever collect them — the eval suite will not red-X normal PR CI.Open decisions for review (why this is a draft)
evalsjob auto-runs (behind environment approval) on every push tomainwhile a Version Packages PR is open — evals are slow/expensive, so this may be too noisy. Proposed alternative: switch toworkflow_dispatch(manual) +kumo-evalsapproval so it runs deliberately pre-release. Feedback wanted.kumo-evalsmust have required reviewers configured, andCF_AI_GATEWAY_*should be environment secrets (not repo-wide) so the approval gate actually protects them.Testing
Local eval run passes 8/8.
tsc --noEmiton all four eval files passes.