Commit 106bfbd
authored
ci: audit example with-keys against current action.yml input contracts (#136)
* ci: audit example with-keys against current action.yml input contracts
Closes the gap that let the recent example-staleness drift through
unnoticed. Composite-action consumers passing ``with:`` keys that
aren't declared in ``action.yml::inputs`` see a runtime warning,
not a failure. CI never *runs* the example workflows — only
YAML-validates them — so a contract trim could silently leave
``examples/`` referencing inputs the action no longer accepts.
PR #134 fixed the symptom; this PR closes the source.
What ships
==========
* ``scripts/ci/check_example_inputs.py`` — walks every
``examples/**/*.yml``, finds each
``uses: huntridge-labs/argus/.github/actions/<name>@<ref>``
step, and diffs its ``with:`` keys against the matching
action's declared inputs. Reports unknown keys with
job/step/file location. Exits 1 on any miss, 0 on clean,
2 on internal error (missing actions dir).
Surfaces:
--json machine-readable output
--gh-annotations ``::error file=...:: PR-inline rendering
--paths <dir>... override the default examples roots
--actions-dir <p> override the default actions dir
* ``tests/unit/test_check_example_inputs.py`` — 18 tests
covering: input-name collection, clean / unknown-input /
multi-key / missing-action / yaml-parse-error workflows,
non-argus uses-step ignored, exit codes (0/1/2), JSON output
shape, gh-annotations stderr emission, and a smoke test that
the actual repo's ``examples/`` passes today.
* ``.github/workflows/test-examples-functional.yml`` — new
``audit-action-inputs`` job runs once across the whole
example tree (cross-action correlation, not per-example).
Wired into the ``examples-summary`` aggregator so any failure
blocks the workflow. Uses env-var-injected ``needs.<>.result``
values to stay workflow-injection-safe per the GitHub
security guidance.
Why a single job, not the per-example matrix
=============================================
The audit needs the full ``action.yml`` input contract for every
referenced action plus every ``with:`` block across the tree.
Splitting per file would re-load the contracts N times and
fragment the failure summary. One job, one parse pass, one
report — fast enough that the matrix split adds nothing.
Local verification
==================
* ``python -m scripts.ci.check_example_inputs`` → exit 0 on
``feat/argus-portability`` post PRs #134 / #135.
* Full SDK suite + the new tests: 2911 passed, 2 skipped, 7
deselected.
* ``test-examples-functional.yml`` parses as valid YAML.
Future
======
If a future contract trim lands without an examples follow-up,
the audit fails the next PR-validation run with an inline
annotation pointing at the offending example. Either fix the
example, or update the action's contract — see the script's
docstring for the resolution flow.
* fix(ci): silence check_version_refs false-positives in audit script + tests
The new audit script and its tests reference ``huntridge-labs/argus/.
github/actions/<name>@<ref>`` as a literal placeholder pattern in
docstrings, comments, and a test-helper f-string. The
``check_version_refs.py`` gate parses that as a real version ref
and flags it as uncovered.
Three minimal fixes — keep the placeholder text intact where the
docstring needed it, just teach the gate to skip those lines:
* scripts/ci/check_example_inputs.py:61 — added the ``release-it-
ignore`` IGNORE_MARKER suffix to the comment line that documents
the regex shape.
* tests/unit/test_check_example_inputs.py:4 — embedded the marker
inline in the docstring's prose. The marker is a plain string
the gate searches for, so prose context works fine.
* tests/unit/test_check_example_inputs.py::_write_example —
pulled ``huntridge-labs/argus/.github/actions/`` into a local
variable so the literal pattern doesn't appear on the same
source line as the action name + ref. The rendered YAML still
has a single ``uses:`` line, which is what the audit-under-test
consumes.
Verified: ``check_version_refs`` exits 0 against tracked files,
the audit script + 18 unit tests still pass.
---------
Co-authored-by: eFAILution <eFAILution@users.noreply.github.com>1 parent 12fc7cc commit 106bfbd
3 files changed
Lines changed: 672 additions & 7 deletions
File tree
- .github/workflows
- scripts/ci
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 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 | + | |
212 | 261 | | |
213 | 262 | | |
214 | 263 | | |
| |||
218 | 267 | | |
219 | 268 | | |
220 | 269 | | |
| 270 | + | |
221 | 271 | | |
222 | 272 | | |
223 | 273 | | |
224 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
225 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
226 | 287 | | |
227 | 288 | | |
228 | 289 | | |
229 | 290 | | |
230 | 291 | | |
231 | | - | |
232 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
233 | 295 | | |
234 | 296 | | |
235 | 297 | | |
236 | 298 | | |
237 | 299 | | |
238 | 300 | | |
239 | | - | |
240 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
241 | 304 | | |
242 | 305 | | |
243 | 306 | | |
244 | 307 | | |
245 | 308 | | |
246 | | - | |
247 | | - | |
248 | | - | |
| |||
| 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 | + | |
| 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 | + | |
0 commit comments