Skip to content

Phase 3 (Q14): distinct sweeper-PR naming + reap-exempt own-PR exclusion#6

Merged
petemoore merged 1 commit into
mainfrom
rework/phase3-q14-own-pr-exclusion
Jun 15, 2026
Merged

Phase 3 (Q14): distinct sweeper-PR naming + reap-exempt own-PR exclusion#6
petemoore merged 1 commit into
mainfrom
rework/phase3-q14-own-pr-exclusion

Conversation

@petemoore

Copy link
Copy Markdown
Collaborator

Phase 3 sub-item Q14 (docs/WORKPLAN.md; resolves T12). Cost-safety-critical. Independent of the analyser-removal rework.

Why

Idempotency is the only thing bounding agentic spend, so the tool must never re-ingest its own replacement PR as a fresh dependabot PR. The author filter is the primary in-scope gate, but on the test bed (--accept-author petemoore, which is also the fix-PR author) an own-PR could be re-ingested and re-enter the expensive agentic step.

What

  • SweeperPRTitle — replacement title = dependabot title with the conventional-commit type swapped to fix (build(deps): …fix(deps): …), or fix(deps): prepended when there's no parseable prefix. Replaces the verbatim copy of pr.Title that made dependabot and sweeper PRs indistinguishable.
  • Reap-exempt created_prs table (created PR → origin dependabot PR), with Writer.RecordCreatedPR / Reader.CreatedPRs on both stores. Store.Reap only prunes pr_progress, so these records are permanent (review C1). A branch-name heuristic is explicitly rejected — branch names are attacker-spoofable; a DB record of what we created is not.
  • The orchestrator records every replacement it opens (both the freshly-created and the pre-existing-branch paths) and excludes recorded PRs from the scan set each cycle. The created→origin reverse link also feeds the dashboard pairing (Phase 4).

Tests

  • TestSweeperPRTitle — type-swap, prepend-when-bare, group titles, idempotence.
  • TestCreatedPRsSurviveReap on both stores (sqlite + in-memory) — the C1 regression: the record persists across a Reap that prunes pr_progress.
  • TestRecordCreatedPRRoundtrip, TestExcludeOwnPRs (+ nil/empty pass-through).

Schema note: created_prs is added via CREATE TABLE IF NOT EXISTS — no migration needed (the test DB is disposable; flagged in WORKPLAN for when production traffic lands).

Local: go build/vet/test ./..., gofmt, staticcheck all clean.

🤖 Generated with Claude Code

petemoore added a commit that referenced this pull request Jun 15, 2026
… plan

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cost-safety (idempotency is the only thing bounding agentic spend): the tool
must never re-ingest its own replacement PR as a fresh dependabot PR. The author
filter is the primary gate, but on the test bed the fix-PR author is also an
accepted author, so an own-PR could re-enter the expensive agentic step.

- SweeperPRTitle derives the replacement title from the dependabot title with
  the conventional-commit type swapped to `fix` (build(deps): … → fix(deps): …),
  or prepends `fix(deps): ` when there's no parseable prefix. Replaces the
  verbatim copy of the dependabot title that made the two indistinguishable (T12).
- New reap-exempt `created_prs` table (created PR → origin dependabot PR), with
  Writer.RecordCreatedPR and Reader.CreatedPRs on both stores. Store.Reap only
  prunes pr_progress, so these records are permanent (review C1) — a branch-name
  heuristic is rejected (branch names are attacker-spoofable; the DB record is not).
- The orchestrator records every replacement it opens (new and pre-existing
  branches) and excludes recorded PRs from the scan set each cycle. The reverse
  link (created→origin) also enables the dashboard pairing (Phase 4).

Tests: TestSweeperPRTitle; created_prs survives Reap on BOTH stores (C1);
RecordCreatedPR/CreatedPRs roundtrip; excludeOwnPRs (+ nil/empty pass-through).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@petemoore petemoore marked this pull request as ready for review June 15, 2026 18:42
@petemoore petemoore force-pushed the rework/phase3-q14-own-pr-exclusion branch from 359ac25 to 190238d Compare June 15, 2026 18:42
@petemoore petemoore merged commit 7e1985f into main Jun 15, 2026
1 check passed
@petemoore petemoore deleted the rework/phase3-q14-own-pr-exclusion branch June 15, 2026 18:43
petemoore added a commit that referenced this pull request Jun 15, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant