@derwinjs/db 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-promotion-evaluator.d.ts +63 -0
- package/dist/auto-promotion-evaluator.d.ts.map +1 -0
- package/dist/auto-promotion-evaluator.js +195 -0
- package/dist/auto-promotion-evaluator.js.map +1 -0
- package/dist/budget-gate.d.ts +43 -0
- package/dist/budget-gate.d.ts.map +1 -0
- package/dist/budget-gate.js +110 -0
- package/dist/budget-gate.js.map +1 -0
- package/dist/classification-override-store.d.ts +24 -0
- package/dist/classification-override-store.d.ts.map +1 -0
- package/dist/classification-override-store.js +131 -0
- package/dist/classification-override-store.js.map +1 -0
- package/dist/freeze-window-evaluator.d.ts +62 -0
- package/dist/freeze-window-evaluator.d.ts.map +1 -0
- package/dist/freeze-window-evaluator.js +236 -0
- package/dist/freeze-window-evaluator.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/kill-switch-evaluator.d.ts +68 -0
- package/dist/kill-switch-evaluator.d.ts.map +1 -0
- package/dist/kill-switch-evaluator.js +389 -0
- package/dist/kill-switch-evaluator.js.map +1 -0
- package/dist/path-tier-resolver.d.ts +47 -0
- package/dist/path-tier-resolver.d.ts.map +1 -0
- package/dist/path-tier-resolver.js +177 -0
- package/dist/path-tier-resolver.js.map +1 -0
- package/dist/project-mode-store.d.ts +28 -0
- package/dist/project-mode-store.d.ts.map +1 -0
- package/dist/project-mode-store.js +126 -0
- package/dist/project-mode-store.js.map +1 -0
- package/dist/trust-threshold-config-store.d.ts +20 -0
- package/dist/trust-threshold-config-store.d.ts.map +1 -0
- package/dist/trust-threshold-config-store.js +88 -0
- package/dist/trust-threshold-config-store.js.map +1 -0
- package/package.json +3 -3
- package/prisma/migrations/20260507120000_sprint8_policy_governance/migration.sql +58 -0
- package/prisma/migrations/20260507120100_sprint8_phase2_thresholds_and_freeze/migration.sql +33 -0
- package/prisma/migrations/20260507120200_sprint8_phase3_budget_cap/migration.sql +21 -0
- package/prisma/migrations/20260507120300_sprint8_phase4_kill_switches/migration.sql +74 -0
- package/prisma/schema.prisma +183 -11
- package/prisma-client/edge.js +96 -19
- package/prisma-client/index-browser.js +93 -16
- package/prisma-client/index.d.ts +10997 -3426
- package/prisma-client/index.js +96 -19
- package/prisma-client/package.json +1 -1
- package/prisma-client/schema.prisma +183 -11
- package/prisma-client/wasm.js +93 -16
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createPrismaFreezeWindowEvaluator — Prisma-backed implementation of the
|
|
3
|
+
* SDK FreezeWindowEvaluator contract introduced by QAP-083.
|
|
4
|
+
*
|
|
5
|
+
* Sprint 8 Phase 2 (Policy Governance). Operator-defined recurring time
|
|
6
|
+
* windows during which auto-fix dispatch is partially or fully blocked.
|
|
7
|
+
*
|
|
8
|
+
* # Cron evaluator
|
|
9
|
+
*
|
|
10
|
+
* Embedded, dependency-free. Supports a SUBSET of standard 5-field cron:
|
|
11
|
+
* `minute hour dayOfMonth month dayOfWeek`. Each field accepts:
|
|
12
|
+
* - `*` — wildcard (any value in the field's allowed range)
|
|
13
|
+
* - exact non-negative integer in the field's allowed range
|
|
14
|
+
*
|
|
15
|
+
* NOT supported (intentional MVP scope): `*\/N` step values, `M-N` ranges,
|
|
16
|
+
* comma-separated lists, named months/days, `?`, `L`, `W`, `#`. Sprint 9's
|
|
17
|
+
* policy editor may extend this when richer scheduling is needed; until
|
|
18
|
+
* then, operators compose multiple FreezeWindow rows for OR semantics
|
|
19
|
+
* (e.g., separate rows for "every Friday 5pm" and "every Saturday 9am").
|
|
20
|
+
*
|
|
21
|
+
* Algorithm: `mostRecentFire(cron, at)` walks BACKWARDS minute-by-minute
|
|
22
|
+
* from `at` for at most `MAX_LOOKBACK_MINUTES` and returns the first time
|
|
23
|
+
* the cron matches. The dispatcher only ever asks "did this fire within
|
|
24
|
+
* the past durationMinutes?"; we cap the search at 7 days of minutes
|
|
25
|
+
* (10080) which comfortably exceeds any practical durationMinutes.
|
|
26
|
+
*
|
|
27
|
+
* # Tenant isolation
|
|
28
|
+
*
|
|
29
|
+
* Every method scopes by projectId. Pattern D — wrong-project /
|
|
30
|
+
* unknown-project queries return empty arrays / not_found errors.
|
|
31
|
+
*/
|
|
32
|
+
import type { PrismaClient } from './prisma.js';
|
|
33
|
+
import { type FreezeWindowEvaluator } from '@derwinjs/sdk';
|
|
34
|
+
export interface PrismaFreezeWindowEvaluatorConfig {
|
|
35
|
+
/** Generated Prisma client. Pass an instance per process. */
|
|
36
|
+
prisma: PrismaClient;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parsed cron — each field is either null (wildcard `*`) or a literal int.
|
|
40
|
+
*/
|
|
41
|
+
interface ParsedCron {
|
|
42
|
+
minute: number | null;
|
|
43
|
+
hour: number | null;
|
|
44
|
+
dayOfMonth: number | null;
|
|
45
|
+
month: number | null;
|
|
46
|
+
dayOfWeek: number | null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parse a 5-field cron expression. Throws FreezeWindowEvaluatorError
|
|
50
|
+
* (`invalid_cron`) on bad input. Whitespace-tolerant — splits on /\s+/.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseCron(expr: string): ParsedCron;
|
|
53
|
+
/**
|
|
54
|
+
* Find the most recent time at or before `at` when the cron fires.
|
|
55
|
+
* Returns null if no fire within the past MAX_LOOKBACK_MINUTES (which
|
|
56
|
+
* exceeds any practical durationMinutes — windows beyond a week are out
|
|
57
|
+
* of scope for the MVP).
|
|
58
|
+
*/
|
|
59
|
+
export declare function mostRecentFire(cron: ParsedCron, at: Date): Date | null;
|
|
60
|
+
export declare function createPrismaFreezeWindowEvaluator(config: PrismaFreezeWindowEvaluatorConfig): FreezeWindowEvaluator;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=freeze-window-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freeze-window-evaluator.d.ts","sourceRoot":"","sources":["../src/freeze-window-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,iCAAiC;IAChD,6DAA6D;IAC7D,MAAM,EAAE,YAAY,CAAC;CACtB;AAmBD;;GAEG;AACH,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAyClD;AAgCD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAoBtE;AA+ED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,iCAAiC,GACxC,qBAAqB,CA4DvB"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createPrismaFreezeWindowEvaluator — Prisma-backed implementation of the
|
|
3
|
+
* SDK FreezeWindowEvaluator contract introduced by QAP-083.
|
|
4
|
+
*
|
|
5
|
+
* Sprint 8 Phase 2 (Policy Governance). Operator-defined recurring time
|
|
6
|
+
* windows during which auto-fix dispatch is partially or fully blocked.
|
|
7
|
+
*
|
|
8
|
+
* # Cron evaluator
|
|
9
|
+
*
|
|
10
|
+
* Embedded, dependency-free. Supports a SUBSET of standard 5-field cron:
|
|
11
|
+
* `minute hour dayOfMonth month dayOfWeek`. Each field accepts:
|
|
12
|
+
* - `*` — wildcard (any value in the field's allowed range)
|
|
13
|
+
* - exact non-negative integer in the field's allowed range
|
|
14
|
+
*
|
|
15
|
+
* NOT supported (intentional MVP scope): `*\/N` step values, `M-N` ranges,
|
|
16
|
+
* comma-separated lists, named months/days, `?`, `L`, `W`, `#`. Sprint 9's
|
|
17
|
+
* policy editor may extend this when richer scheduling is needed; until
|
|
18
|
+
* then, operators compose multiple FreezeWindow rows for OR semantics
|
|
19
|
+
* (e.g., separate rows for "every Friday 5pm" and "every Saturday 9am").
|
|
20
|
+
*
|
|
21
|
+
* Algorithm: `mostRecentFire(cron, at)` walks BACKWARDS minute-by-minute
|
|
22
|
+
* from `at` for at most `MAX_LOOKBACK_MINUTES` and returns the first time
|
|
23
|
+
* the cron matches. The dispatcher only ever asks "did this fire within
|
|
24
|
+
* the past durationMinutes?"; we cap the search at 7 days of minutes
|
|
25
|
+
* (10080) which comfortably exceeds any practical durationMinutes.
|
|
26
|
+
*
|
|
27
|
+
* # Tenant isolation
|
|
28
|
+
*
|
|
29
|
+
* Every method scopes by projectId. Pattern D — wrong-project /
|
|
30
|
+
* unknown-project queries return empty arrays / not_found errors.
|
|
31
|
+
*/
|
|
32
|
+
import { FreezeWindowEvaluatorError, } from '@derwinjs/sdk';
|
|
33
|
+
// ─── Cron evaluator (embedded, dependency-free) ──────────────────────────
|
|
34
|
+
/**
|
|
35
|
+
* Per-field allowed range. dayOfMonth/month are 1-indexed; minute, hour,
|
|
36
|
+
* and dayOfWeek are 0-indexed. dayOfWeek: 0 = Sunday, 6 = Saturday
|
|
37
|
+
* (POSIX cron convention).
|
|
38
|
+
*/
|
|
39
|
+
const FIELD_RANGES = [
|
|
40
|
+
[0, 59], // minute
|
|
41
|
+
[0, 23], // hour
|
|
42
|
+
[1, 31], // dayOfMonth
|
|
43
|
+
[1, 12], // month
|
|
44
|
+
[0, 6], // dayOfWeek
|
|
45
|
+
];
|
|
46
|
+
const FIELD_NAMES = ['minute', 'hour', 'dayOfMonth', 'month', 'dayOfWeek'];
|
|
47
|
+
/**
|
|
48
|
+
* Parse a 5-field cron expression. Throws FreezeWindowEvaluatorError
|
|
49
|
+
* (`invalid_cron`) on bad input. Whitespace-tolerant — splits on /\s+/.
|
|
50
|
+
*/
|
|
51
|
+
export function parseCron(expr) {
|
|
52
|
+
if (typeof expr !== 'string' || expr.trim().length === 0) {
|
|
53
|
+
throw new FreezeWindowEvaluatorError('invalid_cron', 'FreezeWindowEvaluator: cronExpression must be a non-empty string');
|
|
54
|
+
}
|
|
55
|
+
const fields = expr.trim().split(/\s+/);
|
|
56
|
+
if (fields.length !== 5) {
|
|
57
|
+
throw new FreezeWindowEvaluatorError('invalid_cron', `FreezeWindowEvaluator: cronExpression must have 5 fields (got ${String(fields.length)}: ${JSON.stringify(expr)})`);
|
|
58
|
+
}
|
|
59
|
+
const parsed = [];
|
|
60
|
+
for (const [i, raw] of fields.entries()) {
|
|
61
|
+
const range = FIELD_RANGES[i];
|
|
62
|
+
const fieldName = FIELD_NAMES[i];
|
|
63
|
+
if (range === undefined || fieldName === undefined)
|
|
64
|
+
continue;
|
|
65
|
+
const [min, max] = range;
|
|
66
|
+
if (raw === '*') {
|
|
67
|
+
parsed.push(null);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!/^\d+$/.test(raw)) {
|
|
71
|
+
throw new FreezeWindowEvaluatorError('invalid_cron', `FreezeWindowEvaluator: ${fieldName} must be '*' or an integer (got ${JSON.stringify(raw)})`);
|
|
72
|
+
}
|
|
73
|
+
const n = Number.parseInt(raw, 10);
|
|
74
|
+
if (n < min || n > max) {
|
|
75
|
+
throw new FreezeWindowEvaluatorError('invalid_cron', `FreezeWindowEvaluator: ${fieldName} must be in [${String(min)}, ${String(max)}] (got ${String(n)})`);
|
|
76
|
+
}
|
|
77
|
+
parsed.push(n);
|
|
78
|
+
}
|
|
79
|
+
const [minute = null, hour = null, dayOfMonth = null, month = null, dayOfWeek = null] = parsed;
|
|
80
|
+
return { minute, hour, dayOfMonth, month, dayOfWeek };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* True iff the supplied Date matches the parsed cron.
|
|
84
|
+
*
|
|
85
|
+
* NOTE: cron's POSIX convention is that dayOfMonth and dayOfWeek are
|
|
86
|
+
* OR-combined when BOTH are restricted (non-`*`). When at least one is `*`,
|
|
87
|
+
* the other applies normally. This impl follows that convention.
|
|
88
|
+
*/
|
|
89
|
+
function cronMatches(cron, at) {
|
|
90
|
+
const minute = at.getUTCMinutes();
|
|
91
|
+
const hour = at.getUTCHours();
|
|
92
|
+
const dom = at.getUTCDate();
|
|
93
|
+
const month = at.getUTCMonth() + 1; // JS month is 0-indexed
|
|
94
|
+
const dow = at.getUTCDay();
|
|
95
|
+
if (cron.minute !== null && cron.minute !== minute)
|
|
96
|
+
return false;
|
|
97
|
+
if (cron.hour !== null && cron.hour !== hour)
|
|
98
|
+
return false;
|
|
99
|
+
if (cron.month !== null && cron.month !== month)
|
|
100
|
+
return false;
|
|
101
|
+
// POSIX dom/dow OR semantics.
|
|
102
|
+
if (cron.dayOfMonth !== null && cron.dayOfWeek !== null) {
|
|
103
|
+
if (cron.dayOfMonth !== dom && cron.dayOfWeek !== dow)
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
if (cron.dayOfMonth !== null && cron.dayOfMonth !== dom)
|
|
108
|
+
return false;
|
|
109
|
+
if (cron.dayOfWeek !== null && cron.dayOfWeek !== dow)
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
const MAX_LOOKBACK_MINUTES = 60 * 24 * 7; // 7 days
|
|
115
|
+
/**
|
|
116
|
+
* Find the most recent time at or before `at` when the cron fires.
|
|
117
|
+
* Returns null if no fire within the past MAX_LOOKBACK_MINUTES (which
|
|
118
|
+
* exceeds any practical durationMinutes — windows beyond a week are out
|
|
119
|
+
* of scope for the MVP).
|
|
120
|
+
*/
|
|
121
|
+
export function mostRecentFire(cron, at) {
|
|
122
|
+
// Round down to the start of the current minute — cron fires at minute
|
|
123
|
+
// boundaries. seconds/milliseconds set to zero.
|
|
124
|
+
const start = new Date(Date.UTC(at.getUTCFullYear(), at.getUTCMonth(), at.getUTCDate(), at.getUTCHours(), at.getUTCMinutes(), 0, 0));
|
|
125
|
+
let cursor = start;
|
|
126
|
+
for (let i = 0; i <= MAX_LOOKBACK_MINUTES; i++) {
|
|
127
|
+
if (cronMatches(cron, cursor))
|
|
128
|
+
return cursor;
|
|
129
|
+
cursor = new Date(cursor.getTime() - 60_000);
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* True iff the freeze window is active at `at` — i.e., its cron fired
|
|
135
|
+
* within the past `durationMinutes`.
|
|
136
|
+
*/
|
|
137
|
+
function windowIsActive(cronExpression, durationMinutes, at) {
|
|
138
|
+
let cron;
|
|
139
|
+
try {
|
|
140
|
+
cron = parseCron(cronExpression);
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
// A corrupted row should not crash the dispatcher. Treat it as inactive
|
|
144
|
+
// (defense-in-depth) — the createWindow validator prevents bad cron at
|
|
145
|
+
// write time, so this branch is for legacy / direct-DB-edit cases.
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
const lastFire = mostRecentFire(cron, at);
|
|
149
|
+
if (lastFire === null)
|
|
150
|
+
return false;
|
|
151
|
+
return at.getTime() - lastFire.getTime() < durationMinutes * 60_000;
|
|
152
|
+
}
|
|
153
|
+
// ─── Validation ──────────────────────────────────────────────────────────
|
|
154
|
+
function validateCreateInput(input) {
|
|
155
|
+
if (typeof input.projectId !== 'string' || input.projectId.length === 0) {
|
|
156
|
+
throw new FreezeWindowEvaluatorError('invalid_input', 'FreezeWindowEvaluator: projectId is required');
|
|
157
|
+
}
|
|
158
|
+
if (typeof input.label !== 'string' || input.label.trim().length === 0) {
|
|
159
|
+
throw new FreezeWindowEvaluatorError('invalid_input', 'FreezeWindowEvaluator: label is required');
|
|
160
|
+
}
|
|
161
|
+
if (typeof input.durationMinutes !== 'number' ||
|
|
162
|
+
!Number.isFinite(input.durationMinutes) ||
|
|
163
|
+
!Number.isInteger(input.durationMinutes) ||
|
|
164
|
+
input.durationMinutes <= 0) {
|
|
165
|
+
throw new FreezeWindowEvaluatorError('invalid_input', `FreezeWindowEvaluator: durationMinutes must be a positive integer (got ${String(input.durationMinutes)})`);
|
|
166
|
+
}
|
|
167
|
+
// parseCron throws invalid_cron on bad input.
|
|
168
|
+
parseCron(input.cronExpression);
|
|
169
|
+
}
|
|
170
|
+
function mapWindow(row) {
|
|
171
|
+
return {
|
|
172
|
+
id: row.id,
|
|
173
|
+
projectId: row.projectId,
|
|
174
|
+
cronExpression: row.cronExpression,
|
|
175
|
+
durationMinutes: row.durationMinutes,
|
|
176
|
+
label: row.label,
|
|
177
|
+
blocksDispatch: row.blocksDispatch,
|
|
178
|
+
enabled: row.enabled,
|
|
179
|
+
createdAt: row.createdAt,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
// ─── Factory ─────────────────────────────────────────────────────────────
|
|
183
|
+
export function createPrismaFreezeWindowEvaluator(config) {
|
|
184
|
+
const { prisma } = config;
|
|
185
|
+
return {
|
|
186
|
+
async getActiveWindows(input) {
|
|
187
|
+
const at = input.at ?? new Date();
|
|
188
|
+
const rows = await prisma.freezeWindow.findMany({
|
|
189
|
+
where: { projectId: input.projectId, enabled: true },
|
|
190
|
+
});
|
|
191
|
+
return rows
|
|
192
|
+
.filter((row) => windowIsActive(row.cronExpression, row.durationMinutes, at))
|
|
193
|
+
.map(mapWindow);
|
|
194
|
+
},
|
|
195
|
+
async isDispatchBlocked(input) {
|
|
196
|
+
const at = input.at ?? new Date();
|
|
197
|
+
const rows = await prisma.freezeWindow.findMany({
|
|
198
|
+
where: { projectId: input.projectId, enabled: true, blocksDispatch: true },
|
|
199
|
+
});
|
|
200
|
+
return rows.some((row) => windowIsActive(row.cronExpression, row.durationMinutes, at));
|
|
201
|
+
},
|
|
202
|
+
async listWindows(input) {
|
|
203
|
+
const rows = await prisma.freezeWindow.findMany({
|
|
204
|
+
where: { projectId: input.projectId },
|
|
205
|
+
orderBy: { createdAt: 'desc' },
|
|
206
|
+
});
|
|
207
|
+
return rows.map(mapWindow);
|
|
208
|
+
},
|
|
209
|
+
async createWindow(input) {
|
|
210
|
+
validateCreateInput(input);
|
|
211
|
+
const row = await prisma.freezeWindow.create({
|
|
212
|
+
data: {
|
|
213
|
+
projectId: input.projectId,
|
|
214
|
+
cronExpression: input.cronExpression,
|
|
215
|
+
durationMinutes: input.durationMinutes,
|
|
216
|
+
label: input.label,
|
|
217
|
+
blocksDispatch: input.blocksDispatch,
|
|
218
|
+
enabled: input.enabled,
|
|
219
|
+
},
|
|
220
|
+
select: { id: true },
|
|
221
|
+
});
|
|
222
|
+
return { id: row.id };
|
|
223
|
+
},
|
|
224
|
+
async deleteWindow(input) {
|
|
225
|
+
const existing = await prisma.freezeWindow.findFirst({
|
|
226
|
+
where: { id: input.windowId, projectId: input.projectId },
|
|
227
|
+
select: { id: true },
|
|
228
|
+
});
|
|
229
|
+
if (existing === null) {
|
|
230
|
+
throw new FreezeWindowEvaluatorError('not_found', `FreezeWindow ${input.windowId} not found in project ${input.projectId}`);
|
|
231
|
+
}
|
|
232
|
+
await prisma.freezeWindow.delete({ where: { id: input.windowId } });
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=freeze-window-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freeze-window-evaluator.js","sourceRoot":"","sources":["../src/freeze-window-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EACL,0BAA0B,GAG3B,MAAM,eAAe,CAAC;AAS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,EAAE,KAAK,CAAC,SAAS;oBAC1B,cAAc,EAAE,KAAK,CAAC,cAAc;oBACpC,eAAe,EAAE,KAAK,CAAC,eAAe;oBACtC,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,cAAc,EAAE,KAAK,CAAC,cAAc;oBACpC,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB;gBACD,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;aACrB,CAAC,CAAC;YACH,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC;QACxB,CAAC;QAED,KAAK,CAAC,YAAY,CAAC,KAA8C;YAC/D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC;gBACnD,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE;gBACzD,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;aACrB,CAAC,CAAC;YACH,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACtB,MAAM,IAAI,0BAA0B,CAClC,WAAW,EACX,gBAAgB,KAAK,CAAC,QAAQ,yBAAyB,KAAK,CAAC,SAAS,EAAE,CACzE,CAAC;YACJ,CAAC;YACD,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACtE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -25,5 +25,13 @@ export { createPrismaLearningHealthReporter, type PrismaLearningHealthReporterCo
|
|
|
25
25
|
export { createPrismaCoverageGapReporter, type PrismaCoverageGapReporterConfig, } from './coverage-gap-reporter.js';
|
|
26
26
|
export { createPrismaRegressionDetector, type PrismaRegressionDetectorConfig, } from './regression-detector.js';
|
|
27
27
|
export { createPrismaDriftDetector, type PrismaDriftDetectorConfig } from './drift-detector.js';
|
|
28
|
+
export { createPrismaPathTierResolver, matchGlob, type PrismaPathTierResolverConfig, } from './path-tier-resolver.js';
|
|
29
|
+
export { createPrismaClassificationOverrideStore, type PrismaClassificationOverrideStoreConfig, } from './classification-override-store.js';
|
|
30
|
+
export { createPrismaTrustThresholdConfigStore, type PrismaTrustThresholdConfigStoreConfig, } from './trust-threshold-config-store.js';
|
|
31
|
+
export { createPrismaFreezeWindowEvaluator, parseCron, mostRecentFire, type PrismaFreezeWindowEvaluatorConfig, } from './freeze-window-evaluator.js';
|
|
32
|
+
export { createPrismaBudgetGate, type PrismaBudgetGateConfig } from './budget-gate.js';
|
|
33
|
+
export { createPrismaKillSwitchEvaluator, DEFAULT_KILL_SWITCH_THRESHOLDS, type PrismaKillSwitchEvaluatorConfig, } from './kill-switch-evaluator.js';
|
|
34
|
+
export { createPrismaProjectModeStore, type PrismaProjectModeStoreConfig, } from './project-mode-store.js';
|
|
35
|
+
export { createPrismaAutoPromotionEvaluator, DEFAULT_PROMOTION_THRESHOLDS, type PrismaAutoPromotionEvaluatorConfig, } from './auto-promotion-evaluator.js';
|
|
28
36
|
export * from './prisma.js';
|
|
29
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,YAAY,EAAG,cAAuB,CAAC;AAIpD,OAAO,EAAE,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EACL,6BAA6B,EAC7B,KAAK,6BAA6B,GACnC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,KAAK,0BAA0B,EAAE,MAAM,u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C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,+BAA+B,EAC/B,KAAK,+BAA+B,GACrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,KAAK,8BAA8B,GACpC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EACL,4BAA4B,EAC5B,SAAS,EACT,KAAK,4BAA4B,GAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,uCAAuC,EACvC,KAAK,uCAAuC,GAC7C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,qCAAqC,EACrC,KAAK,qCAAqC,GAC3C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,iCAAiC,EACjC,SAAS,EACT,cAAc,EACd,KAAK,iCAAiC,GACvC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC9B,KAAK,+BAA+B,GACrC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,KAAK,4BAA4B,GAClC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,kCAAkC,EAClC,4BAA4B,EAC5B,KAAK,kCAAkC,GACxC,MAAM,+BAA+B,CAAC;AA4BvC,cAAc,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,14 @@ export { createPrismaLearningHealthReporter, } from './learning-health-reporter.
|
|
|
26
26
|
export { createPrismaCoverageGapReporter, } from './coverage-gap-reporter.js';
|
|
27
27
|
export { createPrismaRegressionDetector, } from './regression-detector.js';
|
|
28
28
|
export { createPrismaDriftDetector } from './drift-detector.js';
|
|
29
|
+
export { createPrismaPathTierResolver, matchGlob, } from './path-tier-resolver.js';
|
|
30
|
+
export { createPrismaClassificationOverrideStore, } from './classification-override-store.js';
|
|
31
|
+
export { createPrismaTrustThresholdConfigStore, } from './trust-threshold-config-store.js';
|
|
32
|
+
export { createPrismaFreezeWindowEvaluator, parseCron, mostRecentFire, } from './freeze-window-evaluator.js';
|
|
33
|
+
export { createPrismaBudgetGate } from './budget-gate.js';
|
|
34
|
+
export { createPrismaKillSwitchEvaluator, DEFAULT_KILL_SWITCH_THRESHOLDS, } from './kill-switch-evaluator.js';
|
|
35
|
+
export { createPrismaProjectModeStore, } from './project-mode-store.js';
|
|
36
|
+
export { createPrismaAutoPromotionEvaluator, DEFAULT_PROMOTION_THRESHOLDS, } from './auto-promotion-evaluator.js';
|
|
29
37
|
// ─── Prisma client re-export ─────────────────────────────────────────────
|
|
30
38
|
//
|
|
31
39
|
// @derwinjs/db ships its OWN generated Prisma client (output: prisma-client/
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,cAAuB,CAAC;AAEpD,4EAA4E;AAE5E,OAAO,EAAE,yBAAyB,EAAkC,MAAM,sBAAsB,CAAC;AACjG,OAAO,EACL,6BAA6B,GAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAA+B,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAmC,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAkC,MAAM,sBAAsB,CAAC;AACjG,OAAO,EACL,6BAA6B,GAE9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iCAAiC,GAElC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,kCAAkC,GAEnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,+BAA+B,GAEhC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,GAE/B,MA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BAAyB,CAAC;AACjC,OAAO,EACL,kCAAkC,EAClC,4BAA4B,GAE7B,MAAM,+BAA+B,CAAC;AAEvC,4EAA4E;AAC5E,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,sEAAsE;AACtE,wEAAwE;AACxE,wEAAwE;AACxE,gDAAgD;AAChD,EAAE;AACF,+DAA+D;AAC/D,0EAA0E;AAC1E,yCAAyC;AACzC,+EAA+E;AAC/E,yCAAyC;AACzC,uEAAuE;AACvE,sEAAsE;AACtE,kEAAkE;AAClE,+BAA+B;AAC/B,EAAE;AACF,oBAAoB;AACpB,8DAA8D;AAC9D,4CAA4C;AAC5C,qEAAqE;AACrE,QAAQ;AACR,gDAAgD;AAEhD,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* createPrismaKillSwitchEvaluator — Prisma-backed implementation of the
|
|
3
|
+
* SDK KillSwitchEvaluator contract introduced by QAP-085 / QAP-086 / QAP-087.
|
|
4
|
+
*
|
|
5
|
+
* Sprint 8 Phase 4 (Policy Governance). Three independent triggers that
|
|
6
|
+
* halt auto-fix activity when recent telemetry indicates the platform is
|
|
7
|
+
* misbehaving:
|
|
8
|
+
*
|
|
9
|
+
* 1. SUCCESS_RATE_DROP (QAP-085) — per-(classification, surface):
|
|
10
|
+
* For each (classification, surface) seen in recent MERGED attempts
|
|
11
|
+
* (last 30 days), compute success rate as
|
|
12
|
+
* `(mergedClean + mergedWithEdits) / total`. If `total >= minSample`
|
|
13
|
+
* AND `successRate < threshold`, trip a CLASSIFICATION-scope switch.
|
|
14
|
+
*
|
|
15
|
+
* 2. CONSECUTIVE_FAILURE (QAP-086) — per-project: count attempts in
|
|
16
|
+
* the last `consecutiveFailureWindowHours` for the project ordered
|
|
17
|
+
* by attemptedAt desc. If the FIRST N are all PRE_VERIFY_FAILED,
|
|
18
|
+
* trip a PROJECT-scope switch.
|
|
19
|
+
*
|
|
20
|
+
* 3. REGRESSION_CASCADE (QAP-087) — platform-wide: count attempts
|
|
21
|
+
* across ALL projects where `autoRevertedAt` is within the last
|
|
22
|
+
* `regressionCascadeWindowHours`. If `>=N`, trip a PLATFORM-scope
|
|
23
|
+
* switch (projectId IS NULL).
|
|
24
|
+
*
|
|
25
|
+
* # History semantics
|
|
26
|
+
*
|
|
27
|
+
* Trips are history-preserving — when a trigger evaluates positive on a
|
|
28
|
+
* tuple that already has an engaged row, the existing row is preserved.
|
|
29
|
+
* When it evaluates positive on a tuple with only unblocked rows (or
|
|
30
|
+
* none), a new row is inserted. This means the audit trail shows every
|
|
31
|
+
* trip across time without losing prior unblock provenance.
|
|
32
|
+
*
|
|
33
|
+
* # Tenant isolation
|
|
34
|
+
*
|
|
35
|
+
* Every method scopes by projectId. Pattern D — wrong-project / unknown-
|
|
36
|
+
* project lookups for unblock return `not_found` (defense-in-depth
|
|
37
|
+
* against tenant enumeration). PLATFORM-scope switches have
|
|
38
|
+
* `projectId IS NULL` in storage; getEngaged unions per-project + platform
|
|
39
|
+
* rows so the dispatcher gate sees both.
|
|
40
|
+
*/
|
|
41
|
+
import type { PrismaClient } from './prisma.js';
|
|
42
|
+
import { type KillSwitchEvaluator } from '@derwinjs/sdk';
|
|
43
|
+
export interface PrismaKillSwitchEvaluatorConfig {
|
|
44
|
+
/** Generated Prisma client. Pass an instance per process. */
|
|
45
|
+
prisma: PrismaClient;
|
|
46
|
+
/**
|
|
47
|
+
* Optional clock injection for deterministic window-boundary tests.
|
|
48
|
+
* Tests pass a fixed Date; production callers omit (defaults to
|
|
49
|
+
* `new Date()`).
|
|
50
|
+
*/
|
|
51
|
+
now?: () => Date;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Default thresholds applied when a project's `killSwitchConfig` JSON
|
|
55
|
+
* column is null. Operators tighten / loosen these per-project once the
|
|
56
|
+
* project has trust history. Picked conservatively so the platform errs
|
|
57
|
+
* on the side of halting too eagerly rather than missing a real problem.
|
|
58
|
+
*/
|
|
59
|
+
export declare const DEFAULT_KILL_SWITCH_THRESHOLDS: {
|
|
60
|
+
readonly successRateDropPct: 0.4;
|
|
61
|
+
readonly successRateMinSample: 10;
|
|
62
|
+
readonly consecutiveFailureN: 5;
|
|
63
|
+
readonly consecutiveFailureWindowHours: 24;
|
|
64
|
+
readonly regressionCascadeN: 3;
|
|
65
|
+
readonly regressionCascadeWindowHours: 6;
|
|
66
|
+
};
|
|
67
|
+
export declare function createPrismaKillSwitchEvaluator(config: PrismaKillSwitchEvaluatorConfig): KillSwitchEvaluator;
|
|
68
|
+
//# sourceMappingURL=kill-switch-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kill-switch-evaluator.d.ts","sourceRoot":"","sources":["../src/kill-switch-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAEL,KAAK,mBAAmB,EAIzB,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,+BAA+B;IAC9C,6DAA6D;IAC7D,MAAM,EAAE,YAAY,CAAC;IACrB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAID;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;;;;;;CAUjC,CAAC;AAoGX,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,+BAA+B,GACtC,mBAAmB,CA2TrB"}
|