Skip to content

Extend the backtest check to logic/regex changes via a dedicated CI job, using captured raw context #8139

Description

@JSONbored

Context

Once #8129/#8130 land (merged), BacktestCase.metadata carries the raw diff/issue content each rule evaluated (except secret_leak, permanently excluded — see #8130). #8138 shipped ORB-native threshold-only backtesting (#8142): it lives entirely inside ORB's live Worker request handling (src/services/threshold-backtest.ts + src/services/threshold-backtest-run.ts, called from resolveThresholdBacktestAdvisory in src/queue/processors.ts) because it never needs to execute anything — parsing a changed numeric constant out of a diff and comparing it against a fixed, already-deployed classifier function requires no untrusted code execution.

Logic/regex changes are different in kind, not just degree: verifying that a rewritten detection function is actually better requires running the PR's own new code against historical cases, and doing that honestly also requires running the old code as a baseline for comparison. ORB's Worker is a persistent production service holding GitHub App credentials and D1 access, processing webhooks for potentially many repos — there's no safe way to execute PR-supplied logic there. A dedicated CI job doesn't have this problem: checking out a PR's branch and running scripts against it is the exact same trust boundary this repo's validate-code/validate-tests jobs already rely on for every single contributor PR today. This isn't a new risk being introduced — it's the one piece of this epic that actually needs the mechanism CI already provides, unlike #8138 which deliberately avoided CI because it didn't need it.

Design

Deliverables

  • The new workflow file (dual checkout, path filter, concurrency, draft-skip).
  • KNOWN_LOGIC_RULES registry, scoped to linked_issue_scope_mismatch.
  • The classify-construction + scoring script (pure core + thin IO wrapper).
  • Tests for the pure-core logic: classify-function construction against fixture raw-context cases, the secret_leak exclusion, the comparison/render call.

Test Coverage Requirements

99%+ patch coverage (branch-counted) on the pure-core script logic. The thin IO wrapper (checkout-root file imports, D1 read/write, gh pr comment) is exempt under this repo's established pure-core/thin-IO precedent, provided it contains no logic beyond argument handling, the calls, and IO.

Expected Outcome

A PR that rewrites detection logic (not just a threshold) gets the same honest, objective backtest comparison a threshold-only change already gets from #8138 — computed by actually running both the old and new versions of the logic against real recorded history, not just eyeballing the diff.

Links & Resources

Boundaries

maintainer-only — CI wiring for a real trust/safety-relevant execution boundary, not a build task for contributors.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.roadmapOn the Wave-2 agent-layer roadmap board (project 9)

Projects

Status
Done
Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions