Commit Graph

323 Commits

Author SHA1 Message Date
Teknium
d836448951 fix(ci): stop the Windows lane timing out on workflow replays and racing a killed backup's lock
tests/ci/test_update_ci_routing.py hit the runner's 300 s per-file cap on
the Windows-only lane (run 43948656160). Its selection (36 tests) spawns
Git Bash 363 times through tests/ci/workflow_steps._run, but only 37 of
those scripts are distinct: every test first replays the unmutated
workflows, then the mutated copy. A step replay is a pure function of its
rendered script, env, cwd and receipt mode, so memoize it per process.
`required()` still runs on every call, so the disabled/advisory mutations
keep failing. Same selection on Linux: 18.8 s -> 3.8 s.

test_retry_elsewhere_reclaims_default_backup_stages_but_preserves_live_ones
flaked on Windows with the killed child's stage left behind. Windows frees
a terminated process's LockFileEx locks asynchronously ("depends upon
available system resources"), so the retry's reaper can still find the
lease locked and correctly skips it as a live owner. Product behaviour is
right (the next run reclaims it); the test now waits until the lease is
lockable before retrying, in both killed-child recovery tests.
2026-11-16 13:25:22 -08:00
Maciej Lisiewski
b624d30ec0 Merge pull request #155405 from NousResearch/sec3/128930-history-check-pr-head
fix(ci): judge the unrelated-histories gate on the PR head, not the merge ref
2026-11-15 01:31:00 +01:00
Maciej Lisiewski
00c53467ef Merge pull request #155389 from NousResearch/sec3/108382-ci-input-hardening
ci: pin wheel, pass install-e2e inputs via env, keep skills-index probe output single-line
2026-11-15 01:30:15 +01:00
Maciej Lisiewski
ac9f86e3cd fix(ci): decode git output as UTF-8 and honour a head the last fetch brings in
The _git() helper ran git with text=True but no encoding=, which the
footgun checker rejects (locale codec on Windows); pass encoding='utf-8',
errors='replace', and the same in the test file's git() helper.

pr_head() checked for the commit only before each fetch, so a head that
only the final fetch retrieved still resolved to "" (PR head unavailable).
Resolve it once after the loop instead.

Refs #128930

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-14 13:24:09 +01:00
Maciej Lisiewski
5c2daadc29 fix(ci): judge the unrelated-histories gate on the PR head, not the merge ref
A pull_request checkout is refs/pull/N/merge, whose first parent is main's
tip, so merge-base origin/main HEAD always succeeded and the gate could never
reject. The step now gets github.event.pull_request.head.sha, fails closed
when that commit cannot be resolved, and also rejects a head whose root
commits are not all already in main (a main-descended branch that merged an
unrelated history).

Fixes #128930

Co-authored-by: beardthelion <56458543+beardthelion@users.noreply.github.com>
2026-11-14 13:24:09 +01:00
Teknium
78f8c9a625 fix(update): module-mode old updaters still hand off; shim tests use a manifest
`python -m hermes_cli.main update` from releases before update_cmd.py was split
out runs cmd_update/_cmd_update_impl as `__main__`, so in_historical_update()
did not see them and e.g. bc747001eec5's post-pull update_managed_uv() import
raised instead of handing off, leaving the update half-done. A `__main__` frame
now counts when its code was compiled from this checkout's hermes_cli/main.py;
the current tree's own entry points stay live code via the sentinel local.

The shim runtime tests discovered shims by parsing source (banned in tests).
The shim list is now data (tests/fixtures/retired_updater_shims.json, 63 shims,
generated from the former scan); scripts/ci/check_retired_shims_manifest.py runs
the AST scan as a repo-guards step and fails on drift or an empty scan.
2026-11-14 01:03:00 -08:00
Maciej Lisiewski
158044fe67 test(ci): rank the hostile source into the skills-index probe summary
The newline-bearing source had one entry, so most_common(8) dropped it
and the test passed with source sanitization removed. Give it 600
entries and assert its flattened text leads the summary line.

Refs #108382
2026-11-14 05:26:27 +01:00
Maciej Lisiewski
cb87eee4b3 fix(ci): keep skills-index probe output single-line
The probe's stdout is appended to $GITHUB_OUTPUT, so a CR/LF in the
fetched generated_at, a skill's source key, or a JSON decode error
would start a new key=value line and could forge status=ok, silencing
the watchdog. Flatten those remote-derived values before formatting.

Fixes #108382
2026-11-14 05:26:27 +01:00
Teknium
e2e701e86c test: move the allowlist test to the Linux-only catalog CI suite
The gate shells out to grep -Z, which GNU grep reads as NUL-delimited
output and BSD grep (macOS) as decompress, so the posix-marked suite
saw no flagged files on macOS and the rejection never fired. The gate
only ever runs on Linux CI runners, so the test joins the Linux-only
suite that already drives the gate.
2026-11-13 16:49:24 -08:00
Teknium
c711c2efe6 ci(plugin-catalog): maintainer allowlist for third-party tool downloads in the self-updater gate
The self-updater gate rejects any plugin script that both fetches from
GitHub and writes or renames files. rom-studio (#153798) trips it on
kit/kit.ts, which downloads the third-party poryscript 3.6.1 compiler
from its own release, checks a fixed sha256 and unpacks it into
kit/.cache. It never fetches or replaces rom-studio's own files, so the
pin stays the only update path (README rule 3).

Teknium ruled to allow it. A maintainer now lists such a file in
scripts/ci/catalog_self_updater_allowlist.json by repo, pinned sha, path
and the file's sha256: a re-pin, an edit to that file or a second
fetching file is gated again. The list lives under scripts/ci/, which an
entry PR may not touch (catalog_changed_entries.py), so a submitter
cannot add themselves. Rule 3 in both rule blocks names the exception.
2026-11-13 16:49:24 -08:00
Siddharth Balyan
d312b4989e Merge pull request #151880 from NousResearch/sid/migrate-branch-tool
feat(move): just migrate-branch carries a branch across module moves
2026-11-14 05:37:07 +05:30
Maciej Lisiewski
5163cc678b Merge pull request #155077 from NousResearch/fix/nit-150296-lockfile-diff
fix(ci): read pnpm explicit-key pairs in lockfile diff; cover peer/dev/optional paths
2026-11-13 22:48:15 +01:00
alt-glitch
93792d12ea fix(ci): route the inits above a moved module, and test lane tables through MOVES
Importing a moved module runs hermes_agent/__init__.py and the inits where it lives now; the
classifier lists them by original path, which is what classify() reads. The lane-table tests map
tracked files back through original_path, find listed files where they live now, and walk the
update entry points' imports by original path, skipping the old-path forwarders.
2026-11-13 20:47:04 +00:00
alt-glitch
124cb0bb16 fix(ci): route package inits to the upgrade lanes without checking they exist on disk
The classifier kept a package __init__.py in the e2e_upgrade and e2e_desktop_update tables only if
the file existed at that path. The CI detect job runs in a sparse checkout that has no package
inits, and after a move no init exists at its old path, so both lanes stopped firing for nine
inits. A listed path that does not exist never matches a changed file, so the filter is dropped.
2026-11-13 20:47:04 +00:00
alt-glitch
7d090e2c0e fix(ci): sparse-check out the compat package the change classifier imports
The detect job checks out only the classifier and its action, so the classifier's
hermes_agent.compat import fails and every later job is skipped. Check out the package too, and
pin the sparse list against the classifier's imports in a test.
2026-11-13 20:47:04 +00:00
Maciej Lisiewski
0502253fd4 test(ci): section_keys refuses a key line one column short 2026-11-13 17:27:29 +01:00
Maciej Lisiewski
2f49f19032 test(ci): pin importer optionalDependencies, the ? precondition of the fold, and short quoted keys
Each test kills a mutant that previously survived: _DEP_FIELDS without
optionalDependencies, a fold of any '  : ' line, and _KEY splitting a plain
quoted 'key: x': line (real pnpm 12.15.0 writes one for a short file: path
containing ': ').

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 16:55:57 +01:00
Kevin Rajan
40d379ca38 fix(ci): preserve quoted colon-space in long pnpm mapping keys
After c2h5oh's explicit-key fold in #155077, section_keys still split
quoted file: keys at the first embedded ': '. This truncates the
package name/version in semantic lockfile reports for a legal POSIX
file path containing ': ' and long enough to trigger js-yaml's pair.

Reuse the quote-aware _ENTRY parser at the keys-only call site and
pin the real 1024-character threshold without changing pnpm defaults.

Follow-up to c2h5oh's #155077 and BearHuddleston's #150296 review.

(cherry picked from commit 0d8141d97fb09e3439b76b89f6da090134e049df)
2026-11-13 16:54:52 +01:00
Maciej Lisiewski
3abb6fa2ab test(ci): cover peer suffixes, dev/optional deps and one-sided moves in lockfile diff
Kills surviving mutants in _reference, the snapshot consumer key, the
dependency fields, the '- item' list branch and hidden()'s two sides.

Follow-up to #150296 (review nits).

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 16:54:51 +01:00
Maciej Lisiewski
a407a95938 fix(ci): read pnpm's explicit ? key / : value pairs in the lockfile reader
js-yaml (pnpm's lockfile emitter) writes a mapping key longer than 1024
characters as an explicit pair, which a long peer suffix on a snapshot key
or a long file: path reaches. _section_lines refused the '? ' line, failing
the lockfile-diff step on a lock pnpm wrote itself; fold the pair back
into the usual key: lines.

Follow-up to #150296 (review nits).

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-13 16:54:51 +01:00
Maciej Lisiewski
5b7b470cc3 fix(ci): catch streamed downloads hidden by comments, blank lines or absolute paths
BuildKit drops comment lines and blank lines inside a RUN continuation, and a
top-level comment ending in a backslash does not continue; the guard joined
lines naively, so 'curl u \\ / # c / | tar' and '# c \\ / RUN curl u | sh' slipped
through. '| /bin/tar' and '| /usr/bin/sh' were missed by the matcher too.
2026-11-12 19:57:31 +01:00
Maciej Lisiewski
c321b8f406 fix(sandbox): verify the cua-driver tarball before extracting it
docker/sandbox-desktop.Dockerfile streamed the cua-driver release asset
straight into tar, so whatever the server returned became a root-owned
binary on PATH in the published default terminal sandbox. Fetch to a
file and sha256sum -c it against committed per-arch digests first, the
way the root Dockerfile already handles SQLite and s6-overlay.

Add scripts/ci/check_dockerfile_downloads.py (repo-guards step and
`scripts/check --only dockerfile-downloads`) so no tracked Dockerfile
can pipe a download into an extractor or interpreter again.

Fixes #126942

Co-authored-by: Yuan Li <dskwelmcy@163.com>
2026-11-12 19:55:14 +01:00
Teknium
d92c31ae65 feat(catalog): weekly check delists entries whose repo or pin is gone
A catalog entry whose repository was deleted, or whose pinned commit was
force-pushed away, can't be installed any more: `hermes plugins install` clones
the repo and checks out the pin, and both fail. Nothing noticed until a user
hit it.

scripts/ci/catalog_dead_repos.py looks up every entry (GitHub in GraphQL batches
of 50, with REST confirming each miss so a renamed or transferred repo is never
taken for deleted; other hosts via git ls-remote). Any unclear answer, or more
than 25 dead at once, aborts with nothing delisted, because that shape is an
outage, not a week of deletions. The weekly workflow deletes the dead entry
files on bot/catalog-dead-repos and opens one PR for review; nothing
auto-merges. It delists (deletes the file) and never touches removed.yaml,
which is the security blocklist.

First run, on today's catalog: 8 of 2,087 entries are dead (7 deleted repos,
1 force-pushed pin). Their files are deleted in a separate commit.
2026-11-12 02:21:17 -08:00
Teknium
9dc7e6a524 fix(ci): reject text files stored with CRLF line endings
.gitattributes asks git to store text with LF, but only a client that
honours it does: a GitHub web upload or an API commit lands bytes as sent.
plugin-catalog/board-insights.yaml arrived that way. Every fresh checkout
then showed it as modified, and the icon check (which needs a clean tree)
failed on every catalog PR until #154171 rewrote it.

- scripts/ci/check_line_endings.py reads `git ls-files --eol` and fails on
  any index blob that is crlf/mixed, except -text (binary) and eol=crlf
  (*.ps1) paths. `--fix` rewrites offenders with LF and stages them.
- Runs as a Repository guards step and as `scripts/check --only
  line-endings` (so the pre-push hook catches it locally too).
- `* text=auto` catch-all in .gitattributes, so text files outside the
  listed extensions are normalized at check-in too (renormalizing the
  whole tree with it changes nothing but the file below).
- Fixes the one remaining offender:
  contributors/emails/uperLu@users.noreply.github.com.

Co-authored-by: lancelotsh51sh <283335493+lancelotsh51sh@users.noreply.github.com>
2026-11-11 18:50:11 -08:00
Siddharth Balyan
3bcd071226 fix(ci): the supply-chain scan no longer counts a moved line as new (#153398)
* fix(ci): the supply-chain scan judges a moved file by what changed in it

The supply-chain pattern scan failed on a pull request that moves hermes_cli/_launchers.py to hermes_agent/hermes_cli/_launchers.py and leaves a small forwarding file at the old path. Git showed the old path as modified and the new path as an added file, so all 1,177 unchanged lines counted as added. Line 334, which builds a Windows launcher with exec and base64.b64decode and has been on main for a long time, was then reported as a critical finding.

The scan now runs git diff with --find-copies -l0. Git pairs the new file with its old path and shows only the lines that changed as added. -l0 removes git's file limit: on a diff of about 5,000 files git otherwise skips copy detection and also drops rename detection.

Copy detection alone would also hide a payload-shaped line that a pull request copies into a new file while the original file keeps it. The scan therefore still judges every line of a copied file that its source file still contains after the pull request. A line is treated as moved only when it left its old place.

It still reports a payload line added anywhere: new lines in a moved file, a new file, a copy of an existing file with a line inserted, and a copied line whose source still has it. Renamed files without a forwarding file were already judged by their changed lines and are unchanged. On the 5,230-file move range the scan takes about 8 seconds instead of 1.3.

* fix(ci): the supply-chain scan judges a moved line by whether the diff also removes it

The scan paired a moved file with its old path through git's copy detection and then re-read both files. That missed a payload line when one file was copied to two new paths, and it split lines at characters git does not treat as line ends.
The scan now diffs without rename detection and leaves out an added line only when the same diff removes a line with the same text, once per removed line. A second copy of a moved file and a copy whose source keeps the line are judged.
The copy detection, the name-status parser and the cat-file reader are removed, so the scan no longer needs git 2.38.

* fix(ci): the supply-chain scan treats a line as moved only between files of the same name

An added line was left out whenever the diff removed the same text anywhere, so a payload-shaped line deleted from a test fixture and added to another module produced no finding.
The removed line must now come from a file with the same file name, which is what a move to a new folder keeps. Text taken from a file of another name is judged.
2026-11-11 18:10:04 +05:30
unsupportedpastels
bf4d330db0 fix(ci): only delegate to a twin from the same head branch and repository
A cancelled gate could pass on a live run of another PR that shares its head
SHA. Fork runs carry an empty pull_requests list, so the PR cannot be matched
without refusing every fork duplicate; require the twin's head_branch and
head_repository.id to match instead (both duplicates of one push share them).
Also soften the README: the last run to start never passes by delegation,
and a run cancelled while still pending never runs its gate.

Suggested by Greptile; narrowing from @BearHuddleston's review.
2026-11-09 22:16:54 -05:00
unsupportedpastels
d85c6f3974 fix(ci): fail closed with the report when a runs page is not an object
Catch AttributeError in the superseding-run lookup so a JSON list page keeps
the gate failing with its job report instead of a traceback.

Suggested by @BearHuddleston's review.
2026-11-09 22:16:54 -05:00
unsupportedpastels
6d84737945 fix(ci): delegate from approved fork duplicates by run start order
Order superseding runs by (run_started_at, id) so the later entrant to the
concurrency group, which is the one that cancels, carries the verdict. Let
attempt 2 delegate only when attempt 1 concluded action_required (a fork
run held for approval). Adds tests for a pending twin and the client-side
workflow/SHA/event check.

Patch from @BearHuddleston's review.
2026-11-09 22:16:54 -05:00
unsupportedpastels
3105eb1f6a fix(ci): page through event-filtered runs when looking for a superseding twin 2026-11-09 22:16:54 -05:00
unsupportedpastels
3bdbc97063 fix(ci): only let a cancelled duplicate run delegate forward to a newer twin
A cancelled run's gate may now pass only when a strictly newer run (higher id) of the same workflow, event and head SHA is live or succeeded, and only on the run's first attempt. Delegation is acyclic, so two cancelled duplicates can no longer vouch for each other and the newest cancelled run always fails.
2026-11-09 22:16:54 -05:00
unsupportedpastels
8c891f2d51 fix(ci): pass the gate of a cancelled duplicate PR run when its twin is live 2026-11-09 22:16:54 -05:00
Maciej Lisiewski
f4bbeab788 ci(guards): hadolint runs from scripts/ci/lint_docker.sh, which just lint-docker also runs
The pinned hadolint digest moves from the workflow into the script, which CI calls as
`lint_docker.sh hadolint`. Locally the script also runs shellcheck on the files
ludeeus/action-shellcheck selects under docker/. Editing the script alone now starts the
docker_meta lane that runs it, without building an image.
2026-11-09 19:43:47 +01:00
Teknium
cacad9510e ci: side-branch dispatch cancel covers branches only; README matches
Review follow-up: the dispatch clause matched any non-main ref, so a
non-release tag dispatch also cancelled its predecessor. It now requires
refs/heads/ (tag case added to the test; red on the previous head).
_gha_expr models startsWith/endsWith (case-insensitive, per the Actions
docs). .github/workflows/README.md concurrency section now describes
side-branch dispatches, and notes GitHub may still replace a pending run
in a non-cancelling group.
2026-11-09 10:14:14 -08:00
Teknium
339989f8db ci: a re-dispatch on a side branch replaces its stale run
ci.yaml keyed manual dispatches on the branch ref with cancel-in-progress
off, so a second `gh workflow run ci.yaml --ref fix/x` sat `pending`
behind the first until that one finished every slow leg (e2e-upgrade
shards, Windows install/update E2E). A release-blocker debug lane lost
~30 min waiting on runs whose answer it had already read.

cancel-in-progress now also covers workflow_dispatch on any ref but
main, the same way a new push to a PR supersedes the previous run.
Unchanged: pushes to main, a dispatch on main, and stable-release
workflow_call runs (their group is run_id and inputs.release
short-circuits the expression).

tests/ci/test_ci_concurrency_cancel.py evaluates the real block for each
start mode; the side-branch dispatch case is red on the old expression.
The commit-threading guard gets an allowlist row for the github.ref use,
which never chooses the commit under test.
2026-11-09 10:14:14 -08:00
teknium1
8719a66ef8 ci: limit the ajv declaration separator to ':' (drop '=>')
BearHuddleston: '(?::|=>)' also matched an arrow function returning ajv's id
(const f = $id => '<ajv id>'; fetch(new URL('/evil', f()))), stripping the id
and letting a fetch-base self-updater pass. No JS object declaration uses '=>',
so restrict the separator to ':'. Add arrow_fn_base and other_url_declared as
red cases (the latter pins that only ajv's exact id -- not any
raw.githubusercontent URL in a $id -- is exempt).
2026-11-09 08:36:59 -08:00
teknium1
aa711165dd ci: exempt the ajv meta-schema by declaration in Python, not a grep lookbehind
Two review findings on the regex approach:
- Greptile: the fixed `$id: "` / `$ref: "` lookbehinds rejected harmless ajv
  bundles with quoted keys ("$id":) or minified spacing ($id:"...") -- the very
  false rejection this change removes.
- BearHuddleston: the lookahead left a `.../data.json/../../evil` traversal (Node
  normalizes it to a real GitHub path) and a real fetch sharing a minified line
  with the inert id.

Replace the overloaded grep pattern with a plain grep -E first cut plus a Python
refinement (_file_fetches_github): strip the inert ajv $id/$ref DECLARATION in
any quoting/spacing, then a real raw.githubusercontent / release URL remaining is
a true fetch. "#" is the only id terminator, so a traversal out of data.json is a
different, non-exempt URL; the literal reused as a fetch base is not a declaration
and stays flagged. Tests parametrize four legit declaration forms and four
adversarial forms (two traversals, beside-id, fetch-base).
2026-11-09 08:36:59 -08:00
teknium1
ae6a219527 ci: pin the ajv exemption to the schema-declaration prefix
Greptile (P1): exempting the ajv meta-schema URL by value let the same literal
be abused as an executable fetch base --
`new URL('/evil/repo/main/plugin.js', ajvUrl); fetch(u)...writeFileSync(__filename, body)`
-- whose only raw.githubusercontent occurrence is the exempt id, so the fetch
scan skipped the file and the write scan never saw it.

Pin the exemption to the `$id: "`/`$ref: "` schema-declaration prefix with
fixed-length negative lookbehinds, so the URL is inert only where ajv declares
its meta-schema. The executable-base form, a sibling refs path, and a traversal
all still trip the gate. Adds the new-URL-base exploit as an invariant test.
2026-11-09 08:36:59 -08:00
teknium1
a81232342b fix(ci): the catalog self-updater gate ignores ajv's bundled meta-schema URL
A plugin that bundles ajv ships ajv's draft-06 meta-schema, whose $id/$ref is
the literal string "https://raw.githubusercontent.com/ajv-validator/ajv/master/
lib/refs/data.json#". ajv matches that identifier by value against its own
in-memory schema; it never drives a network request. But the self-updater gate's
fetch pattern matched raw.githubusercontent.com anywhere, so any such bundle that
also wrote a data file (both halves in one minified file) was rejected as a
self-updater (e.g. subnano's server/cli.js).

Exempt only that exact inert id, pinned up to its "#" fragment terminator via a
negative lookahead (needs grep -P), so a real fetch under any other
raw.githubusercontent path -- or a traversal like .../lib/refs/../../payload.js --
still trips the gate. Two invariant tests cover the exemption and the traversal.
2026-11-09 08:36:59 -08:00
alt-glitch
4ba6e7ef8a fix(ci): an attested file still goes through the self-updater gate
_check_attested removes each verified file from the clone so the payload scan
ignores it, and it ran before _check_self_updater. A plugin could list a JS
updater under attested_binaries: once its provenance checked out the file was
gone, the self-updater grep never saw it, and users still got it from the
pin. Provenance shows where a file came from, not what it does, so the
self-updater gate now runs before anything is removed.
2026-11-09 19:07:47 +05:30
alt-glitch
e82a44fcc6 fix(ci): the plugin catalog gate verifies attested binaries
README rule 17 lets a catalog entry ship a native binary listed under
attested_binaries, if `gh attestation verify` proves the plugin repo built it
at the pinned commit. The old inline step fed its parser as
`python3 -I - "$entry" <<PYEOF </dev/null`; the later </dev/null replaced the
heredoc, so the parser ran an empty program, the list always came back empty
and `gh attestation verify` never ran. #151877 moved the step into
scripts/ci/ and kept that dead branch out, so behaviour stayed the same.

The field reader now returns the attested paths beside the clone source and
rejects any that is not a plain relative path. The gate verifies each one
against the entry's repo at the pinned sha, then removes it so the payload
scan ignores it, and any other binary still fails. No catalog entry declares
attested_binaries today, so nothing admitted now changes.
2026-11-09 18:56:58 +05:30
Siddharth Balyan
d478c8ffc6 Merge pull request #151877 from NousResearch/sid/just-ci-scripts
ci: repo-guards, plugin-catalog and skills-index steps run scripts instead of inline bash
2026-11-09 18:53:07 +05:30
alt-glitch
c042454317 fix(ci): catalog fields cross as JSON; a uv.lock timeout keeps its report
The catalog field reader printed shell assignments and the gate parsed them
back with shlex, a shell layer between two Python programs. It now prints
one JSON object, and the gate rejects the entry unless it gets exactly
REPO, SHA, SUBDIR and BAD as strings.

verify_uv_lock.py let TimeoutExpired escape after 600 s, so the job lost the
attempt's log and published no review status. A timed-out attempt now prints
its partial log, reports "uv.lock check timed out" and stops: retrying three
more 600 s attempts would outlive the job.
2026-11-09 18:32:10 +05:30
alt-glitch
d8ed14f2da ci: a justfile or hermes-python change runs every lane
Workflows now run their commands as just recipes, so the justfile and the
wrapper its Python recipes use are CI configuration living outside
.github/. The change classifier only failed open on .github/, so a PR
that broke a recipe skipped the jobs that run it and failed after merge.
Both files now count as CI configuration.
2026-11-09 18:05:31 +05:30
alt-glitch
07cc878490 test(ci): build the supply-chain fixture payloads from pieces
The supply-chain scanner reads every added line of a PR, including this
test's, so the literal payloads made the scan on this PR fail. The test
now assembles them, so the lines it adds never match the scanner while the
files it commits still do.
2026-11-09 16:57:39 +05:30
alt-glitch
42288e127b ci(guards): repository guard steps run scripts under scripts/ci
repo-guards.yml carried twelve inline run blocks of 17 to 79 lines: bash
programs with embedded JSON, heredoc Python and a retry loop. Each moves
into a stdlib Python script that CI and a developer can run alike; the
workflow keeps every step name, id and if: unchanged, and the longest
run block is now one line.

- check_infographic_images.py: Reject committed PR-infographic images
- check_common_ancestor.py: Reject PRs with no common ancestor on main
- check_contributor_emails.py: Check for unmapped contributor emails
- pr_diff_report.py prompt-surface|lockfile: the two advisory diff
  summaries (merge base, $GITHUB_OUTPUT changed=, step summary)
- scan_supply_chain.py patterns|dependency-bounds: the supply-chain
  scan and the unbounded PyPI dependency check
- verify_uv_lock.py: Verify uv.lock is up-to-date (5/15/45s retry on
  registry failures only)
- review_status.py emit <check> | merge <artifact> ENV...: the four
  near-identical "Emit review_status (...)" blocks and the supply-chain
  merge, as one table of findings

${{ }} values the old blocks interpolated into bash (base_ref, PR base
and head SHAs, the lockfile-diff flag) now reach the scripts through
step env only.

An equivalence harness ran every old block and its replacement on the
same fixture repos (Linux, bash -e, GNU grep): 39 cases, identical exit
code, stdout, stderr, $GITHUB_OUTPUT, step summary and review-status
files. The one deliberate text change: the supply-chain how_to_fix now
points at scripts/ci/scan_supply_chain.py, where the pattern lives.
tests/ci/test_repo_guard_checks.py covers each guard as its step runs it.
2026-11-09 16:42:47 +05:30
alt-glitch
bec4baa051 ci(catalog): plugin-catalog gate steps call scripts instead of inline bash
The two long run: blocks of plugin-catalog-ci.yml move into scripts/ci/,
so the admission gate can be read, tested and run outside a workflow:

- "Find changed catalog entries" (41 lines) ->
  scripts/ci/catalog_changed_entries.py: the merge-commit check, the
  AMRT entry list without removed.yaml, the data-only rule for entry PRs,
  and the files<<__EOF__ block in $GITHUB_OUTPUT.
- "Clone each entry at its pinned sha and validate" (235 lines) ->
  scripts/ci/catalog_validate_pinned_entries.py, with the entry-field
  parser that the step fed to `python3 -I -` on a heredoc now in
  scripts/ci/catalog_entry_fields.py (still run with -I, still evaled
  as shlex-quoted assignments, still reset to "parser failed" when it
  dies).

Both steps run `python3 -I "$GITHUB_WORKSPACE/scripts/ci/<script>"`;
env, error lines, PASS/FAIL lines and exit codes are unchanged. The
attested_binaries block is not carried over: its parser ran with
`<<'PYEOF' </dev/null`, so the later redirect gave python an empty
program, ATTESTED was always empty and no `gh attestation verify` ever
ran. Dropping it keeps today's behaviour (a declared binary still fails
the payload scan).

test_plugin_catalog_ci_confinement.py still runs the workflow step text
(now the script call); every case passes against both the old and the
new workflow. test_catalog_pinned_confinement.py adds a POSIX test of
the confinement rule and the entry-field rejections, since the step
test is Linux-only.
2026-11-09 16:42:47 +05:30
alt-glitch
f5ef9cef05 ci(skills-index): probe and watchdog steps run scripts under scripts/ci
The freshness workflow carried a 64-line inline Python judge and two
near-identical bash blocks that open or comment on a watchdog issue.

- `Probe live index`: the heredoc judge moves to
  scripts/ci/skills_index_probe.py (same floors, 26 h limit, 1500 total,
  same output lines on stdout, exit 0 for every verdict). curl stays
  inline in the step.
- Both "Open issue" steps call scripts/ci/skills_index_watchdog_issue.py
  with `skills-index` or `plugin-catalog-cors`. One table holds the two
  title prefixes, titles and bodies; the find/comment/create logic is
  written once. GH_TOKEN, STATUS and DETAIL stay in the step env and the
  repository comes from GITHUB_REPOSITORY instead of `${{ }}` in the script.
  The prefix filter that used `--jq startswith` is now done in Python.

Tests judge saved index fixtures and drive the watchdog against a stub
gh, with no network.
2026-11-09 16:42:47 +05:30
Maciej Lisiewski
c3bcfcc5bd test(e2e-upgrade): start a merge release from its second parent; fail on CI with no release
upgrade_base() took N-1 from `git tag --merged HEAD~1`, a first-parent
walk. A release cut as a merge loses its predecessor that way: at
v0.22.2 (first parent the release/0.22.1 tip, second parent the
published v0.22.1) it picked v0.22.0. release_tags(before=True) now
takes `--merged HEAD --no-contains HEAD` and keeps the depth-1 guard on
HEAD~1. On main both pick v0.23.0.

With no release reachable the suites skipped. On CI, where the job
fetches full history and tags, that means a broken checkout reported
green, so it now raises there.

The resolver test lives in tests/ci so PR CI runs it; the e2e-upgrade
lane runs only on release and dispatch runs.

Part of #150040
2026-11-08 23:46:06 +01:00
alt-glitch
307a47994f test(upgrade): the start-version tests run in the full-history e2e-upgrade job
Ordinary test jobs check out depth 1, where these tests skip; the core
e2e-upgrade shard has tags and collects files under tests/e2e/core/upgrade.
2026-11-06 23:23:32 -05:00
alt-glitch
b880d944d0 test(upgrade): a scenario's generation needs release history, not an error
Without tags (a depth-1 checkout) the scenarios that ask for one updater
generation now skip like the rest; only a generation that the reachable
releases do not ship is an error. The scenario's generation also takes
precedence over the suite-wide override, which may name another updater.
2026-11-06 23:23:32 -05:00