Stability pass: deterministic dependency order, retry backoff, input validation

Found via manual audit plus a staticcheck run:

- collectDependencyClosure iterated a package's dependencies map
  directly, so which package "won" a same-key collision (and the
  order things got downloaded/unpacked in) could vary between runs
  of the exact same download command. Sort the dependency targets
  first, matching what --print-deps-tree's tree-printer already did.
  Verified two consecutive --print-deps-tree runs now produce
  byte-identical output.
- HTTP retry loops (manifest fetch, payload download) retried
  immediately with no backoff, which just hammers a server harder
  during exactly the kind of transient failure retries exist for.
  Added a capped exponential backoff (1s/2s/4s/8s/10s).
- --architecture/--host-arch accepted any string silently; a typo'd
  value matched nothing during package selection and surfaced as a
  confusing downstream failure far from the actual mistake. Now
  rejected up front with a clear error.
- pumpLines' bufio.Scanner silently stops (dropping the rest of a
  tool's output) if a single line ever exceeds its buffer - narrow but
  real for pathological cases like heavily templated C++ diagnostics.
  Now at least reports that truncation happened instead of losing
  output with no trace.
- Removed select.go's unused off() helper (staticcheck U1000).

Re-verified end-to-end after these changes: a real KMDF driver build
and a plain cl/link build both still succeed.
This commit is contained in:
Cheviiot
2026-07-25 04:14:34 +10:00
parent a1743e4435
commit d11b534fa1
5 changed files with 48 additions and 3 deletions
+7
View File
@@ -310,4 +310,11 @@ func pumpLines(r io.Reader, w *os.File, filter lineFilter) {
}
fmt.Fprintln(w, line)
}
// bufio.Scanner silently stops (dropping the rest of the stream) once a
// single line exceeds its 16MB buffer - surface that rather than letting
// build output vanish without explanation (heavily templated C++ error
// messages are the realistic way to hit this).
if err := scanner.Err(); err != nil {
fmt.Fprintf(w, "vintner: output truncated: %v\n", err)
}
}