@derwinjs/db 0.1.0 → 0.3.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/package.json +3 -3
- package/prisma/schema.prisma +66 -5
- package/prisma-client/edge.js +9 -5
- package/prisma-client/index-browser.js +3 -1
- package/prisma-client/index.d.ts +145 -1
- package/prisma-client/index.js +9 -5
- package/prisma-client/package.json +1 -1
- package/prisma-client/schema.prisma +66 -5
- package/prisma-client/wasm.js +3 -1
- package/prisma/migrations/20260501165631_init/migration.sql +0 -407
- package/prisma/migrations/20260503051425_0002_qap018b_qaticket_crosslink_fields/migration.sql +0 -6
- package/prisma/migrations/20260504231316_add_project_repofullname_and_webhooksecret/migration.sql +0 -12
- package/prisma/migrations/20260504232851_add_qaticket_resolvedby/migration.sql +0 -2
- package/prisma/migrations/20260505042646_add_qapattern_qarevert/migration.sql +0 -77
- package/prisma/migrations/20260505055826_add_qauniformity_and_agent_trigger/migration.sql +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@derwinjs/db",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Prisma schema + migrations for Derwin's own Postgres. 14 models, project-namespaced. Per ADR-0005. Ships its own generated Prisma client (multi-platform binaries) for cross-consumer compatibility.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@prisma/client": "^5.22.0",
|
|
36
|
-
"@derwinjs/core": "0.
|
|
37
|
-
"@derwinjs/sdk": "0.
|
|
36
|
+
"@derwinjs/core": "0.3.0",
|
|
37
|
+
"@derwinjs/sdk": "0.3.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@vitest/coverage-v8": "^2.1.9",
|
package/prisma/schema.prisma
CHANGED
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
// pgvector convention: `embedding Bytes?` on RAGCorpus is the v1 storage type.
|
|
15
15
|
// QAP-076 (Sprint 7 — RAG corpus add) switches it to a pgvector `vector(1536)`
|
|
16
16
|
// column once the extension is enabled in QAP-036.
|
|
17
|
+
//
|
|
18
|
+
// Multi-schema: every model + enum is in the `derwin` Postgres schema (not
|
|
19
|
+
// `public`). This isolates Derwin's tables from each consumer's existing
|
|
20
|
+
// schema — e.g., Lifeline's pre-extraction `public.qa_fix_attempts` stays
|
|
21
|
+
// untouched while Derwin's tables live at `derwin.qa_fix_attempts`. Required
|
|
22
|
+
// for the multi-tenant boundary rule: each consumer = ONE Project row, but
|
|
23
|
+
// each consumer also has its own pre-existing schema in `public`. (Added in
|
|
24
|
+
// QAP-019G when extracting Derwin into Lifeline first revealed the conflict.)
|
|
17
25
|
|
|
18
26
|
// Generator output is INSIDE the package so the generated client ships
|
|
19
27
|
// in the published tarball alongside dist/. Consumer code does
|
|
@@ -33,14 +41,16 @@
|
|
|
33
41
|
// tarball platform-dependent (whatever the publisher was running on).
|
|
34
42
|
// Intel Mac users (rare) add `darwin` locally via a re-generate.
|
|
35
43
|
generator client {
|
|
36
|
-
provider
|
|
37
|
-
output
|
|
38
|
-
binaryTargets
|
|
44
|
+
provider = "prisma-client-js"
|
|
45
|
+
output = "../prisma-client"
|
|
46
|
+
binaryTargets = ["darwin-arm64", "rhel-openssl-3.0.x", "linux-arm64-openssl-3.0.x"]
|
|
47
|
+
previewFeatures = ["multiSchema"]
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
datasource db {
|
|
42
51
|
provider = "postgresql"
|
|
43
52
|
url = env("DATABASE_URL")
|
|
53
|
+
schemas = ["derwin"]
|
|
44
54
|
}
|
|
45
55
|
|
|
46
56
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -61,8 +71,9 @@ model Project {
|
|
|
61
71
|
modeChangedBy String?
|
|
62
72
|
|
|
63
73
|
// Per-project quotas + budgets
|
|
64
|
-
monthlyBudgetCents Int
|
|
65
|
-
dailyDispatchLimit Int
|
|
74
|
+
monthlyBudgetCents Int @default(10000) // $100 default
|
|
75
|
+
dailyDispatchLimit Int @default(50)
|
|
76
|
+
testCommand String? // shell command for Verify-Pre, default 'pnpm test'
|
|
66
77
|
|
|
67
78
|
// GitHub integration (QAP-019C / Group D-1, 2026-05-04).
|
|
68
79
|
//
|
|
@@ -81,6 +92,7 @@ model Project {
|
|
|
81
92
|
// payloads before any DB writes.
|
|
82
93
|
repoFullName String? @unique
|
|
83
94
|
webhookSecret String?
|
|
95
|
+
authorModel String? // override Author LLM model (Sprint 3b — claude-sonnet-4-6 default in adapter)
|
|
84
96
|
|
|
85
97
|
// Relations
|
|
86
98
|
profile ProjectProfile?
|
|
@@ -96,6 +108,7 @@ model Project {
|
|
|
96
108
|
uniformities QAUniformity[]
|
|
97
109
|
|
|
98
110
|
@@map("projects")
|
|
111
|
+
@@schema("derwin")
|
|
99
112
|
}
|
|
100
113
|
|
|
101
114
|
enum ProjectType {
|
|
@@ -106,6 +119,8 @@ enum ProjectType {
|
|
|
106
119
|
ANALYTICS
|
|
107
120
|
INFRA
|
|
108
121
|
CONTENT
|
|
122
|
+
|
|
123
|
+
@@schema("derwin")
|
|
109
124
|
}
|
|
110
125
|
|
|
111
126
|
enum ProjectMode {
|
|
@@ -113,6 +128,8 @@ enum ProjectMode {
|
|
|
113
128
|
TICKET_ONLY // write tickets, no fix authoring
|
|
114
129
|
AUTHOR // tickets + fix authoring, all to PR
|
|
115
130
|
AUTO // full autonomy per risk tier policies
|
|
131
|
+
|
|
132
|
+
@@schema("derwin")
|
|
116
133
|
}
|
|
117
134
|
|
|
118
135
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -142,6 +159,7 @@ model ProjectProfile {
|
|
|
142
159
|
evolutionLog ProfileEvolutionLog[]
|
|
143
160
|
|
|
144
161
|
@@map("project_profiles")
|
|
162
|
+
@@schema("derwin")
|
|
145
163
|
}
|
|
146
164
|
|
|
147
165
|
model IngestedDoc {
|
|
@@ -157,6 +175,7 @@ model IngestedDoc {
|
|
|
157
175
|
@@unique([projectId, sourcePath, contentHash])
|
|
158
176
|
@@index([projectId, sourcePath])
|
|
159
177
|
@@map("ingested_docs")
|
|
178
|
+
@@schema("derwin")
|
|
160
179
|
}
|
|
161
180
|
|
|
162
181
|
model ProfileEvolutionLog {
|
|
@@ -172,6 +191,7 @@ model ProfileEvolutionLog {
|
|
|
172
191
|
|
|
173
192
|
@@index([profileId, appliedAt(sort: Desc)])
|
|
174
193
|
@@map("profile_evolution_log")
|
|
194
|
+
@@schema("derwin")
|
|
175
195
|
}
|
|
176
196
|
|
|
177
197
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -201,6 +221,7 @@ model QARun {
|
|
|
201
221
|
|
|
202
222
|
@@index([projectId, startedAt(sort: Desc)])
|
|
203
223
|
@@map("qa_runs")
|
|
224
|
+
@@schema("derwin")
|
|
204
225
|
}
|
|
205
226
|
|
|
206
227
|
enum RunTrigger {
|
|
@@ -209,6 +230,8 @@ enum RunTrigger {
|
|
|
209
230
|
WEBHOOK
|
|
210
231
|
CONTINUOUS // for routes that run as a daemon (telemetry mining etc.)
|
|
211
232
|
AGENT // QAP-019F (Group D-3): standalone QA agent (browser tool) ingestion
|
|
233
|
+
|
|
234
|
+
@@schema("derwin")
|
|
212
235
|
}
|
|
213
236
|
|
|
214
237
|
enum RunStatus {
|
|
@@ -216,6 +239,8 @@ enum RunStatus {
|
|
|
216
239
|
COMPLETED
|
|
217
240
|
FAILED
|
|
218
241
|
CANCELLED
|
|
242
|
+
|
|
243
|
+
@@schema("derwin")
|
|
219
244
|
}
|
|
220
245
|
|
|
221
246
|
// A RawSignal is what a Discovery route emits. It hasn't been investigated /
|
|
@@ -240,6 +265,7 @@ model RawSignal {
|
|
|
240
265
|
@@index([qaRunId])
|
|
241
266
|
@@index([routeName, capturedAt(sort: Desc)])
|
|
242
267
|
@@map("raw_signals")
|
|
268
|
+
@@schema("derwin")
|
|
243
269
|
}
|
|
244
270
|
|
|
245
271
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -315,6 +341,7 @@ model QATicket {
|
|
|
315
341
|
@@index([projectId, finalBucket])
|
|
316
342
|
@@index([projectId, createdAt(sort: Desc)])
|
|
317
343
|
@@map("qa_tickets")
|
|
344
|
+
@@schema("derwin")
|
|
318
345
|
}
|
|
319
346
|
|
|
320
347
|
enum SurfaceCategory {
|
|
@@ -326,6 +353,8 @@ enum SurfaceCategory {
|
|
|
326
353
|
COMPLIANCE_AUDIT
|
|
327
354
|
MULTI_TENANT_SAFETY
|
|
328
355
|
OPERATIONAL_HEALTH
|
|
356
|
+
|
|
357
|
+
@@schema("derwin")
|
|
329
358
|
}
|
|
330
359
|
|
|
331
360
|
enum Severity {
|
|
@@ -333,6 +362,8 @@ enum Severity {
|
|
|
333
362
|
HIGH
|
|
334
363
|
MEDIUM
|
|
335
364
|
LOW
|
|
365
|
+
|
|
366
|
+
@@schema("derwin")
|
|
336
367
|
}
|
|
337
368
|
|
|
338
369
|
enum RiskTier {
|
|
@@ -340,6 +371,8 @@ enum RiskTier {
|
|
|
340
371
|
MEDIUM
|
|
341
372
|
HIGH
|
|
342
373
|
NEVER
|
|
374
|
+
|
|
375
|
+
@@schema("derwin")
|
|
343
376
|
}
|
|
344
377
|
|
|
345
378
|
enum TicketStatus {
|
|
@@ -352,12 +385,16 @@ enum TicketStatus {
|
|
|
352
385
|
CLOSED_WONTFIX
|
|
353
386
|
CLOSED_RESOLVED
|
|
354
387
|
ESCALATED
|
|
388
|
+
|
|
389
|
+
@@schema("derwin")
|
|
355
390
|
}
|
|
356
391
|
|
|
357
392
|
enum ReviewBucket {
|
|
358
393
|
PASS
|
|
359
394
|
FAIL
|
|
360
395
|
ESCALATION
|
|
396
|
+
|
|
397
|
+
@@schema("derwin")
|
|
361
398
|
}
|
|
362
399
|
|
|
363
400
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -408,6 +445,7 @@ model QAFixAttempt {
|
|
|
408
445
|
@@index([qaTicketId, attemptNumber])
|
|
409
446
|
@@index([projectId, attemptedAt(sort: Desc)])
|
|
410
447
|
@@map("qa_fix_attempts")
|
|
448
|
+
@@schema("derwin")
|
|
411
449
|
}
|
|
412
450
|
|
|
413
451
|
enum AttemptStatus {
|
|
@@ -420,6 +458,8 @@ enum AttemptStatus {
|
|
|
420
458
|
REJECTED
|
|
421
459
|
REGRESSED_REVERTED
|
|
422
460
|
FAILED
|
|
461
|
+
|
|
462
|
+
@@schema("derwin")
|
|
423
463
|
}
|
|
424
464
|
|
|
425
465
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -450,6 +490,7 @@ model ClassificationTrust {
|
|
|
450
490
|
|
|
451
491
|
@@unique([projectId, classification, surface])
|
|
452
492
|
@@map("classification_trust")
|
|
493
|
+
@@schema("derwin")
|
|
453
494
|
}
|
|
454
495
|
|
|
455
496
|
// Successful past fixes used as in-context examples for new dispatches.
|
|
@@ -470,6 +511,7 @@ model RAGCorpus {
|
|
|
470
511
|
|
|
471
512
|
@@index([projectId, classification, surface])
|
|
472
513
|
@@map("rag_corpus")
|
|
514
|
+
@@schema("derwin")
|
|
473
515
|
}
|
|
474
516
|
|
|
475
517
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -505,6 +547,7 @@ model AuditArtifact {
|
|
|
505
547
|
@@index([qaTicketId])
|
|
506
548
|
@@index([projectId, capturedAt(sort: Desc)])
|
|
507
549
|
@@map("audit_artifacts")
|
|
550
|
+
@@schema("derwin")
|
|
508
551
|
}
|
|
509
552
|
|
|
510
553
|
enum ArtifactType {
|
|
@@ -520,6 +563,8 @@ enum ArtifactType {
|
|
|
520
563
|
REASONING_TRACE
|
|
521
564
|
REVIEWER_OUTPUT
|
|
522
565
|
REPLAY_BUNDLE
|
|
566
|
+
|
|
567
|
+
@@schema("derwin")
|
|
523
568
|
}
|
|
524
569
|
|
|
525
570
|
enum ArtifactStage {
|
|
@@ -530,6 +575,8 @@ enum ArtifactStage {
|
|
|
530
575
|
PRE_MERGE_VERIFICATION
|
|
531
576
|
POST_MERGE_VERIFICATION
|
|
532
577
|
ARCHIVAL
|
|
578
|
+
|
|
579
|
+
@@schema("derwin")
|
|
533
580
|
}
|
|
534
581
|
|
|
535
582
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -571,6 +618,7 @@ model Policy {
|
|
|
571
618
|
|
|
572
619
|
@@index([projectId])
|
|
573
620
|
@@map("policies")
|
|
621
|
+
@@schema("derwin")
|
|
574
622
|
}
|
|
575
623
|
|
|
576
624
|
enum PolicyType {
|
|
@@ -578,6 +626,8 @@ enum PolicyType {
|
|
|
578
626
|
CONCURRENCY
|
|
579
627
|
TRUST_THRESHOLD
|
|
580
628
|
ESCALATION
|
|
629
|
+
|
|
630
|
+
@@schema("derwin")
|
|
581
631
|
}
|
|
582
632
|
|
|
583
633
|
model ProjectModeLog {
|
|
@@ -593,6 +643,7 @@ model ProjectModeLog {
|
|
|
593
643
|
|
|
594
644
|
@@index([projectId, changedAt(sort: Desc)])
|
|
595
645
|
@@map("project_mode_log")
|
|
646
|
+
@@schema("derwin")
|
|
596
647
|
}
|
|
597
648
|
|
|
598
649
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -615,6 +666,7 @@ model SpendLedger {
|
|
|
615
666
|
@@index([projectId, occurredAt(sort: Desc)])
|
|
616
667
|
@@index([projectId, vendor, occurredAt])
|
|
617
668
|
@@map("spend_ledger")
|
|
669
|
+
@@schema("derwin")
|
|
618
670
|
}
|
|
619
671
|
|
|
620
672
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -661,12 +713,15 @@ model QAPattern {
|
|
|
661
713
|
@@index([projectId, lastSeenAt(sort: Desc)])
|
|
662
714
|
@@index([status])
|
|
663
715
|
@@map("qa_patterns")
|
|
716
|
+
@@schema("derwin")
|
|
664
717
|
}
|
|
665
718
|
|
|
666
719
|
enum QAPatternStatus {
|
|
667
720
|
OPEN
|
|
668
721
|
RESOLVED
|
|
669
722
|
ARCHIVED
|
|
723
|
+
|
|
724
|
+
@@schema("derwin")
|
|
670
725
|
}
|
|
671
726
|
|
|
672
727
|
enum QAFailureClass {
|
|
@@ -676,6 +731,8 @@ enum QAFailureClass {
|
|
|
676
731
|
PRODUCT_BUG
|
|
677
732
|
SCHEMA_DRIFT
|
|
678
733
|
UNKNOWN
|
|
734
|
+
|
|
735
|
+
@@schema("derwin")
|
|
679
736
|
}
|
|
680
737
|
|
|
681
738
|
// QARevert logs a manual or auto-revert of a fix-forward commit. The route
|
|
@@ -713,6 +770,7 @@ model QARevert {
|
|
|
713
770
|
@@index([projectId, revertedAt(sort: Desc)])
|
|
714
771
|
@@index([ticketId])
|
|
715
772
|
@@map("qa_reverts")
|
|
773
|
+
@@schema("derwin")
|
|
716
774
|
}
|
|
717
775
|
|
|
718
776
|
// QAUniformity stores per-page rule outcomes from the invariant crawler
|
|
@@ -739,10 +797,13 @@ model QAUniformity {
|
|
|
739
797
|
@@index([projectId, ruleName, status])
|
|
740
798
|
@@index([projectId, pagePath])
|
|
741
799
|
@@map("qa_uniformities")
|
|
800
|
+
@@schema("derwin")
|
|
742
801
|
}
|
|
743
802
|
|
|
744
803
|
enum QAUniformityStatus {
|
|
745
804
|
PASSED
|
|
746
805
|
FAILED
|
|
747
806
|
SKIPPED
|
|
807
|
+
|
|
808
|
+
@@schema("derwin")
|
|
748
809
|
}
|