mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-23 08:31:44 +01:00
Pull requests get a Test changes summary of deleted or skipped tests and edits to their own checks (GST-3386) (#4645)
Every gstack pull request now gets a flag-only Test changes check listing removed or skipped tests, loosened limits and edits to the files that run its own checks. Why: agents write most of our tests, and a pull request shouldn't be able to quietly weaken them or grade itself with an edited checker; this two-week trial measures how often that happens. Nothing to do: the check isn't required, and a flag never turns it red. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/red-team#1 reader=red-team Review-Finding: lib/gate-diff/git.ts:314:stale-comment reader=core Review-Finding: p3/outside-voice#1 reader=outside-voice
This commit is contained in:
1 parent
abdc09dad1
commit
973b49eabb
11 files changed
+451
-15
No files matched your search
@@ -0,0 +1,68 @@
|
||||
name: Test changes
|
||||
|
||||
# Flag-only report of what a pull request does to its own tests and checks
|
||||
# (docs/ship-policy.md#test-changes): tests removed or skipped, suppressions,
|
||||
# gate bypasses and relaxed gate values that bin/gstack-gate-diff tags, the net
|
||||
# count of added and removed test declarations, and edits to the files that run
|
||||
# or define this repository's own checks. Flags never fail it: they exit 0. It
|
||||
# fails only when the checker itself fails, so a broken run is never read as a
|
||||
# quiet pull request; like any failed check, that holds gstack-ship-queue land
|
||||
# until the job is rerun. Not a required check.
|
||||
#
|
||||
# WHY pull_request_target: it runs the base repository's copy of this workflow,
|
||||
# of scripts/test-changes-report.ts and of bin/gstack-gate-diff, so a pull
|
||||
# request cannot edit the checker that reports on it.
|
||||
#
|
||||
# WHY this is SAFE:
|
||||
# - The job checks out the BASE repo (no ref:) and never runs PR code. The
|
||||
# pull request's commits are fetched as git objects and read as a diff.
|
||||
# - The token is read-only (contents: read) and is not persisted; no secrets.
|
||||
# - PR fields arrive only through env:; none is inlined into run:.
|
||||
# - The report names paths, tags and hunk ids, never PR line content.
|
||||
# test/test-changes-workflow-safety.test.ts is the static tripwire for all of it.
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test-changes:
|
||||
name: Test changes
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
concurrency:
|
||||
group: test-changes-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
# Base repo only: trusted code. No PR-head checkout. Full history for the merge base.
|
||||
- name: Checkout base repo (trusted)
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
filter: blob:none
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
|
||||
with:
|
||||
bun-version: 1.4.2
|
||||
|
||||
- name: Fetch the pull request's commits as data
|
||||
env:
|
||||
PR_NUM: ${{ github.event.pull_request.number }}
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch --no-tags --quiet origin "+refs/pull/$PR_NUM/head:refs/remotes/pr/head"
|
||||
git cat-file -e "$PR_HEAD_SHA^{commit}"
|
||||
|
||||
- name: Report test changes
|
||||
env:
|
||||
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
GSTACK_HOME="$RUNNER_TEMP/gstack-home" bun --no-env-file --config=/dev/null scripts/test-changes-report.ts \
|
||||
--base "$(git rev-parse HEAD)" --head "$PR_HEAD_SHA" --summary-file "$GITHUB_STEP_SUMMARY"
|
||||
Reference in new issue
Block a user