Skip to content

[lint-monster] Handle ignored errors and discarded results - #79402

Merged
pelikhan merged 2 commits into
mainfrom
lint-monster/handle-scanner-errors-20261120-076f710428d6bbc3
Nov 20, 2026
Merged

pelikhan merged 2 commits into
mainfrom
lint-monster/handle-scanner-errors-20261120-076f710428d6bbc3

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Evidence

The pre-check make golint-custom output identified seven scanner loops that omit Scanner.Err() checks across six source files. The ignored-results tracker #71980 now records 727 remaining findings after these seven fixes.

Implementation

  • Check and propagate scanner failures in markdown section extraction, runtime-import and include expansion, eval JSONL parsing, nested workflow imports, remote include processing, and zizmor output parsing.
  • Add error-path tests using oversized scanner tokens.
  • Keep the remaining ignored-result findings tracked in [lint-monster] Handle ignored errors and discarded results #71980; this change does not close the category.

Validation

  • make fmt — passed.
  • go test ./pkg/parser — passed in the combined package run before CLI compilation was killed.
  • Focused CLI scanner error-path tests — passed.
  • Workflow package compile check — passed; no tests were run.
  • make golint-custom — completed with status 2 because repository-wide findings remain (2,956 diagnostics in the output). The broad combined package test invocation did not complete because the CLI compiler was killed under runner memory pressure.

Generated by 🧌 LintMonster · codex · gpt60 · ~20 AIC · ⌖ ~1 AIC · ⊞ 17.2K · ◷

@github-actions github-actions Bot added automation cookie Issue Monster Loves Cookies! lint labels Nov 20, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 20, 2026 05:33
Copilot AI adaptive review requested due to automatic review settings November 20, 2026 05:34
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

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.

Generated by PR Specification Reviewer for #79402 · copilot · gpt56 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated by Ponytail Reviewer for #79402 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~5 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Matt Pocock Skills Reviewer

Outcome: reported_action

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.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-7d9e5c41-c365-489e-bcb2-fdb4f2712be7","parents":[],"payload":{"id":"ldg-8d5b949a-d9d7-4b04-af15-f4cc8afd9a5d","operation":"append","value":{"finding_count":0,"head_sha":"e3d06f1fbe05ab5f19135a9bb685e82dee1c6572","outcome":"aligned"}},"sha":"sha256:d84c115644491ac4758e6f27dd1be62aabe501ef21ededc1560d568514fb034e","timestamp":"2026-11-20T05:40:26.092Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two correctness issues in the new scanner-error handling: oversized eval records now abort analysis due to the unchanged 64 KiB scanner limit, and nested include scan errors are swallowed by the caller in the normal (non-verbose) path. Please address these before merging.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~5 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

@@ -93,7 +101,10 @@ func parseEvalResultRecords(data []byte) []evalResultRecord {
records = append(records, record)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This turns any eval JSONL record over bufio.Scanner's default 64 KiB token limit into a fatal analysis error, even though oversized records were previously ignored and other valid records could still be summarized. Eval answers can contain arbitrarily long text, so a single large record now aborts both metric summary and observation attribution. Please raise the scanner buffer (or use a reader without this limit) before treating the scanner error as fatal, and add coverage for a valid large record.

Comment thread pkg/cli/imports.go
queue = append(queue, nestedFilePath)
}
}
if err := nestedScanner.Err(); err != nil {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new error is not actually propagated to the caller: add_workflow_content.go logs this error only in verbose mode and returns the original content with a nil error. Thus a nested include that hits Scanner's 64 KiB limit still silently succeeds in the normal path, while the new check only changes verbose output. Please either propagate this error or explicitly make the best-effort behavior clear and test it; otherwise this fix does not prevent truncated nested include processing.

@github-actions

Copy link
Copy Markdown
Contributor Author

ADR Required

This PR meets the ADR threshold. It has no implementation label, but it adds 125 lines in business-logic directories (pkg/), above the default 100-line threshold. Neither the PR body nor the repository contains an ADR for this change.

Draft committed: docs/adr/79402-propagate-bufio-scanner-errors.md (Status: Draft).

Decision captured in the draft: check scanner.Err() after every bufio.Scanner loop and return the error instead of partial results. This changes behavior for lines longer than 64 KiB, which were previously truncated silently. It also changes the signature of the exported parser.ExtractBodyLevelImportPaths.

ADR-60660 defines the analyzer that reports these loops. It does not record this error-propagation decision.

Next action (author): Review the draft, resolve the two [TODO: verify] markers (workflows that exceed 64 KiB lines, and out-of-tree callers of ExtractBodyLevelImportPaths), then change Status from Draft to Accepted.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷
Comment /review to run again

@github-actions

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-9daced33-79be-413c-9a8a-9d6248b21430","parents":[],"payload":{"id":"ldg-b620f8bd-1391-4eb3-9ed8-c21b3421480c","operation":"append","value":{"finding_count":2,"head_sha":"e3d06f1fbe05ab5f19135a9bb685e82dee1c6572","outcome":"findings"}},"sha":"sha256:9655e1db74dcbc911407d6994490171651883df5d01766e60b1c6913404aa083","timestamp":"2026-11-20T05:43:35.700Z","type":"ledger_append","version":1}
History

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Changes to the exported parser API and scanner failures now aborting compilation, recursive include processing, and experiment analysis require human compatibility and operational review.

No open issues 🎉

What changed in this PR

This PR addresses seven unchecked scanner loops in gh-aw, making parsing failures explicit rather than silently returning incomplete results. It covers the scanner-related subset of #71980; the remaining ignored-result findings stay tracked separately.

Changes:

  • Check scanner errors in markdown parsing, import/include processing, eval JSONL parsing, and zizmor output handling.
  • Propagate errors through affected compiler and CLI callers.
  • Add oversized-token regression tests and update existing tests for error-returning signatures.
File Description
pkg/​workflow/​compiler_orchestrator_tools.go Propagates runtime-import scanning errors during compilation.
pkg/​parser/​include_expander.go Returns scanning errors from runtime-import extraction and include expansion.
pkg/​parser/​include_expander_relativize_test.go Adds scanner error tests for import extraction and expansion.
pkg/​parser/​frontmatter_extraction_test.go Tests oversized tokens during section extraction.
pkg/​parser/​frontmatter_content.go Reports scanner errors when extracting markdown sections.
pkg/​cli/​zizmor.go Reports errors while scanning zizmor stderr.
pkg/​cli/​zizmor_test.go Adds a zizmor scanner error regression test.
pkg/​cli/​remote_workflow_test.go Tests remote include scanning failures.
pkg/​cli/​includes.go Propagates runtime-import and remote include scanning errors.
pkg/​cli/​imports.go Reports nested include scanning failures.
pkg/​cli/​imports_test.go Tests oversized tokens in nested includes.
pkg/​cli/​experiments_fetch.go Returns eval JSONL scanning errors through result loaders.
pkg/​cli/​experiments_eval_observations_test.go Tests eval scanner failures and updates parser calls.
pkg/​cli/​experiments_command.go Propagates eval loading errors through experiment analysis.
pkg/​cli/​experiments_command_test.go Updates summary tests for the parser’s error return.

Review effort: Balanced (adaptive)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /diagnosing-bugs, /tdd and /codebase-design. No blocking correctness issues found; three follow-ups to consider.

📋 Key Themes & Highlights

Key Themes

  • Silent success on scan failure: experiments analyze still exits 0 when the eval-results scan fails (inline comment on experiments_command.go).
  • Scanner limit consistency: parser scanners keep the default 64 KiB limit while CLI scanners use 1 MiB (inline comment on include_expander.go).
  • Boundary coverage: the new tests only cover the over-limit error path (inline comment on the eval observations test).

Positive Highlights

  • ✅ Every touched bufio.Scanner now checks Err(), so truncated input is no longer treated as complete.
  • ✅ Error returns are propagated through all in-repo callers, including the compiler path in compiler_orchestrator_tools.go.
  • ✅ Error-path tests use a 64 KiB+1 line to trigger ErrTooLong reliably.
  • ✅ Targeted pkg/parser and pkg/cli tests pass, and gofmt is clean on changed files.

Verification Notes

  • A full go vet of pkg/workflow was OOM-killed on the runner, so its compile is inferred from pkg/cli, which imports it.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

}

func TestParseEvalResultRecordsReturnsScannerErrors(t *testing.T) {
data := []byte(strings.Repeat("x", 64*1024+1))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] The new coverage only exercises the error path with a 64 KiB+1 line. Add a success-path case so the boundary is pinned on both sides: a valid record followed by a line just under the limit should still parse and return the valid records with no error.

💡 Suggested test

Assert that a payload at the limit parses, and that limit+1 returns the wrapped scan error. Name the cases as specs, for example returns valid records when lines are within the scanner limit.

@copilot please address this.

})
}
return results
if err := scanner.Err(); err != nil {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] The parser scanners use the default 64 KiB token limit with no Buffer() call, while some CLI scanners in this PR raise it to 1 MiB. A single line over 64 KiB in an imported or runtime-imported file now fails hard, where before it was silently truncated. The same applies to frontmatter_content.go:284. Confirm the 64 KiB limit is intended, or share one buffer-size constant between parser and CLI.

💡 Suggested change

Set an explicit limit on each parser scanner, for example scanner.Buffer(make([]byte, 0, 64*1024), maxLine), with maxLine defined once in pkg/parser so both paths stay consistent.

@copilot please address this.

return frontmatter, details, loadRemoteMetricEvalResults(config.RepoOverride, details.WorkflowID), nil
metricEvalResults, err := loadRemoteMetricEvalResults(config.RepoOverride, details.WorkflowID)
if err != nil {
return frontmatter, details, nil, err

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] The helpers now return scan errors, but the caller at experiments_command.go:196-200 prints them and returns nil, so experiments analyze exits 0 when the eval-results file cannot be fully read. The comment at lines 192-195 documents config loading as best-effort, which may justify this. Decide explicitly: either return the error from the caller, or keep the non-fatal path and add a test that pins the exit-0 behavior.

💡 Suggested change

Return scan failures from runExperimentsAnalyze and reserve the best-effort path for missing config, so a truncated input cannot produce a silent success exit.

@copilot please address this.

@pelikhan
pelikhan merged commit 4e8bb52 into main Nov 20, 2026
58 checks passed
@pelikhan
pelikhan deleted the lint-monster/handle-scanner-errors-20261120-076f710428d6bbc3 branch November 20, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation cookie Issue Monster Loves Cookies! lint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants