mirror of
https://github.com/devvmhq/ciwatch.git
synced 2026-12-01 06:13:17 -10:00
When the fuzz-target search reads a _test.go line over 1 MiB, it now wraps bufio.ErrTooLong in a *fs.PathError with Op read and the file's path relative to the checkout. Before, --fetch-crashes printed only "looking for X in the checkout: bufio.Scanner: token too long", so the file couldn't be told apart. The CLI's existing path quoting applies to the new error, so a folder name with a newline is quoted and the message stays on one line. The error still matches bufio.ErrTooLong. Only that one error is wrapped. The 1 MiB limit, the files searched, permission skips and other read errors are unchanged, and the CLI needs no change. Tests cover the search directly and the stderr line and fetch_error through the CLI, with an ordinary path and one with a newline. Spec: acceptance cases AC-1: The checkout has `internal/q/q_test.go`, whose second line is 1 MiB + 1 bytes long, and no file reaches a `FuzzParse` declaration before the search gets to it. `ciwatch --fetch-crashes <sha>` for a run with a `crash-FuzzParse` artifact prints this line once on stderr: `ciwatch: can't fetch crash-FuzzParse of run <id>: looking for FuzzParse in the checkout: read internal/q/q_test.go: bufio.Scanner: token too long`. With `--json`, that crash's `fetch_error` is `looking for FuzzParse in the checkout: read internal/q/q_test.go: bufio.Scanner: token too long`. The exit code is 1, as before. AC-2: Same as AC-1, but the file is `p\nq/q_test.go` (the folder name contains a newline). The message reads `… in the checkout: read "p\nq/q_test.go": bufio.Scanner: token too long`. It stays one line on stderr and no stderr line starts with `q/`. `fetch_error` has the same quoted text. AC-3: `Declaring` called directly on the AC-1 file system returns an error where `errors.As` finds a `*fs.PathError` with `Op == "read"` and `Path == "internal/q/q_test.go"`, and `errors.Is(err, bufio.ErrTooLong)` is true. AC-4: A file whose declaration comes before its over-long line is still found, with no error, as it is today. Spec: non-goals - Raising or removing the 1 MiB line limit. - Changing which files are searched. One over-long file still stops the whole search, even if another file declares the target. - Other errors from the search: open and read I/O errors, permission skips, an unreadable root. Their text stays as it is, including any absolute path in an `os.File` read error. - Using `reason()`/`Skipped` for this case. A too-long line isn't a permission error, so it is never skipped. Spec: inference none Spec: approved with Approved under CJ's standing delegation: no inference, a one-error wrap that reuses quoteErr. Your answer is accepted: only bufio.ErrTooLong is wrapped. Built in steps: - test(fuzztarget): name the file when a test line is too long - feat(fuzztarget): name the file when a test line is too long Co-Authored-By: Claude Sonnet 5.5 <[email protected]>