Q132: remove PR bot gates that no task completion or goal close consulted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-08 21:36:07 -04:00
1 parent fe45cd4d46
commit e562444487
19 files changed
+35 -151

No files matched your search

-2
View File
@@ -32,7 +32,6 @@ const LEGACY_TABLES = [
"operational_events",
"chaos_drills",
"chaos_drill_runs",
"pr_bot_gates",
"chat_spaces",
"chat_messages",
"chat_threads",
@@ -159,7 +158,6 @@ const RELATION_CHECKS: RelationCheck[] = [
{ table: "chaos_drills", column: "org_id", referencedTable: "organizations", referencedColumn: "id", reason: "dangling_org_id" },
{ table: "chaos_drill_runs", column: "org_id", referencedTable: "organizations", referencedColumn: "id", reason: "dangling_org_id" },
{ table: "chaos_drill_runs", column: "drill_id", referencedTable: "chaos_drills", referencedColumn: "id", reason: "dangling_drill_id" },
{ table: "pr_bot_gates", column: "org_id", referencedTable: "organizations", referencedColumn: "id", reason: "dangling_org_id" },
{ table: "chat_spaces", column: "org_id", referencedTable: "organizations", referencedColumn: "id", reason: "dangling_org_id" },
{ table: "chat_messages", column: "org_id", referencedTable: "organizations", referencedColumn: "id", reason: "dangling_org_id" },
{ table: "chat_messages", column: "space_id", referencedTable: "chat_spaces", referencedColumn: "id", reason: "dangling_space_id" },
-3
View File
@@ -7,7 +7,6 @@ import { PolicyService } from "./policy-service";
import { IdentityAccessService } from "./identity-access-service";
import { OrgGovernanceService } from "./org-governance-service";
import { OperationsService } from "./operations-service";
import { SdlcService } from "./sdlc-service";
import { assertUsableMentionName } from "../../shared/mention-handles";
/**
@@ -22,7 +21,6 @@ export function seedOrganization(db: DatabaseSync, input: CreateOrganizationInpu
const identityAccess = new IdentityAccessService(db);
const governance = new OrgGovernanceService(db);
const operations = new OperationsService(db);
const sdlc = new SdlcService(db);
assertUsableMentionName(input.employeeName);
const orgId = createId("org");
@@ -50,7 +48,6 @@ export function seedOrganization(db: DatabaseSync, input: CreateOrganizationInpu
identityAccess.seedEmployeeAccess(orgId, employeeId, now);
governance.seedOrganizationGovernance(orgId, employeeId, now);
operations.seedOrganizationOperations(orgId, now);
sdlc.seedOrganizationSdlc(orgId, now);
for (const space of [
["company", "general", "Company coordination", "workspace"],
-49
View File
@@ -1,49 +0,0 @@
import type { DatabaseSync } from "node:sqlite";
import type { SetPrBotGateInput } from "../../shared/commands";
import { PR_BOT_GATE_KEY } from "../../shared/domain";
import { createId } from "../../shared/ids";
import { AuditService } from "./audit-service";
const PR_BOT_GATES = [
{ key: PR_BOT_GATE_KEY.STATIC_CHECKS, label: "Static checks", gateType: "typecheck_lint_test" },
{ key: PR_BOT_GATE_KEY.MIGRATION_DIFF, label: "Migration diff", gateType: "schema_review" },
{ key: PR_BOT_GATE_KEY.POLICY_DIFF, label: "Policy diff", gateType: "policy_review" },
{ key: PR_BOT_GATE_KEY.HUMAN_APPROVAL, label: "Human approval", gateType: "approval_required" },
] as const;
export class SdlcService {
private readonly audit: AuditService;
constructor(private readonly db: DatabaseSync) {
this.audit = new AuditService(db);
}
seedOrganizationSdlc(orgId: string, now: string): void {
for (const gate of PR_BOT_GATES) {
this.db.prepare(`
insert into pr_bot_gates(id, org_id, key, label, gate_type, enabled, created_at, updated_at)
values (?, ?, ?, ?, ?, 1, ?, ?)
on conflict(org_id, key) do nothing
`).run(createId("pbg"), orgId, gate.key, gate.label, gate.gateType, now, now);
}
}
setPrBotGate(input: SetPrBotGateInput): void {
const gate = this.db.prepare("select key from pr_bot_gates where id = ? and org_id = ?")
.get(input.gateId, input.orgId) as { key: string } | undefined;
if (!gate) throw new Error("PR bot gate was not found.");
const now = new Date().toISOString();
const result = this.db.prepare("update pr_bot_gates set enabled = ?, updated_at = ? where id = ? and org_id = ?")
.run(input.enabled ? 1 : 0, now, input.gateId, input.orgId);
if (result.changes === 0) throw new Error("PR bot gate was not found.");
this.audit.record({
orgId: input.orgId,
entityType: "pr_bot_gate",
entityId: input.gateId,
actorType: "system",
actorId: null,
action: "updated",
payload: { key: gate.key, enabled: input.enabled },
});
}
}
-3
View File
@@ -81,8 +81,6 @@ export class SnapshotService {
.map((event) => ({ ...event, success: toBool(event.success) }));
const chaosDrills = list<AppSnapshot["chaosDrills"][number]>(this.db, "chaos_drills", "key asc")
.map((drill) => ({ ...drill, enabled: toBool(drill.enabled) }));
const prBotGates = list<AppSnapshot["prBotGates"][number]>(this.db, "pr_bot_gates", "key asc")
.map((gate) => ({ ...gate, enabled: toBool(gate.enabled) }));
const rollbackSnapshots = list<AppSnapshot["rollbackSnapshots"][number]>(this.db, "rollback_snapshots", "created_at desc")
.map((snapshot) => ({ ...snapshot, active: toBool(snapshot.active) }));
@@ -162,7 +160,6 @@ export class SnapshotService {
operationalEvents,
chaosDrills,
chaosDrillRuns: list(this.db, "chaos_drill_runs", "started_at desc"),
prBotGates,
auditReplayRuns: list(this.db, "audit_replay_runs", "created_at desc"),
auditEvents: recentList<AppSnapshot["auditEvents"][number]>(this.db, "audit_events", "created_at desc", 200),
documents: list(this.db, "documents", "updated_at desc"),