@open-qa/qa 0.1.0-alpha.4 → 0.1.0-alpha.5

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.
Files changed (109) hide show
  1. package/THIRD_PARTY.md +5 -0
  2. package/drizzle/0017_provider_notifications.sql +13 -0
  3. package/drizzle/0018_classification_registry.sql +39 -0
  4. package/drizzle/0019_trial_audit.sql +44 -0
  5. package/drizzle/meta/0017_snapshot.json +2092 -0
  6. package/drizzle/meta/0018_snapshot.json +2102 -0
  7. package/drizzle/meta/0019_snapshot.json +2451 -0
  8. package/drizzle/meta/_journal.json +21 -0
  9. package/package.json +12 -7
  10. package/src/access-binding.d.ts +8 -0
  11. package/src/access-binding.js +26 -0
  12. package/src/adapters/classification-write.d.ts +87 -0
  13. package/src/adapters/classification-write.js +64 -0
  14. package/src/adapters/e2b-executor.js +4 -0
  15. package/src/adapters/file-run-store.d.ts +186 -41
  16. package/src/adapters/file-run-store.js +87 -19
  17. package/src/adapters/file-trial-audit.d.ts +280 -0
  18. package/src/adapters/file-trial-audit.js +105 -0
  19. package/src/adapters/pg-classification-store.d.ts +98 -20
  20. package/src/adapters/pg-classification-store.js +84 -44
  21. package/src/adapters/pg-run-store.d.ts +1 -0
  22. package/src/adapters/pg-run-store.js +70 -9
  23. package/src/adapters/run-metadata.d.ts +2 -0
  24. package/src/adapters/run-metadata.js +10 -0
  25. package/src/adapters/secret-manager-credential-resolver.d.ts +1 -1
  26. package/src/attempt-audit.d.ts +363 -0
  27. package/src/attempt-audit.js +253 -0
  28. package/src/audit-command.d.ts +13 -0
  29. package/src/audit-command.js +77 -0
  30. package/src/classification-command.d.ts +14 -9
  31. package/src/classification-command.js +119 -26
  32. package/src/classification-model.d.ts +10 -3
  33. package/src/classification-model.js +40 -24
  34. package/src/classification-notifier.d.ts +4 -3
  35. package/src/classification-notifier.js +26 -6
  36. package/src/classify-runs.d.ts +2 -1
  37. package/src/classify-runs.js +39 -3
  38. package/src/cli-program.js +53 -7
  39. package/src/commands.d.ts +1 -0
  40. package/src/commands.js +2 -0
  41. package/src/db/database.d.ts +7 -0
  42. package/src/db/database.js +15 -0
  43. package/src/db/event-chunks.d.ts +38 -29
  44. package/src/db/flow-status.d.ts +7 -3
  45. package/src/db/flow-status.js +240 -16
  46. package/src/db/queries.d.ts +24 -1
  47. package/src/db/queries.js +22 -0
  48. package/src/db/schema.d.ts +333 -4
  49. package/src/db/schema.js +83 -11
  50. package/src/db/trial-audit.d.ts +526 -0
  51. package/src/db/trial-audit.js +84 -0
  52. package/src/draft-api.d.ts +25 -421
  53. package/src/draft-api.js +10 -3
  54. package/src/engine.d.ts +47 -4
  55. package/src/engine.js +97 -8
  56. package/src/execution-snapshot.d.ts +1 -1
  57. package/src/execution-snapshot.js +22 -17
  58. package/src/export-command.d.ts +6 -0
  59. package/src/export-command.js +106 -0
  60. package/src/flow-check.js +1 -1
  61. package/src/flow-loader.d.ts +72 -6
  62. package/src/flow-loader.js +76 -12
  63. package/src/http-stage-client.d.ts +98 -1
  64. package/src/independent-model.js +53 -6
  65. package/src/judge-review-store.d.ts +13 -0
  66. package/src/judge-review-store.js +58 -0
  67. package/src/local-host-executor.d.ts +3 -1
  68. package/src/local-host-executor.js +2 -0
  69. package/src/quarantine-command.d.ts +5 -1
  70. package/src/quarantine-command.js +56 -13
  71. package/src/remote-command.js +2 -0
  72. package/src/report/browser.js +37 -37
  73. package/src/report/ctrf.d.ts +983 -0
  74. package/src/report/ctrf.js +306 -0
  75. package/src/report/generate.d.ts +1 -1
  76. package/src/report/generate.js +29 -6
  77. package/src/report/load.d.ts +738 -42
  78. package/src/report/load.js +78 -6
  79. package/src/result-notifier.js +1 -1
  80. package/src/result-trace.d.ts +62 -0
  81. package/src/result-trace.js +81 -0
  82. package/src/run-command.d.ts +2 -0
  83. package/src/run-command.js +285 -62
  84. package/src/run-setup-error.d.ts +1 -1
  85. package/src/run-setup-error.js +2 -2
  86. package/src/server/app.js +5 -4
  87. package/src/server/index.d.ts +2 -0
  88. package/src/server/index.js +11 -2
  89. package/src/server/repository.d.ts +166 -29
  90. package/src/server/repository.js +14 -2
  91. package/src/studio-review.js +1 -1
  92. package/src/system-config.d.ts +2 -2
  93. package/src/system-config.js +5 -4
  94. package/src/trial-audit.d.ts +630 -0
  95. package/src/trial-audit.js +272 -0
  96. package/src/visual-baseline.d.ts +4 -0
  97. package/src/visual-baseline.js +42 -0
  98. package/src/webhook-notification.d.ts +15 -0
  99. package/src/webhook-notification.js +61 -0
  100. package/src/worker/execution.d.ts +2 -1
  101. package/src/worker/execution.js +122 -3
  102. package/src/worker/index.d.ts +4 -0
  103. package/src/worker/index.js +10 -1
  104. package/src/worker/quarantine-notifications.js +2 -2
  105. package/src/worker/queue.d.ts +6 -2
  106. package/src/worker/queue.js +80 -19
  107. package/src/worker/result-notifications.d.ts +10 -2
  108. package/src/worker/result-notifications.js +120 -23
  109. package/src/worker/store.js +6 -3
@@ -120,6 +120,27 @@
120
120
  "when": 1795793990890,
121
121
  "tag": "0016_open_qa_classification",
122
122
  "breakpoints": true
123
+ },
124
+ {
125
+ "idx": 17,
126
+ "version": "7",
127
+ "when": 1796297393163,
128
+ "tag": "0017_provider_notifications",
129
+ "breakpoints": true
130
+ },
131
+ {
132
+ "idx": 18,
133
+ "version": "7",
134
+ "when": 1796316282203,
135
+ "tag": "0018_classification_registry",
136
+ "breakpoints": true
137
+ },
138
+ {
139
+ "idx": 19,
140
+ "version": "7",
141
+ "when": 1796360032574,
142
+ "tag": "0019_trial_audit",
143
+ "breakpoints": true
123
144
  }
124
145
  ]
125
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-qa/qa",
3
- "version": "0.1.0-alpha.4",
3
+ "version": "0.1.0-alpha.5",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "Apache-2.0",
@@ -74,18 +74,23 @@
74
74
  "types": "./src/flows-api.d.ts",
75
75
  "import": "./src/flows-api.js",
76
76
  "default": "./src/flows-api.js"
77
+ },
78
+ "./results": {
79
+ "types": "./src/report/ctrf.d.ts",
80
+ "import": "./src/report/ctrf.js",
81
+ "default": "./src/report/ctrf.js"
77
82
  }
78
83
  },
79
84
  "bin": {
80
85
  "open-qa": "./src/cli.js"
81
86
  },
82
87
  "dependencies": {
83
- "@open-qa/qa-agents": "0.1.0-alpha.4",
84
- "@open-qa/qa-engine": "0.1.0-alpha.4",
85
- "@open-qa/qa-inspect": "0.1.0-alpha.4",
86
- "@open-qa/qa-replay": "0.1.0-alpha.4",
87
- "@open-qa/qa-stage": "0.1.0-alpha.4",
88
- "@open-qa/qa-studio": "0.1.0-alpha.4",
88
+ "@open-qa/qa-agents": "0.1.0-alpha.5",
89
+ "@open-qa/qa-engine": "0.1.0-alpha.5",
90
+ "@open-qa/qa-inspect": "0.1.0-alpha.5",
91
+ "@open-qa/qa-replay": "0.1.0-alpha.5",
92
+ "@open-qa/qa-stage": "0.1.0-alpha.5",
93
+ "@open-qa/qa-studio": "0.1.0-alpha.5",
89
94
  "@libsql/client": "^0.15.0",
90
95
  "commander": "^15.0.0",
91
96
  "drizzle-orm": "^0.45.2",
@@ -0,0 +1,8 @@
1
+ import type { ProviderRegistry } from "@open-qa/qa-engine";
2
+ export declare function resolveAccessBinding(providers: ProviderRegistry, id: string, target: string, url: string, env: NodeJS.ProcessEnv): {
3
+ accessHeaders: {
4
+ origin: string;
5
+ headers: Record<string, string>;
6
+ };
7
+ secrets: string[];
8
+ };
@@ -0,0 +1,26 @@
1
+ import { accessHeadersSchema } from "@open-qa/qa-engine/protocol";
2
+ import { RunSetupError } from "./run-setup-error.js";
3
+ function resolveAccessBinding(providers, id, target, url, env) {
4
+ const policy = providers.accessPolicy(providers.resolve("access", id, target));
5
+ const origin = new URL(url).origin;
6
+ if (!origin.startsWith("https://"))
7
+ throw new RunSetupError("configuration", `Access policy ${id} requires an HTTPS target`);
8
+ const credentials = /* @__PURE__ */ Object.create(null);
9
+ for (const key of policy.credentialKeys) {
10
+ const value = env[key];
11
+ if (!value) throw new RunSetupError("configuration", `Access policy ${id} requires ${key}`);
12
+ credentials[key] = value;
13
+ }
14
+ try {
15
+ const headers = Object.fromEntries(
16
+ Object.entries(policy.headers(credentials)).map(([key, value]) => [key.toLowerCase(), value])
17
+ );
18
+ const accessHeaders = accessHeadersSchema.parse({ origin, headers });
19
+ return { accessHeaders, secrets: [...Object.values(credentials), ...Object.values(headers)] };
20
+ } catch {
21
+ throw new RunSetupError("configuration", `Invalid headers from access policy ${id}`);
22
+ }
23
+ }
24
+ export {
25
+ resolveAccessBinding
26
+ };
@@ -0,0 +1,87 @@
1
+ import { type ProjectClassificationRegistry } from "@open-qa/qa-engine";
2
+ import { type Classification, type ClassificationCorrection } from "@open-qa/qa-engine/protocol";
3
+ /** Validate a new effective classification and attach identity for callers using the older input shape. */
4
+ export declare function validateClassificationWrite(scope: ProjectClassificationRegistry, value: Classification): {
5
+ category: string | null;
6
+ confidence: number;
7
+ reason: string;
8
+ source: "model" | "rule" | "fallback" | "human";
9
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
10
+ cause?: string | undefined;
11
+ taxonomy?: {
12
+ project: string;
13
+ version: string;
14
+ } | undefined;
15
+ flakiness?: "unknown" | "observed" | undefined;
16
+ needsReview?: boolean | undefined;
17
+ classifierVersion?: string | undefined;
18
+ rawPrediction?: {
19
+ category: string | null;
20
+ confidence: number;
21
+ reason: string;
22
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
23
+ cause?: string | undefined;
24
+ modelVersion?: string | undefined;
25
+ } | undefined;
26
+ };
27
+ export declare function classificationCorrection(scope: ProjectClassificationRegistry, input: ClassificationCorrection, predicted: Classification | null): {
28
+ label: {
29
+ reason: string;
30
+ category: string;
31
+ modifiedBy: string;
32
+ modifiedAt: number;
33
+ predicted: {
34
+ category: string | null;
35
+ confidence: number;
36
+ reason: string;
37
+ source: "model" | "rule" | "fallback" | "human";
38
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
39
+ cause?: string | undefined;
40
+ taxonomy?: {
41
+ project: string;
42
+ version: string;
43
+ } | undefined;
44
+ flakiness?: "unknown" | "observed" | undefined;
45
+ needsReview?: boolean | undefined;
46
+ classifierVersion?: string | undefined;
47
+ rawPrediction?: {
48
+ category: string | null;
49
+ confidence: number;
50
+ reason: string;
51
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
52
+ cause?: string | undefined;
53
+ modelVersion?: string | undefined;
54
+ } | undefined;
55
+ } | null;
56
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
57
+ cause?: string | undefined;
58
+ flakiness?: "unknown" | "observed" | undefined;
59
+ taxonomy?: {
60
+ project: string;
61
+ version: string;
62
+ } | undefined;
63
+ };
64
+ classification: {
65
+ category: string | null;
66
+ confidence: number;
67
+ reason: string;
68
+ source: "model" | "rule" | "fallback" | "human";
69
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
70
+ cause?: string | undefined;
71
+ taxonomy?: {
72
+ project: string;
73
+ version: string;
74
+ } | undefined;
75
+ flakiness?: "unknown" | "observed" | undefined;
76
+ needsReview?: boolean | undefined;
77
+ classifierVersion?: string | undefined;
78
+ rawPrediction?: {
79
+ category: string | null;
80
+ confidence: number;
81
+ reason: string;
82
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
83
+ cause?: string | undefined;
84
+ modelVersion?: string | undefined;
85
+ } | undefined;
86
+ };
87
+ };
@@ -0,0 +1,64 @@
1
+ import { ClassificationRegistryError } from "@open-qa/qa-engine";
2
+ import {
3
+ classificationLabelSchema,
4
+ classificationSchema
5
+ } from "@open-qa/qa-engine/protocol";
6
+ function requireCurrentTaxonomy(scope, identity) {
7
+ if (identity && (identity.project !== scope.project || identity.version !== scope.current.version))
8
+ throw new ClassificationRegistryError(
9
+ "Classification taxonomy does not match the active project and version"
10
+ );
11
+ return { project: scope.project, version: scope.current.version };
12
+ }
13
+ function validateClassificationWrite(scope, value) {
14
+ const parsed = classificationSchema.parse(value);
15
+ const taxonomy = requireCurrentTaxonomy(scope, parsed.taxonomy);
16
+ const category = parsed.category === null ? void 0 : scope.requireCategory(parsed.category, taxonomy);
17
+ if (parsed.source === "human")
18
+ throw new ClassificationRegistryError("Human classifications require an audit label");
19
+ const classifierVersion = parsed.classifierVersion ?? parsed.rawPrediction?.modelVersion ?? "unrecorded";
20
+ const rawPrediction = parsed.rawPrediction ?? (parsed.source === "model" ? {
21
+ category: parsed.category,
22
+ confidence: parsed.confidence,
23
+ reason: parsed.reason,
24
+ origin: parsed.origin,
25
+ cause: parsed.cause,
26
+ modelVersion: classifierVersion
27
+ } : void 0);
28
+ return classificationSchema.parse({
29
+ ...parsed,
30
+ taxonomy,
31
+ origin: parsed.origin ?? category?.origin ?? "unknown",
32
+ cause: parsed.cause ?? "unknown",
33
+ flakiness: parsed.flakiness ?? "unknown",
34
+ needsReview: parsed.category === null || (parsed.needsReview ?? false),
35
+ classifierVersion,
36
+ ...rawPrediction && { rawPrediction }
37
+ });
38
+ }
39
+ function classificationCorrection(scope, input, predicted) {
40
+ const category = scope.requireCategory(input.category, input.taxonomy);
41
+ const taxonomy = requireCurrentTaxonomy(scope);
42
+ const label = classificationLabelSchema.parse({
43
+ ...input,
44
+ taxonomy,
45
+ modifiedAt: Date.now(),
46
+ predicted
47
+ });
48
+ const classification = {
49
+ category: category.id,
50
+ taxonomy,
51
+ reason: label.reason,
52
+ confidence: 1,
53
+ source: "human",
54
+ origin: label.origin ?? category.origin ?? "unknown",
55
+ cause: label.cause ?? "unknown",
56
+ flakiness: label.flakiness ?? predicted?.flakiness ?? "unknown",
57
+ needsReview: false
58
+ };
59
+ return { label, classification };
60
+ }
61
+ export {
62
+ classificationCorrection,
63
+ validateClassificationWrite
64
+ };
@@ -59,6 +59,8 @@ class E2bExecutor {
59
59
  if (!qaId.safeParse(spec.runId).success) throw new Error("Invalid QA run ID");
60
60
  if (!spec.actors.length || spec.actors.some((actor) => !actor.trim()) || new Set(spec.actors).size !== spec.actors.length)
61
61
  throw new Error("At least one unique, nonempty actor is required");
62
+ if (spec.providers?.some((reference) => reference.provider !== "open-qa"))
63
+ throw new Error("Managed E2B image does not support deployment-installed providers");
62
64
  if ((spec.views?.length ?? 0) > 6) throw new Error("QA E2B supports at most six views");
63
65
  const provisionedAt = performance.now();
64
66
  const lifetimeMs = this.options.budgetMs + E2B_FINALIZATION_MS;
@@ -130,6 +132,7 @@ class E2bExecutor {
130
132
  {
131
133
  host: "0.0.0.0",
132
134
  port: 4101,
135
+ providers: spec.providers,
133
136
  dir: stageDirectory,
134
137
  conductorToken,
135
138
  watchToken,
@@ -151,6 +154,7 @@ class E2bExecutor {
151
154
  endpoint: sandbox.endpoint,
152
155
  ...new URL(sandbox.endpoint).protocol === "https:" ? { screenAccess: { url: `${sandbox.endpoint}/watch`, token: watchToken } } : {},
153
156
  placement: "e2b",
157
+ image: { template },
154
158
  conductorToken,
155
159
  actorTokens,
156
160
  asyncDispose: dispose
@@ -1,52 +1,114 @@
1
1
  import { z } from "zod";
2
2
  import { type ArtifactScan } from "../artifact-scan.js";
3
- import { type CreateRun, type FinishRun, type RunStore } from "@open-qa/qa-engine";
4
- import { type Classification, type RunEvent } from "@open-qa/qa-engine/protocol";
3
+ import { type CreateRun, type FinishRun, type ProjectClassificationRegistry, type RunStore } from "@open-qa/qa-engine";
4
+ import { type Classification, type ClassificationCorrection, type RunEvent } from "@open-qa/qa-engine/protocol";
5
5
  declare const runSchema: z.ZodObject<{
6
6
  classification: z.ZodDefault<z.ZodNullable<z.ZodObject<{
7
- category: z.ZodEnum<{
8
- env: "env";
9
- agent: "agent";
10
- "product-bug": "product-bug";
11
- "test-case": "test-case";
12
- flaky: "flaky";
13
- }>;
7
+ category: z.ZodNullable<z.ZodString>;
14
8
  confidence: z.ZodNumber;
15
9
  reason: z.ZodString;
10
+ origin: z.ZodOptional<z.ZodEnum<{
11
+ unknown: "unknown";
12
+ judge: "judge";
13
+ product: "product";
14
+ harness: "harness";
15
+ infra: "infra";
16
+ }>>;
17
+ cause: z.ZodOptional<z.ZodString>;
16
18
  source: z.ZodEnum<{
17
19
  model: "model";
18
- fallback: "fallback";
19
20
  rule: "rule";
21
+ fallback: "fallback";
20
22
  human: "human";
21
23
  }>;
24
+ taxonomy: z.ZodOptional<z.ZodObject<{
25
+ project: z.ZodString;
26
+ version: z.ZodString;
27
+ }, z.core.$strict>>;
28
+ flakiness: z.ZodOptional<z.ZodEnum<{
29
+ unknown: "unknown";
30
+ observed: "observed";
31
+ }>>;
32
+ needsReview: z.ZodOptional<z.ZodBoolean>;
33
+ classifierVersion: z.ZodOptional<z.ZodString>;
34
+ rawPrediction: z.ZodOptional<z.ZodObject<{
35
+ category: z.ZodNullable<z.ZodString>;
36
+ confidence: z.ZodNumber;
37
+ reason: z.ZodString;
38
+ origin: z.ZodOptional<z.ZodEnum<{
39
+ unknown: "unknown";
40
+ judge: "judge";
41
+ product: "product";
42
+ harness: "harness";
43
+ infra: "infra";
44
+ }>>;
45
+ cause: z.ZodOptional<z.ZodString>;
46
+ modelVersion: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strict>>;
22
48
  }, z.core.$strict>>>;
23
49
  classificationLabels: z.ZodDefault<z.ZodArray<z.ZodObject<{
24
- category: z.ZodEnum<{
25
- env: "env";
26
- agent: "agent";
27
- "product-bug": "product-bug";
28
- "test-case": "test-case";
29
- flaky: "flaky";
30
- }>;
50
+ origin: z.ZodOptional<z.ZodEnum<{
51
+ unknown: "unknown";
52
+ judge: "judge";
53
+ product: "product";
54
+ harness: "harness";
55
+ infra: "infra";
56
+ }>>;
57
+ cause: z.ZodOptional<z.ZodString>;
58
+ flakiness: z.ZodOptional<z.ZodEnum<{
59
+ unknown: "unknown";
60
+ observed: "observed";
61
+ }>>;
31
62
  reason: z.ZodString;
63
+ taxonomy: z.ZodOptional<z.ZodObject<{
64
+ project: z.ZodString;
65
+ version: z.ZodString;
66
+ }, z.core.$strict>>;
67
+ category: z.ZodString;
32
68
  modifiedBy: z.ZodString;
33
69
  modifiedAt: z.ZodNumber;
34
70
  predicted: z.ZodNullable<z.ZodObject<{
35
- category: z.ZodEnum<{
36
- env: "env";
37
- agent: "agent";
38
- "product-bug": "product-bug";
39
- "test-case": "test-case";
40
- flaky: "flaky";
41
- }>;
71
+ category: z.ZodNullable<z.ZodString>;
42
72
  confidence: z.ZodNumber;
43
73
  reason: z.ZodString;
74
+ origin: z.ZodOptional<z.ZodEnum<{
75
+ unknown: "unknown";
76
+ judge: "judge";
77
+ product: "product";
78
+ harness: "harness";
79
+ infra: "infra";
80
+ }>>;
81
+ cause: z.ZodOptional<z.ZodString>;
44
82
  source: z.ZodEnum<{
45
83
  model: "model";
46
- fallback: "fallback";
47
84
  rule: "rule";
85
+ fallback: "fallback";
48
86
  human: "human";
49
87
  }>;
88
+ taxonomy: z.ZodOptional<z.ZodObject<{
89
+ project: z.ZodString;
90
+ version: z.ZodString;
91
+ }, z.core.$strict>>;
92
+ flakiness: z.ZodOptional<z.ZodEnum<{
93
+ unknown: "unknown";
94
+ observed: "observed";
95
+ }>>;
96
+ needsReview: z.ZodOptional<z.ZodBoolean>;
97
+ classifierVersion: z.ZodOptional<z.ZodString>;
98
+ rawPrediction: z.ZodOptional<z.ZodObject<{
99
+ category: z.ZodNullable<z.ZodString>;
100
+ confidence: z.ZodNumber;
101
+ reason: z.ZodString;
102
+ origin: z.ZodOptional<z.ZodEnum<{
103
+ unknown: "unknown";
104
+ judge: "judge";
105
+ product: "product";
106
+ harness: "harness";
107
+ infra: "infra";
108
+ }>>;
109
+ cause: z.ZodOptional<z.ZodString>;
110
+ modelVersion: z.ZodOptional<z.ZodString>;
111
+ }, z.core.$strict>>;
50
112
  }, z.core.$strict>>;
51
113
  }, z.core.$strict>>>;
52
114
  findings: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -103,57 +165,140 @@ declare const runSchema: z.ZodObject<{
103
165
  }, z.core.$strict>;
104
166
  export type FileRun = z.infer<typeof runSchema>;
105
167
  export declare class FileRunStore implements RunStore {
168
+ private scope?;
106
169
  private readonly qaRoot;
107
- constructor(qaRoot?: string);
170
+ constructor(qaRoot?: string, scope?: ProjectClassificationRegistry | undefined);
171
+ get classificationScope(): ProjectClassificationRegistry;
108
172
  createRun(run: CreateRun): Promise<void>;
109
173
  appendEvents(runId: string, events: readonly RunEvent[]): Promise<void>;
110
174
  finishRun(runId: string, result: FinishRun): Promise<void>;
175
+ recordClassifierUsage(runId: string, samples: Parameters<NonNullable<RunStore["recordClassifierUsage"]>>[1]): Promise<void>;
111
176
  getRun(runId: string): Promise<FileRun | undefined>;
112
177
  getClassification(runId: string): Promise<{
113
178
  classification: {
114
- category: "env" | "agent" | "product-bug" | "test-case" | "flaky";
179
+ category: string | null;
115
180
  confidence: number;
116
181
  reason: string;
117
- source: "model" | "fallback" | "rule" | "human";
182
+ source: "model" | "rule" | "fallback" | "human";
183
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
184
+ cause?: string | undefined;
185
+ taxonomy?: {
186
+ project: string;
187
+ version: string;
188
+ } | undefined;
189
+ flakiness?: "unknown" | "observed" | undefined;
190
+ needsReview?: boolean | undefined;
191
+ classifierVersion?: string | undefined;
192
+ rawPrediction?: {
193
+ category: string | null;
194
+ confidence: number;
195
+ reason: string;
196
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
197
+ cause?: string | undefined;
198
+ modelVersion?: string | undefined;
199
+ } | undefined;
118
200
  } | null;
119
201
  labels: {
120
- category: "env" | "agent" | "product-bug" | "test-case" | "flaky";
121
202
  reason: string;
203
+ category: string;
122
204
  modifiedBy: string;
123
205
  modifiedAt: number;
124
206
  predicted: {
125
- category: "env" | "agent" | "product-bug" | "test-case" | "flaky";
207
+ category: string | null;
126
208
  confidence: number;
127
209
  reason: string;
128
- source: "model" | "fallback" | "rule" | "human";
210
+ source: "model" | "rule" | "fallback" | "human";
211
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
212
+ cause?: string | undefined;
213
+ taxonomy?: {
214
+ project: string;
215
+ version: string;
216
+ } | undefined;
217
+ flakiness?: "unknown" | "observed" | undefined;
218
+ needsReview?: boolean | undefined;
219
+ classifierVersion?: string | undefined;
220
+ rawPrediction?: {
221
+ category: string | null;
222
+ confidence: number;
223
+ reason: string;
224
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
225
+ cause?: string | undefined;
226
+ modelVersion?: string | undefined;
227
+ } | undefined;
129
228
  } | null;
229
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
230
+ cause?: string | undefined;
231
+ flakiness?: "unknown" | "observed" | undefined;
232
+ taxonomy?: {
233
+ project: string;
234
+ version: string;
235
+ } | undefined;
130
236
  }[];
131
237
  } | undefined>;
238
+ assertClassificationProject(stored: FileRun): void;
132
239
  saveClassification(runId: string, value: Classification): Promise<void>;
133
- labelClassification(runId: string, input: {
134
- category: Classification["category"];
135
- reason: string;
136
- modifiedBy: string;
137
- }): Promise<{
240
+ labelClassification(runId: string, input: ClassificationCorrection): Promise<{
138
241
  classification: {
139
- category: "env" | "agent" | "product-bug" | "test-case" | "flaky";
242
+ category: string | null;
140
243
  confidence: number;
141
244
  reason: string;
142
- source: "model" | "fallback" | "rule" | "human";
245
+ source: "model" | "rule" | "fallback" | "human";
246
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
247
+ cause?: string | undefined;
248
+ taxonomy?: {
249
+ project: string;
250
+ version: string;
251
+ } | undefined;
252
+ flakiness?: "unknown" | "observed" | undefined;
253
+ needsReview?: boolean | undefined;
254
+ classifierVersion?: string | undefined;
255
+ rawPrediction?: {
256
+ category: string | null;
257
+ confidence: number;
258
+ reason: string;
259
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
260
+ cause?: string | undefined;
261
+ modelVersion?: string | undefined;
262
+ } | undefined;
143
263
  };
144
264
  labels: {
145
- category: "env" | "agent" | "product-bug" | "test-case" | "flaky";
146
265
  reason: string;
266
+ category: string;
147
267
  modifiedBy: string;
148
268
  modifiedAt: number;
149
269
  predicted: {
150
- category: "env" | "agent" | "product-bug" | "test-case" | "flaky";
270
+ category: string | null;
151
271
  confidence: number;
152
272
  reason: string;
153
- source: "model" | "fallback" | "rule" | "human";
273
+ source: "model" | "rule" | "fallback" | "human";
274
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
275
+ cause?: string | undefined;
276
+ taxonomy?: {
277
+ project: string;
278
+ version: string;
279
+ } | undefined;
280
+ flakiness?: "unknown" | "observed" | undefined;
281
+ needsReview?: boolean | undefined;
282
+ classifierVersion?: string | undefined;
283
+ rawPrediction?: {
284
+ category: string | null;
285
+ confidence: number;
286
+ reason: string;
287
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
288
+ cause?: string | undefined;
289
+ modelVersion?: string | undefined;
290
+ } | undefined;
154
291
  } | null;
292
+ origin?: "unknown" | "judge" | "product" | "harness" | "infra" | undefined;
293
+ cause?: string | undefined;
294
+ flakiness?: "unknown" | "observed" | undefined;
295
+ taxonomy?: {
296
+ project: string;
297
+ version: string;
298
+ } | undefined;
155
299
  }[];
156
300
  }>;
301
+ recordQuarantine(runId: string, quarantined: boolean, overdueSince?: number): Promise<void>;
157
302
  recordArtifactScan(runId: string, scan: ArtifactScan): Promise<void>;
158
303
  readEvents(runId: string, afterSeq?: number): Promise<RunEvent[]>;
159
304
  recentUsage(flow: string): Promise<{