Skip to content

Review keeps a file that a branch swaps from our own code to upstream bytes (GST-3298) - #4690

Merged
capy-ai[bot] merged 3 commits into
mainfrom
vendored-modified-files-stay-ours
Nov 22, 2026
Merged

capy-ai[bot] merged 3 commits into
mainfrom
vendored-modified-files-stay-ours

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

A branch that replaces your own file, or drops a local patch, so the file now matches an upstream copy byte for byte no longer leaves review: a changed file counts as vendored only if it was already vendored and verified at the merge base, or is new on the branch.
This closes the gap the second-model review of #4665 found, so readers always see your own lines leave. Nothing to do for repos without review_vendored, which is every repo today.

What changed

The second-model review of #4665 found that a branch could swap a file it owned for the upstream's bytes, list it in the vendored manifest, and have review skip the change. Now a changed vendored file is left out of review only when the merge base already pinned it and its copy there matched the upstream too. Otherwise review keeps it as your code and says why.

  • Modified vendored files (lib/review-vendored.ts, vendoredSelection): a head manifest entry the merge base already has is checked at the merge base too. If the base manifests did not pin it, or its base copy does not verify, it stays in review with REVIEW_VENDORED_KEPT: mismatched <path> (...) naming why. New files and re-pins of files that were already vendored are unchanged.
  • gstack-vendored-verify also checks the merge base's pins for the files a branch changes or deletes and prints VENDORED_BASE: checked=N verified=M. That line never fails the run, and when the check itself errors it prints VENDORED_BASE: unavailable (...) and the head verdict stands.
  • Failed fetches fail their own run and no longer wipe good cached pin records. gstack-vendored-verify --offline still answers from them, while review keeps that pin's files until a fetch succeeds, so the review plan and the later offline check /ship runs before landing pick the same files.
  • Wording: the keep-too-large refusal no longer points at lines a refused plan never prints, and says plainly when the vendored check could not run. The line reviewers get no longer claims the manifest is in their diff.
  • Docs: docs/vendored-code.md; changelog fragment.
Why

"A file the branch swaps from our own code to upstream bytes leaves review" was a finding the second-model review of #4665 raised. Now that removal of your own code always reaches the readers.

Blast radius

Only repos whose base policy sets review_vendored see any change, and none do today. For everyone else the plan is byte for byte what it was, and the selection only ever keeps more files in review than before (read in vendoredSelection; covered by the "without review_vendored nothing changes" test and the no-loss replay fixture for repos without the key).

Pre-Landing Review

The full review panel ran on this change, plus one fix round. The second-model reviewer found two problems in the first version, both fixed with tests that failed before the fix. First, after a failed fetch the review plan and the later offline check /ship runs before landing could pick different files. Second, the merge-base check in gstack-vendored-verify could fail the run when it errored. Six smaller notes stay open below the bar for a fix: a large re-pin whose base copies don't verify now keeps every file and can refuse to plan, and five wording or diagnostics points in the plan and verify output. Two further findings from the security reader: security finding, details recorded privately.

Exploratory QA

Two smoke probes on a local fixture (a base that owns up/lib/tests/a.py, a branch that swaps it for upstream bytes and adds a new vendored file), run on the final code: the plan keeps the swapped file as code and leaves the new verified file out of review, and gstack-vendored-verify --base main passes with exit 0. Status: pass.

Scope Drift

Scope Check: CLEAN. The change closes the ruled findings from #4665 and the two blockers its own review found, nothing else.

Documentation

Status: current. The docs already match the branch, so nothing was edited.

Scope: base 9cfbbb9 to head 8ae5503 on vendored-modified-files-stay-ours: 3 commits, 7 files, nothing staged, unstaged or untracked. Docs reviewed: docs/vendored-code.md, docs/troubleshooting.md (the vendored upstream files section), docs/ship-policy.md (the review_vendored row), plus the changelog fragment and the changed code in bin/gstack-vendored-verify, lib/review-vendored.ts and lib/review-exclude.ts.

Documentation health

  • docs/vendored-code.md: current. This branch already updated it to explain that review keeps a file when a branch swaps your own code for upstream bytes, what the VENDORED_BASE: line means, and that a failed fetch keeps earlier good cache answers.
  • docs/troubleshooting.md: current. The VENDORED_FETCH_FAILED entry is still accurate.
  • docs/ship-policy.md: current. The review_vendored row is high-level and still true.

Coverage debt: two minor gaps, nothing critical. Troubleshooting has no entry explaining the new REVIEW_VENDORED_KEPT details ("replaces our own code" and "the latest fetch failed"). The VENDORED_BASE: output line is documented only in docs/vendored-code.md. Diagram drift: none.

Tests
  • bun run typecheck: exit 0.
  • bun test test/review-exclude-vendored.test.ts test/review-vendored.test.ts test/module-size-ratchet.test.ts: 40 pass, 0 fail.
  • Free test suite on CI at this tree (free-tests.yml run 44999154884): green, 38,835 tests.
  • macOS named regressions (run 44999154884) and Windows smoke (run 44995451943): green.
Agent notes

Refs GST-3298

GST-3298 PR 3, ordered by the Captain (GStack Minder, GSTA-36) after #4665's ruled notes (findings lib/review-vendored.ts:319, :201, :207, :330 and lib/review-exclude.ts:524, :592). Failing first on main: 5 of the new or changed cases fail (swap and local patch, failed fetch keeps cache, verify base pins, refusal wording, disclosure wording); the branch-ref test fails when the update-ref -d line is removed. The review fix round (e7a1522) added two tests that failed before the fix. Trial merge with #4681 (shares lib/review-exclude.ts) at 2e00715: clean, typecheck clean. /ship ran in a lane subagent; its receipt follows.

Noted review findings (not fixed, below the blocking floor): lib/review-vendored.ts:354 (large re-pin can refuse to plan when base copies don't verify), lib/review-vendored.ts:196 (good cached pin outlives a deleted upstream for verify --offline), lib/review-vendored.ts:369 (new keep reason shows as verdict mismatched), lib/review-vendored.ts:370 (base pins in the plan's pin rows), bin/gstack-vendored-verify:100 (VENDORED_BASE gives no cause; second fetch), lib/review-exclude.ts:581 (--json hint misses kept merge-base copies).

Approvals

No approvals recorded for branch vendored-modified-files-stay-ours.
Plan: exempt: bug fix closing the ruled review findings of #4665, with failing-first tests
Plan check: exempt bug fix

REVIEW_LOOP: passes=2 blocking_found=2 deferred=0 noted=8 fixed=3 scope=frozen ledgers_read=3 dispatches=8
Gate edits: 3 listed, 3 read, 0 findings (patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

{
  "schema_version": 1,
  "pr": 4690,
  "head": "8ae550307ff0eba2dfead5c4476f461113d3671b",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "typecheck": {
      "pass": 1,
      "fail": 0,
      "skip": 0
    },
    "vendored": {
      "pass": 40,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 44999154884,
      "attempt": 1,
      "tree": "f05c490c42b9d8d4cd846a0e8dc2cb2e781d88ec"
    }
  ],
  "calls": 54,
  "session_kind": "unattended",
  "run": "ship-4690",
  "head_tree": "f05c490c42b9d8d4cd846a0e8dc2cb2e781d88ec",
  "product_patch_id": "ff459ea8d2394c828880ff67d8afe1bf48f0f80d",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 113,
    "rules": "630fd3101899e28e",
    "base": "0b4f0ceeec19fef62480db6c8eb00c4015380a39",
    "registry": "0b4f0ceeec19fef62480db6c8eb00c4015380a39",
    "gate_scan": {
      "tagged": 0,
      "head": "8ae550307ff0eba2dfead5c4476f461113d3671b"
    },
    "reasons": [
      "gate-class",
      "runtime=113"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @f05c490c42b9 (8 checks, current for 8ae550307ff0)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44999154884/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44995451943/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=f05c490c42b9 tests=38835 skipped=89 runs=44999154884/1 profiles=ci-reuse/free-tests heads=8ae550307ff0 verified=2026-11-22T08:23:21.741Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md (docs/vendored-code.md, docs/troubleshooting.md, docs/ship-policy.md read in full)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 8,
    "fixed": 3,
    "scope": "frozen",
    "rounds": 2,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  },
  "gate_dispositions": []
}

Open in Capy

… bytes (GST-3298)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 2 commits November 22, 2026 06:38
…the merge-base check never fails verify

A fetch that fails now marks the good cached pin instead of leaving it as if nothing happened, so the review plan and every later offline step keep that pin's files until a fetch succeeds; gstack-vendored-verify --offline still answers from the good pin. The merge-base pin check in gstack-vendored-verify reports an error as VENDORED_BASE: unavailable instead of exiting nonzero.

Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 3cff6a4 into main Nov 22, 2026
76 checks passed
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.

1 participant