Skip to content

Unify JSON decoder EOF checks - #78268

Merged
pelikhan merged 3 commits into
mainfrom
copilot/refactor-unify-io-eof-checks
Nov 16, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/refactor-unify-io-eof-checks

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

The token and decode walkers used different rules to recognize io.EOF checks, allowing unrelated EOF comparisons to count as checks for token calls. This unifies them around the call’s actual error result.

  • Predicate: Share a per-if check across both walkers; recognize the error result in single- and multi-result assignments.
  • AST traversal: Replace specialized containment scans with a nil-safe generic helper.
  • Coverage: Add fixtures for unrelated EOF comparisons and if conditions without an initializer.
if _, err := decoder.Token(); err != io.EOF {
    return err // Checks this Token call's error.
}

gh-aw-bot and others added 2 commits November 16, 2026 05:11
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@gh-aw-bot gh-aw-bot changed the title [WIP] Refactor unify duplicated io.EOF-check predicates Unify JSON decoder EOF checks Nov 16, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 16, 2026 05:37
Copilot AI adaptive review requested due to automatic review settings November 16, 2026 05:37
@pelikhan
pelikhan merged commit fc32505 into main Nov 16, 2026
60 checks passed
@pelikhan
pelikhan deleted the copilot/refactor-unify-io-eof-checks branch November 16, 2026 05:37
Copilot stopped reviewing on behalf of pelikhan due to an error November 16, 2026 05:37
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification 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 PR Specification Reviewer for #78268 · copilot · gpt56 · ~1 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

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

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

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.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: sonnet55 high · ~6 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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 · ~2 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

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

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.

🟢 Approval recommended

No active review issues are recorded for the changes tying EOF checks to the errors returned by Token or Decode.

No open issues 🎉

What changed in this PR

This PR makes EOF detection consistent in gh-aw’s JSON trailing-data linter, requiring checks to reference the actual error returned by Token or Decode.

Changes:

  • Shares one EOF-check predicate across both walkers and supports single- and multi-result assignments.
  • Replaces specialized containment scans with a nil-safe generic AST helper.
  • Adds regression fixtures for unrelated EOF comparisons and conditions without an initializer.
File Description
pkg/​linters/​jsondecodertrailingdataunchecked/​testdata/​src/​jsondecodertrailingdataunchecked/​jsondecodertrailingdataunchecked.go Adds fixtures covering unrelated EOF checks and initializer-free conditions.
pkg/​linters/​jsondecodertrailingdataunchecked/​jsondecodertrailingdataunchecked.go Unifies EOF predicates, tracks returned errors, and introduces nil-safe AST containment.

Review effort: Balanced (dynamic)

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Unify duplicated io.EOF-check predicates in jsondecodertrailingdataunchecked

4 participants