Enforce pre-create duplicate title gate in gitea_create_issue (Issue #207) #220

Merged
sysadmin merged 1 commits from feat/issue-207-issue-duplicate-gate into master 2026-07-05 16:34:50 -05:00
Owner

Closes #207

Summary

  • Add issue_duplicate_gate.py with normalized-title matching, near-duplicate detection, and pre_create_issue_duplicate_gate verdicts (duplicate_found, no_duplicate_found, ambiguous_duplicate_stop).
  • Wire the gate into gitea_create_issue: re-query open + recently closed issues at mutation time (closes TOCTOU), block duplicates unless allow_duplicate_override + split_from_issue, and record split relationship in issue body.
  • Expose assess_duplicate_search_proof via review_proofs.py to reject LLM duplicate summaries that omit known matches.

Tests

  • tests/test_issue_duplicate_gate.py — 14 tests covering all acceptance criteria (exact title, near-duplicate, TOCTOU pre-create block, invalid proof, operator split override, MCP integration).
  • Updated create-issue mocks in test_mcp_server.py, test_audit.py, and test_role_session_router.py.

Validation

  • python3 -m py_compile on changed modules
  • pytest tests/test_issue_duplicate_gate.py + related suites (24 passed post-rebase)
  • Secret sweep on diff: clean
Closes #207 ## Summary - Add `issue_duplicate_gate.py` with normalized-title matching, near-duplicate detection, and `pre_create_issue_duplicate_gate` verdicts (`duplicate_found`, `no_duplicate_found`, `ambiguous_duplicate_stop`). - Wire the gate into `gitea_create_issue`: re-query open + recently closed issues at mutation time (closes TOCTOU), block duplicates unless `allow_duplicate_override` + `split_from_issue`, and record split relationship in issue body. - Expose `assess_duplicate_search_proof` via `review_proofs.py` to reject LLM duplicate summaries that omit known matches. ## Tests - `tests/test_issue_duplicate_gate.py` — 14 tests covering all acceptance criteria (exact title, near-duplicate, TOCTOU pre-create block, invalid proof, operator split override, MCP integration). - Updated create-issue mocks in `test_mcp_server.py`, `test_audit.py`, and `test_role_session_router.py`. ## Validation - `python3 -m py_compile` on changed modules - `pytest tests/test_issue_duplicate_gate.py` + related suites (24 passed post-rebase) - Secret sweep on diff: clean
jcwalker3 added 1 commit 2026-07-05 16:24:38 -05:00
Add server-side duplicate detection in gitea_create_issue that re-queries
open and recently closed issues at mutation time, blocks normalized title
matches unless the operator explicitly approves a split, and validates LLM
duplicate-search summaries via review_proofs.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
sysadmin reviewed 2026-07-05 16:34:48 -05:00
sysadmin left a comment
Owner

Review decision: APPROVE

Pinned head: 75c176991ec0054daf83ca3fe6c19c9be8f88471
Reviewer: sysadmin / prgs-reviewer
Target repo: Scaled-Tech-Consulting/Gitea-Tools
Linked issue: #207

Scope check

7 files, all #207 scope: issue_duplicate_gate.py, gitea_create_issue gate wiring, review_proofs.assess_duplicate_search_proof, and harness tests. No unrelated edits, no gate weakening.

Validation (pinned checkout)

  • python3 -m py_compile issue_duplicate_gate.py mcp_server.py review_proofs.py tests/test_issue_duplicate_gate.py → pass
  • pytest tests/test_issue_duplicate_gate.py -q14 passed
  • pytest tests/test_mcp_server.py::TestCreateIssue tests/test_audit.py::TestSimpleToolAudit tests/test_role_session_router.py -q16 passed
  • pytest tests/test_issue_duplicate_gate.py tests/test_review_proofs.py -q109 passed
  • git diff --check prgs/master...HEAD → clean
  • Secret/provenance sweep on diff → clean (no credential values)

Acceptance criteria

  • Exact-title duplicate blocks creation (gate + MCP test) ✓
  • Near-duplicate (punctuation/case/hard-wall wording) fail-closed ✓
  • TOCTOU closed by server-side re-query at create time ✓
  • Invalid LLM duplicate-search proof rejected ✓
  • Operator split override records relationship in body ✓
  • Normalized-title match blocked unless allow_duplicate_override + split_from_issue
## Review decision: APPROVE Pinned head: `75c176991ec0054daf83ca3fe6c19c9be8f88471` Reviewer: `sysadmin / prgs-reviewer` Target repo: `Scaled-Tech-Consulting/Gitea-Tools` Linked issue: #207 ## Scope check 7 files, all #207 scope: `issue_duplicate_gate.py`, `gitea_create_issue` gate wiring, `review_proofs.assess_duplicate_search_proof`, and harness tests. No unrelated edits, no gate weakening. ## Validation (pinned checkout) - `python3 -m py_compile issue_duplicate_gate.py mcp_server.py review_proofs.py tests/test_issue_duplicate_gate.py` → pass - `pytest tests/test_issue_duplicate_gate.py -q` → **14 passed** - `pytest tests/test_mcp_server.py::TestCreateIssue tests/test_audit.py::TestSimpleToolAudit tests/test_role_session_router.py -q` → **16 passed** - `pytest tests/test_issue_duplicate_gate.py tests/test_review_proofs.py -q` → **109 passed** - `git diff --check prgs/master...HEAD` → clean - Secret/provenance sweep on diff → clean (no credential values) ## Acceptance criteria - Exact-title duplicate blocks creation (gate + MCP test) ✓ - Near-duplicate (punctuation/case/hard-wall wording) fail-closed ✓ - TOCTOU closed by server-side re-query at create time ✓ - Invalid LLM duplicate-search proof rejected ✓ - Operator split override records relationship in body ✓ - Normalized-title match blocked unless `allow_duplicate_override` + `split_from_issue` ✓
sysadmin merged commit 5b9fcaefbf into master 2026-07-05 16:34:50 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#220