Skip to content

ci: skip heavy jobs for learnings and toolkit PRs (jflowers/ship pr-scope.yml) - #217

Merged
jflowers merged 2 commits into
unbound-force:mainfrom
jflowers:ci/pr-scope
Nov 28, 2026
Merged

jflowers merged 2 commits into
unbound-force:mainfrom
jflowers:ci/pr-scope

Conversation

@jflowers

Copy link
Copy Markdown
Contributor

Summary

Replaces ci.yml's inline learnings-only changes detector with jflowers/ship's shared pr-scope.yml. It runs as a scope job, pinned to 3b0ce8bf (main, after v0.11.0). Its code output is 'false' for two kinds of PR:

  • Dewey learnings PRs: every changed file is a .uf/dewey/learnings/*.md file.
  • gh-hud toolkit rollouts: author jflowers, branch chore/toolkit-*, every file under .opencode/.

Pushes and everything else get 'true'.

Changes:

  • Standardized CI moves into ci.yml. ci_checks.yml is deleted and its call-reusable-ci job now lives in ci.yml. The job name stays Standardized CI, so the check names (Standardized CI / Run linters and the rest) don't change and release preflight still finds them on main. With the job in the same workflow, CI OK can need it. That lets CI OK cover it and be the only required check. A skipped reusable-workflow caller reports none of its inner check names, so Standardized CI / Run linters can't stay required once that job can skip.
  • Gating. Build and Test and Standardized CI run only when needs.scope.outputs.code == 'true'.
  • New Gitleaks job. It runs only on chore PRs (code == 'false') and scans the PR's commits (HEAD^1..HEAD^2). The gitleaks version is SHA-256 pinned and matches dewey and gaze. This replaces the secret scan chore PRs no longer get from MegaLinter's betterleaks.
  • CI OK. It keeps its always() condition, which still exempts only a cancelled push run. It now fails unless scope succeeded and each job ended as scope chose: Build and Test and Standardized CI succeed with Gitleaks skipped for code, and the reverse for chores. Before, it accepted any mix of success and skipped.
  • internal/workflowtest/ci_gating_test.go. Removes the tests of the deleted detector script, since ship owns and tests that classifier now. It now pins the new job graph and runs the verdict script against a truth table.
  • Docs. The AGENTS.md CI Parity Gate and the .github/settings.yml comment are updated.

This reverses CLS-FR-002 of ci-skip-build-for-learnings, which said Standardized CI is never skipped. Chore PRs now skip MegaLinter, KICS and PR title validation. The new Gitleaks job keeps the secret scan for them.

ci_dependencies.yml (dependency review) is left ungated. It is cheap, not required, and relevant to toolkit rollouts, which can change .opencode/ package manifests.

After merge, the org's safe-settings will make CI OK the only required check, dropping Standardized CI / Run linters.

Related Issues

  • Follows up ci-skip-build-for-learnings

Review Hints

  • go test ./internal/workflowtest/ and actionlint .github/workflows/*.yml pass locally.
  • Until safe-settings drops Standardized CI / Run linters from the required checks, chore PRs will wait on it. Code PRs are unaffected.

🤖 Generated with Claude Code

…cope.yml)

Replace ci.yml's inline learnings-only `changes` detector with a `scope`
job that calls jflowers/ship's shared pr-scope.yml. Its code output is
'false' for Dewey learnings PRs and for gh-hud toolkit rollouts.

Move the Standardized CI call from ci_checks.yml into ci.yml, keeping
its job name, so CI OK can need it and become the only required check.
Build and Test and Standardized CI now run only on code == 'true'.
Chore PRs get a Gitleaks job that scans their commits, which replaces
the secret scan they no longer get from Standardized CI. CI OK now
checks each job ended as scope chose, instead of accepting any mix of
success and skipped.

ci_gating_test.go drops the tests of the deleted detector. It now pins
the new job graph and runs the new verdict against a truth table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jflowers
jflowers merged commit 68c3d7e into unbound-force:main Nov 28, 2026
8 checks passed

@uf-divisor uf-divisor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Council verdict: APPROVE WITH ADVISORIES — 7/7 reviewer runs succeeded; 10 findings (2 MEDIUM, 8 LOW), none blocking.

Replaces the inline learnings-only changes detector with jflowers/ship's pr-scope.yml scope job, moves Standardized CI into ci.yml so CI OK can be the only required check, and adds a chore-only Gitleaks job replacing the secret scan chore PRs lose. The workflow graph, the fail-closed verdict logic, and the 18-case truth-table test are correct as written.

The two MEDIUM advisories are forward-looking operational risks rather than defects in this diff:

  • The new Gitleaks job never executes on this PR (code == 'true'), so its pinned URL, checksum, and HEAD^1..HEAD^2 scan range stay unvalidated until the first chore PR triggers it — and CI OK requires gitleaks success for chores. A scratch-branch smoke test before the first real chore PR closes the gap.
  • The CLS-FR-001 push guarantee now rests entirely on ship's external push path: the in-repo push short-circuit and its executed regression case are deleted, while release.yml preflight and CI OK both depend on that path returning code=true on push.

Lower-severity advisories are inline. One item sits outside this PR's diff hunks, so it belongs here:

  • LOW (documentation) — AGENTS.md's "Recent Changes" list still describes the deleted architecture: the ci-skip-build-for-learnings entry says learnings-only PRs skip Build and Test "via a changes detection job" and that Standardized CI / Run linters still runs on every PR (AGENTS.md:629), and the list has no entry for this migration. Updating it alongside the CI Parity Gate section keeps the doc internally consistent.

Findings via the Divisor review council (adversary, architect, curator, gaze-testing, guard, sre, testing).

This review was generated by /uf.review-pr (AI-assisted).

Comment thread .github/workflows/ci.yml

# Chore PRs skip Standardized CI, and with it the secret scan: scan
# their commits here instead, since learnings can carry leaked secrets.
gitleaks:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM | release-pipeline-integrity | divisor-sre] The new Gitleaks job never runs on this PR — if: needs.scope.outputs.code == 'false' is false for a code PR — so the pinned artifact URL, the hardcoded GITLEAKS_SHA256, and the HEAD^1..HEAD^2 scan range unique to this repo's merge-commit checkout are unvalidated at merge time. The first chore/learnings PR is the first execution, and CI OK requires gitleaks == success for chores, so a wrong checksum, asset name, or range blocks every chore PR until a fix-up lands. Exercising the job out-of-band (a scratch chore branch or a temporary unconditional run) before the first real chore PR closes the gap.

Comment thread .github/workflows/ci.yml
# code == 'false' only for pull requests whose files are all Dewey
# learnings, or a gh-hud toolkit rollout; 'true' for everything else.
scope:
uses: jflowers/ship/.github/workflows/pr-scope.yml@3b0ce8bf47183be402df9eaec16644c213eee5f7 # main, after v0.11.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM | release-pipeline-integrity | divisor-sre] Deleting the in-repo changes job moves the CLS-FR-001 push guarantee (pushes to main always run everything) entirely onto ship's pr-scope.yml push path, and the PR also removes the executed push event regression case that asserted code=true. TestCIGatingWorkflows_StructureEnforcesChoreSkip pins the SHA but not push behavior. release.yml's preflight gates on Build and Test and Standardized CI / Run linters, which exist on main HEAD only if call-reusable-ci runs on push; CI OK passes a push only when scope returns code=true. A ship push-path regression reddens main CI and blocks releases with no in-repo signal.

// when both a failure and a cancellation occur) fails this test.
// script against needed-job results, so weakening it (say, accepting a
// skipped Build and Test on a code PR) fails this test.
func TestCIGatingWorkflows_AggregateVerdictBehavior(t *testing.T) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW | test-quality | divisor-gaze-testing] TestCIGatingWorkflows_AggregateVerdictBehavior spawns a bash subprocess for each of the 18 truth-table cases without a testing.Short() guard, diverging from TC-011 (SHOULD) and AGENTS.md's workflow-test guidance that subprocess-spawning tests be skippable in short mode. The pre-change version carried the same gap.

assertMatches(t, yamlSection(t, workflow, "call-reusable-ci", 2), `(?m)^\s+uses:\s*complytime/org-infra/\.github/workflows/reusable_ci\.yml@`, "org-infra reusable CI call")
gitleaks := yamlSection(t, workflow, "gitleaks", 2)
assertContains(t, gitleaks, `sha256sum -c -`, "gitleaks download checksum")
assertContains(t, gitleaks, `--log-opts='HEAD^1..HEAD^2'`, "gitleaks scans the PR's commits")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW | coverage-gap | divisor-testing] The structure test pins the gitleaks scan range and the checksum-verified download but not the checkout's fetch-depth: 0 that makes HEAD^1..HEAD^2 resolvable — the same invariant the deleted detector test pinned (fetch-depth: 2). A regression that shrinks the fetch depth passes make check and surfaces only as a runtime gitleaks failure on the next chore PR.

Suggested change
assertContains(t, gitleaks, `--log-opts='HEAD^1..HEAD^2'`, "gitleaks scans the PR's commits")
assertContains(t, gitleaks, `--log-opts='HEAD^1..HEAD^2'`, "gitleaks scans the PR's commits")
assertContains(t, gitleaks, "fetch-depth: 0", "gitleaks fetches full history for the commit scan")

Comment thread .github/settings.yml
# (repos/replicator.yml: "CI OK" and "Standardized CI / Run linters",
# not strict; the org code-repos ruleset requires the code owner's
# approval). protection: null has the Settings app remove the classic
# (repos/replicator.yml: "CI OK", not strict; the org code-repos

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW | operational-documentation | divisor-sre] The required-check transition is not atomic with this merge — the live safe-settings required set still includes Standardized CI / Run linters while this comment asserts repos/replicator.yml: "CI OK" as if live. After merge, a chore PR skips call-reusable-ci, so the still-required check never reports and the PR blocks until the safe-settings change lands. Spelling out the merge → safe-settings sequencing in this comment or the PR body makes the blocking window discoverable.

Comment thread .pinact.yaml
- ignore: true
conditions:
- expr: |
ActionName == "jflowers/ship/.github/workflows/pr-scope.yml" && ActionVersion == "3b0ce8bf47183be402df9eaec16644c213eee5f7"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW | coverage-gap | divisor-gaze-testing + divisor-testing] No test in internal/workflowtest/ reads .pinact.yaml, so the two-file invariant this rule creates — ci.yml's scope pin must match this rule's ActionVersion exactly — has no local pinning. A ship-pin bump that forgets the rule, widens it, or leaves a stale dead rule behind after moving to a released tag passes make check and fails only in Standardized CI's "Verify action versions" after push. Extending TestCIGatingWorkflows_StructureEnforcesChoreSkip to assert the rule's ActionVersion equals the SHA captured by shipScopeRE moves that failure to make check time.

Comment thread .pinact.yaml
@@ -0,0 +1,17 @@
# pinact configuration, read by Standardized CI's "Verify action versions"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[LOW | dependency-health | divisor-sre] The scope job pins an untagged commit on ship's main (# main, after v0.11.0), so the pin has no released tag to audit against and no version-comment provenance — an auditability gap rather than a reproducibility break (the SHA is immutable). Bumping to a ship release tag once one is cut, which lets this ignore rule stop matching, closes the gap.

@jflowers
jflowers deleted the ci/pr-scope branch November 28, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants