# "Shipped with gstack" pull request footer When a contributor opts in, `/gstack-ship` appends one line at the bottom of a pull request body after it binds the ship check record to the exact pushed commit: ```markdown [Shipped with gstack](https://github.com/garrytan/gstack/blob/main/docs/pr-receipt.md) (`1be3d56`: reviewed, second-model reviewed, tests run) ``` The trailing `` comment is invisible on GitHub; gstack uses it to find, update and remove its own footer. The line is off by default (`pr_receipt_footer: false`). It is generated only from the head-bound JSON block stored inside the pull request's collapsed **Agent notes** section, never hand-typed. ## What each part proves | Part | Shown only when | Omitted when | |---|---|---| | Short commit SHA (`1be3d56`) | Always shown on an eligible footer; matches the first 7 characters of the checked commit's SHA. | No valid, unblocked record exists for the pull request's pushed head (the entire footer is omitted). | | `reviewed` | The record shows at least one completed review pass on that commit (`review_loop.passes` above zero), or a platform review bound to that head. | No review pass is recorded or zero passes ran. | | `second-model reviewed` | An independent review from a different model family completed and passed cross-family validation. | Only one model family reviewed the pull request, or the second model was skipped or unavailable. | | `tests run` | Green CI results are recorded for that commit's exact tree with zero failing lanes. | No green CI result is recorded for that commit, a lane failed, or a follow-up commit changed the tree without fresh CI. | A pull request without a valid record at its pushed head gets no footer at all. The footer is an audit summary backed by the pull request's check record, not a cryptographic signature; always check the commit SHA and GitHub's own check runs before relying on it. ## How to verify the commit SHA Anyone reading a pull request on GitHub can check that the footer matches the code they are reviewing: 1. Open the pull request's **Commits** tab on GitHub and note the latest commit's 7-character SHA (or run `gh pr view --json headRefOid --jq .headRefOid`). 2. Confirm that the short SHA in the footer (`1be3d56`) matches the prefix of that latest commit SHA. If new commits were pushed after the check ran, the SHAs will not match. 3. Expand **Agent notes** directly above the footer and inspect the `gstack-ship-receipt` JSON block: - `head` is the full 40-character commit SHA that the footer's short SHA comes from. - `review_loop.passes` shows how many review passes completed. - `outside_voice` shows the independent model's `status`, `model`, `family`, and `native_family` when `second-model reviewed` is listed. - `ci` or `ci_carried` (matched against `head_tree`) shows the green CI run recorded when `tests run` is listed. 4. With gstack installed, you can verify the record read-only from the command line and compare its `head` against the pull request's latest commit: ```bash gstack-ship-receipt read --pr --repo --check-prose gh pr view --repo --json headRefOid --jq .headRefOid ``` `gstack-ship-receipt read` parses and validates the record without editing the pull request, and exits `0` only when the record is valid and its quoted counts match. ## When the footer updates or disappears - **Follow-up commits that preserve the reviewed diff:** When a follow-up commit only merges the base branch, edits tests, or updates release metadata and `gstack-ship-receipt carry` rebinds the record to the new commit, gstack rewrites the footer with the new short SHA. If the tree changed and CI has not yet passed on the new tree, `tests run` is dropped automatically. - **Voided, abandoned, stopped, or blocked runs:** If a ship run is voided (`gstack-ship-receipt stub --void`), abandoned (`gstack-ship-receipt abandoned`), stopped at the review limit (`gstack-ship-receipt stop`), paused on a failing base branch check, or blocked by a failing audit, gstack removes any existing footer from the pull request body instead of leaving a stale claim behind. - **Public-safety filter:** Before writing the footer, gstack runs both the source record and the rendered line through its leak filter (`publicReceiptLeaks`) and plain-text check. If a home directory path, internal thread or message identifier, tracker code, or internal jargon appears, no public footer is written. ## How to opt in The footer is opt-in and defaults to `false`. Enable it in your gstack configuration: ```bash gstack-config set pr_receipt_footer true ``` Check the current value: ```bash gstack-config get pr_receipt_footer ``` Turn it off again at any time: ```bash gstack-config set pr_receipt_footer false ``` ## Public count gstack publishes a weekly count of merged public GitHub pull requests that carry the footer and pass full check-record validation. The counter reads only the public GitHub REST API, with no private telemetry, so anyone can reproduce the published number locally. ### What gets counted and what gets excluded Raw footer text is never enough to be counted. Mentioning the HTML marker in prose or inside a code fence, or pasting a footer without a backing record, is excluded before a pull request enters the total. Every candidate pull request returned by GitHub Search must pass all of the following checks against its live pull request data. 1. The pull request is merged (or open when `--state all` is passed); closed, unmerged pull requests are always excluded. 2. The body contains a canonical column-0 `[Shipped with gstack]` footer outside code fences using the canonical explainer URL. 3. The body contains a schema-valid `gstack-ship-receipt` JSON block matching the pull request number and the pull request's live head commit SHA. 4. The record is not blocked, voided, abandoned, stopped at a review limit, or paused on a failing base branch check, and it passes the public-safety leak filter. 5. The claims and short commit SHA printed in the footer match the fields proven by the underlying record. Private repositories and public pull requests where `pr_receipt_footer` stays at its default (`false`) are not included in the public count. ### Weekly shields.io endpoint badge Every Monday at 08:00 UTC, `.github/workflows/receipt-count.yml` runs `bin/gstack-receipt-count --verify-self --json --badge-out ...` using only `GITHUB_TOKEN` and publishes the resulting shields.io endpoint JSON to the repository's orphan `badges` branch without touching `main`. The badge JSON follows the shields.io endpoint schema (`schemaVersion: 1`, `label`, `message`, `color`, `namedLogo`) and is served from: ```text https://raw.githubusercontent.com/garrytan/gstack/badges/receipt-count.json ``` Shields.io renders that endpoint at: ```text https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgarrytan%2Fgstack%2Fbadges%2Freceipt-count.json ``` ### Search undercount safeguard GitHub Search can miss pull requests during indexing lag or on very long pull request bodies. Every weekly run passes `--verify-self`, which reads recent merged pull requests directly from `garrytan/gstack` (up to `--self-limit`, default 100) through the repository Pulls API, verifies their records, and checks whether GitHub Search returned each of those exact pull request numbers. The check compares opted-in footer pull requests when any exist in the sample, or verified `gstack-ship-receipt` pull requests before any opted-in pull request has merged. If GitHub Search misses more than 10% of that direct census during an unfiltered merged count, the tool refuses to publish a misleading global undercount. Instead, it sets `scope` to `"repo-only"`, publishes only the verified `garrytan/gstack` census onto the badge (labeled `garrytan/gstack shipped` for opted-in footer pull requests or `garrytan/gstack receipts` when falling back to the receipt census, and noting the inspected window when the sample is bounded), and includes the full comparison in the JSON report. Explicit `--repo` filters and non-merged `--state` queries keep their requested scope while still reporting the `self_census` diagnostic. ### Reproduce the count locally Run the public count yourself from a gstack checkout: ```bash # Global verified count with self-census check (JSON report, no file written) bin/gstack-receipt-count --verify-self --json --dry-run # Single-repository count that writes a shields.io endpoint JSON file bin/gstack-receipt-count --repo garrytan/gstack --badge-out ./receipt-count.json ``` The command works without credentials against public repositories. Setting `GITHUB_TOKEN` (or running `gh auth login` on `github.com`) raises GitHub's API rate limits from 10 to 30 search requests per minute and 60 to 5,000 core requests per hour. When pagination hits the Search API ceiling or GitHub returns `incomplete_results: true`, the CLI exits non-zero with a coded error rather than printing a partial total.