diff --git a/scripts/backfill-synthetic-recovery-prs.py b/scripts/backfill-synthetic-recovery-prs.py index 2299f39..e13ecb5 100644 --- a/scripts/backfill-synthetic-recovery-prs.py +++ b/scripts/backfill-synthetic-recovery-prs.py @@ -43,6 +43,10 @@ RECOVERY_PRS = [ "domain_verdict": "approve", "submitted_by": "alexastrum", "source_channel": "github", + # origin='human' matches lib/merge.py convention for external contributors + # (default is 'pipeline' which misclassifies us as machine-authored). + "origin": "human", + "priority": "high", "description": "Multi-agent git workflows production maturity | Cryptographic agent trust ratings | Defense in depth for AI agent oversight | Deterministic policy engines below LLM layer | Knowledge validation four-layer architecture | Structurally separating proposer and reviewer agents", "merged_at": "2026-03-09 00:00:00", "created_at": "2026-03-08 00:00:00", @@ -60,6 +64,8 @@ RECOVERY_PRS = [ "domain_verdict": "approve", "submitted_by": "cameron-s1", "source_channel": "github", + "origin": "human", + "priority": "high", "description": "Orthogonality is an artefact of specification architectures not a property of intelligence itself", "merged_at": "2026-04-01 00:00:00", "created_at": "2026-04-01 00:00:00", @@ -80,14 +86,19 @@ def main(): conn = sqlite3.connect(DB_PATH, timeout=30) conn.row_factory = sqlite3.Row - # Guard against colliding with real PRs — current max + some headroom. + # Guard against synthetic-range colonization (Ganymede review): check for + # any row in the synthetic range that isn't one of ours. INSERT OR IGNORE on + # the specific numbers is the real collision defense; this is belt-and-suspenders. max_real = conn.execute( "SELECT MAX(number) FROM prs WHERE number < 900000" ).fetchone()[0] or 0 print(f"Max real Forgejo PR number: {max_real}") - if max_real >= 900000: - print(f"ERROR: real PR numbers reached synthetic range (>= 900000). Aborting.", - file=sys.stderr) + synth_conflict = conn.execute( + "SELECT number FROM prs WHERE number >= 900000 AND number NOT IN (900068, 900088) LIMIT 1" + ).fetchone() + if synth_conflict: + print(f"ERROR: PR #{synth_conflict[0]} already exists in synthetic range. " + f"Pick a new range before running.", file=sys.stderr) sys.exit(2) inserted = 0 @@ -109,13 +120,15 @@ def main(): """INSERT INTO prs ( number, github_pr, branch, status, domain, commit_type, tier, leo_verdict, domain_verdict, submitted_by, source_channel, + origin, priority, description, merged_at, created_at, last_error - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""", ( row["number"], row["github_pr"], row["branch"], row["status"], row["domain"], row["commit_type"], row["tier"], row["leo_verdict"], row["domain_verdict"], row["submitted_by"], row["source_channel"], + row["origin"], row["priority"], row["description"], row["merged_at"], row["created_at"], row["last_error"], ),