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
@@ -3,7 +3,6 @@ import { createHash } from "node:crypto";
|
||||
import { resolve } from "node:path";
|
||||
import { DatabaseSync, type StatementSync } from "node:sqlite";
|
||||
import type { CreateMigrationReportInput } from "../../shared/commands";
|
||||
import { SLO_SIGNAL_KEY } from "../../shared/domain";
|
||||
import { createId } from "../../shared/ids";
|
||||
import { AuditService } from "./audit-service";
|
||||
import { buildMigrationValidationSummary, type MigrationValidationSummary } from "./migration-validation-summary";
|
||||
@@ -343,7 +342,6 @@ export class MigrationService {
|
||||
});
|
||||
this.operations.recordSignal({
|
||||
orgId: input.orgId,
|
||||
signalKey: SLO_SIGNAL_KEY.MIGRATION_VALIDATION_SUCCESS,
|
||||
source: "migration_validation",
|
||||
success: validationSummary.passed,
|
||||
durationMs: null,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
import type { SetFeatureFlagInput } from "../../shared/commands";
|
||||
import { FEATURE_FLAG_KEY, SLO_SIGNAL_KEY, type FeatureFlagKey, type SloSignalKey } from "../../shared/domain";
|
||||
import { FEATURE_FLAG_KEY, SLO_SIGNAL_KEY, type FeatureFlagKey } from "../../shared/domain";
|
||||
import { createId } from "../../shared/ids";
|
||||
import { AuditService } from "./audit-service";
|
||||
|
||||
@@ -10,10 +10,18 @@ const FEATURE_FLAGS = [
|
||||
{ key: FEATURE_FLAG_KEY.BOARD_INTERVENTION, label: "Board intervention", enabled: true },
|
||||
] as const;
|
||||
|
||||
/** Each runtime source and the one signal it reports; drills and self-checks have no source here, so they cannot pass as real traffic. */
|
||||
const SIGNAL_OF_SOURCE = {
|
||||
provider_gateway: SLO_SIGNAL_KEY.PROVIDER_REQUEST_SUCCESS,
|
||||
approval_routing: SLO_SIGNAL_KEY.APPROVAL_ROUTE_COVERAGE,
|
||||
skill_resolver: SLO_SIGNAL_KEY.SKILL_RESOLVE_SUCCESS,
|
||||
migration_validation: SLO_SIGNAL_KEY.MIGRATION_VALIDATION_SUCCESS,
|
||||
} as const;
|
||||
export type SignalSource = keyof typeof SIGNAL_OF_SOURCE;
|
||||
|
||||
const SLO_TARGETS = [
|
||||
{ signalKey: SLO_SIGNAL_KEY.PROVIDER_REQUEST_SUCCESS, label: "Provider requests", targetBasisPoints: 9950, windowMinutes: 43200 },
|
||||
{ signalKey: SLO_SIGNAL_KEY.APPROVAL_ROUTE_COVERAGE, label: "Approval routing", targetBasisPoints: 10000, windowMinutes: 43200 },
|
||||
{ signalKey: SLO_SIGNAL_KEY.BROWSER_SESSION_BOUNDARY, label: "Browser session boundary", targetBasisPoints: 10000, windowMinutes: 43200 },
|
||||
{ signalKey: SLO_SIGNAL_KEY.SKILL_RESOLVE_SUCCESS, label: "Skill resolve", targetBasisPoints: 9950, windowMinutes: 43200 },
|
||||
{ signalKey: SLO_SIGNAL_KEY.MIGRATION_VALIDATION_SUCCESS, label: "Migration validation", targetBasisPoints: 10000, windowMinutes: 43200 },
|
||||
] as const;
|
||||
@@ -68,21 +76,15 @@ export class OperationsService {
|
||||
return row.enabled === 1;
|
||||
}
|
||||
|
||||
recordSignal(input: {
|
||||
orgId: string;
|
||||
signalKey: SloSignalKey;
|
||||
source: string;
|
||||
success: boolean;
|
||||
durationMs: number | null;
|
||||
detail: unknown;
|
||||
}): void {
|
||||
recordSignal(input: { orgId: string; source: SignalSource; success: boolean; durationMs: number | null; detail: unknown }): void {
|
||||
if (!Object.hasOwn(SIGNAL_OF_SOURCE, input.source)) throw new Error(`"${input.source}" is not a runtime signal source.`);
|
||||
this.db.prepare(`
|
||||
insert into operational_events(id, org_id, signal_key, source, success, duration_ms, detail_json, created_at)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`).run(
|
||||
createId("ope"),
|
||||
input.orgId,
|
||||
input.signalKey,
|
||||
SIGNAL_OF_SOURCE[input.source],
|
||||
input.source,
|
||||
input.success ? 1 : 0,
|
||||
input.durationMs,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
import type { CreateAgentInput } from "../../shared/commands";
|
||||
import { RISK_LEVEL, ROUTE_TO_TYPE, SLO_SIGNAL_KEY, type RiskLevel } from "../../shared/domain";
|
||||
import { RISK_LEVEL, ROUTE_TO_TYPE, type RiskLevel } from "../../shared/domain";
|
||||
import { createId } from "../../shared/ids";
|
||||
import { AuditService } from "./audit-service";
|
||||
import { OperationsService } from "./operations-service";
|
||||
@@ -117,7 +117,6 @@ export class OrgGovernanceService {
|
||||
});
|
||||
this.operations.recordSignal({
|
||||
orgId: input.orgId,
|
||||
signalKey: SLO_SIGNAL_KEY.APPROVAL_ROUTE_COVERAGE,
|
||||
source: "approval_routing",
|
||||
success: true,
|
||||
durationMs: null,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
import { SLO_SIGNAL_KEY, type ProviderExecutionMode } from "../../shared/domain";
|
||||
import type { ProviderExecutionMode } from "../../shared/domain";
|
||||
import type { ProviderObservedRateLimitState } from "../../shared/provider-runtime-domain";
|
||||
import { AuditService } from "./audit-service";
|
||||
import { OperationsService } from "./operations-service";
|
||||
@@ -59,7 +59,6 @@ export class ProviderResponseObserver {
|
||||
});
|
||||
this.operations.recordSignal({
|
||||
orgId: input.orgId,
|
||||
signalKey: SLO_SIGNAL_KEY.PROVIDER_REQUEST_SUCCESS,
|
||||
source: "provider_gateway",
|
||||
success: true,
|
||||
durationMs: Date.now() - input.startedAt,
|
||||
@@ -85,7 +84,6 @@ export class ProviderResponseObserver {
|
||||
this.recordProviderHealth(input.provider.id, input.orgId, HEALTH_STATE_FAILED, message);
|
||||
this.operations.recordSignal({
|
||||
orgId: input.orgId,
|
||||
signalKey: SLO_SIGNAL_KEY.PROVIDER_REQUEST_SUCCESS,
|
||||
source: "provider_gateway",
|
||||
success: false,
|
||||
durationMs: Date.now() - input.startedAt,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
import type { BindSkillInput, ImportSkillDirectoryInput, ResolveAgentSkillsInput, RunSkillTestsInput } from "../../shared/commands";
|
||||
import { SLO_SIGNAL_KEY } from "../../shared/domain";
|
||||
import { createId } from "../../shared/ids";
|
||||
import { AuditService } from "./audit-service";
|
||||
import { OperationsService } from "./operations-service";
|
||||
@@ -390,7 +389,6 @@ export class SkillService {
|
||||
});
|
||||
this.operations.recordSignal({
|
||||
orgId: input.orgId,
|
||||
signalKey: SLO_SIGNAL_KEY.SKILL_RESOLVE_SUCCESS,
|
||||
source: "skill_resolver",
|
||||
success: true,
|
||||
durationMs: null,
|
||||
|
||||
Reference in new issue
Block a user