Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 0 additions & 301 deletions .github/workflows/calibration-advisory.yml

This file was deleted.

192 changes: 0 additions & 192 deletions .github/workflows/verify-public-claims.yml

This file was deleted.

35 changes: 16 additions & 19 deletions apps/loopover-ui/content/docs/backtest-calibration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ confidence-threshold constant, the old and new values are replayed as classifier
rule's recorded history, and the comparison is rendered directly into the unified review
comment. No code from the PR is ever executed — a threshold is just a number.

**Logic/regex changes** run in a dedicated CI workflow instead, because honestly verifying a
**Logic/regex changes** are checked outside the review pass, because honestly verifying a
rewritten detection function requires _executing the PR's own code_ against history — something
the production review service must never do. The workflow checks out both the PR's head and its
base, replays each recorded case's captured raw context through both versions of the detection
function, and posts its own clearly-labeled **"Logic backtest"** PR comment, separate from the
unified review comment. It triggers only for PRs touching the watched detection-logic paths,
skips drafts and forks (fork runs get no secrets), and fails open: an infrastructure problem
produces a skip notice, never a red check.
the production review service must never do. `scripts/backtest-logic-check.ts` loads a corpus
export, replays each recorded case's captured raw context through the detection function from two
checkouts (the PR's head and its base), and writes a clearly-labeled **"Logic backtest"**
comparison, separate from the unified review comment. Run it by hand against your own corpus: the
CI workflow that ran it on this repository's pull requests was retired with the hosted D1 database
it read.

## Reading the comparison

Expand Down Expand Up @@ -186,19 +186,16 @@ parser or mapping change costs nothing. Exit codes reflect operational success o

### The prompt-change workflow

A PR that touches the reviewer judge-prompt surface (`src/services/ai-review.ts` — bump
`REVIEW_PROMPT_VERSION` whenever a change shapes the judge's verdict) triggers the
`counterfactual-replay` advisory workflow: it extracts the **canonical judge prompt** from both the
base and head checkouts, replays both over the identical seeded sample (seed = head SHA, so re-runs
per push are deterministic), posts the comparison as an update-in-place PR comment, and persists a
A change to the reviewer judge-prompt surface (`src/services/ai-review.ts` — bump
`REVIEW_PROMPT_VERSION` whenever a change shapes the judge's verdict) is checked with
`scripts/counterfactual-replay.ts`, run by hand: give it the **canonical judge prompt** from the base
and head checkouts (`scripts/print-review-prompt.ts` prints it) and it replays both over the identical
seeded sample, prints the comparison, and with `--persist` records a
`calibration.counterfactual_backtest_run` event feeding the same REGRESSED-verdict track record as the
threshold and logic backtests. The check spends nothing unless the deployment explicitly configures a
replay budget (repo variables `COUNTERFACTUAL_REPLAY_BUDGET`/`COUNTERFACTUAL_REPLAY_MODEL`) — otherwise
it posts a visible "skipped: no replay budget configured" notice. Provider selection: with a
`COUNTERFACTUAL_OLLAMA_URL` secret set, the check uses that ollama endpoint (a self-hosted runner
reaching its own local model is the zero-marginal-cost shape); without it, the default is the flag-gated
Workers AI fallback on the deployment's existing Cloudflare credentials — OSS models, usage-priced,
dormant until the budget variables exist.
threshold and logic backtests. It stops at its `--budget` (a built-in default when you set none). Its
default provider is a local ollama (`--ollama-url`); `--provider workers-ai` uses Cloudflare credentials
from the environment instead. The CI workflow that ran it on this repository's pull requests was retired
with the hosted D1 database.
Advisory forever until a separate, explicit authority decision, exactly like every other backtest gate.

## Self-hosting
Expand Down
4 changes: 2 additions & 2 deletions scripts/backtest-logic-check.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
// Logic/regex-change backtest CLI (#8139, epic #8082) — the CI-side runner .github/workflows/
// calibration-advisory.yml invokes. Loads a corpus manifest (produced by backtest-corpus-export.ts),
// Logic/regex-change backtest CLI (#8139, epic #8082), run by hand (the CI workflow that invoked it was
// retired with the hosted D1 database it read). Loads a corpus manifest (produced by backtest-corpus-export.ts),
// dynamically imports the registered detection function from TWO checkout roots (the PR's head and its base
// — the dual checkout is what makes an honest before/after comparison possible), runs the pure core's
// scoring/comparison, writes the PR-comment Markdown, and optionally persists the run to D1 via
Expand Down
Loading
Loading