Q133: remove chaos drills that never injected a fault, and the signals they wrote

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:39:36 -04:00
1 parent e562444487
commit 3849b96192
17 files changed
+20 -220

No files matched your search

+2 -3
View File
@@ -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, 94, 95]);
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, 95, 96]);
connection.close();
});
@@ -60,9 +60,8 @@ describe("domain services", () => {
expect(state.orgDepartments.map((department) => department.name)).toContain("Engineering");
expect(state.hiringPolicies.some((policy) => policy.departmentName === "Engineering")).toBe(true);
expect(state.approvalRoutingRules[0]).toMatchObject({ kind: "*", minimumRisk: "low", routeToType: "employee" });
expect(state.featureFlags.map((flag) => flag.key)).toContain("chaos_drills");
expect(state.featureFlags.map((flag) => flag.key)).toContain("board_intervention");
expect(state.sloTargets.map((target) => target.signalKey)).toContain("provider_request_success");
expect(state.chaosDrills.map((drill) => drill.scenarioKey)).toContain("approval_backlog_gate");
expect(state.chatSpaces.map((space) => space.name)).toContain("board");
expect(state.policyRules[0]?.action).toBe("task_create");
expect(state.auditEvents[0]?.action).toBe("created");
-6
View File
@@ -130,8 +130,6 @@ describe("migration service", () => {
create table feature_flags(id text primary key, org_id text);
create table slo_targets(id text primary key, org_id text);
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 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);
create table chat_threads(id text primary key, org_id text, space_id text, root_message_id text);
@@ -202,8 +200,6 @@ describe("migration service", () => {
insert into feature_flags(id, org_id) values ('flag-1', 'org-1');
insert into slo_targets(id, org_id) values ('slo-1', 'org-1');
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 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');
insert into chat_memberships(space_id, principal_type, principal_id) values ('space-1', 'employee', 'emp-1');
@@ -269,7 +265,6 @@ describe("migration service", () => {
expect(body.tableCounts.org_departments).toBe(1);
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.role_grants).toBe(1);
expect(body.tableCounts.skill_artifacts).toBe(1);
expect(body.tableCounts.chat_read_state).toBe(1);
@@ -297,7 +292,6 @@ describe("migration service", () => {
expect(body.idMaps.access_decisions).toEqual(["access-1"]);
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.board_interventions).toEqual(["bdi-1"]);
expect(body.idMaps.file_handoff_records).toEqual(["handoff-1"]);
expect(body.idMaps.retention_freezes).toEqual(["freeze-1"]);
+2 -25
View File
@@ -34,7 +34,7 @@ const testVault = {
};
describe("operations service", () => {
test("seeds feature flags, SLO targets, and chaos drills for new organizations", () => {
test("seeds feature flags and SLO targets, and no drill that scores configuration as fault handling", () => {
const connection = createConnection();
const organization = new OrganizationService(connection.db);
const snapshot = new SnapshotService(connection.db);
@@ -46,12 +46,11 @@ describe("operations service", () => {
const state = snapshot.load();
expect(state.featureFlags.map((flag) => flag.key).sort()).toEqual([
"board_intervention",
"chaos_drills",
"provider_background_execution",
"social_publish_approval",
]);
expect(state.sloTargets.map((target) => target.signalKey)).toContain("browser_session_boundary");
expect(state.chaosDrills).toHaveLength(4);
expect(connection.db.prepare("select name from sqlite_master where type = 'table' and name like 'chaos_drill%'").all()).toEqual([]);
connection.close();
});
@@ -98,26 +97,4 @@ describe("operations service", () => {
})).rejects.toThrow("Provider background execution is disabled by feature flag.");
connection.close();
});
test("runs chaos drills and records operational signals", () => {
const connection = createConnection();
const organization = new OrganizationService(connection.db);
const operations = new OperationsService(connection.db);
const snapshot = new SnapshotService(connection.db);
let orgId = "";
let drillId = "";
connection.transaction(() => {
orgId = createOrganization(organization);
drillId = (connection.db.prepare("select id from chaos_drills where org_id = ? and scenario_key = ?")
.get(orgId, "approval_backlog_gate") as { id: string }).id;
operations.runChaosDrill({ orgId, drillId });
});
const state = snapshot.load();
expect(state.chaosDrillRuns[0]).toMatchObject({ orgId, drillId, state: "passed" });
expect(state.operationalEvents[0]).toMatchObject({ orgId, signalKey: "approval_route_coverage", source: "chaos_drill", success: true });
expect(state.auditEvents.some((event) => event.entityType === "chaos_drill" && event.action === "run")).toBe(true);
connection.close();
});
});