Skip to content

ci: layer the lychee and zizmor configs over standards in the lint scripts - #18986

Merged
kyle-sexton merged 1 commit into
mainfrom
ci/lychee-zizmor-layering
Nov 25, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
ci/lychee-zizmor-layering

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #18980

Summary

Problem: the online link check and the zizmor gate did not follow the config layering owner decision Q295 set. Intent: "OK go w/ recommendations".

check-changed-links-online.sh now layers lychee configs natively, standards' first and this repository's second, and both it and run-zizmor.sh find standards through the standards_repository key instead of naming the repository.

Fix

  • scripts/check-changed-links-online.sh: passes standards' lychee.toml as the first --config and the root lychee.toml, when present, as the second (lychee 0.24+ merges repeated --config, later wins). LYCHEE_CONFIG stays a complete override read alone. Before, a repository lychee.toml replaced standards' instead of extending it.
  • Both scripts take standards' file from STANDARDS_DIR (CI's download-standards checkout), else from standards_repository in docs/conventions/source-control.yaml through the API. run-zizmor.sh reads that key at BASE_SHA when set, as it already reads the repository's own zizmor config from the base. A missing file or key fails closed with exit 2.
  • zizmor keeps its existing rule: a repository zizmor config is a complete override, else standards' config; no merge.
  • scripts/lane-coverage-step-opt-outs.txt: the lint-repo/standards reason now describes the API fallback correctly.

Verification

  • bash scripts/check-changed-links-online.test.sh: 30 of 30 pass, with new cases for standards-only, standards then repository lychee.toml, LYCHEE_CONFIG alone, a standards checkout missing the file (exit 2), the API read from standards_repository, and no key (exit 2, no API call).
  • bash scripts/run-zizmor.test.sh: 26 of 26 pass, including the API read from the base commit's standards_repository and a key present only at head failing closed.
  • bash scripts/check-lane-coverage.sh --check .github/workflows/pr-require-checks.yml ci-status scripts/lane-coverage-step-opt-outs.txt: passes.
  • shellcheck on the four changed scripts: clean.
  • Left out: check-script-contract.test.sh's two check-html-assets.sh cases, which fail locally only because this worktree has no npm ci (htmlhint missing); the check-changed-links-online.sh contract case passes.

Related

🤖 Generated with Claude Code

…ripts

check-changed-links-online.sh passes standards' lychee.toml as the
first --config and the repository's root lychee.toml, when present, as
the second, lychee's native merge; LYCHEE_CONFIG stays a complete
override read alone. Before, a repository lychee.toml replaced
standards' instead of extending it.

Both scripts take standards' file from STANDARDS_DIR, else from the
standards_repository of docs/conventions/source-control.yaml through the
API (run-zizmor.sh reads the key from the base commit), so neither names
the standards repository. A missing file or key fails closed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 25, 2026 03:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T03:42:57.125583Z bc23f54 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed bc23f54a1ebbc1b3db1cdf69dd68bce7aebab9ed: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #18986

I found no security issues. No changed file matches a trusted-path glob, and the diff touches no trust control.

What I checked

  • scripts/run-zizmor.sh: the standards repository now comes from a config key instead of a fixed name. The fallback used to name melodic-software/standards directly. It now reads standards_repository from docs/conventions/source-control.yaml. With BASE_SHA set, it reads that key as committed at the base commit. CI sets it: BASE_SHA: ${{ github.event.pull_request.base.sha }} at pr-require-checks.yml#L1338. So a pull request cannot point the zizmor config fetch at a repository it controls.
    • parse-concern-value.sh --ref only accepts a 40-hex commit id or origin/<name>, and passes it to git after --end-of-options (lib/parse-concern-value.sh#L88-L97).
    • The value must match ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ before it is used in the gh api path.
    • A missing key, a bad value or a failed read all exit 2 (fail closed). The new test covers a key that exists only at head.
  • scripts/check-changed-links-online.sh: the same key is read from the working tree (the PR head). This adds no new reach for an attacker:
    • The repository's own lychee.toml comes from the PR head too, is passed after standards', and wins on conflict. A pull request could already control the lychee ruleset that way.
    • The step runs on pull_request with the job's read-only github.token (pr-require-checks.yml#L1742-L1752).
    • The same owner/repo regex protects the API path, and a missing key or a failed read exits 2.
    • The script itself runs from the PR head checkout, so redirecting the config grants nothing the head does not already have.
  • Temporary files and the exit trap: the temporary array now holds both the fetched standards file and the link-input file, and a single EXIT trap removes them. Nothing leaks.
  • scripts/lane-coverage-step-opt-outs.txt: only the prose reason for the lint-repo/standards opt-out changed. Its gate meaning is the same.
  • Test files: they use fixture stubs (gh, the lychee stub) under TMP_ROOT and carry no credentials.

Throughput-phase exemption: this diff does not remove any of the owner's named friction holds.

PR context: there is no embedded text addressed to the review lane.

Instruction-surface lens: this diff does not delete or soften any standing instruction.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed bc23f54a1ebbc1b3db1cdf69dd68bce7aebab9ed: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I found nothing to block in this change. It makes the online link check layer its lychee configs over standards' config, and both lint scripts now find standards through the standards_repository key.

Closing issue #18980, checked against each "Done when" item:

  • Lychee layering is met. resolve_configs passes standards' lychee.toml first and the root lychee.toml, when it exists, second. LYCHEE_CONFIG stays a complete override read on its own (check-changed-links-online.sh#L34-L54). Tests cover standards only, standards then the repository's file, and LYCHEE_CONFIG alone.
  • Standards location is met. Both scripts take standards' file from STANDARDS_DIR, else read standards_repository from docs/conventions/source-control.yaml through lib/parse-concern-value.sh and fetch the file through the API. Neither script hardcodes the standards repository for the lookup any more.
    • run-zizmor.sh reads the key with --ref "$BASE_SHA" (run-zizmor.sh#L53).
    • The workflow sets BASE_SHA to github.event.pull_request.base.sha, a 40-hex id, so the parser's --ref check accepts it.
    • A test pins that a key present only at head fails closed.
  • Failing closed is met. A standards checkout with no lychee.toml, or a missing or malformed standards_repository, exits 2.
    • The parser exits 0 with empty output when the file is missing, so the regex guard is the branch that fires. Tests cover this, including that no API call is made.
    • In run-zizmor.sh, the existing cp and gh api failures still exit 2.
  • Test coverage is met. Both test files cover the layered, override, API and fail-closed cases.

Other checks:

  • In the link script, repository=$(...) runs under set -e. Because the parser exits 0 when the file is missing, the explicit exit-2 message is reached.
  • The temporary array and the single EXIT trap now replace the old trap 'rm -f "$input"'. The trap expands correctly even when the array is empty (bash 4.4 and later).
  • In CI, the online link step gets only GITHUB_TOKEN, which gh accepts.
  • The script-contract case uses LYCHEE=/nonexistent/lychee, so it exits 2 before any config lookup or API read.

Not verified: The design relies on lychee 0.24+ merging repeated --config flags. That is the author's claim; I could not confirm that the lychee installed by ci-workflows' lychee-offline composite is at least that version. The test results quoted in the PR are also the author's; I ran nothing myself.

Loosened checks: The lychee step now reads standards' rules as well as this repository's, so it may accept URLs standards excludes. The closing issue asks for exactly this, so it passes. The test edits move expected values to the new behaviour, for example from melodic-software/standards to the fixture's example-org/standards. That makes the tests stricter, not looser. The prompt has no loosened_check_verdict: or loosened_check_patterns: line, so I used the defaults (fail, no consumer patterns). It also has no loosened_check_decision_record: line, so the citation requirement was not checked.
Loosened checks would be marked: fail (bundled default); patterns: 0

Verifier dropped 0 of 0 candidates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Layer the lychee and zizmor configs in the link and zizmor scripts over standards

1 participant