跳到正文
DEV Community· Maheswar Sahoo·· 46 分鐘前AI 評分53

Bumpgate 以 Kane CLI 攔截 CI 通過但導致空白頁的依賴更新

Dependabot said green. The app was blank. So I made Kane CLI check before it merges

AI 導讀

Maheswar Sahoo 建立 Bumpgate,以 Kane CLI 比較 Dependabot 或 Renovate 更新 PR 前後的關鍵瀏覽器旅程,決定是否放行。

正文

Built for the Kane CLI Hackathon by TestMu AI.

I found six public repos where the same thing happened. Dependabot opened a React bump. CI went green: type check, lint, build, and in four of them the deploy itself. The PR merged. The live app was a blank page, and the maintainer had to revert it or fix it by hand.

One of them put it plainly in the revert:

"Format check, lint, typecheck and build stay green, which is why the chain did not catch it."

In all six, the bot raised react and left react-dom behind. React refuses to start when the two differ (error #527), so the bundle throws before the first render. Nothing in a normal CI pipeline opens the app, so nothing sees it. Even npm is happy, because react-dom only asks for ^19.

Five public apps: on main each renders; on Dependabot's react bump each page is empty

A green check on a bot PR means the code builds. It doesn't mean checkout still works. So I built Bumpgate.

What it does

On every Dependabot or Renovate PR, Bumpgate:

  1. builds main and the bump side by side (two git worktrees);
  2. has Kane CLI replay your app's critical journeys in a real browser on both;
  3. decides with one rule, in plain code: every journey that passes on main must pass on the bump.

Then one of three lights:

  • 🟢 Green: every journey behaves the same. The PR merges itself.
  • 🟡 Amber: it works, but Kane had to self-heal a step, or new console errors appeared. One human look.
  • 🔴 Red: a journey broke. Blocked, and the fix loop starts.

A journey is plain English

No selectors and no page objects. This is a real journey from the demo shop, .kane/checkout_errors_test.md:

# Checkout explains what is wrong

## Add a product and go to checkout
Click "Add to cart" on the first product, click "Cart" in the header, then click "Go to checkout".

## Submit with a missing name and a bad email
Leave "Full name" empty, type "not-an-email" into "Email", then click the "Place order" button.

## See the errors
Verify the message "Please enter your name" is shown.
Verify the message "Enter a valid email address" is shown.

Kane records it once on main, then replays it against each PR build with kane-cli testmd run --override-start-url. Because the journey describes behaviour, not CSS classes, a UI kit renaming its classes doesn't break it. A checkout that stops showing errors does.

Don't want to write them? bumpgate init has Claude Code draft journeys from your code, and only the drafts Kane passes on main are kept.

When something breaks: the closed loop

This is a real run, on PR #4 in the demo shop.

Dependabot bumped zod from 3 to 4. CI passed. Kane ran "Checkout explains what is wrong" on the bump, and the errors never appeared: it failed at step 3, on 2 of 2 runs. Kane's own bug verdict: "Checkout omits required-name validation message (major)", with a new console error only on the bump: Cannot read properties of undefined (reading 'forEach').

Kane's failed step, reason, bug verdict, console errors and the package's release notes became Claude Code's task. It came back with one line:

-      result.error.errors.forEach((issue) => {
+      result.error.issues.forEach((issue) => {

Before anything merges, code, not a prompt, checks the diff. It rejects any fix that:

  • edits a journey (making the test easier),
  • undoes the bump,
  • hard-codes a text the journey checks for,
  • or is suspiciously large.

Then Kane re-runs every journey on the fixed branch: 3 of 3 passed, and it merged. If the fix fails three times, the PR is labelled for a human instead. If you'd rather a person approve every agent-written fix, set merge-fixes: review.

Bumpgate's comment on the PR: journeys on base and bump, the failed step, Claude Code's fix, Kane's 3/3 re-run

Results, with the limits

What Result
Real React bumps in 6 public repos that passed CI and shipped a blank page Kane blocks 6 of 6 at step 1, each failure confirmed by a second run
Demo shop: zod 3→4 and react-query 4→5 both passed CI and broke the app Both blocked, fixed by Claude Code, re-verified by Kane, merged
Demo shop: clsx 1→2, a safe bump Green; merged itself in under 2 minutes
10 open Dependabot PRs in strangers' repos 2 blank pages (their own CI was red, but a forced install ships them), 1 amber, 7 green
Bot bumps that were merged and never reverted 0 false alarms on 4

Honest limits:

  • The six blank pages are one bug class, and I found them by searching for it. 6 of 6 is not a catch rate. A script comparing the two version numbers would catch this one bug too; the point is that one plain-English journey catches it and whatever comes next, with no rule written for it.
  • The app has to run without a private backend.
  • Kane runs cost credits (replaying a recorded journey is cheap).

Try the whole loop in 10 seconds, no account

npx github:Maheswar-Sah00/bumpgate replay

It feeds Kane CLI's recorded output from the real PR #4 run through the real gate code: the block, the evidence Claude Code was handed, its fix, the guardrails rejecting two cheating fixes, and Kane's 3/3 re-run. No keys, no credits.

Add it to your repo

# .github/workflows/bumpgate.yml
name: Bumpgate
on:
  pull_request:
    types: [opened, synchronize, reopened]
permissions: { contents: write, pull-requests: write, issues: write, statuses: write }
jobs:
  gate:
    if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with: { fetch-depth: 0 }
      - uses: actions/setup-node@v4
        with: { node-version: 22 }
      - uses: Maheswar-Sah00/bumpgate@v1.1
        with:
          lt-username: ${{ secrets.LT_USERNAME }}
          lt-access-key: ${{ secrets.LT_ACCESS_KEY }}
          anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}

One gotcha: Dependabot PRs can only read Dependabot secrets, so add the keys under Settings → Secrets → Dependabot. And the bump's install scripts never see the TestMu key, the GitHub token or the agent key.

Why this only works with Kane CLI

The gate needs three things a selector script can't give: a journey that survives cosmetic UI churn but fails on broken behaviour; evidence an agent can act on (the failed step, a bug verdict, console and network); and a re-check of the agent's own fix. Kane is all three: the gate, the evidence, and the referee.

Links

Questions and "this would never work on my repo" are both welcome in the comments.

KaneCLIHackathon #KaneCLI

來源:DEV Community · dev.to