Skip to content

The headless browser for AI agents and web scraping

fix(ci): require all obstacle stages before release

SGavrl891256276262
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0582ef27..c602ee81 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -139,6 +139,9 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
+ - name: Test obstacle comparison gate
+ run: python3 -m unittest discover -s scripts/ci -p 'test_*.py' -v
+
- name: Install cargo-nextest
uses: taiki-e/install-action@b20dedce73af6905cdc30d6611090c9b67557c8d # v2
with:
@@ -162,6 +165,29 @@ jobs:
- name: Stage candidate binary for comparison
run: install -D -m 0755 target/release/obscura "$RUNNER_TEMP/obscura-ci/obscura-pr"
+ - name: Checkout pinned obstacle course
+ uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
+ with:
+ repository: h4ckf0r0day/obscura-benchmark
+ ref: 2d08d9a8e860e423b47209434a9fba9c75e6eee6
+ path: obscura-benchmark
+ persist-credentials: false
+
+ - name: Require all 33 obstacle stages
+ run: |
+ OBSCURA_BIN="$RUNNER_TEMP/obscura-ci/obscura-pr" \
+ python3 obscura-benchmark/obstacle-course/run.py \
+ --json --runs 1 --warmup 0 > "$RUNNER_TEMP/obscura-ci/obstacle-candidate.json"
+
+ - name: Upload obstacle evidence
+ if: always()
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
+ with:
+ name: core-obstacle-${{ github.run_id }}-${{ github.run_attempt }}
+ path: ${{ runner.temp }}/obscura-ci/obstacle-candidate.json
+ if-no-files-found: ignore
+ retention-days: 7
+
- name: Build render and stealth release
run: cargo build --release -p obscura-cli --bins --features render,stealth
@@ -221,7 +247,7 @@ jobs:
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
repository: h4ckf0r0day/obscura-benchmark
- ref: 6ebac8293d7477f59e837768bfd4e74173f04f1c
+ ref: 2d08d9a8e860e423b47209434a9fba9c75e6eee6
path: obscura-benchmark
persist-credentials: false
diff --git a/scripts/ci/compare_obstacle.py b/scripts/ci/compare_obstacle.py
index 7b49ce77..0bc605bc 100755
--- a/scripts/ci/compare_obstacle.py
+++ b/scripts/ci/compare_obstacle.py
@@ -111,6 +111,9 @@ def main() -> None:
if regressions:
raise SystemExit("candidate introduces new obstacle-course failures")
+ if candidate_passed != EXPECTED_STAGE_COUNT:
+ failed = sorted(name for name, result in candidate.items() if not result["pass"])
+ raise SystemExit(f"candidate fails the release obstacle course: {', '.join(failed)}")
if __name__ == "__main__":
diff --git a/scripts/ci/test_compare_obstacle.py b/scripts/ci/test_compare_obstacle.py
new file mode 100644
index 00000000..1416a3aa
--- /dev/null
+++ b/scripts/ci/test_compare_obstacle.py
@@ -0,0 +1,38 @@
+import json
+from pathlib import Path
+import subprocess
+import sys
+import tempfile
+import unittest
+
+
+class ObstacleReleaseGate(unittest.TestCase):
+ def compare(self, candidate_passes):
+ stages = [{"name": f"stage-{n}", "pass": True, "median_ms": 1}
+ for n in range(33)]
+ with tempfile.TemporaryDirectory() as directory:
+ base = Path(directory) / "base.json"
+ candidate = Path(directory) / "candidate.json"
+ stages[0]["pass"] = False
+ base.write_text(json.dumps({"results": stages}))
+ stages[0]["pass"] = candidate_passes
+ candidate.write_text(json.dumps({"results": stages}))
+ return subprocess.run(
+ [sys.executable, str(Path(__file__).with_name("compare_obstacle.py")),
+ "--base", str(base), "--candidate", str(candidate)],
+ capture_output=True, text=True,
+ )
+
+ def test_shared_baseline_failure_does_not_pass_the_release_gate(self):
+ result = self.compare(False)
+ self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr)
+ self.assertIn("32/33", result.stdout)
+
+ def test_candidate_fixing_the_baseline_failure_passes(self):
+ result = self.compare(True)
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ self.assertIn("33/33", result.stdout)
+
+
+if __name__ == "__main__":
+ unittest.main()