deadgate 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {deadgate-0.1.2 → deadgate-0.1.4}/PKG-INFO +113 -2
  2. {deadgate-0.1.2 → deadgate-0.1.4}/README.md +112 -1
  3. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/cli.py +1 -1
  4. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/detectors.py +399 -17
  5. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate.egg-info/PKG-INFO +113 -2
  6. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate.egg-info/SOURCES.txt +1 -0
  7. {deadgate-0.1.2 → deadgate-0.1.4}/pyproject.toml +1 -1
  8. deadgate-0.1.4/tests/test_api_status_gates.py +361 -0
  9. {deadgate-0.1.2 → deadgate-0.1.4}/tests/test_corpus.py +39 -8
  10. deadgate-0.1.4/tests/test_wildcard_gates.py +683 -0
  11. deadgate-0.1.2/tests/test_wildcard_gates.py +0 -357
  12. {deadgate-0.1.2 → deadgate-0.1.4}/LICENSE +0 -0
  13. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/__init__.py +0 -0
  14. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/checknames.py +0 -0
  15. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/predicates.py +0 -0
  16. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/protection.py +0 -0
  17. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/resolve.py +0 -0
  18. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate/sandbox.py +0 -0
  19. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate.egg-info/dependency_links.txt +0 -0
  20. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate.egg-info/entry_points.txt +0 -0
  21. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate.egg-info/requires.txt +0 -0
  22. {deadgate-0.1.2 → deadgate-0.1.4}/deadgate.egg-info/top_level.txt +0 -0
  23. {deadgate-0.1.2 → deadgate-0.1.4}/setup.cfg +0 -0
  24. {deadgate-0.1.2 → deadgate-0.1.4}/tests/test_predicates.py +0 -0
  25. {deadgate-0.1.2 → deadgate-0.1.4}/tests/test_protection.py +0 -0
  26. {deadgate-0.1.2 → deadgate-0.1.4}/tests/test_sandbox.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deadgate
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Find CI checks that cannot fail: gates satisfied by skipped jobs, exit statuses swallowed by pipes, fan-ins that never read whether their upstream passed.
5
5
  Author-email: Erik Hill <contact@erikhill.dev>
6
6
  License: MIT
@@ -161,6 +161,117 @@ is a separate and harder problem and is not in this release.
161
161
  ## Licence
162
162
  MIT
163
163
 
164
+ ## 0.1.4 closes two more classes, and D1 stops claiming HIGH
165
+
166
+ **Upgrade from anything earlier.** Seven times now this tool has reported correct CI as
167
+ broken. The first six were all the same mistake, asking "does this job consult its
168
+ upstreams?" and looking in too few places, each fixed by widening a pattern. The seventh
169
+ is not that, and could not be fixed that way.
170
+
171
+ | # | what was missed | found on |
172
+ |---|---|---|
173
+ | 6 | D2 fired on `always() + needs + no result read`, the signature of every reporting job | pre-registered sample |
174
+ | 7 | upstream status read through the **GitHub Actions API**, not `needs` | WordPress/gutenberg |
175
+
176
+ ### Class 7, and why a wider regex cannot fix it
177
+
178
+ gutenberg's `*-status-check` jobs run a script that pages
179
+ `GET /repos/{repo}/actions/runs/{run_id}/jobs` and fails if any job concluded as anything
180
+ other than `success` or `skipped`. The word `result` never appears and `needs` is never
181
+ consulted, so **no pattern over the workflow file can find it**: the evidence lives in a
182
+ file this tool does not parse. That gate is in fact *more* robust than the idiom deadgate
183
+ hunts for, because it also fails closed when a job was never evaluated, which
184
+ `needs.*.result` cannot detect. Ten of the 54 D1 findings were this shape, all false, all
185
+ one repository.
186
+
187
+ So the claim is narrowed instead of the pattern widened. When a named gate shells out with
188
+ a token in scope, deadgate reads the script: it **suppresses** if the script consults run
189
+ status, keeps full severity if it demonstrably does not, and otherwise **demotes and says
190
+ the claim is unverified** rather than asserting something it cannot check. The token
191
+ requirement is what keeps this narrow, since reading another job's conclusion needs
192
+ credentials; without it every job running `./build.sh` would be demoted.
193
+
194
+ ### Two smaller classes
195
+
196
+ - **A job that can never run.** Four findings were jobs whose own `if:` is a literal
197
+ false. A job that never executes cannot report success on anything.
198
+ - **A gate that watches the whole chain.** A gate needing a job *and every job upstream of
199
+ it* sees any real failure in that chain directly, so the only skip still getting through
200
+ is a condition the author deliberately evaluated false. Note the direction: suppressing a
201
+ job because its *parent* is covered is unsound, because `needs.*.result` reports only
202
+ direct needs and a failed grandparent makes the parent skip rather than fail.
203
+
204
+ ### D1 no longer produces a HIGH finding
205
+
206
+ D1's population was small enough to **census rather than sample**, so it was: every one of
207
+ the 54 findings hand-labelled, 29 distinct jobs. **76% false per finding, 59% per job**,
208
+ exact, no interval. Even after all three fixes above it is 65% false, with eleven of the
209
+ survivors a single reporting job.
210
+
211
+ "A required check is satisfied by a skipped job" needs a protection configuration no
212
+ workflow file carries. So D1 follows D4 and D2: MEDIUM when nothing in the workflow
213
+ consults upstream results at all, LOW when something does, and HIGH only when
214
+ `protection.py` confirms the job is a required check.
215
+
216
+ Corpus HIGH across 275 repositories and 4543 files: **354 to 125**, now entirely D3,
217
+ measured at 21-33% false per finding.
218
+
219
+ ### The measurement defect, which is the part worth reading
220
+
221
+ Every precision figure published for this tool before 0.1.4, including the 40% in the
222
+ write-up, was **answering a different question than the one it was reported as answering.**
223
+
224
+ The samples were stratified with a cap of two findings per repository, to stop one
225
+ repository dominating. But deadgate emits one finding per (job, upstream) pair, and the
226
+ false positives concentrate in jobs with many dependencies: one reporting job in the
227
+ corpus emits eleven findings by itself. The cap deletes exactly that clustering.
228
+
229
+ Simulated against the censused truth, 20k draws at n=15:
230
+
231
+ | sampler | converges to | bias vs per-finding | bias vs per-job |
232
+ |---|---|---|---|
233
+ | cap 1/repo | 58.3% | -17.6 pts | -0.3 pts |
234
+ | cap 2/repo | 60.1% | -15.8 pts | +1.5 pts |
235
+ | cap 3/repo | 63.6% | -12.3 pts | +5.0 pts |
236
+ | uncapped | 74.7% | -1.2 pts | +16.1 pts |
237
+
238
+ The capped sampler is an unbiased estimator of the **per-job** rate and runs about 16
239
+ points low for the **per-finding** rate. Every published number was weighted back to
240
+ per-finding populations, so every one understated in the same direction. Two n=15 samples
241
+ of D1 estimated 60% and 33%; the truth is 76%, and the second sample's 95% interval did
242
+ not contain it.
243
+
244
+ Related, and also worth stating plainly: **179 findings were 136 distinct problems**, a
245
+ 1.32x inflation. A finding count is not a problem count.
246
+
247
+ ## 0.1.3 closes a fifth class, and D4 stops claiming HIGH
248
+
249
+ **Upgrade from anything earlier.** Five times now this tool has reported correct CI as
250
+ broken, each time because it asked "does this job consult its upstreams?" and looked in too
251
+ few places.
252
+
253
+ | # | what was missed | found on |
254
+ |---|---|---|
255
+ | 1 | `needs.*.result`, the WILDCARD form, matched with `[A-Za-z0-9_-]+` which cannot match `*` | Arize-ai/openinference |
256
+ | 2 | D4 judged a job alone, ignoring the workflow's own gate | Arize-ai/openinference |
257
+ | 3 | `toJSON(needs)`, every upstream read with no `result` token anywhere | astral-sh/ruff |
258
+ | 4 | PLACEMENT: a reusable-workflow call has `uses:` and no `steps:`, passing the result through JOB-level `with:` | scikit-learn |
259
+ | 5 | a gate that NAMES each upstream, `needs.a.result`, `needs.b.result`, one per job | open-gsd, omi, inbox-zero |
260
+
261
+ 1 and 2 shipped in 0.1.0. 3 and 4 were found by pointing the fixed version at two more
262
+ repositories. 5 was found by hand-labelling 40 of its own surviving findings, which is the
263
+ only method here that found anything the previous method could not.
264
+
265
+ **D4 no longer produces a HIGH finding.** That sample scored D4 at **0 defensible out of
266
+ 18**, and the overall false-positive rate among survivors was 40% (Wilson 95% [26%, 55%]),
267
+ statistically indistinguishable from the 40% removed in 0.1.2. D4's HIGH came from whether
268
+ the job's NAME matched test/lint/check, while the finding asserted something about branch
269
+ protection that a workflow file cannot know. It is now MEDIUM when nothing in the workflow
270
+ gates at all, LOW when something does, and HIGH only when protection data confirms the job
271
+ is a required check.
272
+
273
+ Corpus HIGH across 275 repositories and 4543 files: **658 to 354**.
274
+
164
275
  ## 0.1.2 closes four false-positive classes, two of them shipped
165
276
 
166
277
  **Upgrade from 0.1.0 or 0.1.1.** Four times this tool reported correct CI as broken, each time
@@ -198,5 +309,5 @@ That gap is the lesson worth keeping. The tool was least accurate on the reposit
198
309
  BEST CI, which is the worst place for a linter to cry wolf, and no corpus average would have
199
310
  surfaced it. The suite passed unchanged through every one of the four, 149 of it through the
200
311
  first two fixes and 161 through the second two, so not one of them was covered by anything.
201
- There are 165 tests now, and `scripts/check_readme_test_count.py` fails if that number and the
312
+ There are 219 tests now, and `scripts/check_readme_test_count.py` fails if that number and the
202
313
  suite ever drift apart again.
@@ -133,6 +133,117 @@ is a separate and harder problem and is not in this release.
133
133
  ## Licence
134
134
  MIT
135
135
 
136
+ ## 0.1.4 closes two more classes, and D1 stops claiming HIGH
137
+
138
+ **Upgrade from anything earlier.** Seven times now this tool has reported correct CI as
139
+ broken. The first six were all the same mistake, asking "does this job consult its
140
+ upstreams?" and looking in too few places, each fixed by widening a pattern. The seventh
141
+ is not that, and could not be fixed that way.
142
+
143
+ | # | what was missed | found on |
144
+ |---|---|---|
145
+ | 6 | D2 fired on `always() + needs + no result read`, the signature of every reporting job | pre-registered sample |
146
+ | 7 | upstream status read through the **GitHub Actions API**, not `needs` | WordPress/gutenberg |
147
+
148
+ ### Class 7, and why a wider regex cannot fix it
149
+
150
+ gutenberg's `*-status-check` jobs run a script that pages
151
+ `GET /repos/{repo}/actions/runs/{run_id}/jobs` and fails if any job concluded as anything
152
+ other than `success` or `skipped`. The word `result` never appears and `needs` is never
153
+ consulted, so **no pattern over the workflow file can find it**: the evidence lives in a
154
+ file this tool does not parse. That gate is in fact *more* robust than the idiom deadgate
155
+ hunts for, because it also fails closed when a job was never evaluated, which
156
+ `needs.*.result` cannot detect. Ten of the 54 D1 findings were this shape, all false, all
157
+ one repository.
158
+
159
+ So the claim is narrowed instead of the pattern widened. When a named gate shells out with
160
+ a token in scope, deadgate reads the script: it **suppresses** if the script consults run
161
+ status, keeps full severity if it demonstrably does not, and otherwise **demotes and says
162
+ the claim is unverified** rather than asserting something it cannot check. The token
163
+ requirement is what keeps this narrow, since reading another job's conclusion needs
164
+ credentials; without it every job running `./build.sh` would be demoted.
165
+
166
+ ### Two smaller classes
167
+
168
+ - **A job that can never run.** Four findings were jobs whose own `if:` is a literal
169
+ false. A job that never executes cannot report success on anything.
170
+ - **A gate that watches the whole chain.** A gate needing a job *and every job upstream of
171
+ it* sees any real failure in that chain directly, so the only skip still getting through
172
+ is a condition the author deliberately evaluated false. Note the direction: suppressing a
173
+ job because its *parent* is covered is unsound, because `needs.*.result` reports only
174
+ direct needs and a failed grandparent makes the parent skip rather than fail.
175
+
176
+ ### D1 no longer produces a HIGH finding
177
+
178
+ D1's population was small enough to **census rather than sample**, so it was: every one of
179
+ the 54 findings hand-labelled, 29 distinct jobs. **76% false per finding, 59% per job**,
180
+ exact, no interval. Even after all three fixes above it is 65% false, with eleven of the
181
+ survivors a single reporting job.
182
+
183
+ "A required check is satisfied by a skipped job" needs a protection configuration no
184
+ workflow file carries. So D1 follows D4 and D2: MEDIUM when nothing in the workflow
185
+ consults upstream results at all, LOW when something does, and HIGH only when
186
+ `protection.py` confirms the job is a required check.
187
+
188
+ Corpus HIGH across 275 repositories and 4543 files: **354 to 125**, now entirely D3,
189
+ measured at 21-33% false per finding.
190
+
191
+ ### The measurement defect, which is the part worth reading
192
+
193
+ Every precision figure published for this tool before 0.1.4, including the 40% in the
194
+ write-up, was **answering a different question than the one it was reported as answering.**
195
+
196
+ The samples were stratified with a cap of two findings per repository, to stop one
197
+ repository dominating. But deadgate emits one finding per (job, upstream) pair, and the
198
+ false positives concentrate in jobs with many dependencies: one reporting job in the
199
+ corpus emits eleven findings by itself. The cap deletes exactly that clustering.
200
+
201
+ Simulated against the censused truth, 20k draws at n=15:
202
+
203
+ | sampler | converges to | bias vs per-finding | bias vs per-job |
204
+ |---|---|---|---|
205
+ | cap 1/repo | 58.3% | -17.6 pts | -0.3 pts |
206
+ | cap 2/repo | 60.1% | -15.8 pts | +1.5 pts |
207
+ | cap 3/repo | 63.6% | -12.3 pts | +5.0 pts |
208
+ | uncapped | 74.7% | -1.2 pts | +16.1 pts |
209
+
210
+ The capped sampler is an unbiased estimator of the **per-job** rate and runs about 16
211
+ points low for the **per-finding** rate. Every published number was weighted back to
212
+ per-finding populations, so every one understated in the same direction. Two n=15 samples
213
+ of D1 estimated 60% and 33%; the truth is 76%, and the second sample's 95% interval did
214
+ not contain it.
215
+
216
+ Related, and also worth stating plainly: **179 findings were 136 distinct problems**, a
217
+ 1.32x inflation. A finding count is not a problem count.
218
+
219
+ ## 0.1.3 closes a fifth class, and D4 stops claiming HIGH
220
+
221
+ **Upgrade from anything earlier.** Five times now this tool has reported correct CI as
222
+ broken, each time because it asked "does this job consult its upstreams?" and looked in too
223
+ few places.
224
+
225
+ | # | what was missed | found on |
226
+ |---|---|---|
227
+ | 1 | `needs.*.result`, the WILDCARD form, matched with `[A-Za-z0-9_-]+` which cannot match `*` | Arize-ai/openinference |
228
+ | 2 | D4 judged a job alone, ignoring the workflow's own gate | Arize-ai/openinference |
229
+ | 3 | `toJSON(needs)`, every upstream read with no `result` token anywhere | astral-sh/ruff |
230
+ | 4 | PLACEMENT: a reusable-workflow call has `uses:` and no `steps:`, passing the result through JOB-level `with:` | scikit-learn |
231
+ | 5 | a gate that NAMES each upstream, `needs.a.result`, `needs.b.result`, one per job | open-gsd, omi, inbox-zero |
232
+
233
+ 1 and 2 shipped in 0.1.0. 3 and 4 were found by pointing the fixed version at two more
234
+ repositories. 5 was found by hand-labelling 40 of its own surviving findings, which is the
235
+ only method here that found anything the previous method could not.
236
+
237
+ **D4 no longer produces a HIGH finding.** That sample scored D4 at **0 defensible out of
238
+ 18**, and the overall false-positive rate among survivors was 40% (Wilson 95% [26%, 55%]),
239
+ statistically indistinguishable from the 40% removed in 0.1.2. D4's HIGH came from whether
240
+ the job's NAME matched test/lint/check, while the finding asserted something about branch
241
+ protection that a workflow file cannot know. It is now MEDIUM when nothing in the workflow
242
+ gates at all, LOW when something does, and HIGH only when protection data confirms the job
243
+ is a required check.
244
+
245
+ Corpus HIGH across 275 repositories and 4543 files: **658 to 354**.
246
+
136
247
  ## 0.1.2 closes four false-positive classes, two of them shipped
137
248
 
138
249
  **Upgrade from 0.1.0 or 0.1.1.** Four times this tool reported correct CI as broken, each time
@@ -170,5 +281,5 @@ That gap is the lesson worth keeping. The tool was least accurate on the reposit
170
281
  BEST CI, which is the worst place for a linter to cry wolf, and no corpus average would have
171
282
  surfaced it. The suite passed unchanged through every one of the four, 149 of it through the
172
283
  first two fixes and 161 through the second two, so not one of them was covered by anything.
173
- There are 165 tests now, and `scripts/check_readme_test_count.py` fails if that number and the
284
+ There are 219 tests now, and `scripts/check_readme_test_count.py` fails if that number and the
174
285
  suite ever drift apart again.
@@ -75,7 +75,7 @@ def main(argv: list[str] | None = None) -> int:
75
75
  jobs_by_file[str(f)] = (doc or {}).get("jobs") or {}
76
76
  if workflow_is_callable(doc):
77
77
  callable_files.add(str(f))
78
- for x in scan_workflow(doc):
78
+ for x in scan_workflow(doc, base=root):
79
79
  why = ""
80
80
  if prot is not None:
81
81
  job = ((doc or {}).get("jobs") or {}).get(x.job)