livery.extensions.coverage._union¶
livery.extensions.coverage._union ¶
The gate job's half of coverage: every leg's parts and the records', as one union.
The gate job's judge, coverage.union, reads what each check leg
left on its per-run ref, carries every unit a leg did not measure from
the records, merges every unit's parts by the line format's rules, and
writes the merged files to the workspace's union file, which the floors
then judge (combine_union). It writes the run's units back onto the
branch's record or main's.
Functions:
| Name | Description |
|---|---|
expected_legs |
The check legs the gate produces, and the ones run's event runs. |
combine_union |
Union the run's legs' parts with the records; the packages it judges. |
Attributes:
| Name | Type | Description |
|---|---|---|
ABSENT |
|
expected_legs ¶
The check legs the gate produces, and the ones run's event runs.
A pull request runs the legs [ci] pull-request-runners names,
the first runner's alone while that key is absent, unless it
carries livery.workshop.EVERY_RUNNER_LABEL; every other event
runs them all. Both empty without a root contract, as a test
workspace may be.
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_union.py
combine_union ¶
Union the run's legs' parts with the records; the packages it judges.
Each check leg's per-run ref carries the scope its gate ran and the units it measured, each unit's parts in the line format. A full leg measured every suite, a narrowed or measured leg the suites its marker names; a leg whose gate skipped (a tree already proved, or nothing affected) measured nothing. Every unit a leg did not measure is carried from a record on that leg, the branch's own before main's, at the unit's current closure identity, so the union is the same global union a full run produces and every package is judged. A unit no record can supply refuses by name: a leg skips a suite only when a record holds it, so a miss here is a leg that narrowed without the records, or a record moved on since, never a smaller union. Every unit's parts merge by the line format's rules: one file's readings merge at the content the checkout holds and by one measurer, a reading at an earlier content the checkout's object store holds is carried across the change line by line, and every reading left out is named. The merged files go to the union file, which the floors read; no union file outlives a run that did not write one.
The union is written back per leg: a pull request's run onto its branch's record, main's run onto main's. The leg's fresh units replace their rows, the rows carried from the other record are copied in, the target's own carried rows stand, and the rows of units that no longer exist go. On main's run the branch is the one the verified record names for the tree, so the merge copies the branch's record into main's. Each row written numbers the tests that reached its lines as the row it replaces does, and a unit the target lacks as the other record's row of it, so a branch's rows number them as main's do; each appends every test the run's rows of its unit name on any leg, so every leg's row numbers a test alike. A record that cannot be written prints why: the next run reruns what it cannot reuse, the safe direction.
A leg the contract names and a pull request did not run, one
outside [ci] pull-request-runners, is carried whole from the
records, so the narrowed run judges the same global union and a
line only another platform reaches stays covered by main's
measurement of it. A file the change touched keeps that leg's
reading at every line the change left in place, carried across the
diff; its reading on a line the change touched is dropped by name,
so a changed line only that platform reaches is red until a run of
every leg measures it.
A leg the run runs and that left no ref is red by name, never carried: it died before its write, or its write was refused, and the union of the legs that did write would judge the floors without the lines only its platform reaches.
Refuses by name when no leg left its parts, when a leg the run runs left no ref, when a leg's ref carries no readable file, when a leg names no scope the union reads, when a leg that ran a suite left its parts out, when a unit is neither the run's nor any record's, and when a part is off the line format, naming where it came from and the key.
Returns:
| Type | Description |
|---|---|
Package
|
The judged packages, in packages order; empty when the |
...
|
workspace has no unit to union, and then no union file is |
tuple[Package, ...]
|
written. |
Source code in packages/extensions/coverage/src/livery/extensions/coverage/_union.py
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 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | |