Skip to content

bug: leak-sweep regex was case-blind to lowercase Sage-memo IDs in shipped src/#225

Open
Antawari wants to merge 1 commit into
mainfrom
catrina/2026-06-13/w1-bonfire-public-sage-memo-id-leak-case-blind-sweep
Open

bug: leak-sweep regex was case-blind to lowercase Sage-memo IDs in shipped src/#225
Antawari wants to merge 1 commit into
mainfrom
catrina/2026-06-13/w1-bonfire-public-sage-memo-id-leak-case-blind-sweep

Conversation

@Antawari

Copy link
Copy Markdown
Contributor

DO-NOT-MERGE — fleet quality burn. Builder PR; the operator gates merge.

Unit

bug: internal Sage-memo ID leaks in shipped src/ that the leak-sweep regex is blind to.

The problem

An internal Sage-memo filename was hard-cited in 9 docstrings/comments across 7 src/bonfire files:

  • handlers/__init__.py, handlers/merge_preflight.py (×2)
  • git/scratch.py
  • engine/gates.py
  • workflow/standard.py
  • github/client.py (×2), github/mock.py

These files ship inside the bonfire-ai wheel via [tool.hatch.build.targets.wheel] packages=['src/bonfire']. CLAUDE.md + CONTRIBUTING.md forbid internal-tracker references in this public PyPI tree.

Why the guard missed it

The guard test tests/unit/test_no_bon_ref_in_src_sweep.py compiled the sweep regex case-sensitively. An oracle running that regex over a lowercase tracker filename returns no match, so the leak passed the gate — even with the allowlist empty of these entries.

Falsifiable claim this PR satisfies

  • Before: grep -rE 'bon-[0-9]+-sage' src/bonfire returned 9 hits, AND the case-sensitive sweep regex matched that string as None.
  • After: the same grep returns 0 hits; the sweep regex is now case-insensitive so the leak class can never silently ship again.

Change

  1. Made the sweep regex case-insensitive so any [Bb][Oo][Nn]-<digits> ref in shipped source costs an explicit allowlist entry (TDD: this turned the guard RED against the 9 leaks).
  2. Scrubbed the internal filename + section/line pointers from all 9 sites. The design rationale in each docstring is preserved — only the internal pointers were removed.
  3. Added a regression test pinning the case-blindness fix (reverting the regex to case-sensitive fails it).

Verification

  • Full suite: 4418 passed, 79 skipped, 34 xfailed, 73 xpassed, 0 failed (run from repo root, as CI does).
  • ruff check + ruff format --check: clean.
  • No existing test weakened, skipped, or deleted. No allowlist inflation. No noqa.

🤖 Generated with Claude Code

…insensitive

The internal Sage-memo filename was hard-cited in 9 docstrings/comments
across 7 src/bonfire files. These ship inside the bonfire-ai wheel
(packages=['src/bonfire']); CLAUDE.md + CONTRIBUTING.md forbid
internal-tracker references in this public PyPI tree.

The guard test test_no_bon_ref_in_src_sweep.py compiled re.compile(r'BON-\d+'),
which is case-SENSITIVE: an oracle running that regex over the lowercase
memo filename returns no match, so the leak passed the gate. Made the
sweep regex case-insensitive (re.IGNORECASE) so any [Bb][Oo][Nn]-<digits>
ref in shipped source costs an explicit allowlist entry.

Design rationale in each docstring is preserved; only the internal
filename + section/line pointers are removed. The tests/unit package stays
at its frozen shrink-only budget (net line delta 0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Antawari Antawari force-pushed the catrina/2026-06-13/w1-bonfire-public-sage-memo-id-leak-case-blind-sweep branch from a895fdc to 10d47a5 Compare June 13, 2026 22:23
@Antawari Antawari changed the title DO-NOT-MERGE · bug: leak-sweep regex was case-blind to lowercase Sage-memo IDs in shipped src/ bug: leak-sweep regex was case-blind to lowercase Sage-memo IDs in shipped src/ Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants