Skip to content

eslint-factory: narrow require-fetch-response-body-try-catch diagnostic to actual failure mode - #52981

Merged
pelikhan merged 2 commits into
mainfrom
copilot/eslint-factory-fix-require-fetch-response-body-try
Aug 15, 2026
Merged

eslint-factory: narrow require-fetch-response-body-try-catch diagnostic to actual failure mode#52981
pelikhan merged 2 commits into
mainfrom
copilot/eslint-factory-fix-require-fetch-response-body-try

Conversation

Copilot AI commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

The rule text for require-fetch-response-body-try-catch overstated impact by saying unhandled response-body parse failures “will crash the action.” In actions/setup/js, entrypoint-level error handling already converts these failures into job failures; the missing value at this call site is preserved parse context and clearer diagnostics.

  • Message semantics correction (no detection change)

    • Updated meta.messages.requireTryCatch in eslint-factory/src/rules/require-fetch-response-body-try-catch.ts.
    • New wording focuses on the real risk: losing original parse-error context and ending up with a generic stack, instead of a call-site-specific error with { cause }.
  • Scope clarification in user-facing guidance

    • Message now explicitly calls out that this still matters even when HTTP error paths are already handled (e.g., if (!response.ok) throw ...), so the warning is clearly about the successful-response body parse call.
  • Focused test update

    • eslint-factory/src/rules/require-fetch-response-body-try-catch.test.ts now asserts the emitted diagnostic text for a representative flagged case.
requireTryCatch:
  "Wrap {{call}} in try/catch — even after explicit HTTP-error handling (for example `if (!response.ok) throw ...`), reading a fetch() Response body can still reject ... Without this call-site try/catch, you lose the original parse error context ... with `{ cause }`."

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix overclaim in require-fetch-response-body-try-catch rule message eslint-factory: narrow require-fetch-response-body-try-catch diagnostic to actual failure mode Aug 15, 2026
Copilot AI requested a review from pelikhan August 15, 2026 22:55
@pelikhan
pelikhan marked this pull request as ready for review August 15, 2026 23:09
Copilot AI balanced review requested due to automatic review settings August 15, 2026 23:09
@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Aug 15, 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

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #52981 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #52981

@github-actions

github-actions Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel completed analysis: PR #52981 modifies only TypeScript ESLint rule tests, which fall outside the primary scoring categories (Go and JavaScript). The test change visible is a quality improvement (explicit message assertion vs. ID-based assertion). No violations detected. See comment for full analysis.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

reviewed_at: 2026-08-15T23:12:00Z
review_event: COMMENT
top_themes:
  - no actionable issues in changed lines
  - message wording aligned with actual failure mode
files_reviewed:
  - eslint-factory/src/rules/require-fetch-response-body-try-catch.ts
  - eslint-factory/src/rules/require-fetch-response-body-try-catch.test.ts
comment_count: 0

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 2.76 AIC · ⌖ 6.09 AIC · ⊞ 6.9K ·
Comment /review to run again

@github-actions github-actions Bot 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.

Verdict

Non-blocking: this change just corrects the lint diagnostic wording to match the actual failure mode, and the focused test assertion covers the new text.

Reviewed themes
  • checked the updated rule message for correctness against the rule behavior
  • checked the test change for brittleness or false confidence
  • found no changed-line issues that would justify blocking merge

🔎 Code quality review by PR Code Quality Reviewer · gpt54 · 2.76 AIC · ⌖ 6.09 AIC · ⊞ 6.9K
Comment /review to run again

@github-actions github-actions Bot 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.

The change narrows the diagnostic message to explain the actual failure mode more clearly. The {{call}} placeholder is preserved correctly, and the test uses an exact message: match that aligns with the updated message text. No correctness or security issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 15 AIC · ⌖ 6.99 AIC · ⊞ 5.6K

@github-actions

Copy link
Copy Markdown
Contributor

Skills-Based Review 🧠

Applied /tdd — one test-fragility observation; no other blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Message semantics correction — the change correctly narrows the claim from "will crash the action" to the actual risk (lost parse-error context). More accurate and actionable for developers.
  • Test assertion style — the test now pins the full literal message string instead of messageId. See inline comment for the fragility risk.

Positive Highlights

  • ✅ No detection logic changed — pure message-text improvement, low risk.
  • ✅ PR description clearly explains the motivation and scope.
  • ✅ Message text is more helpful: explains why the try/catch matters and what is lost without it.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 26.9 AIC · ⌖ 8.42 AIC · ⊞ 7.7K ·
Comment /matt to run again

@github-actions github-actions Bot 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.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 26.9 AIC · ⌖ 8.42 AIC · ⊞ 7.7K
Comment /matt to run again

errors: [
{
messageId: "requireTryCatch",
message:

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.

[/tdd] The test now asserts the full literal error message rather than the messageId key — any future wording change to requireTryCatch will silently break this test (or tempt reverting the wording to avoid the failure).

💡 Suggestion

Keep the assertion on messageId: "requireTryCatch" for "is the right rule triggered" and add a separate, clearly-labelled snapshot or constant-driven test that pins the rendered text. Alternatively, extract the message string into a shared constant so the rule definition and test always reference the same source of truth.

@copilot please address this.

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.

Pull request overview

Updates the ESLint rule diagnostic to describe lost parse context rather than action crashes.

Changes:

  • Clarifies response-body parse failure semantics.
  • Adds an exact diagnostic-message assertion.
Show a summary per file
File Description
require-fetch-response-body-try-catch.ts Revises the rule diagnostic.
require-fetch-response-body-try-catch.test.ts Verifies the revised message.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +44 to +47
requireTryCatch:
"Wrap {{call}} in try/catch — even after explicit HTTP-error handling (for example `if (!response.ok) throw ...`), " +
"reading a fetch() Response body can still reject (malformed JSON, truncated/errored stream). Without this call-site try/catch, " +
"you lose the original parse error context and get a generic, harder-to-diagnose stack instead of a specific message with `{ cause }`.",
@github-actions github-actions Bot mentioned this pull request Aug 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Quality Sentinel 🧪

Summary

Changed Files: 2 (1 test file, 1 production file)

  • eslint-factory/src/rules/require-fetch-response-body-try-catch.test.ts — Modified
  • eslint-factory/src/rules/require-fetch-response-body-try-catch.ts — Modified (production)

Test Framework Detected: TypeScript ESLint rule tests (using RuleTester)

Scoring Status: ⚠️ Out of Scope

The modified test file is TypeScript (ESLint rule test), which falls outside the primary scoring categories:

  • ✅ Go tests (*_test.go): 0 files
  • ✅ JavaScript tests (*.test.cjs, *.test.js): 0 files
  • ⚠️ TypeScript tests (*.test.ts): 1 file (not scored)

Test Changes Analysis

Modified Test: require-fetch-response-body-try-catch.test.ts

  • Change Type: Message assertion refinement
  • What Changed: Updated from using a generic messageId: "requireTryCatch" to an explicit full-text message assertion
  • Quality Signal: ✅ Positive — The test now asserts the actual diagnostic message text rather than relying on a message ID. This is a stricter form of validation that ensures the user-facing message text is correct and contains the proper guidance.

Lines Changed: +4, -1 (net +3 lines)

  • The test adds an explicit assertion of the complete diagnostic message that users will see
  • This ensures the ESLint rule produces the exact wording and guidance intended

Assessment

This PR makes a focused, high-confidence test improvement for an ESLint rule:

  1. ✅ Clarifies rule messaging (diagnostic now explicitly addresses the "successful-response body parse" failure mode)
  2. ✅ Tightens test validation (moves from ID-based to text-based assertion)
  3. ✅ No test inflation (message assertion is 3 net lines added)

Conclusion

This PR cannot be scored with the standard Test Quality Sentinel rubric because it contains no Go or JavaScript tests. However, the test change visible in the TypeScript ESLint test is a quality improvement — it explicitly validates the user-facing diagnostic message text, which is a stronger behavioral contract than ID-based assertion.


Note: Test Quality Sentinel analyzes Go (*_test.go) and JavaScript (*.test.cjs, *.test.js) tests. TypeScript and other languages are detected but not scored per current methodology.

🧪 Test quality analysis by Test Quality Sentinel · haiku45 · 27.9 AIC · ⌖ 3.33 AIC · ⊞ 7.9K ·
Comment /review to run again

@pelikhan
pelikhan merged commit f5e6b13 into main Aug 15, 2026
48 checks passed
@pelikhan
pelikhan deleted the copilot/eslint-factory-fix-require-fetch-response-body-try branch August 15, 2026 23:21
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.87.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

3 participants