Q134: a signal's category comes from its runtime source, so self-checks cannot pass as real traffic
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3849b96192
commit
403c57785c
11 files changed
+44
-34
No files matched your search
@@ -5,10 +5,8 @@ import { describe, expect, test } from "vitest";
|
||||
import { DatabaseConnection } from "../../src/main/database/connection";
|
||||
import { AuditService } from "../../src/main/services/audit-service";
|
||||
import { ChatService } from "../../src/main/services/chat-service";
|
||||
import { OperationsService } from "../../src/main/services/operations-service";
|
||||
import { OrganizationService } from "../../src/main/services/organization-service";
|
||||
import { SnapshotService } from "../../src/main/services/snapshot-service";
|
||||
import { SLO_SIGNAL_KEY } from "../../src/shared/domain";
|
||||
|
||||
function createConnection(): DatabaseConnection {
|
||||
return new DatabaseConnection(join(tmpdir(), `agentcompany-new-replay-${randomUUID()}.db`));
|
||||
@@ -29,7 +27,6 @@ describe("replay eval", () => {
|
||||
const organization = new OrganizationService(connection.db);
|
||||
const chat = new ChatService(connection.db);
|
||||
const audit = new AuditService(connection.db);
|
||||
const operations = new OperationsService(connection.db);
|
||||
const snapshot = new SnapshotService(connection.db);
|
||||
let orgId = "";
|
||||
let employeeId = "";
|
||||
@@ -57,14 +54,6 @@ describe("replay eval", () => {
|
||||
});
|
||||
threadId = (connection.db.prepare("select thread_id from chat_messages where id = ?").get(messageId) as { thread_id: string }).thread_id;
|
||||
replayRunId = audit.createThreadReplay({ orgId, threadId, createdByEmployeeId: employeeId });
|
||||
operations.recordSignal({
|
||||
orgId,
|
||||
signalKey: SLO_SIGNAL_KEY.APPROVAL_ROUTE_COVERAGE,
|
||||
source: "replay_eval",
|
||||
success: true,
|
||||
durationMs: 12,
|
||||
detail: { threadId, replayRunId },
|
||||
});
|
||||
});
|
||||
|
||||
const state = snapshot.load();
|
||||
|
||||
@@ -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, 96]);
|
||||
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, 97]);
|
||||
connection.close();
|
||||
});
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ describe("operations service", () => {
|
||||
"provider_background_execution",
|
||||
"social_publish_approval",
|
||||
]);
|
||||
expect(state.sloTargets.map((target) => target.signalKey)).toContain("browser_session_boundary");
|
||||
// Every SLO target is fed by a runtime source; none waits on a signal only a drill would write.
|
||||
expect(state.sloTargets.map((target) => target.signalKey).sort()).toEqual([
|
||||
"approval_route_coverage", "migration_validation_success", "provider_request_success", "skill_resolve_success",
|
||||
]);
|
||||
expect(connection.db.prepare("select name from sqlite_master where type = 'table' and name like 'chaos_drill%'").all()).toEqual([]);
|
||||
connection.close();
|
||||
});
|
||||
@@ -97,4 +100,19 @@ describe("operations service", () => {
|
||||
})).rejects.toThrow("Provider background execution is disabled by feature flag.");
|
||||
connection.close();
|
||||
});
|
||||
|
||||
test("a signal's category comes from its runtime source, so a self-check cannot be filed as real traffic", () => {
|
||||
const connection = createConnection();
|
||||
const operations = new OperationsService(connection.db);
|
||||
let orgId = "";
|
||||
connection.transaction(() => {
|
||||
orgId = createOrganization(new OrganizationService(connection.db));
|
||||
});
|
||||
operations.recordSignal({ orgId, source: "skill_resolver", success: true, durationMs: null, detail: {} });
|
||||
expect(connection.db.prepare("select signal_key, source from operational_events where org_id = ?").all(orgId))
|
||||
.toEqual([{ signal_key: "skill_resolve_success", source: "skill_resolver" }]);
|
||||
expect(() => operations.recordSignal({ orgId, source: "replay_eval" as "skill_resolver", success: true, durationMs: null, detail: {} }))
|
||||
.toThrow('"replay_eval" is not a runtime signal source.');
|
||||
connection.close();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user