Commit df28ac4
committed
Refactor: Separate modelling of candidate
_Addresses https://github.com/scala-steward-org/scala-steward/issues/3781_
The Scala Steward codebase deals with the concept of 'updates' in two areas:
* **Multiple `newerVersions`**: Initially, evaluating _candidate_ updates (in `UpdateAlg` & `FilterAlg`), where for any given artifact, there can be many possible versions we might want to upgrade to. The list of versions is reduced down with filtering (based on config & other rules), and eventually a single next version is selected.
* **Single `nextVersion`**: Subsequently, retrieving information on the updates represented by the pull requests Scala Steward created - each artifact being updated to a specific _single_ new version.
...Scala Steward used the `Update` type for _both_ areas (specifically, `Update.ForArtifactId` for the first phase, _requiring_ it to support multiple `newerVersions`).
Looking at a single `Update.ForArtifactId` in code, it's not always clear to the newcomer if the update contains many newer versions or not - ie where we are in the pipeline.
## Changes
* `Update.ForArtifactId` → `ArtifactUpdateCandidates`🆕 within `UpdateAlg` & `FilterAlg` where candidate versions are being evaluated
* `Update.ForArtifactId` & `ArtifactUpdateCandidates` both extend `ArtifactUpdateVersions`🆕 to allow `UpdatePattern.findMatch()` to filter lists of either of them:
* Filtering the candidate versions of `ArtifactUpdateCandidates` in `UpdatesConfig.isAllowed`, etc
* Filtering the `Update`s of existing PRs in `PruningAlg.newPullRequestsAllowed()` & `RetractedArtifact.isRetracted()`
* The fields from `Update.ForArtifactId` also required by `ArtifactUpdateCandidates` have been placed in the `ArtifactForUpdate`🆕 case class
* Restrict `Update.Single` types to just `nextVersion`, not `newerVersions`
Remaining unchanged:
* `PullRequestRepository` still persists instances of `Update`
* The JSON serialisation format of `Update` remains unchanged for now (the encoder & decoders have been adapted so that they still output the same format, despite the case classes having changed), so there's currently no need to introduce a new fallback 'legacy' decoder (several of which were recently deleted with #3785). This also means the JSON metadata added to PR descriptions (originally introduced in #3466) also remains the same for now, though I think it will be reasonable to adjust the format for `Update.ForArtifactId` to something more logical in future.newerVersions from Updates1 parent d4e87c7 commit df28ac4
File tree
17 files changed
+284
-164
lines changed- modules
- benchmark/src/main/scala/org/scalasteward/benchmark
- core/src
- main/scala/org/scalasteward/core
- data
- edit/update
- forge/data
- nurture
- repoconfig
- update
- data
- test/scala/org/scalasteward/core
- edit
- forge/data
- nurture
- update
- artifact
17 files changed
+284
-164
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
Lines changed: 117 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 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 | + | |
26 | 63 | | |
27 | 64 | | |
28 | 65 | | |
| |||
37 | 74 | | |
38 | 75 | | |
39 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
40 | 82 | | |
41 | 83 | | |
42 | 84 | | |
| |||
49 | 91 | | |
50 | 92 | | |
51 | 93 | | |
| 94 | + | |
52 | 95 | | |
53 | 96 | | |
54 | 97 | | |
55 | 98 | | |
56 | 99 | | |
57 | 100 | | |
| 101 | + | |
58 | 102 | | |
59 | 103 | | |
60 | | - | |
| 104 | + | |
61 | 105 | | |
62 | 106 | | |
63 | 107 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 108 | + | |
| 109 | + | |
78 | 110 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
84 | 116 | | |
85 | 117 | | |
86 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
87 | 127 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
93 | 142 | | |
94 | 143 | | |
95 | 144 | | |
| |||
100 | 149 | | |
101 | 150 | | |
102 | 151 | | |
103 | | - | |
| 152 | + | |
104 | 153 | | |
105 | 154 | | |
106 | 155 | | |
| |||
109 | 158 | | |
110 | 159 | | |
111 | 160 | | |
112 | | - | |
| 161 | + | |
113 | 162 | | |
114 | 163 | | |
115 | | - | |
| 164 | + | |
116 | 165 | | |
117 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
118 | 173 | | |
119 | | - | |
| 174 | + | |
| 175 | + | |
120 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
121 | 181 | | |
122 | | - | |
| 182 | + | |
123 | 183 | | |
124 | 184 | | |
125 | 185 | | |
| |||
142 | 202 | | |
143 | 203 | | |
144 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
145 | 208 | | |
146 | 209 | | |
147 | 210 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 211 | | |
152 | 212 | | |
153 | 213 | | |
| |||
163 | 223 | | |
164 | 224 | | |
165 | 225 | | |
166 | | - | |
| 226 | + | |
167 | 227 | | |
168 | | - | |
169 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
170 | 233 | | |
171 | 234 | | |
172 | 235 | | |
173 | 236 | | |
174 | 237 | | |
175 | 238 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
179 | 243 | | |
180 | 244 | | |
181 | 245 | | |
| |||
197 | 261 | | |
198 | 262 | | |
199 | 263 | | |
200 | | - | |
| 264 | + | |
201 | 265 | | |
202 | 266 | | |
203 | 267 | | |
| |||
206 | 270 | | |
207 | 271 | | |
208 | 272 | | |
209 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
210 | 280 | | |
211 | 281 | | |
212 | 282 | | |
213 | 283 | | |
214 | 284 | | |
215 | 285 | | |
216 | 286 | | |
217 | | - | |
| 287 | + | |
218 | 288 | | |
219 | 289 | | |
220 | 290 | | |
221 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
222 | 295 | | |
223 | 296 | | |
224 | 297 | | |
| |||
236 | 309 | | |
237 | 310 | | |
238 | 311 | | |
239 | | - | |
| 312 | + | |
240 | 313 | | |
241 | 314 | | |
242 | 315 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
| |||
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
141 | 150 | | |
142 | 151 | | |
143 | 152 | | |
| |||
Lines changed: 7 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
207 | | - | |
208 | | - | |
209 | | - | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | 212 | | |
215 | 213 | | |
216 | | - | |
217 | | - | |
| 214 | + | |
| 215 | + | |
218 | 216 | | |
219 | 217 | | |
220 | | - | |
221 | | - | |
| 218 | + | |
| 219 | + | |
222 | 220 | | |
223 | 221 | | |
224 | 222 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
| 366 | + | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
45 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
0 commit comments