v1.92.83.0 feat(sealed): skip commits the destination already holds or whose patch landed (GSTA-156 P1) (#3689)

* feat(sealed): skip commits the destination already holds (refs/pull/<n>/head) or whose patch landed (GSTA-156 P1)

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

* fix(sealed): compare landed patches byte for byte (latin1), so bytes that are not UTF-8 cannot collapse into a false match

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

* fix(sealed): a landed-patch skip still runs sealed.label_join, which judges the whole file the base may never have held

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>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-02 14:39:24 +00:00
1 parent 26539fb0d9
commit 1a7f2578b7
12 files changed
+395 -38

No files matched your search

+21 -1
View File
@@ -1114,13 +1114,33 @@ publication whenever the managed pre-push hook (`gstack-redact
install-prepush-hook`, no reinstall needed) or the standalone preflight runs:
```
gstack-pregate sealed [--range <a..b>] [--remote origin] [--base <branch>] [--json]
gstack-pregate sealed [--range <a..b>] [--remote origin] [--base <branch>] [--no-skip] [--json]
```
- **Boundary.** Every commit the push publishes: `git rev-list <local sha>
--not --remotes=<remote>` (and the remote tip when the ref exists); a
destination with no refs means everything reachable. `--range` names the
commits explicitly.
- <a id="sealed-skip"></a>**Skipped commits.** When the base branch resolves, a
listed commit is not rescanned when the destination already holds it or its
patch already landed. Held: an ancestor of the destination's own
`refs/pull/<n>/head` for a squash commit `(#n)` on the base since the
merge-base; the subject is only a hint, the fetched ref is the proof. That
lookup lists and fetches at most 50 refs within 20 seconds (receipted, sink
`sealed-guard`) and deletes the fetched refs afterwards. Landed: the commit's
own `git patch-id --verbatim` equals a base commit's since the merge-base and
so does its diff, apart from blob ids and line numbers; a merge never matches,
and above 2,000 base or 400 listed commits this check is off. A landed commit
skips only the path and text rules: `sealed.label_join` judges the whole file
at that commit, which the base may never have held, so it still runs. Nothing
matches a combined diff, so a parent whose commits were never published is
scanned whole even when its squash landed. A lookup that fails, runs out of
time or exceeds a limit prints one line and scans everything. Each PR group
and landed commit is listed (`skipped <n> commit(s) the destination already
has as refs/pull/<n>/head`, `skipped commit <sha> (its patch landed on the
base as <sha>)`), the `SEALED:` line counts them as `skipped=<n>` (its
`commits=` counts the commits scanned), and `--no-skip` scans every listed
commit. The pre-push hook and `gstack-pregate sealed` skip the same way.
- **Rules.** `sealed.path` and `sealed.transcript` check every path a commit
adds, renames or copies, whatever its content (binary, empty, deleted again
in a later commit); `sealed.answer`, `sealed.seed` and `sealed.local_path`