Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

One Test Must Flip, One Must Not: A Pairing Gate for Agent Patches

Description and use

A pairing test gate ensures rate‑limiter patches fix the boundary bug without altering correct behavior.

Problem

A sliding‑window rate limiter allowed one request too many at the window boundary, causing a silent 429 without an outage. The bug was hard to reproduce and patches risked breaking unrelated behavior.

Outcome

The pairing gate prevented two faulty patches and ensured that only a correct fix was merged, preserving existing behavior and improving test reliability.

Workflow

  • 1. Identify the edge‑case bug in the rate limiter.
  • 2. Write a flip test that reproduces the failure at the window boundary.
  • 3. Write a guard test that verifies unchanged behavior for adjacent cases.
  • 4. Create a shell script (gate.sh) to run both tests on a clean checkout.
  • 5. Run the gate before applying any patch; reject if guard is red or flip is green.
  • 6. Apply candidate patch only after pre‑patch state is verified.
  • 7. Re‑run the gate to confirm flip turns green and guard stays green.
  • 8. If additional side effects are detected, add more guard tests (e.g., caller‑collection).

Evidence

The gate refuses to evaluate a patch until the pre‑patch state is proven.

Source

The first patch produced a flip test that was already green — I had written the test against the patched tree.

Source

  • Record date: 2026-09-20T03:15:16.212Z