Repository navigation
[lint-monster] Check scanner errors after iteration - #78574
github-actions[bot] wants to merge 1 commit into
Conversation
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully!
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
What this change does: It reports scanner errors and permits long lines in two in-memory inputs. I reviewed the changed code and its callers as local CLI operations.
Should fix
-
Use line iterators for in-memory inputs
- What this is: Two functions scan data already held in memory.
- Problem: They add buffer setup and error branches that cannot be reached with their readers and buffer limits.
- Fix: Use
bytes.Linesandstrings.Lines; both callers already trim each line. - If we skip it: Extra setup and error handling remain to be maintained.
Verdict: Ship.
Lean: -17 lines possible.
Generated by ✂️ Ponytail Reviewer for #78574 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185
Comment /ponytail to run again
| } | ||
| scanner := bufio.NewScanner(bytes.NewReader(data)) | ||
| // Eval answers can exceed Scanner's default 64 KiB token limit. | ||
| scanner.Buffer(make([]byte, 0, 64*1024), max(64*1024, len(data)+1)) |
There was a problem hiding this comment.
Should fix: Use bytes.Lines(data) here and strings.Lines(content) in ExtractBodyLevelImportPaths: both inputs are already in memory and each line is trimmed, so these iterators handle long lines without a buffer or an unreachable scanner-error branch. This also removes the new logger and about 17 lines of setup and error handling.
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found correctness regressions in scanner handling. Five paths now turn ordinary oversized markdown/log lines into hard failures or partial operations, and zizmor can discard valid stdout findings when stderr exceeds Scanner's limit. Please raise buffers consistently and preserve valid output before merging.
Highlights
- zizmor parsing aborts before valid findings are decoded.
- Include and section processing reject large content without the buffer increases used elsewhere.
- Remote include fetching can stop after partial writes in non-strict mode.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| } | ||
| } | ||
| } | ||
| if err := scanner.Err(); err != nil { |
There was a problem hiding this comment.
This new error return can discard valid zizmor findings whenever stderr contains a line over Scanner's 64 KiB limit.
💡 Preserve stdout findings
The stdout JSON is parsed only after this check, so an oversized informational stderr line turns an otherwise valid audit into a parse failure. Raise the scanner buffer (or log the stderr scan error and continue parsing stdout) and add a regression test with a long stderr line plus valid JSON findings.
| queue = append(queue, nestedFilePath) | ||
| } | ||
| } | ||
| if err := nestedScanner.Err(); err != nil { |
There was a problem hiding this comment.
This adds a hard failure for any included markdown line over 64 KiB, but unlike the other in-memory scanners in this PR it does not raise the buffer limit.
💡 Avoid rejecting valid includes
A long line in an included document now aborts processing before nested directives are discovered, changing a previously successful include into an error. Configure nestedScanner.Buffer with a limit derived from markdownContent (and test a long line followed by a nested include) so the scanner-error check reports genuine failures rather than normal large content.
| } | ||
| } | ||
| } | ||
| if err := scanner.Err(); err != nil { |
There was a problem hiding this comment.
This returns after a default Scanner error without increasing the buffer, so one oversized line can silently prevent all later remote includes from being fetched in non-strict mode.
💡 Keep scanning valid workflow content
The caller treats this as a warning when strict mode is disabled, leaving a partially fetched dependency set while reporting success; strict mode can also fail after earlier files were written. Raise the scanner buffer based on content length (and cover a long line followed by an include) so ordinary large markdown does not trigger this partial-operation path.
| sectionContent.WriteString(line + "\n") | ||
| } | ||
| } | ||
| if err := scanner.Err(); err != nil { |
There was a problem hiding this comment.
This new check makes any markdown section containing a line over 64 KiB fail, because this scanner still uses the default token limit.
💡 Do not turn large content into compilation failures
Sections can legitimately contain generated tables or embedded data, and callers use this helper for include/import extraction. Raise the buffer limit from len(content), as done for the eval scanner, before treating ErrTooLong as an error; add coverage for a long section line and a later header.
| } | ||
| } | ||
|
|
||
| if err := scanner.Err(); err != nil { |
There was a problem hiding this comment.
This adds a hard scanner failure for oversized workflow lines without increasing the scanner buffer, so frontmatter extraction now rejects content that previously passed.
💡 Match the long-line handling above
A long non-directive line before an import can make expansion return an error and block compilation. Configure this scanner with a limit derived from len(content), consistent with ExtractBodyLevelImportPaths, then retain the Err check for genuine failures.
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs, /tdd, and /codebase-design. Requesting changes because the new Err() checks turn a silent truncation into a hard failure, and one of those paths runs during compilation.
📋 Key Themes & Highlights
Key Themes
- Long-line regression:
ExpandIncludesForSafeOutputs(called fromcompiler_orchestrator_workflow.go:654) andExtractMarkdownSectionnow fail on any line over 64 KiB. Their scanners have noBuffercall. I reproduced this with a 70 KiB line, then deleted the temporary test. - Buffer policy:
max(64*1024, len(content)+1)has no real per-line cap. Use a fixed, shared limit. - Error policy: result-only helpers log and return
nil, while sibling sites return errors. Document the best-effort contract or make it consistent. - Test coverage: only the error path is tested. The long-line success path is not.
Positive Highlights
- ✅ Consistent
scanner.Err()checks across the affected per-file scanners - ✅
ExtractBodyLevelImportPathsandparseEvalResultRecordsalready raise the buffer - ✅ Zizmor error propagation falls back to raw output cleanly
- ✅
imports.go:559already checkedErr()before this PR
Not Verified
- I did not run the full
pkg/parsersuite after the probe. - I did not check whether any production workflow has a line over 64 KiB.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| sectionContent.WriteString(line + "\n") | ||
| } | ||
| } | ||
| if err := scanner.Err(); err != nil { |
There was a problem hiding this comment.
[/diagnosing-bugs] This Err() check now hard-fails ExtractMarkdownSection on any line over 64 KiB. Before this PR that case truncated silently. The scanner at line 248 has no Buffer call, so a long prose line inside an imported section will now break the import. Raise the buffer the way ExtractBodyLevelImportPaths does, or document the intended limit.
💡 Suggested fix
scanner := bufio.NewScanner(strings.NewReader(content))
scanner.Buffer(make([]byte, 0, 64*1024), max(64*1024, len(content)+1))A regression test with a long line followed by a section header would lock this in.
@copilot please address this.
| } | ||
| } | ||
|
|
||
| if err := scanner.Err(); err != nil { |
There was a problem hiding this comment.
[/diagnosing-bugs] Same regression as ExtractMarkdownSection. The scanner at line 285 has no Buffer call, so ExpandIncludesForSafeOutputs now returns token too long for any workflow with an @include and a line over 64 KiB. This path is called from the compiler at compiler_orchestrator_workflow.go:654, so this is a compile-time break, not only a CLI warning. I reproduced it with a 70 KiB line in a temporary test, which I then deleted. Please raise the buffer here too and add a regression test.
@copilot please address this.
| var results []BodyLevelImport | ||
| scanner := bufio.NewScanner(strings.NewReader(content)) | ||
| // A long markdown line should not prevent directives on later lines from being found. | ||
| scanner.Buffer(make([]byte, 0, 64*1024), max(64*1024, len(content)+1)) |
There was a problem hiding this comment.
[/codebase-design] max(64*1024, len(content)+1) ties the limit to input size, so there is effectively no per-line cap. Other scanners in this repo use a fixed cap such as 1024*1024. A bounded limit gives a clear failure mode for pathological input. Consider a shared constant, for example maxIncludeLineBytes, used at every site this PR touches.
@copilot please address this.
| Optional: false, // optional directives are skipped above; only required imports are promoted | ||
| }) | ||
| } | ||
| if err := scanner.Err(); err != nil { |
There was a problem hiding this comment.
[/codebase-design] This path logs and returns nil on a scan error, while the sibling changes return the error. Callers of ExtractBodyLevelImportPaths receive no signal that the result is partial. The PR body says this is intentional, so either document the best-effort contract in the function comment or change the signature to return an error.
@copilot please address this.
| } | ||
| } | ||
|
|
||
| func TestExtractMarkdownSectionReturnsScannerError(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] This test covers only the error path. Nothing exercises the success path for lines over 64 KiB, which is the behavior this PR changes. Add a case where a long line precedes a valid @import directive, and assert the directive is still found. The same gap applies to ExtractBodyLevelImportPaths and parseEvalResultRecords.
💡 Suggested test
long := strings.Repeat("x", 70*1024)
content := long + "\n@import shared.md\n"
// assert the import directive is still returned@copilot please address this.
There was a problem hiding this comment.
🟡 Changes recommended
The runtime-import and eval-parser buffer changes lack targeted regression tests for inputs over 64 KiB, leaving dependency omissions and lost eval records unprotected against recurrence.
2 open issues
What changed in this PR
This PR improves scanner error handling in gh-aw’s Markdown, include, eval-result, and zizmor parsing paths, preventing silent truncation from being treated as success.
Changes:
- Propagate scanner errors from APIs that return errors and log failures in result-only helpers.
- Increase scanner limits for body-level runtime imports and eval records to support long lines.
- Add a regression test for oversized-line errors during Markdown section extraction.
| File | Description |
|---|---|
pkg/parser/include_expander.go |
Support long runtime-import lines and handle include scanner errors. |
pkg/parser/frontmatter_extraction_test.go |
Test scanner error propagation for oversized Markdown lines. |
pkg/parser/frontmatter_content.go |
Return Markdown section scanner errors. |
pkg/cli/zizmor.go |
Return errors encountered while scanning zizmor stderr. |
pkg/cli/includes.go |
Propagate remote-include scanner errors. |
pkg/cli/imports.go |
Propagate nested-include scanner errors with source context. |
pkg/cli/experiments_fetch.go |
Support large eval records and log scanner failures. |
Review effort: Balanced (adaptive)
| } | ||
| scanner := bufio.NewScanner(bytes.NewReader(data)) | ||
| // Eval answers can exceed Scanner's default 64 KiB token limit. | ||
| scanner.Buffer(make([]byte, 0, 64*1024), max(64*1024, len(data)+1)) |
| var results []BodyLevelImport | ||
| scanner := bufio.NewScanner(strings.NewReader(content)) | ||
| // A long markdown line should not prevent directives on later lines from being found. | ||
| scanner.Buffer(make([]byte, 0, 64*1024), max(64*1024, len(content)+1)) |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "4b7b2bcbdd5cf8f2ca40ffda93b60c56a72e4c93",
"kind": "requested",
"schema_version": "1",
"state": "3b33c93dc46a6179747767c5ab063ab50ded7ec24b04fe7fce3916a84f26e841",
"work": [
"652e72990f7b790c7c48731764eab059ea26d3ac854eaf2e574706c5b3927127",
"8200d24c688ab9561b943e11ef835ea8bcbdcdf0c6d9298047a86361b4f31f05"
],
"workflow": "pr-sous-chef"
}
|

Evidence
The pre-check lint output reported 7 scanner loops without an
Err()check across 6 Go source files. The complete open-issue inventory was empty, and open-PR searches found no matching implementation work.Changes
Validation
make fmtpassed.go test ./pkg/parser -count=1passed.make golint-customran; all 7 scanner findings cleared. It still exits nonzero for other findings: 1,406 indexing, 724 ignored-results, 296 long functions inpkg/cliandpkg/workflow, and 533 other findings.go test ./pkg/cli -count=1failed. Its output includedgh workflow listfailing because the supplied GitHub CLI is unauthenticated; the focused CLI tests above passed.