跳到正文
DEV Community· Miracle Alajemba·· 46 分鐘前AI 評分52

Ratchet 以即時瀏覽器證據把關 PRD 驗收條件

Ratchet: A Closed-Loop Verification Gate That Turns PRDs into Live Browser Proof

AI 導讀

Miracle Alajemba 建立 Ratchet,利用 Kane CLI 的即時瀏覽器測試驗證 PRD 驗收條件,只有全部條件均有證據支持才會鎖定建置。它會同步 PRD 與 Kane CLI 的設計及覆蓋狀態;所有用例和驗收條件獲證明前,狀態保持 `locked: false`。測試亦找出 URL 尾斜線斷言問題和暫時性截圖逾時,並確認結帳流程沒有應用程式錯誤。

正文

Miracle Alajemba

AI coding agents are great at writing code, but they love saying "it's done" the moment unit tests pass—without ever checking if the app actually works in a real browser.

To fix that, I built Ratchet: a closed-loop verification gate powered by Kane CLI that refuses to lock a build until 100% of your PRD's acceptance criteria are proven in a live browser.

How the Closed Loop Works

Instead of relying on an agent's self-reported completion, Ratchet drives Kane CLI headlessly and enforces a strict verification flow:

  1. Spec Sync: Reads the project's PRD and syncs acceptance criteria against Kane CLI's structured design and coverage state (kane-cli cover gaps --json), including safe no-op handling when the design is already up to date.
  2. Live Browser Verification: Executes real browser tests via kane-cli testrun run against the running application (tested against a Pro Plan checkout demo with SAVE20 promo pricing).
  3. Evidence-Backed Lock: Parses Kane's coverage rollup and evidence packs, failing closed (locked: false) until every use case and acceptance criterion is proven.

What Kane CLI Caught During the Build

Wiring a real browser verification loop surfaced issues that standard unit tests would never catch:

  • Sync Edge Cases: Caught a subtle mismatch where Kane's EMPTY_DESIGN event was treated as a hard failure when non-blocking clarification gaps were present, leading to a cleaner no-op sync path.
  • Root-Cause Triage via Evidence Packs: Using kane-cli evidence serve, Kane separated real application behavior from test/environment noise—flagging a canonical trailing-slash URL assertion issue (http://localhost:4173 vs http://localhost:4173/) and a transient screenshot timeout, confirming zero application bugs in the checkout flow.

Run It Locally


bash
# 1. Install, build, and run offline engine tests
npm install && npm run build && npm test

# 2. Start the demo app (Terminal 1)
cd demo-app && python3 -m http.server 4173

# 3. Run live browser verification and inspect coverage (Terminal 2)
cd demo-app && kane-cli testrun run && kane-cli cover gaps --json

Check out the code on GitHub: Miracle-Alajemba/ratchet

來源:DEV Community · dev.to