@sentry/warden 0.46.0 → 0.46.2
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/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/service.js +1 -1
- package/dist/cli/commands/service.js.map +1 -1
- package/dist/reporting/outcomes.d.ts +300 -0
- package/dist/reporting/outcomes.d.ts.map +1 -0
- package/dist/reporting/outcomes.js +55 -0
- package/dist/reporting/outcomes.js.map +1 -0
- package/dist/reporting/output.d.ts +1011 -0
- package/dist/reporting/output.d.ts.map +1 -0
- package/dist/reporting/output.js +419 -0
- package/dist/reporting/output.js.map +1 -0
- package/dist/reporting/provenance.d.ts +94 -0
- package/dist/reporting/provenance.d.ts.map +1 -0
- package/dist/reporting/provenance.js +139 -0
- package/dist/reporting/provenance.js.map +1 -0
- package/dist/service/findings.d.ts +1 -1
- package/dist/service/findings.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ConfidenceSchema, LocationSchema, SeveritySchema } from '../types/index.js';
|
|
3
|
+
const FindingSnapshotSchema = z.object({
|
|
4
|
+
title: z.string(),
|
|
5
|
+
description: z.string(),
|
|
6
|
+
severity: SeveritySchema,
|
|
7
|
+
confidence: ConfidenceSchema.optional(),
|
|
8
|
+
});
|
|
9
|
+
const VerificationStageSchema = z.discriminatedUnion('outcome', [
|
|
10
|
+
z.object({
|
|
11
|
+
outcome: z.literal('revised'),
|
|
12
|
+
model: z.string().optional(),
|
|
13
|
+
evidence: z.string().optional(),
|
|
14
|
+
before: FindingSnapshotSchema,
|
|
15
|
+
}),
|
|
16
|
+
]);
|
|
17
|
+
const MergeStageSchema = z.object({
|
|
18
|
+
model: z.string().optional(),
|
|
19
|
+
absorbedFindingIds: z.array(z.string()),
|
|
20
|
+
});
|
|
21
|
+
export const FindingProvenanceSchema = z.object({
|
|
22
|
+
originSkillExecutionId: z.string().optional(),
|
|
23
|
+
originModel: z.string().optional(),
|
|
24
|
+
verification: VerificationStageSchema.optional(),
|
|
25
|
+
merge: MergeStageSchema.optional(),
|
|
26
|
+
});
|
|
27
|
+
export const DiscardedFindingSchema = z.object({
|
|
28
|
+
originSkillExecutionId: z.string().optional(),
|
|
29
|
+
stage: z.enum(['verification_rejected', 'merge_absorbed', 'dedupe_dropped']),
|
|
30
|
+
severity: SeveritySchema,
|
|
31
|
+
title: z.string(),
|
|
32
|
+
location: LocationSchema.optional(),
|
|
33
|
+
model: z.string().optional(),
|
|
34
|
+
reason: z.string().optional(),
|
|
35
|
+
survivorFindingId: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Same-run dedupe can recenter two different skill executions' survivor
|
|
39
|
+
* findings onto the same id (e.g. both matched against the same pre-existing
|
|
40
|
+
* comment), so `findingId` alone is not a safe map key: a second execution's
|
|
41
|
+
* event would silently overwrite or merge into the first's entry, and both
|
|
42
|
+
* exported skill rows would then read the same (wrong) provenance. Scoping
|
|
43
|
+
* the key to the owning execution keeps each skill row's provenance
|
|
44
|
+
* independent.
|
|
45
|
+
*/
|
|
46
|
+
export function provenanceKey(skillExecutionId, findingId) {
|
|
47
|
+
return `${skillExecutionId ?? ''}:${findingId}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Build per-finding provenance and the list of discarded candidates from
|
|
51
|
+
* captured `FindingProcessingEvent`s. Handles `verification`/`rejected`,
|
|
52
|
+
* `verification`/`revised`, `merge`/`merged`, and `dedupe`/`dropped` events —
|
|
53
|
+
* `fix_gate` events are out of scope here (they don't remove a finding, they
|
|
54
|
+
* strip a proposed fix from one that's kept).
|
|
55
|
+
*
|
|
56
|
+
* `poster.ts`'s `recenterReportFindingIds` keeps this lookup valid across
|
|
57
|
+
* cross-run dedupe: when it recenters a survivor's `id` onto a pre-existing
|
|
58
|
+
* comment's id, it remaps this same finding's id inside any already-captured
|
|
59
|
+
* `FindingProcessingEvent`s so the id this map is keyed by (and the id
|
|
60
|
+
* `output.ts` looks it up by) stay in sync.
|
|
61
|
+
*/
|
|
62
|
+
export function buildProvenanceAndDiscarded(executions) {
|
|
63
|
+
const provenanceByFindingId = new Map();
|
|
64
|
+
const discarded = [];
|
|
65
|
+
for (const { skillExecutionId, model, verificationModel, mergeModel, events } of executions) {
|
|
66
|
+
for (const event of events) {
|
|
67
|
+
if (event.stage === 'dedupe' && event.action === 'dropped') {
|
|
68
|
+
discarded.push({
|
|
69
|
+
originSkillExecutionId: skillExecutionId,
|
|
70
|
+
stage: 'dedupe_dropped',
|
|
71
|
+
severity: event.finding.severity,
|
|
72
|
+
title: event.finding.title,
|
|
73
|
+
location: event.finding.location,
|
|
74
|
+
model,
|
|
75
|
+
reason: event.reason,
|
|
76
|
+
survivorFindingId: event.replacement?.id,
|
|
77
|
+
});
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (event.stage === 'verification' && event.action === 'rejected') {
|
|
81
|
+
discarded.push({
|
|
82
|
+
originSkillExecutionId: skillExecutionId,
|
|
83
|
+
stage: 'verification_rejected',
|
|
84
|
+
severity: event.finding.severity,
|
|
85
|
+
title: event.finding.title,
|
|
86
|
+
location: event.finding.location,
|
|
87
|
+
model: verificationModel,
|
|
88
|
+
reason: event.reason,
|
|
89
|
+
});
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (event.stage === 'verification' && event.action === 'revised' && event.replacement) {
|
|
93
|
+
const key = provenanceKey(skillExecutionId, event.replacement.id);
|
|
94
|
+
provenanceByFindingId.set(key, {
|
|
95
|
+
...provenanceByFindingId.get(key),
|
|
96
|
+
originSkillExecutionId: skillExecutionId,
|
|
97
|
+
originModel: model,
|
|
98
|
+
verification: {
|
|
99
|
+
outcome: 'revised',
|
|
100
|
+
model: verificationModel,
|
|
101
|
+
evidence: event.reason,
|
|
102
|
+
before: {
|
|
103
|
+
title: event.finding.title,
|
|
104
|
+
description: event.finding.description,
|
|
105
|
+
severity: event.finding.severity,
|
|
106
|
+
confidence: event.finding.confidence,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (event.stage === 'merge' && event.action === 'merged' && event.replacement) {
|
|
113
|
+
discarded.push({
|
|
114
|
+
originSkillExecutionId: skillExecutionId,
|
|
115
|
+
stage: 'merge_absorbed',
|
|
116
|
+
severity: event.finding.severity,
|
|
117
|
+
title: event.finding.title,
|
|
118
|
+
location: event.finding.location,
|
|
119
|
+
model: mergeModel,
|
|
120
|
+
reason: event.reason,
|
|
121
|
+
survivorFindingId: event.replacement.id,
|
|
122
|
+
});
|
|
123
|
+
const key = provenanceKey(skillExecutionId, event.replacement.id);
|
|
124
|
+
const existing = provenanceByFindingId.get(key);
|
|
125
|
+
provenanceByFindingId.set(key, {
|
|
126
|
+
...existing,
|
|
127
|
+
originSkillExecutionId: existing?.originSkillExecutionId ?? skillExecutionId,
|
|
128
|
+
originModel: existing?.originModel ?? model,
|
|
129
|
+
merge: {
|
|
130
|
+
model: mergeModel,
|
|
131
|
+
absorbedFindingIds: [...(existing?.merge?.absorbedFindingIds ?? []), event.finding.id],
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return { provenanceByFindingId, discarded };
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=provenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.js","sourceRoot":"","sources":["../../src/reporting/provenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGrF,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,K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iceOptions } from './options.js';
|
|
3
3
|
/** Convert an in-memory Action findings result into the current service envelope. */
|
|
4
4
|
export declare function buildFindingsServiceRunEnvelope(output: FindingsOutput, service: ResolvedServiceOptions, source: 'action' | 'replay'): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findings.d.ts","sourceRoot":"","sources":["../../src/service/findings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"findings.d.ts","sourceRoot":"","sources":["../../src/service/findings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAwI3D,qFAAqF;AACrF,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,sBAAsB,EAC/B,MAAM,EAAE,QAAQ,GAAG,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsD5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/warden",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.2",
|
|
4
4
|
"description": "Event-driven agent that reacts to GitHub events and executes code-review skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"smol-toml": "^1.6.1",
|
|
52
52
|
"yaml": "^2.9.0",
|
|
53
53
|
"zod": "^4.4.3",
|
|
54
|
-
"@sentry/warden-service-api": "0.46.
|
|
54
|
+
"@sentry/warden-service-api": "0.46.2"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=20.0.0"
|