-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpr-review-flow.drawio
More file actions
296 lines (251 loc) · 20.3 KB
/
pr-review-flow.drawio
File metadata and controls
296 lines (251 loc) · 20.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<mxfile host="app.diagrams.net" modified="2026-03-13T00:00:00.000Z" agent="Claude" version="21.0.0" type="device">
<diagram name="PR Review Flow" id="pr-review-flow">
<mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1654" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- ============================================================ -->
<!-- SWIMLANE BACKGROUNDS -->
<!-- ============================================================ -->
<!-- Trigger lane -->
<mxCell id="lane-trigger-bg" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=none;opacity=30;" vertex="1" parent="1">
<mxGeometry x="20" y="60" width="200" height="1060" as="geometry" />
</mxCell>
<mxCell id="lane-trigger-label" value="Trigger" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=13;fontStyle=1;fontColor=#1e4d78;" vertex="1" parent="1">
<mxGeometry x="20" y="60" width="200" height="30" as="geometry" />
</mxCell>
<!-- Inputs lane -->
<mxCell id="lane-inputs-bg" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=none;opacity=30;" vertex="1" parent="1">
<mxGeometry x="220" y="60" width="250" height="1060" as="geometry" />
</mxCell>
<mxCell id="lane-inputs-label" value="Inputs & Context" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=13;fontStyle=1;fontColor=#2d6a28;" vertex="1" parent="1">
<mxGeometry x="220" y="60" width="250" height="30" as="geometry" />
</mxCell>
<!-- Review engine lane -->
<mxCell id="lane-review-bg" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=none;opacity=30;" vertex="1" parent="1">
<mxGeometry x="470" y="60" width="280" height="1060" as="geometry" />
</mxCell>
<mxCell id="lane-review-label" value="Review Engine (Claude)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=13;fontStyle=1;fontColor=#7d6608;" vertex="1" parent="1">
<mxGeometry x="470" y="60" width="280" height="30" as="geometry" />
</mxCell>
<!-- Output lane -->
<mxCell id="lane-output-bg" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=none;opacity=30;" vertex="1" parent="1">
<mxGeometry x="750" y="60" width="250" height="1060" as="geometry" />
</mxCell>
<mxCell id="lane-output-label" value="Outputs" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=13;fontStyle=1;fontColor=#4c2c7d;" vertex="1" parent="1">
<mxGeometry x="750" y="60" width="250" height="30" as="geometry" />
</mxCell>
<!-- Notify lane -->
<mxCell id="lane-notify-bg" value="" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=none;opacity=30;" vertex="1" parent="1">
<mxGeometry x="1000" y="60" width="280" height="1060" as="geometry" />
</mxCell>
<mxCell id="lane-notify-label" value="Optional: Security Notification" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=13;fontStyle=1;fontColor=#7d1a1a;" vertex="1" parent="1">
<mxGeometry x="1000" y="60" width="280" height="30" as="geometry" />
</mxCell>
<!-- ============================================================ -->
<!-- TRIGGER: manual -->
<!-- ============================================================ -->
<mxCell id="trig-manual" value="workflow_dispatch
(Manual run)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="40" y="120" width="160" height="50" as="geometry" />
</mxCell>
<!-- TRIGGER: PR config -->
<mxCell id="trig-pr" value="pull_request
(.github/pr-review-config.yml changed)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="40" y="200" width="160" height="60" as="geometry" />
</mxCell>
<!-- TRIGGER: reusable workflow -->
<mxCell id="trig-reusable" value="workflow_call
(Reusable workflow)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="40" y="290" width="160" height="50" as="geometry" />
</mxCell>
<!-- Dedup check note -->
<mxCell id="trig-dedup" value="Skip if same commit
SHA already reviewed" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=10;fontStyle=2;fontColor=#333333;" vertex="1" parent="1">
<mxGeometry x="40" y="370" width="160" height="40" as="geometry" />
</mxCell>
<!-- ============================================================ -->
<!-- INPUTS -->
<!-- ============================================================ -->
<mxCell id="input-pr-url" value="GitHub PR URL
(required)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="240" y="120" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="input-optional" value="Optional context:
• Notion SDD URL
• skip_notifications flag" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=10;align=left;spacingLeft=8;" vertex="1" parent="1">
<mxGeometry x="240" y="180" width="200" height="70" as="geometry" />
</mxCell>
<mxCell id="input-secrets" value="Secrets:
• ANTHROPIC_API_KEY
• NOTION_TOKEN (optional)
• SOURCE_REPO_TOKEN (optional)
• SDD_SLACK_WEBHOOK_URL
• LINEAR_API_KEY
• LINEAR_TEAM_ID
• LINEAR_TRIAGE_STATUS_ID" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=10;align=left;spacingLeft=8;" vertex="1" parent="1">
<mxGeometry x="240" y="270" width="200" height="100" as="geometry" />
</mxCell>
<!-- ============================================================ -->
<!-- REVIEW ENGINE STEPS -->
<!-- ============================================================ -->
<!-- Step 1: Fetch PR diff -->
<mxCell id="step-fetch-pr" value="1. Fetch PR diff + metadata
via GitHub API" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="490" y="130" width="220" height="50" as="geometry" />
</mxCell>
<!-- Step 2: Prioritize files -->
<mxCell id="step-prioritize" value="2. Score & prioritize changed files
(auth, IAM, crypto, config, SQL…)
30KB budget / 6KB per file" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="490" y="210" width="220" height="70" as="geometry" />
</mxCell>
<!-- Step 3: Gather optional SDD context -->
<mxCell id="step-context" value="3. Optionally fetch Notion SDD
for design context" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="490" y="310" width="220" height="50" as="geometry" />
</mxCell>
<!-- Step 4: Build prompt -->
<mxCell id="step-prompt" value="4. Build prompt" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="490" y="390" width="220" height="40" as="geometry" />
</mxCell>
<!-- Step 5: Call Claude -->
<mxCell id="step-claude" value="5. Call Claude API
(claude-sonnet / opus)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="490" y="460" width="220" height="50" as="geometry" />
</mxCell>
<!-- Step 6: Parse JSON -->
<mxCell id="step-parse" value="6. Parse structured JSON response
Filter questions < 0.7 confidence" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="490" y="540" width="220" height="50" as="geometry" />
</mxCell>
<!-- Decision: involvement -->
<mxCell id="decision-involvement" value="security_involvement
.recommendation?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="500" y="620" width="200" height="80" as="geometry" />
</mxCell>
<!-- ============================================================ -->
<!-- OUTPUTS -->
<!-- ============================================================ -->
<mxCell id="out-json" value="pr_review_output.json
(full structured result)" style="shape=note;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="770" y="540" width="190" height="50" as="geometry" />
</mxCell>
<mxCell id="out-md" value="pr_review_questions.md
(full review markdown)" style="shape=note;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="770" y="605" width="190" height="50" as="geometry" />
</mxCell>
<mxCell id="out-drawio" value="pr_review_architecture.drawio
(interactive diagram)" style="shape=note;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="770" y="670" width="190" height="50" as="geometry" />
</mxCell>
<mxCell id="out-summary" value="GitHub Actions
Job Summary" style="shape=note;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="770" y="735" width="190" height="50" as="geometry" />
</mxCell>
<mxCell id="out-pr-comment" value="PR Comment
(top-level review)" style="shape=note;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="770" y="800" width="190" height="50" as="geometry" />
</mxCell>
<mxCell id="out-inline" value="Inline PR Comments
(per file + line)" style="shape=note;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="770" y="865" width="190" height="50" as="geometry" />
</mxCell>
<!-- Artifact upload -->
<mxCell id="out-artifacts" value="Upload artifacts
(90-day retention)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontStyle=1;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="770" y="930" width="190" height="40" as="geometry" />
</mxCell>
<!-- Involvement banners -->
<mxCell id="out-banner-req" value="REQUIRED banner
+ next steps" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="770" y="460" width="85" height="50" as="geometry" />
</mxCell>
<mxCell id="out-banner-rec" value="RECOMMENDED
banner" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffe6cc;strokeColor=#d79b00;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="875" y="460" width="85" height="50" as="geometry" />
</mxCell>
<!-- ============================================================ -->
<!-- NOTIFICATION PATH -->
<!-- ============================================================ -->
<!-- Decision: notify? -->
<mxCell id="decision-notify" value="skip_notifications
= false?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontStyle=1;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="1020" y="620" width="180" height="70" as="geometry" />
</mxCell>
<!-- Slack notification (Required + Recommended) -->
<mxCell id="notify-slack" value="Post to Slack
security channel
(Required + Recommended)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="1020" y="730" width="190" height="60" as="geometry" />
</mxCell>
<!-- Linear ticket (Required only) -->
<mxCell id="notify-linear" value="Create Linear triage ticket
(Required only)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=10;" vertex="1" parent="1">
<mxGeometry x="1020" y="820" width="190" height="60" as="geometry" />
</mxCell>
<!-- Skip notifications -->
<mxCell id="notify-skip" value="Skip notifications
(suppressed or Not Required)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=10;fontColor=#333333;" vertex="1" parent="1">
<mxGeometry x="1060" y="930" width="150" height="50" as="geometry" />
</mxCell>
<!-- ============================================================ -->
<!-- TITLE -->
<!-- ============================================================ -->
<mxCell id="title" value="PR Security Review — GitHub Action Flow" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="20" y="10" width="1460" height="40" as="geometry" />
</mxCell>
<!-- ============================================================ -->
<!-- EDGES: Triggers → Engine -->
<!-- ============================================================ -->
<mxCell id="e-manual-fetch" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="trig-manual" target="step-fetch-pr" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-pr-fetch" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="trig-pr" target="step-fetch-pr" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-reusable-fetch" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="trig-reusable" target="step-fetch-pr" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Dedup check on PR trigger -->
<mxCell id="e-pr-dedup" style="edgeStyle=orthogonalEdgeStyle;dashed=1;" edge="1" source="trig-pr" target="trig-dedup" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Inputs → Engine -->
<mxCell id="e-prurl-fetch" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="input-pr-url" target="step-fetch-pr" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-opt-context" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="input-optional" target="step-context" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Engine flow -->
<mxCell id="e-fetch-prioritize" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-fetch-pr" target="step-prioritize" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-prioritize-context" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-prioritize" target="step-context" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-context-prompt" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-context" target="step-prompt" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-prompt-claude" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-prompt" target="step-claude" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-claude-parse" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-claude" target="step-parse" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-parse-decision" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-parse" target="decision-involvement" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Involvement decision → banners -->
<mxCell id="e-decision-req" value="Required" style="edgeStyle=orthogonalEdgeStyle;strokeColor=#b85450;" edge="1" source="decision-involvement" target="out-banner-req" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-decision-rec" value="Recommended" style="edgeStyle=orthogonalEdgeStyle;strokeColor=#d79b00;" edge="1" source="decision-involvement" target="out-banner-rec" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Parse → output files -->
<mxCell id="e-parse-json" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-parse" target="out-json" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-parse-md" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-parse" target="out-md" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-parse-drawio" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-parse" target="out-drawio" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-parse-summary" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-parse" target="out-summary" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-parse-comment" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-parse" target="out-pr-comment" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-parse-inline" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="step-parse" target="out-inline" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-outputs-artifacts" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="out-json" target="out-artifacts" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Involvement → notify decision -->
<mxCell id="e-decision-notify" style="edgeStyle=orthogonalEdgeStyle;" edge="1" source="decision-involvement" target="decision-notify" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- Notify decision branches -->
<mxCell id="e-notify-slack" value="Yes" style="edgeStyle=orthogonalEdgeStyle;strokeColor=#b85450;" edge="1" source="decision-notify" target="notify-slack" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-slack-linear" value="Required only" style="edgeStyle=orthogonalEdgeStyle;strokeColor=#b85450;" edge="1" source="notify-slack" target="notify-linear" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="e-notify-skip" value="No / Not Required" style="edgeStyle=orthogonalEdgeStyle;strokeColor=#666666;dashed=1;" edge="1" source="decision-notify" target="notify-skip" parent="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>