Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.

Commit cd8a6c0

Browse files
patchwrightruvnet
andcommitted
feat(aibug-gate): v0.2 — grow corpus to 8 rules (5 merged-backed) + CI integrity gate
Three new provenance-pinned rules, each distilled from a *merged* gift-PR fleet fix (stronger provenance than the open-PR rules in AB003-005): - AB006 radix-from-source-not-override [high/default] skorokithakis/shortuuid#115 (merged) — len/radix derived from the original parameter after an override parameter is established as the source of truth; alpha_len = len(alphabet) instead of len(alphabet_index). - AB007 log-exp-rounded-mantissa-no-carry [medium/pedantic] python-humanize/humanize#329 (merged) — magnitude exponent chosen from the unrounded value, then the mantissa formatted with rounding; no carry-guard when rounding rolls the mantissa to the base ('1000.0 kB'). - AB008 magnitude-bin-inclusive-boundary-break [medium/pedantic] mahmoud/boltons#403 (merged) — consecutive-bin loop breaks on '<=' against the next bin's lower bound; bytes2human(1024) -> '1024B'. Corpus now: 8 rules, 5 merged-PR-backed (AB001/AB002/AB006/AB007/AB008), 3 open-PR (AB003/AB004/AB005). All 8 upstream URLs verified against the GitHub API (state + merged flag) at commit time. CI hardening (.github/workflows/ci.yml): - New 'Corpus integrity gate' step runs the corpus-size, URL-format + generator-attribution, and merged>=open invariant tests verbosely as a named gate (not just under the general test step). - Added pedantic-tier self-scan of own source (both tiers must stay clean). - Integrity test strengthened: URL must match ^https://github.com/[^/]+/[^/]+/pull/\d+$; generator field checked against an 11-name denylist (copilot/chatgpt/gpt/claude/gemini/cursor/ codex/codewhisperer/deepseek/llama/mistral). 31 tests green (20 -> 31). Self-scan clean at both default and pedantic tiers. Version bumped to 0.2.0. Optional ast-grep multi-lang port (goal #3) deferred: ast-grep binary is not installed locally, and shipping an unverified .sgy would violate the build-honesty discipline that is the product's premise. Co-Authored-By: claude-flow <ruv@ruv.net>
1 parent 6cb8a31 commit cd8a6c0

8 files changed

Lines changed: 542 additions & 16 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,24 @@ jobs:
1818
python-version: ${{ matrix.python-version }}
1919
- name: Install
2020
run: pip install -e . pytest
21+
- name: Corpus integrity gate
22+
# The corpus IS the moat. Every rule must link a real upstream PR and
23+
# must not attribute the bug to a specific generator. These invariants
24+
# are gate-enforced here and visible in the CI log; a regression fails
25+
# the build with a named step rather than silently slipping through.
26+
run: |
27+
python -m pytest -v \
28+
tests/test_rules.py::test_corpus_size_and_codes \
29+
tests/test_rules.py::test_every_entry_has_verifiable_upstream_fix_url \
30+
tests/test_rules.py::test_merged_backed_rules_outnumber_open_backed_at_v0_2
2131
- name: Tests
2232
run: python -m pytest -q
2333
- name: Smoke (python -m)
2434
run: python -m aibug_gate --version
2535
- name: Self-scan (default tier — must pass clean on own source)
2636
run: python -m aibug_gate src/aibug_gate tests
37+
- name: Self-scan (pedantic tier — must pass clean on own source)
38+
run: python -m aibug_gate --pedantic src/aibug_gate tests
2739
- name: List rules (exercises corpus load)
2840
run: python -m aibug_gate --list-rules
2941

‎README.md‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A finding without its evidence link is just another lint hit. With it, the rule
1010

1111
Off-the-shelf linters catch style. Type checkers catch type errors. Neither catches the *class* of bug that AI code generators ship reliably enough to be worth a named rule: `str.replace` used as a strip, `str.split(' ')` where `str.split()` was meant, an argparse flag that parses then silently vanishes, a `not A and B or C` precedence slip. Each of these is **provenance-pinned**: a real maintainer merged (or is reviewing) a real fix for it right now. `aibug-gate` is the discipline that turns those one-off fixes into reusable CI gates.
1212

13-
## The 5 seed rules (v0.1)
13+
## The corpus (v0.2: 8 rules, 5 merged-PR-backed)
1414

1515
Each entry is pinned to a verified upstream fix. The `generator` field is framed honestly as "bug-class commonly shipped by AI generators" rather than attributing a specific bug to a specific tool — that inference is not proven, and `aibug-gate` does not fabricate attributions.
1616

@@ -21,8 +21,13 @@ Each entry is pinned to a verified upstream fix. The `generator` field is framed
2121
| AB003 | Deep negative index `x[-k]` with no length guard → `IndexError` | medium | savoirfairelinux/num2words#661 | open |
2222
| AB004 | argparse option defined but its dest never read (flag silently ignored) | high | un33k/python-slugify#176 | open |
2323
| AB005 | `not A and B or C` precedence (`and` binds tighter than `or`) | low | alexanderlukanin13/coolname#34 | open |
24+
| AB006 | Radix/length derived from the original param after an override guard (silent wrong values) | high | skorokithakis/shortuuid#115 | merged |
25+
| AB007 | log-derived exponent + rounded mantissa, no carry-guard ("1000.0 kB") | medium | python-humanize/humanize#329 | merged |
26+
| AB008 | Magnitude-binning loop breaks on `<=` at the boundary (1024→"1024B") | medium | mahmoud/boltons#403 | merged |
2427

25-
AB001/AB004 are default-tier (low false-positive); AB002/AB003/AB005 are pedantic (opt-in via `--pedantic`).
28+
AB001/AB004/AB006 are default-tier (low false-positive); AB002/AB003/AB005/AB007/AB008 are pedantic (opt-in via `--pedantic`).
29+
30+
**v0.2 hardening.** AB006-AB008 extend the corpus with three new rules distilled from *merged* gift-PR fleet fixes (shortuuid, humanize, boltons) — stronger provenance than the open-PR rules already in AB003-005. Every entry's URL is a real, verifiable GitHub PR (format-validated in CI; resolution verified by the author at commit time). The corpus-integrity and generator-attribution invariants are now a named CI gate (`Corpus integrity gate`), not just a local test — a regression fails the build with a labeled step.
2631

2732
## Install
2833

@@ -70,11 +75,12 @@ src/app.py:42:8: AB001 [high] .replace('/blob/', "") guarded by startswith('/blo
7075
7176
The two-line shape is deliberate: the fix link is on its own line so it survives copy-paste into a PR comment, a Slack thread, or a ticket.
7277
73-
## Honesty notes (v0.1)
78+
## Honesty notes (v0.2)
7479
75-
- **5 seed rules.** The detection logic is ported from [wildlint](https://github.com/patchwright/wildlint)'s `WL001`-`WL005`, which have been hardened against false positives over multiple releases. Re-deriving them from scratch would discard that discipline. The codes are re-issued as `AB001`-`AB005` to match the corpus.
76-
- **No specific generator attribution.** The `generator` field is "bug-class commonly shipped by AI generators" — `aibug-gate` does not claim "Copilot shipped this exact bug" without verified evidence. Bugs are attributed to their real upstream maintainers and fixes, not to a specific LLM tool.
77-
- **Open vs merged status.** AB003, AB004, and AB005 pin to open PRs (the bug is verified on master; the fix is under review). The status is shown in every finding so the reviewer knows whether the fix has landed upstream.
80+
- **8 rules; 5 merged-PR-backed.** AB001-AB005 are ported from [wildlint](https://github.com/patchwright/wildlint)'s `WL001`-`WL005`, hardened against false positives over multiple releases. AB006-AB008 are v0.2 additions distilled from *merged* gift-PR fleet fixes (shortuuid #115, humanize #329, boltons #403) — each one verified merged before being cited. The codes are re-issued as `AB001`-`AB008` to match the corpus.
81+
- **No specific generator attribution.** The `generator` field is "bug-class commonly shipped by AI generators" — `aibug-gate` does not claim "Copilot shipped this exact bug" without verified evidence. Bugs are attributed to their real upstream maintainers and fixes, not to a specific LLM tool. The CI gate rejects entries naming a specific generator (copilot/chatgpt/claude/gemini/cursor/codex/...).
82+
- **Open vs merged status.** AB003, AB004, and AB005 pin to open PRs (the bug is verified on master; the fix is under review). Every other rule is merged-PR-backed. The status is shown in every finding so the reviewer knows whether the fix has landed upstream, and a CI invariant enforces `merged >= open` so the open-PR tail never grows past the merged-PR body.
83+
- **URL structure gate.** Every `upstream_fix_url` must match `^https://github\.com/{owner}/{repo}/pull/\d+$` — checked in CI. URL resolution (the PR exists and is merged when the status says so) is verified by the author at commit time against the GitHub API.
7884
- **Fleet-growing corpus.** The corpus grows as the gift-PR fleet (patchwright-ops) finds and fixes more real bugs. Each new rule adds one `dataset.jsonl` entry + one checker class — the runner resolves the provenance automatically.
7985

8086
## Contributing a rule

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "aibug-gate"
7-
version = "0.1.0"
7+
version = "0.2.0"
88
description = "Pre-commit / CI quality gate whose lint rules are each provenance-pinned to a real bug an AI code generator shipped, with the upstream fix linked. The corpus grows as the gift-PR fleet finds+fixes more real AI bugs."
99
readme = "README.md"
1010
requires-python = ">=3.9"

0 commit comments

Comments
 (0)