Q131: remove review agents and eval suites whose pass only counted configuration rows
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
074a1fc8e3
commit
fe45cd4d46
20 files changed
+32
-476
No files matched your search
@@ -35,7 +35,7 @@ describe("domain services", () => {
|
||||
const connection = createConnection();
|
||||
|
||||
const rows = connection.db.prepare("select version from schema_migrations order by version asc").all() as Array<{ version: number }>;
|
||||
expect(rows.map((row) => row.version)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93]);
|
||||
expect(rows.map((row) => row.version)).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94]);
|
||||
connection.close();
|
||||
});
|
||||
|
||||
@@ -63,8 +63,6 @@ describe("domain services", () => {
|
||||
expect(state.featureFlags.map((flag) => flag.key)).toContain("chaos_drills");
|
||||
expect(state.sloTargets.map((target) => target.signalKey)).toContain("provider_request_success");
|
||||
expect(state.chaosDrills.map((drill) => drill.scenarioKey)).toContain("approval_backlog_gate");
|
||||
expect(state.sdlcReviewAgents.map((agent) => agent.key)).toContain("code_reviewer");
|
||||
expect(state.evalSuites.map((suite) => suite.key)).toContain("contract");
|
||||
expect(state.prBotGates.map((gate) => gate.key)).toContain("static_checks");
|
||||
expect(state.chatSpaces.map((space) => space.name)).toContain("board");
|
||||
expect(state.policyRules[0]?.action).toBe("task_create");
|
||||
|
||||
@@ -132,11 +132,6 @@ describe("migration service", () => {
|
||||
create table operational_events(id text primary key, org_id text);
|
||||
create table chaos_drills(id text primary key, org_id text);
|
||||
create table chaos_drill_runs(id text primary key, org_id text, drill_id text);
|
||||
create table sdlc_review_agents(id text primary key, org_id text);
|
||||
create table sdlc_review_runs(id text primary key, org_id text, review_agent_id text);
|
||||
create table eval_suites(id text primary key, org_id text);
|
||||
create table eval_cases(id text primary key, org_id text, suite_id text);
|
||||
create table eval_runs(id text primary key, org_id text, suite_id text);
|
||||
create table pr_bot_gates(id text primary key, org_id text);
|
||||
create table chat_spaces(id text primary key, org_id text);
|
||||
create table chat_messages(id text primary key, org_id text, space_id text, thread_id text);
|
||||
@@ -210,11 +205,6 @@ describe("migration service", () => {
|
||||
insert into operational_events(id, org_id) values ('op-1', 'org-1');
|
||||
insert into chaos_drills(id, org_id) values ('drill-1', 'org-1');
|
||||
insert into chaos_drill_runs(id, org_id, drill_id) values ('drill-run-1', 'org-1', 'drill-1');
|
||||
insert into sdlc_review_agents(id, org_id) values ('reviewer-1', 'org-1');
|
||||
insert into sdlc_review_runs(id, org_id, review_agent_id) values ('review-run-1', 'org-1', 'reviewer-1');
|
||||
insert into eval_suites(id, org_id) values ('suite-1', 'org-1');
|
||||
insert into eval_cases(id, org_id, suite_id) values ('case-1', 'org-1', 'suite-1');
|
||||
insert into eval_runs(id, org_id, suite_id) values ('eval-run-1', 'org-1', 'suite-1');
|
||||
insert into pr_bot_gates(id, org_id) values ('gate-1', 'org-1');
|
||||
insert into chat_threads(id, org_id, space_id, root_message_id) values ('thread-1', 'org-1', 'space-1', null);
|
||||
insert into chat_messages(id, org_id, space_id, thread_id) values ('msg-1', 'org-1', 'space-1', 'thread-1');
|
||||
@@ -282,8 +272,6 @@ describe("migration service", () => {
|
||||
expect(body.tableCounts.hiring_policies).toBe(1);
|
||||
expect(body.tableCounts.feature_flags).toBe(1);
|
||||
expect(body.tableCounts.chaos_drill_runs).toBe(1);
|
||||
expect(body.tableCounts.sdlc_review_runs).toBe(1);
|
||||
expect(body.tableCounts.eval_cases).toBe(1);
|
||||
expect(body.tableCounts.role_grants).toBe(1);
|
||||
expect(body.tableCounts.skill_artifacts).toBe(1);
|
||||
expect(body.tableCounts.chat_read_state).toBe(1);
|
||||
@@ -312,8 +300,6 @@ describe("migration service", () => {
|
||||
expect(body.idMaps.approval_assignments).toEqual(["assign-1"]);
|
||||
expect(body.idMaps.operational_events).toEqual(["op-1"]);
|
||||
expect(body.idMaps.chaos_drill_runs).toEqual(["drill-run-1"]);
|
||||
expect(body.idMaps.sdlc_review_runs).toEqual(["review-run-1"]);
|
||||
expect(body.idMaps.eval_runs).toEqual(["eval-run-1"]);
|
||||
expect(body.idMaps.board_interventions).toEqual(["bdi-1"]);
|
||||
expect(body.idMaps.file_handoff_records).toEqual(["handoff-1"]);
|
||||
expect(body.idMaps.retention_freezes).toEqual(["freeze-1"]);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DatabaseConnection } from "../../src/main/database/connection";
|
||||
import { OrganizationService } from "../../src/main/services/organization-service";
|
||||
import { SdlcService } from "../../src/main/services/sdlc-service";
|
||||
import { SnapshotService } from "../../src/main/services/snapshot-service";
|
||||
import { SDLC_REVIEW_TARGET_TYPE } from "../../src/shared/domain";
|
||||
import { IPC_CHANNELS } from "../../src/shared/ipc";
|
||||
|
||||
function createConnection(): DatabaseConnection {
|
||||
return new DatabaseConnection(join(tmpdir(), `agentcompany-new-sdlc-${randomUUID()}.db`));
|
||||
@@ -22,65 +22,36 @@ function createOrganization(organization: OrganizationService): string {
|
||||
}
|
||||
|
||||
describe("SDLC service", () => {
|
||||
test("seeds review agents, eval suites, eval cases, and PR bot gates", () => {
|
||||
test("offers no review or eval whose pass only counts configuration rows", () => {
|
||||
const connection = createConnection();
|
||||
const organization = new OrganizationService(connection.db);
|
||||
const snapshot = new SnapshotService(connection.db);
|
||||
|
||||
connection.transaction(() => {
|
||||
createOrganization(organization);
|
||||
createOrganization(new OrganizationService(connection.db));
|
||||
});
|
||||
|
||||
const state = snapshot.load();
|
||||
expect(state.sdlcReviewAgents.map((agent) => agent.key).sort()).toEqual(["code_reviewer", "migration_reviewer", "policy_reviewer"]);
|
||||
expect(state.evalSuites.map((suite) => suite.key).sort()).toEqual(["contract", "integration", "replay"]);
|
||||
expect(state.evalCases).toHaveLength(6);
|
||||
expect(state.prBotGates.map((gate) => gate.key).sort()).toEqual(["human_approval", "migration_diff", "policy_diff", "static_checks"]);
|
||||
const tables = connection.db.prepare(`
|
||||
select name from sqlite_master where type = 'table' and name in ('sdlc_review_agents', 'sdlc_review_runs', 'eval_suites', 'eval_cases', 'eval_runs')
|
||||
`).all();
|
||||
expect(tables).toEqual([]);
|
||||
expect(Object.keys(IPC_CHANNELS).filter((name) => name === "runSdlcReview" || name === "runEvalSuite")).toEqual([]);
|
||||
connection.close();
|
||||
});
|
||||
|
||||
test("runs review agents against validated workspace targets", () => {
|
||||
test("seeds PR bot gates and toggles them", () => {
|
||||
const connection = createConnection();
|
||||
const organization = new OrganizationService(connection.db);
|
||||
const sdlc = new SdlcService(connection.db);
|
||||
const snapshot = new SnapshotService(connection.db);
|
||||
let orgId = "";
|
||||
let reviewAgentId = "";
|
||||
|
||||
connection.transaction(() => {
|
||||
orgId = createOrganization(organization);
|
||||
reviewAgentId = (connection.db.prepare("select id from sdlc_review_agents where org_id = ? and key = ?")
|
||||
.get(orgId, "code_reviewer") as { id: string }).id;
|
||||
sdlc.runReview({ orgId, reviewAgentId, targetType: SDLC_REVIEW_TARGET_TYPE.WORKSPACE, targetRef: orgId });
|
||||
});
|
||||
|
||||
const state = snapshot.load();
|
||||
expect(state.sdlcReviewRuns[0]).toMatchObject({ orgId, reviewAgentId, targetType: SDLC_REVIEW_TARGET_TYPE.WORKSPACE, state: "passed" });
|
||||
expect(state.auditEvents.some((event) => event.entityType === "sdlc_review_run" && event.action === "created")).toBe(true);
|
||||
connection.close();
|
||||
});
|
||||
|
||||
test("runs contract eval suites and toggles PR bot gates", () => {
|
||||
const connection = createConnection();
|
||||
const organization = new OrganizationService(connection.db);
|
||||
const sdlc = new SdlcService(connection.db);
|
||||
const snapshot = new SnapshotService(connection.db);
|
||||
let orgId = "";
|
||||
let suiteId = "";
|
||||
let gateId = "";
|
||||
|
||||
connection.transaction(() => {
|
||||
orgId = createOrganization(organization);
|
||||
suiteId = (connection.db.prepare("select id from eval_suites where org_id = ? and key = ?")
|
||||
.get(orgId, "contract") as { id: string }).id;
|
||||
gateId = (connection.db.prepare("select id from pr_bot_gates where org_id = ? and key = ?")
|
||||
.get(orgId, "static_checks") as { id: string }).id;
|
||||
sdlc.runEvalSuite({ orgId, suiteId });
|
||||
sdlc.setPrBotGate({ orgId, gateId, enabled: false });
|
||||
});
|
||||
|
||||
const state = snapshot.load();
|
||||
expect(state.evalRuns[0]).toMatchObject({ orgId, suiteId, state: "passed", failedCount: 0 });
|
||||
expect(state.prBotGates.map((gate) => gate.key).sort()).toEqual(["human_approval", "migration_diff", "policy_diff", "static_checks"]);
|
||||
expect(state.prBotGates.find((gate) => gate.id === gateId)?.enabled).toBe(false);
|
||||
expect(state.auditEvents.some((event) => event.entityType === "pr_bot_gate" && event.action === "updated")).toBe(true);
|
||||
connection.close();
|
||||
|
||||
Reference in new issue
Block a user