Pass a check's changed paths in a file so a change of thousands of files can start (issue 1247)

One environment string over 128 KiB made the container fail to start with no words; the gate reads --changed-file, and a command that cannot start now says its error.
This commit is contained in:
2026-10-19 15:22:00 +02:00
parent a5a43c8f31
commit dd802c81a7
5 changed files with 251 additions and 6 deletions
@@ -114,6 +114,36 @@ echo checked
}
}
func TestACheckOfAChangeTouchingMoreFilesThanOneArgumentHoldsRunsWhole(t *testing.T) { // 1247/AC5
registry := checkEnvironment(t)
// 3000 paths of about 70 bytes: over 128 KiB comma-joined, which no environment string can carry.
var paths []string
for i := 0; i < 3000; i++ {
paths = append(paths, fmt.Sprintf("modules/m%d/vendor/github.com/nats-io/nats-server/v2/server/file_%05d.go", i%4, i))
}
script := `set -e
test -s "$MESH_CHECK_CHANGED_FILE"
test "$(wc -l < "$MESH_CHECK_CHANGED_FILE")" = 3000
head -n 1 "$MESH_CHECK_CHANGED_FILE" | grep -q '^modules/m0/vendor/.*file_00000.go$'
test "${#MESH_CHECK_CHANGED}" -lt 65536
case "$MESH_CHECK_CHANGED" in modules/m0/,*) ;; *) echo "changed: $MESH_CHECK_CHANGED"; exit 1;; esac
echo checked
`
repo, head := aCheckedRepository(t, map[string]string{CheckScript: script})
v, err := Check(t.Context(), Command, CheckSpec{ID: fmt.Sprintf("check-many-%d", time.Now().UnixNano()), Repository: repo,
Ref: head, Owner: "novox", Repo: "hq", Number: 8, Paths: paths, Toolchain: goToolchain}, t.TempDir(), registry,
GitCredential{}, nil)
if err != nil {
t.Fatal(err)
}
if v.Repo == nil || v.Repo.Verdict != "pass" || !strings.Contains(v.Report, "checked") {
t.Fatalf("the repository's check answered %+v\n%s", v.Repo, v.Report)
}
if !strings.Contains(v.Report, EnvChangedFile) {
t.Errorf("the report does not say the list went into a file:\n%s", v.Report)
}
}
func TestAFailingCheckFailsAndOneThatCannotRunIsNeverAPass(t *testing.T) {
registry := checkEnvironment(t)
repo, head := aCheckedRepository(t, map[string]string{CheckScript: "echo 'resource \"x.service\": refused'; exit 3\n"})