23f7624596
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Has been cancelled
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Has been cancelled
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Has been cancelled
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Has been cancelled
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Has been cancelled
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Has been cancelled
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Has been cancelled
CI/CD Pipeline / Deploy & Release (push) Has been cancelled
CI/CD Pipeline / CI Status (push) Has been cancelled
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Has been cancelled
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Has been cancelled
🔍 Verification Pipeline / ⚡ Performance Verification (push) Has been cancelled
🔍 Verification Pipeline / 📊 Verification Report (push) Has been cancelled
163 lines
6.4 KiB
JavaScript
163 lines
6.4 KiB
JavaScript
#!/usr/bin/env node
|
|
// beir-bootstrap-significance.mjs — paired bootstrap significance test for
|
|
// BEIR retrieval results (ADR-086).
|
|
//
|
|
// Given a run JSON with per-query nDCG@10 and a baseline mean nDCG@10,
|
|
// estimates whether our result is significantly above the baseline.
|
|
//
|
|
// Method: paired bootstrap — resample N=10000 with replacement from our
|
|
// per-query nDCG scores, compute mean each time, take 2.5%-97.5% percentile
|
|
// for 95% CI. Compare baseline to our CI: if baseline < CI lower bound,
|
|
// the difference is significant at p < 0.05.
|
|
//
|
|
// For a paired test against ANOTHER per-query run (e.g. our pure-BM25 vs
|
|
// our BGE-base), resample paired DIFFERENCES instead. Pass --paired
|
|
// path/to/baseline-run.json.
|
|
//
|
|
// Usage:
|
|
// node scripts/beir-bootstrap-significance.mjs <run-json-path>
|
|
// node scripts/beir-bootstrap-significance.mjs <ours> --paired <baseline>
|
|
//
|
|
// Example:
|
|
// node scripts/beir-bootstrap-significance.mjs \
|
|
// docs/benchmarks/runs/beir-nfcorpus-bge-latest.json
|
|
|
|
import { readFileSync } from 'node:fs';
|
|
import { performance } from 'node:perf_hooks';
|
|
|
|
const args = process.argv.slice(2);
|
|
if (args.length === 0) {
|
|
console.error('Usage: node beir-bootstrap-significance.mjs <run-json> [--paired <baseline-run-json>]');
|
|
process.exit(1);
|
|
}
|
|
const RUN_PATH = args[0];
|
|
const PAIRED_IDX = args.indexOf('--paired');
|
|
const PAIRED_PATH = PAIRED_IDX > 0 ? args[PAIRED_IDX + 1] : null;
|
|
const ITERATIONS = Number(process.env.BOOTSTRAP_ITERATIONS) || 10000;
|
|
|
|
// Deterministic PRNG (Mulberry32) — so re-runs are reproducible.
|
|
const SEED = Number(process.env.BOOTSTRAP_SEED) || 42;
|
|
function mulberry32(a) {
|
|
return function () {
|
|
a |= 0; a = (a + 0x6D2B79F5) | 0;
|
|
let t = a;
|
|
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
};
|
|
}
|
|
|
|
function mean(arr) { let s = 0; for (const v of arr) s += v; return s / arr.length; }
|
|
|
|
function percentile(sortedArr, p) {
|
|
const idx = Math.max(0, Math.min(sortedArr.length - 1, Math.floor(p * sortedArr.length)));
|
|
return sortedArr[idx];
|
|
}
|
|
|
|
function pointEstimate(scores) {
|
|
return {
|
|
mean: mean(scores),
|
|
n: scores.length,
|
|
};
|
|
}
|
|
|
|
function bootstrapCI(scores, iterations, rng, percentiles = [0.025, 0.975]) {
|
|
const means = new Float64Array(iterations);
|
|
const n = scores.length;
|
|
for (let i = 0; i < iterations; i++) {
|
|
let s = 0;
|
|
for (let j = 0; j < n; j++) s += scores[Math.floor(rng() * n)];
|
|
means[i] = s / n;
|
|
}
|
|
const sorted = Array.from(means).sort((a, b) => a - b);
|
|
return {
|
|
point: mean(scores),
|
|
lower: percentile(sorted, percentiles[0]),
|
|
upper: percentile(sorted, percentiles[1]),
|
|
p_value_vs_baseline_zero: null,
|
|
};
|
|
}
|
|
|
|
// Paired bootstrap: compare our per-query scores to a baseline's per-query
|
|
// scores. Resample (idx) and average paired differences. The 95% CI on the
|
|
// mean difference tells us if it's significantly non-zero.
|
|
function pairedBootstrap(oursByQid, baselineByQid, iterations, rng) {
|
|
const sharedIds = [...oursByQid.keys()].filter((id) => baselineByQid.has(id));
|
|
const diffs = sharedIds.map((id) => oursByQid.get(id) - baselineByQid.get(id));
|
|
const n = diffs.length;
|
|
const means = new Float64Array(iterations);
|
|
for (let i = 0; i < iterations; i++) {
|
|
let s = 0;
|
|
for (let j = 0; j < n; j++) s += diffs[Math.floor(rng() * n)];
|
|
means[i] = s / n;
|
|
}
|
|
const sorted = Array.from(means).sort((a, b) => a - b);
|
|
// One-sided p ≈ fraction of resamples where mean diff ≤ 0
|
|
let negCount = 0;
|
|
for (const m of means) if (m <= 0) negCount++;
|
|
return {
|
|
n_paired: n,
|
|
point_diff: mean(diffs),
|
|
lower_95: percentile(sorted, 0.025),
|
|
upper_95: percentile(sorted, 0.975),
|
|
p_one_sided: negCount / iterations,
|
|
};
|
|
}
|
|
|
|
function loadRun(path) {
|
|
const data = JSON.parse(readFileSync(path, 'utf-8'));
|
|
if (!data.perQuery || !Array.isArray(data.perQuery)) {
|
|
console.error(`Run JSON at ${path} has no perQuery array — re-run the bench with the updated harness.`);
|
|
process.exit(2);
|
|
}
|
|
return data;
|
|
}
|
|
|
|
const ours = loadRun(RUN_PATH);
|
|
console.log(`# BEIR significance test (ADR-086)`);
|
|
console.log(`Run: ${RUN_PATH}`);
|
|
console.log(`Dataset: ${ours.dataset ?? '?'} Model: ${ours.model ?? '?'} Queries: ${ours.perQuery.length}`);
|
|
console.log(`Bootstrap: ${ITERATIONS} iterations, seed=${SEED}`);
|
|
|
|
const rng = mulberry32(SEED);
|
|
const ourScores = ours.perQuery.map((q) => q.ndcg10);
|
|
|
|
const t0 = performance.now();
|
|
const oursCI = bootstrapCI(ourScores, ITERATIONS, rng);
|
|
console.log(`\n=== Our nDCG@10 (1-sample bootstrap CI) ===`);
|
|
console.log(` point: ${oursCI.point.toFixed(4)}`);
|
|
console.log(` 95% CI: [${oursCI.lower.toFixed(4)}, ${oursCI.upper.toFixed(4)}]`);
|
|
|
|
if (ours.baselines) {
|
|
console.log(`\n=== vs each published baseline (CI overlap) ===`);
|
|
for (const [name, score] of Object.entries(ours.baselines)) {
|
|
const ciDiff = oursCI.point - score;
|
|
const lowerDiff = oursCI.lower - score;
|
|
const upperDiff = oursCI.upper - score;
|
|
const direction = ciDiff > 0 ? '↑ above' : '↓ below';
|
|
const sig = (lowerDiff > 0 && upperDiff > 0) ? 'p<0.05 (95% CI excludes baseline)'
|
|
: (lowerDiff < 0 && upperDiff < 0) ? 'p<0.05 (95% CI below baseline)'
|
|
: 'n.s. (95% CI overlaps baseline)';
|
|
console.log(` ${score.toFixed(3)} ${name.padEnd(28)} Δ=${ciDiff >= 0 ? '+' : ''}${ciDiff.toFixed(4)} ${direction} [${sig}]`);
|
|
}
|
|
}
|
|
|
|
if (PAIRED_PATH) {
|
|
const baseline = loadRun(PAIRED_PATH);
|
|
console.log(`\n=== Paired bootstrap vs ${PAIRED_PATH} ===`);
|
|
const oursByQid = new Map(ours.perQuery.map((q) => [q.qid, q.ndcg10]));
|
|
const baseByQid = new Map(baseline.perQuery.map((q) => [q.qid, q.ndcg10]));
|
|
const rng2 = mulberry32(SEED + 1);
|
|
const paired = pairedBootstrap(oursByQid, baseByQid, ITERATIONS, rng2);
|
|
console.log(` paired queries: ${paired.n_paired}`);
|
|
console.log(` Δ (ours - baseline): ${paired.point_diff >= 0 ? '+' : ''}${paired.point_diff.toFixed(4)}`);
|
|
console.log(` 95% CI: [${paired.lower_95.toFixed(4)}, ${paired.upper_95.toFixed(4)}]`);
|
|
console.log(` one-sided p (Δ ≤ 0): ${paired.p_one_sided.toFixed(4)}`);
|
|
const sig = paired.lower_95 > 0 ? 'SIGNIFICANT improvement (p<0.025 one-sided)' :
|
|
paired.upper_95 < 0 ? 'SIGNIFICANT regression (p<0.025 one-sided)' :
|
|
'NOT SIGNIFICANT — CI overlaps zero';
|
|
console.log(` verdict: ${sig}`);
|
|
}
|
|
|
|
console.log(`\nBootstrap took ${((performance.now() - t0) / 1000).toFixed(1)}s.`);
|