Commit 8142f52
committed
refactor: simplify CronTrigger timezone field and add deduplication tests
Change timezone field from Optional[str] to str since the default="UTC"
ensures it's never None at runtime. This makes the type annotation
accurately reflect the actual behavior.
Changes:
- Change CronTrigger.timezone from Optional[str] to str
- Remove None check from timezone validator (Pydantic default handles it)
- Remove Optional import (no longer needed)
- Rename test_duplicate_triggers_with_identical_values to
test_trigger_model_equality_with_identical_values to clarify it tests
Pydantic model equality, not business logic deduplication
- Remove test_none_timezone_defaults_to_utc (timezone=None no longer valid)
- Add integration tests for trigger deduplication in create_crons function
- test_create_crons_deduplicates_identical_triggers
- test_create_crons_keeps_triggers_with_different_timezones
- test_create_crons_keeps_triggers_with_different_expressions
- test_create_crons_complex_deduplication_scenario
The integration tests verify actual database behavior to ensure the
deduplication logic in verify_graph.py correctly creates only one
DatabaseTriggers row per (expression, timezone) pair.
Signed-off-by: Sparsh <sparsh.raj30@gmail.com>1 parent 077ca50 commit 8142f52
4 files changed
Lines changed: 274 additions & 45 deletions
File tree
- state-manager
- app/models
- tests/unit
- models
- tasks
- with_database
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 34 | + | |
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 62 | | |
68 | 63 | | |
69 | 64 | | |
| |||
118 | 113 | | |
119 | 114 | | |
120 | 115 | | |
121 | | - | |
122 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
123 | 122 | | |
124 | 123 | | |
125 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
| |||
90 | 88 | | |
91 | 89 | | |
92 | 90 | | |
93 | | - | |
94 | 91 | | |
95 | 92 | | |
96 | 93 | | |
| |||
115 | 112 | | |
116 | 113 | | |
117 | 114 | | |
118 | | - | |
119 | 115 | | |
120 | 116 | | |
121 | 117 | | |
122 | | - | |
123 | 118 | | |
124 | 119 | | |
125 | 120 | | |
| |||
166 | 161 | | |
167 | 162 | | |
168 | 163 | | |
169 | | - | |
170 | 164 | | |
171 | 165 | | |
172 | 166 | | |
173 | | - | |
174 | 167 | | |
175 | 168 | | |
176 | 169 | | |
| |||
197 | 190 | | |
198 | 191 | | |
199 | 192 | | |
200 | | - | |
201 | 193 | | |
202 | 194 | | |
203 | 195 | | |
204 | | - | |
205 | 196 | | |
206 | 197 | | |
207 | 198 | | |
| |||
228 | 219 | | |
229 | 220 | | |
230 | 221 | | |
231 | | - | |
232 | 222 | | |
233 | 223 | | |
234 | 224 | | |
| |||
243 | 233 | | |
244 | 234 | | |
245 | 235 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
0 commit comments