-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpr.html
More file actions
251 lines (231 loc) · 10.9 KB
/
Copy pathpr.html
File metadata and controls
251 lines (231 loc) · 10.9 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
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PR 写作(作者侧)· 模板</title>
<!--
pr-writeup.html
用途:agent 帮 PR 作者写"评审者真正想看的描述"。
6 段:TL;DR / Why / Before-After / File-by-file / Where-to-focus / Test-plan / Rollout。
替换:所有 [...] 占位。
-->
<style>
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
font-size: 16px; line-height: 1.6; color: #141413; background: #FAF9F5;
-webkit-font-smoothing: antialiased; }
:root {
--clay: #D97757; --slate: #141413; --ivory: #FAF9F5;
--white: #FFFFFF; --gray-100: #F0EEE6; --gray-300: #D1CFC5;
--gray-500: #87867F; --gray-700: #3D3D3A;
--success: #788C5D; --warning: #C78E3F; --danger: #B04A4A; --info: #5C7CA3;
--font-mono: ui-monospace, "SF Mono", Menlo, Monaco, monospace;
}
.container { max-width: 980px; margin: 0 auto; padding: 56px 32px 96px; }
code { font-family: var(--font-mono); font-size: 0.88em;
background: var(--gray-100); padding: 2px 6px; border-radius: 4px; }
pre { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55;
margin: 12px 0 0; padding: 14px 16px; background: var(--gray-100);
border-radius: 8px; overflow: auto; }
pre code { background: none; padding: 0; }
h1 { font-size: 28px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 32px; }
h2 { font-size: 20px; font-weight: 500; margin: 48px 0 16px;
padding-bottom: 8px; border-bottom: 1px solid var(--gray-300); }
h3 { font-size: 16px; font-weight: 500; margin: 0 0 8px; }
/* ---- TL;DR ---- */
aside.tldr { background: rgba(217, 119, 87, 0.08);
border-left: 3px solid var(--clay);
padding: 16px 20px; margin: 0 0 32px;
border-radius: 0 8px 8px 0; }
aside.tldr strong { display: block; font-size: 11px;
letter-spacing: 0.08em; text-transform: uppercase;
color: var(--clay); margin-bottom: 8px; }
aside.tldr p { margin: 0; }
/* ---- before / after ---- */
.before-after { display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
margin: 16px 0 0; }
.before-after > div { padding: 16px 20px; border-radius: 10px;
border: 1px solid var(--gray-300); background: var(--white); }
.before-after > div:first-child { border-left: 3px solid var(--gray-500); }
.before-after > div:last-child { border-left: 3px solid var(--success); }
.before-after h3 { font-size: 13px; text-transform: uppercase;
letter-spacing: 0.06em; color: var(--gray-700);
margin-bottom: 12px; }
.before-after ul { margin: 0; padding-left: 18px; }
.before-after li { margin: 6px 0; font-size: 14px; }
/* ---- file-by-file ---- */
section.files details { margin-bottom: 12px; background: var(--white);
border: 1px solid var(--gray-300); border-radius: 10px;
overflow: hidden; }
section.files summary { padding: 14px 18px; cursor: pointer;
list-style: none; display: flex; gap: 12px;
align-items: center; font-size: 14px;
background: var(--gray-100); }
section.files summary::-webkit-details-marker { display: none; }
section.files summary::before { content: '▸'; color: var(--gray-500); }
section.files details[open] summary::before { content: '▾'; }
section.files summary code { font-size: 13px; }
section.files .badge { padding: 2px 8px; border-radius: 4px;
font-size: 11px; font-weight: 600;
letter-spacing: 0.04em; }
section.files .badge.new { background: rgba(120,140,93,0.15); color: var(--success); }
section.files .badge.mod { background: rgba(199,142,63,0.15); color: var(--warning); }
section.files details > div { padding: 16px 20px; }
section.files p:first-of-type { margin-top: 0; }
/* ---- focus list ---- */
section.focus ol { list-style: none; counter-reset: focus-counter;
padding: 0; margin: 0; }
section.focus li { counter-increment: focus-counter;
padding: 16px 16px 16px 60px; margin-bottom: 12px;
position: relative; background: var(--white);
border: 1px solid var(--gray-300); border-radius: 10px; }
section.focus li::before { content: counter(focus-counter);
position: absolute; left: 16px; top: 14px;
width: 28px; height: 28px; border-radius: 50%;
background: var(--clay); color: var(--white);
display: grid; place-items: center;
font-family: var(--font-mono); font-size: 13px;
font-weight: 600; }
section.focus h3 { font-weight: 500; margin: 0 0 8px; }
section.focus li > p { margin: 0; color: var(--gray-700); font-size: 14px; }
/* ---- test plan ---- */
section.tests dl { display: grid; grid-template-columns: 200px 1fr;
gap: 8px 16px; margin: 0; }
section.tests dt { font-weight: 500; color: var(--slate);
padding: 12px 0; border-top: 1px solid var(--gray-300); }
section.tests dd { margin: 0; padding: 12px 0;
border-top: 1px solid var(--gray-300);
color: var(--gray-700); font-size: 14px; }
section.tests dd small { display: block; color: var(--gray-500);
font-size: 12px; margin-top: 2px; }
/* ---- rollout ramp ---- */
section.rollout ol.ramp { list-style: none; padding: 0; margin: 16px 0 0;
display: grid;
grid-template-columns: repeat(3, 1fr); gap: 12px; }
section.rollout ol.ramp li { padding: 16px 18px; background: var(--white);
border: 1px solid var(--gray-300); border-radius: 10px;
display: flex; flex-direction: column; gap: 4px; }
section.rollout ol.ramp b { font-size: 12px; color: var(--gray-500);
letter-spacing: 0.06em; text-transform: uppercase; }
section.rollout ol.ramp .pct { font-size: 22px; font-weight: 500;
color: var(--clay); }
</style>
</head>
<body>
<div class="container">
<h1>PR #[number] — [一句话标题,例如 "Move notification delivery onto a queue"]</h1>
<aside class="tldr">
<strong>TL;DR</strong>
<p>[2-4 句直接讲完:之前是什么、为什么不行、现在改成什么、关键指标变化。例如 "Notification sends were happening inline. Under load they added 200–800ms to mutation latency. This PR moves delivery onto pg-boss; p99 on comments.create dropped 1.4s → 180ms in staging."]</p>
</aside>
<h2>Why</h2>
<p>[一段背景:之前是怎么做的,触发什么问题。例如 "When we added @mentions last quarter, every mention triggered up to 3 sends inside the comment-save transaction. That was fine at launch — fine no longer, since one task update can fan out to forty watchers."]</p>
<div class="before-after">
<div>
<h3>Before</h3>
<ul>
<li>[具体的 before 行为 1]</li>
<li>[具体的 before 行为 2]</li>
<li>[失败模式或瓶颈]</li>
<li>[关键指标,例如 p99 ratio]</li>
</ul>
</div>
<div>
<h3>After</h3>
<ul>
<li>[具体的 after 行为 1]</li>
<li>[具体的 after 行为 2]</li>
<li>[新增的 safety net,例如 retry / dead-letter]</li>
<li>[改善后的指标]</li>
</ul>
</div>
</div>
<h2>File-by-file</h2>
<p>[Ordered for reading, not alphabetically. Tell the reviewer where to start and why.]</p>
<section class="files">
<details open>
<summary>
<code>[file/path/A.ts]</code>
<span class="badge new">new +[N]</span>
</summary>
<div>
<p>[这文件的角色一句话讲清。例如 "The heart of the PR. A pg-boss subscriber that pulls notify.deliver jobs."]</p>
<pre><code>[8-15 行最关键的代码片段,让 reviewer 看到逻辑核心]</code></pre>
</div>
</details>
<details>
<summary>
<code>[file/path/B.ts]</code>
<span class="badge mod">mod +[N] −[M]</span>
</summary>
<div>
<p>[Where the win shows up. The mutation used to call A, B, C inline. Now it does X.]</p>
<pre><code>[before/after 对照或关键 diff]</code></pre>
</div>
</details>
<details>
<summary>
<code>[file/path/C.sql]</code>
<span class="badge new">new +[N]</span>
</summary>
<div>
<p>[这文件的目的,注意非显然的设计选择。]</p>
</div>
</details>
<details>
<summary>
<code>[file/path/D]</code>
<span class="badge mod">mod +[N] −[M]</span>
</summary>
<div>
<p>[一两句说明。]</p>
</div>
</details>
</section>
<h2 id="focus">Where to focus your review</h2>
<section class="focus">
<ol>
<li>
<h3>[关键审阅点 1,例如 "The retry / dead-letter boundary"]</h3>
<p><code>[file:line-range]</code>. [为什么这是 risk hotspot——如果错了会发生什么。]</p>
</li>
<li>
<h3>[关键审阅点 2,例如 "The singleton key"]</h3>
<p><code>[file:line]</code>. [为什么需要重点 sanity-check。]</p>
</li>
<li>
<h3>What I deliberately did <em>not</em> do</h3>
<p>[列出明确推迟的工作,避免 reviewer 提出"为什么没加 X"。例如 "No per-user digest batching, no delivery receipts, no priority lanes. All layer cleanly on top; bundling them would make this unreviewable."]</p>
</li>
</ol>
</section>
<h2>Test plan</h2>
<section class="tests">
<dl>
<dt>Unit</dt>
<dd>[关键单测覆盖了什么]
<small>[路径或测试用例数]</small></dd>
<dt>Integration</dt>
<dd>[端到端场景]
<small>[环境/数据]</small></dd>
<dt>Staging load</dt>
<dd>[压测数字]
<small>[before/after 对比,附 dashboard 链接]</small></dd>
<dt>Manual</dt>
<dd>[手动验证步骤,含会做但还没做的]
<small>[何时做]</small></dd>
</dl>
</section>
<h2>Rollout</h2>
<p>[Behind <code>[flag_name]</code>. The old path stays in the codebase, dormant, for one release in case we need to flip back.]</p>
<section class="rollout">
<ol class="ramp">
<li><b>Day 0</b><span class="pct">internal</span><span>[Acme team only. Watch X and Y.]</span></li>
<li><b>Day 2</b><span class="pct">10%</span><span>[Random sample. Alert if Z.]</span></li>
<li><b>Day 4</b><span class="pct">100%</span><span>[Ramp fully, delete old path next week.]</span></li>
</ol>
</section>
</div>
</body>
</html>