Skip to content

Commit b374830

Browse files
committed
fix(tooling): fail the vendor drift gate on a deleted vendored file
1 parent 041e657 commit b374830

3 files changed

Lines changed: 76 additions & 10 deletions

File tree

‎docs/ARCHITECTURE.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,4 +672,6 @@ read it, and passes the rest of the request to stock.
672672

673673
Interchange is vendored under `vendor/interchange` at a stock pin plus the
674674
deltas in `vendor/interchange/VENDORED.md`, each with the condition for removing it.
675-
`tooling/vendor-diff-check.sh` fails on any other drift.
675+
`tooling/vendor-diff-check.sh` fails on any other drift, including a stock
676+
file missing from the vendored copy unless `tooling/vendor-diff-pruned.txt`
677+
lists it or a directory above it as an upstream path we don't vendor.

‎tooling/vendor-diff-check.sh‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
# - Compares committed content only: the vendor/interchange tree at HEAD
99
# against the stock commit's tree, by exact path, mode and blob id. Local
1010
# untracked or uncommitted files are not seen.
11-
# - The vendored tree is a pruned checkout (upstream-only paths such as
12-
# bin/, docs/, or packages never vendored are reported as information,
13-
# not failures). The gate fails on any other difference: a changed blob,
14-
# mode or type, or a path added locally, unless the path is exactly an
15-
# allowlist entry. Our provenance record (VENDORED.md) is excluded.
11+
# - The vendored tree is a pruned checkout: a stock path missing from it is
12+
# reported as information when tooling/vendor-diff-pruned.txt lists it or
13+
# a directory above it, and fails otherwise. The gate fails on any other
14+
# difference: a changed blob, mode or type, or a path added locally, unless
15+
# the path is exactly an allowlist entry. Our provenance record
16+
# (VENDORED.md) is excluded.
1617
#
1718
# Env overrides:
1819
# INTERCHANGE_STOCK_REPO upstream repo (default https://github.com/faremeter/interchange)
@@ -22,6 +23,7 @@ set -eu
2223
STOCK_REPO="${INTERCHANGE_STOCK_REPO:-https://github.com/faremeter/interchange}"
2324
STOCK_REF="${INTERCHANGE_STOCK_REF:-b1ca01f0d9bc2eb203e95b1780a6f685c5da8215}"
2425
ALLOWLIST="tooling/vendor-diff-allowlist.txt"
26+
PRUNED="tooling/vendor-diff-pruned.txt"
2527
VENDOR_DIR="vendor/interchange"
2628

2729
WORK="$(mktemp -d)"
@@ -44,27 +46,36 @@ git -C "$WORK/stock" -c core.quotePath=true diff-tree -r --no-renames --no-abbre
4446
"$STOCK_TREE" "$VENDOR_TREE" > "$WORK/diff.txt"
4547

4648
grep -v '^#' "$ALLOWLIST" | grep -v '^$' > "$WORK/allowlist.txt" || true
49+
grep -v '^#' "$PRUNED" | grep -v '^$' > "$WORK/pruned.txt" || true
4750

48-
# Deleted entries are the pruned upstream-only paths. Every other entry fails
49-
# unless its path is exactly allowlisted; a line that is not a diff-tree raw
50-
# entry fails as it is.
51+
# A deleted entry passes as pruned when its path or a directory above it is
52+
# listed. Every other entry fails unless its path is exactly allowlisted; a
53+
# line that is not a diff-tree raw entry fails as it is.
5154
awk -v allowlist="$WORK/allowlist.txt" \
55+
-v pruned="$WORK/pruned.txt" \
5256
-v unexpected="$WORK/unexpected.txt" \
5357
-v upstream_only="$WORK/upstream-only.txt" '
5458
BEGIN {
5559
while ((getline entry < allowlist) > 0) allowed[entry] = 1
5660
allowed["VENDORED.md"] = 1
61+
while ((getline entry < pruned) > 0) pruned_paths[entry] = 1
5762
printf "" > unexpected
5863
printf "" > upstream_only
5964
}
65+
function is_pruned(path, i) {
66+
if (path in pruned_paths) return 1
67+
for (i = length(path) - 1; i > 0; i--)
68+
if (substr(path, i, 1) == "/" && (substr(path, 1, i) in pruned_paths)) return 1
69+
return 0
70+
}
6071
!/^:[0-7]+ [0-7]+ [0-9a-f]+ [0-9a-f]+ [A-Z][0-9]*\t/ {
6172
print "unparseable: " $0 > unexpected
6273
next
6374
}
6475
{
6576
path = substr($0, index($0, "\t") + 1)
6677
status = substr($5, 1, 1)
67-
if (status == "D") print path > upstream_only
78+
if (status == "D" && is_pruned(path)) print path > upstream_only
6879
else if (!(path in allowed)) print status " " path > unexpected
6980
}
7081
' "$WORK/diff.txt"

‎tooling/vendor-diff-pruned.txt‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Upstream paths not vendored (relative to vendor/interchange, one per line).
2+
#
3+
# The vendor-diff gate (tooling/vendor-diff-check.sh) reports a stock path
4+
# missing from vendor/interchange as information only when it is exactly an
5+
# entry here, or sits under an entry ending in `/`. Any other missing stock
6+
# path fails. Lines starting with `#` and blank lines are ignored.
7+
8+
.env.sidecar
9+
Makefile
10+
apps/admin-ui/
11+
bin/
12+
bun.lock
13+
bunfig.toml
14+
db/
15+
docs/
16+
eslint.config.ts
17+
examples/
18+
package.json
19+
packages/inference-catalog/
20+
packages/inference-discovery-anthropic/
21+
packages/inference-discovery-google-genai/
22+
packages/inference-discovery-openai/
23+
skills/
24+
tests/admin-ui-e2e/.gitignore
25+
tests/admin-ui-e2e/login.spec.ts
26+
tests/admin-ui-e2e/playwright.config.ts
27+
tests/admin-ui-e2e/shared-sidecar-deploy.spec.ts
28+
tests/admin-ui-e2e/storage-isogit.playwright.config.ts
29+
tests/admin-ui-e2e/storage-isogit/
30+
tests/admin-ui-e2e/workflow-deploy-live.spec.ts
31+
tests/admin-ui-e2e/workflow-deploy-picker.spec.ts
32+
tests/agent-audit-log/
33+
tests/agent-blob-spill/
34+
tests/agent-common/
35+
tests/agent-multi-provider/
36+
tests/agent-quickstart/
37+
tests/agent-resume/
38+
tests/agent-rewind/
39+
tests/agent-rich-tool/
40+
tests/agent-structured-payload/
41+
tests/agent/
42+
tests/coding-agent/
43+
tests/db/
44+
tests/hub-agent/
45+
tests/hub-api/
46+
tests/inference-testing/
47+
tests/inference/
48+
tests/lib/
49+
tests/tool-packaging/
50+
tests/workflow-deploy/
51+
tests/workflow-quickstart/
52+
tests/workflow/
53+
tsconfig.eslint.json

0 commit comments

Comments
 (0)