Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/gstack-review-plan
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function main(): number {
if (flag('--gate-tagged') !== undefined) gateTagged = Number(flag('--gate-tagged'));
} else gateTagged = flag('--gate-tagged') !== undefined ? Number(flag('--gate-tagged')) : gateTagsOf([diffBase]);
if (gateTagged !== null && !Number.isFinite(gateTagged)) gateTagged = null;
const exclusion: Exclusion = !baseSha || !collected.mergeBase ? { state: 'none' } : reviewExclude({ root, baseSha, ref, mergeBase: collected.mergeBase, perPath: collected.perPath, added: collected.added, classRoot: root, gateTagged: tagged, context: 'gstack-review-plan' });
const exclusion: Exclusion = !baseSha || !collected.mergeBase ? { state: 'none' } : reviewExclude({ root, baseSha, ref, mergeBase: collected.mergeBase, perPath: collected.perPath, added: collected.added, classRoot: root, gateTagged: tagged, context: 'gstack-review-plan', vendoredFetch: true });
if (exclusion.state === 'refused') { for (const l of exclusion.lines) process.stderr.write(l + '\n'); return exclusion.code === 'REVIEW_DIFF_UNREADABLE' ? EXIT.fail : EXIT.refused; }
if (exclusion.state === 'fallback') process.stderr.write(`gstack-review-plan: ${fallbackLine(exclusion, base)}\n`);
const active = exclusion.state === 'active' ? exclusion : null;
Expand Down Expand Up @@ -311,7 +311,7 @@ function main(): number {
if (has('--json')) {
const { runtimeLines, stepDepth, depthReasons, ...rest } = plan;
process.stdout.write(JSON.stringify({ ...rest, review_policy: review, platform_review: platform ? (platform.ok ? platform.review : { none: platform.reason }) : null, readers, targeted: { ...targeted, brief, targeted_patch_id: patch }, step_depth: stepDepth, runtime_lines: runtimeLines, depth_reasons: depthReasons, depth_floor: floor ?? null, gate_scan: gateScan, fix_range: fixRange ?? null, targeted_delta: targetedDeltaOut, registry: { sha: registry.sha, outputs: registry.outputs }, per_path: perPath, diff_lines: diffLines, base: collected.base, pass, audit_effort: auditEffort, scope, gate_tagged: gateTagged, paths, deleted, stamp_only: stampOnly, consumed: collected.consumed, drawings: collected.drawings, executables: collected.executables,
...(exclusion.state === 'head-only' || exclusion.state === 'fallback' ? { review_exclude: exclusion } : active ? { review_exclude: { state: 'active', ...active.record, specs: active.specs, keep: active.keep, excerpt: active.excerpt, kept_files: active.kept, content: active.content, references: active.references } } : {}) }) + '\n');
...(exclusion.state === 'head-only' || exclusion.state === 'fallback' ? { review_exclude: exclusion } : active ? { review_exclude: { state: 'active', ...active.record, specs: active.specs, keep: active.keep, excerpt: active.excerpt, kept_files: active.kept, content: active.content, references: active.references, ...(active.vendored ? { vendored_selection: active.vendored } : {}) } } : {}) }) + '\n');
return EXIT.ok;
}
const out = [`REVIEW_CLASS: ${plan.class} (${plan.reasons.slice(0, 3).join('; ') || 'no signals'})`, reviewDepthLine(plan), `GATE_SCAN: ${gateTagged === null ? 'unavailable' : `tagged=${gateTagged}`} head=${head}`, `REVIEW_BASE: ${ref} ${baseSha.slice(0, 12)}`,
Expand Down
1 change: 1 addition & 0 deletions changelog.d/review-skips-verified-vendored-files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Review can now leave out copied open-source files that gstack has verified. When a base branch declares both `review_vendored` and `review_exclude_paths`, a matched file that is byte-for-byte its upstream's file at the pinned commit leaves the reviewers' diff, and a re-pin's deleted files are checked at the old pin. Agent instructions, config, executables, credential lines and gate-tagged files stay in review, so a gate-tagged upstream test file is still read whole. `gstack-review-plan` prints what verified and what didn't, and the verified list is part of the selection the ship receipt binds (docs/vendored-code.md#what-review-leaves-out).
2 changes: 1 addition & 1 deletion docs/ship-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ branch that changes the policy.
| `review_content_patterns` | git glob pathspecs | `[]` | Files that `review_exclude_paths` also matches and that count as content whatever their extension (`.patch` files, `MANIFEST.sha256`, extension-less licence texts), so the exclusion leaves them out. Source code, agent prose, config and the other keep rules still keep a matched file in review. Explicit policy only; a pattern here with no `review_exclude_paths` pattern over the same files excludes nothing. Read from the base only. See [review_content_patterns](#review-content-patterns). Needs `min_gstack_version`. |
| `review` | `{ panel?, reader_model?, platform?, risk_paths? }` | `{ all, lane, off, [] }` | Who does `/ship`'s review, read from the base only; see [Who reads](review-policy.md#who-reads-r65-the-base-policys-review-key). `panel`: `all` (today's panel on every class) \| `risk` \| `off` (the opt-in one-reader shapes); `reader_model`: `lane`, `cross-family` or a model id; `platform`: `off` \| `on` (a docs or tests diff with no numeric, results or prereg claims whose PR carries capy-ai[bot]'s review at the exact head skips the readers); `risk_paths`: globs of code paths that count as risk class `policy`. Introduced at 1.94.30.0; needs `min_gstack_version` when set to a non-default value. |
| `readers` | `{ forbid_fetch?, forbid_paths?, brief_note? }` | `{ [], [], null }` | What `/ship`'s readers may not reach beyond the fetch rule every brief carries; see [readers](#readers). Read from the base; the head may add `forbid_fetch` entries, never remove one. Needs `min_gstack_version`. |
| `review_vendored` | `{ upstreams, manifests }` or `null` | `null` | The repositories this repo copies unchanged files from (https URLs, or `{ url, branches }`) and the manifests that pin each copied file to a path at a commit. `gstack-vendored-verify` checks every pinned file is byte-for-byte that upstream file at a commit on the upstream's default branch or a tag; see [vendored-code.md](vendored-code.md). Read from the base only. Needs `min_gstack_version`. |
| `review_vendored` | `{ upstreams, manifests }` or `null` | `null` | The repositories this repo copies unchanged files from (https URLs, or `{ url, branches }`) and the manifests that pin each copied file to a path at a commit. `gstack-vendored-verify` checks every pinned file is byte-for-byte that upstream file at a commit on the upstream's default branch, a tag, or a branch the base names for that upstream. Under `review_exclude_paths`, a matched file that verifies is vendored content that review can leave out; every other keep rule still applies (see [vendored-code.md](vendored-code.md#what-review-leaves-out)). Read from the base only. Needs `min_gstack_version`. |
| `min_gstack_version` | version or `null` | `null` | The oldest gstack that may read the file; see the compatibility rule above. |
| `docs` | `{ caps: [{ path, max_bytes }] }` or `null` | `null` | Documentation files with a byte cap. `/ship` Step 14.5 runs `gstack-ship-receipt docs-caps --base <base>` (the caps come from `origin/<base>`'s policy, never the branch's copy; `--policy <file>` is for a repository bootstrapping its policy) before the verification gate and prints one `DOCS_CAP: <path> <bytes>/<max> ok\|over` line per cap; any `over` (an absent file counts) exits 1 and blocks the ship until the file is trimmed or the cap raised on the base branch (`DOCS_AUDIT_BLOCKED`). At most 64 caps, each path contained. See [the ship receipt](#ship-receipt). Needs `min_gstack_version`. |
| `train` | `{ gate_workflow, free_workflow, full_gate_check, record_artifact, max_size, fill_hours, screen_selection, trial_reservation_usd, land? }`, `{ gates, land, max_size, fill_hours }` or `null` | `null` | Turns on [merge trains](#run-a-merge-train), read from the base revision only. Every field is required and an unknown field is `POLICY_INVALID`: `max_size` 1 to 6, `fill_hours` above 0 and at most 24, `screen_selection` `gstack-paid` \| `none`, `trial_reservation_usd` above 0 and at most 100. A block with `gates` ([any repository](#train-gates)) takes `max_size` 1 to 5 and needs `min_gstack_version` at least `TRAIN_GATES_KEY_VERSION`. `null` keeps the per-PR queue exactly as it is. Needs `min_gstack_version`. |
Expand Down
45 changes: 40 additions & 5 deletions docs/vendored-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,44 @@ The check
runs from the head's workflow file, so it is a backstop for honest mistakes; a
workflow edit is itself reviewed like any other `.github/` change.

## What comes next
## What review leaves out

When the base policy also lists `review_exclude_paths`, a file one of those
patterns matches that verifies byte for byte counts as vendored content, so
`/ship`'s reviewers can leave it out. Nothing else about the keep rules
changes: a vendored file stays in review when it is agent prose (`AGENTS.md`,
`CLAUDE.md`), config, executable, a link, under `.github/` or `.gstack/`, on a
gate path, holds a credential value, or carries a gate tag. A file kept only
for a credential line is shown as an excerpt, as any data file would be. A
gate-tagged file is excerpted only off the gate floor, so a gate-tagged
upstream test file (anything under `tests/`, `test/` or `spec/`) stays in
review whole. When a re-pin deletes files, a deleted file that verifies at the
base's pin can be left out too; a file the branch drops from the manifest but
keeps stays in review. A file that does not verify keeps the reason it had
before. Keep the manifest outside every `review_exclude_paths` pattern: when a
pattern matches it, nothing counts as verified and the plan prints
`REVIEW_VENDORED: unavailable`.

`gstack-review-plan` fetches the upstreams into the cache first and prints one
summary line, one line per pin and up to 20 files that did not verify:

```text
REVIEW_VENDORED: verified=1054 unverified=2 pins=71 digest=<sha256>
REVIEW_VENDORED_PIN: https://github.com/pallets/click@<commit> reachable_from=tags/8.1.7 files=40 verified=40
REVIEW_VENDORED_KEPT: mode tasks/.../tests/test_rr.py (head 100755, upstream 100755)
```

Today the check proves the claim. A later release lets `/ship`'s review skip
verified files under a `review_exclude_paths` pattern while still showing
reviewers the manifest, every pin and the lines in those files that skip or
silence tests.
Every later step (the review dispatch, the receipt write and carry) reads the
same cache without the network, and the verified list is part of the
selection digest the receipt binds. A machine with an empty cache verifies
nothing, so its selection differs and the receipt says so; run
`gstack-vendored-verify --base <base>` there first. Reviewers still read the
manifest, every pin change and all of the repo's own code. When unverified
vendored files make a pattern keep too many files, the refusal names them as
`REVIEW_VENDORED_KEPT` and points at `gstack-vendored-verify`.

How much this saves depends on the gate tags. On harness-evals#504 (1,056
upstream test files), 877 files and 4.47 MB leave review, but 161 gate-tagged
upstream test files (5.83 MB, mostly skip markers) stay whole, so that PR
stays over the 2 MB reader limit; 5 gate-tagged `pyproject.toml` files are
shown as excerpts.
Loading
Loading