Commit 226cb71
Seven cases in this package asserted an exact call/execution count while
`CronJobAdapter.schedule()` had registered a REAL croner job on a firing
expression. Croner fired that registration on its own schedule alongside the
explicit `trigger()`, so every one of those assertions was a claim about the
wall clock rather than about the adapter.
Reproduced by faking ONLY `Date` — real timers, croner's real scheduling path —
with the registration placed 2/5/10/15 ms before the expression's own instant.
Under the firing spellings each case gained exactly one extra handler run:
`records executions` 1 -> 2 execution rows, `retries a failing handler` 3 -> 4
calls (the self-fire re-enters a handler whose retry counter is already spent,
so it succeeds on the first attempt), and the daily kernel-rebuild case gained
an unasked-for `fired` entry at 08:00 UTC. At a 2 ms lead two of the three
stopped reproducing — croner had already passed the instant by the time it
computed `nextRun()` — which is what makes this a positional flake rather than
a deterministic failure. Under the fixture all three hold at every lead.
Four cases used '* * * * *' (hazard window once per minute) and three used a
daily expression (same defect, ~1440x rarer). All seven now schedule on the
inert `NEVER_FIRES` fixture ('0 0 30 2 *' — February 30th never occurs, so
`nextRun()` is null and the registration owns no schedule of its own).
The counts themselves are unchanged: they are the only thing here that can
catch a genuine double-scheduling regression.
`NEVER_FIRES` moves out of db-job-adapter.timeout.test.ts into a shared
test-support module so a later tidy-up cannot revive the hazard in one file
only, and both halves of the pin (the fixture cannot fire; the registration the
case actually made cannot fire) are shared assertions rather than a shape each
file re-spells by hand.
Claude-Session: https://claude.ai/code/session_01NaS1PAHJcPfAA2acnV53Tn
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 79394d7 commit 226cb71
4 files changed
Lines changed: 157 additions & 37 deletions
File tree
- packages/services/service-job/src
Lines changed: 40 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
7 | 18 | | |
8 | 19 | | |
9 | 20 | | |
10 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
11 | 26 | | |
12 | 27 | | |
13 | 28 | | |
14 | | - | |
| 29 | + | |
15 | 30 | | |
| 31 | + | |
16 | 32 | | |
17 | 33 | | |
18 | 34 | | |
| |||
35 | 51 | | |
36 | 52 | | |
37 | 53 | | |
38 | | - | |
| 54 | + | |
| 55 | + | |
39 | 56 | | |
40 | 57 | | |
41 | 58 | | |
| |||
76 | 93 | | |
77 | 94 | | |
78 | 95 | | |
79 | | - | |
| 96 | + | |
80 | 97 | | |
81 | 98 | | |
82 | 99 | | |
83 | 100 | | |
84 | 101 | | |
85 | 102 | | |
| 103 | + | |
86 | 104 | | |
87 | 105 | | |
88 | 106 | | |
| |||
95 | 113 | | |
96 | 114 | | |
97 | 115 | | |
98 | | - | |
| 116 | + | |
99 | 117 | | |
100 | 118 | | |
101 | 119 | | |
| 120 | + | |
102 | 121 | | |
103 | 122 | | |
104 | 123 | | |
| |||
109 | 128 | | |
110 | 129 | | |
111 | 130 | | |
112 | | - | |
| 131 | + | |
113 | 132 | | |
114 | 133 | | |
115 | 134 | | |
| 135 | + | |
116 | 136 | | |
117 | 137 | | |
118 | 138 | | |
| |||
168 | 188 | | |
169 | 189 | | |
170 | 190 | | |
171 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
172 | 197 | | |
173 | 198 | | |
174 | 199 | | |
175 | 200 | | |
176 | 201 | | |
177 | 202 | | |
178 | | - | |
| 203 | + | |
179 | 204 | | |
180 | 205 | | |
181 | 206 | | |
182 | 207 | | |
183 | 208 | | |
184 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
185 | 212 | | |
186 | 213 | | |
187 | 214 | | |
| |||
193 | 220 | | |
194 | 221 | | |
195 | 222 | | |
196 | | - | |
| 223 | + | |
197 | 224 | | |
198 | 225 | | |
199 | 226 | | |
| |||
213 | 240 | | |
214 | 241 | | |
215 | 242 | | |
216 | | - | |
| 243 | + | |
217 | 244 | | |
218 | 245 | | |
219 | | - | |
| 246 | + | |
| 247 | + | |
220 | 248 | | |
221 | 249 | | |
222 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
170 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
171 | 185 | | |
172 | 186 | | |
173 | 187 | | |
| |||
178 | 192 | | |
179 | 193 | | |
180 | 194 | | |
181 | | - | |
| 195 | + | |
| 196 | + | |
182 | 197 | | |
183 | 198 | | |
184 | 199 | | |
| |||
197 | 212 | | |
198 | 213 | | |
199 | 214 | | |
200 | | - | |
| 215 | + | |
| 216 | + | |
201 | 217 | | |
202 | 218 | | |
203 | 219 | | |
204 | 220 | | |
205 | 221 | | |
206 | 222 | | |
207 | 223 | | |
208 | | - | |
| 224 | + | |
| 225 | + | |
209 | 226 | | |
210 | 227 | | |
211 | 228 | | |
| |||
Lines changed: 11 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
64 | 57 | | |
65 | 58 | | |
66 | 59 | | |
67 | 60 | | |
68 | | - | |
69 | | - | |
| 61 | + | |
70 | 62 | | |
71 | 63 | | |
72 | 64 | | |
| |||
233 | 225 | | |
234 | 226 | | |
235 | 227 | | |
236 | | - | |
| 228 | + | |
237 | 229 | | |
238 | 230 | | |
239 | 231 | | |
| |||
251 | 243 | | |
252 | 244 | | |
253 | 245 | | |
254 | | - | |
255 | | - | |
256 | | - | |
| 246 | + | |
257 | 247 | | |
258 | 248 | | |
259 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments