Skip to content

[eslint-miner] eslint-factory: add require-per-page-on-github-list-call rule - #76119

Merged
pelikhan merged 3 commits into
mainfrom
eslint-miner/require-per-page-on-github-list-call-c17fb85d505b9034
Nov 9, 2026
Merged

pelikhan merged 3 commits into
mainfrom
eslint-miner/require-per-page-on-github-list-call-c17fb85d505b9034

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

New rule: require-per-page-on-github-list-call

Flags Octokit <client>.rest.<ns>.list*({...}) calls with no per_page, which silently return only the default 30 items. Conservative: skips spreads and non-literal arguments.

Research

Validation (from eslint-factory)

  • npm ci: ok
  • npm run build: ok
  • npm test -- src/rules/require-per-page-on-github-list-call.test.ts: 2 passed
  • npm run lint:setup-js: exit 0, 0 errors, 1062 warnings (all pre-existing apart from the 1 new-rule hit above)

Steering issue #76113 had no steer comments.

Generated by ESLint Miner · copilot · auto (Claude Sonnet 5.5) · ~39 AIC · ⌖ ~2 AIC · ⊞ 10.3K · ◷
Claim finished

  • expires on Nov 15, 2026, 7:36 PM UTC-08:00

@github-actions github-actions Bot added automation cookie Issue Monster Loves Cookies! eslint labels Nov 9, 2026
@github-actions
github-actions Bot requested an adaptive review from Copilot November 9, 2026 03:36
@pelikhan
pelikhan marked this pull request as ready for review November 9, 2026 03:36
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 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 Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 9, 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 from Ponytail Reviewer · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76119

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ 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.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.6K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 9, 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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

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.

🟡 Changes recommended

The new rule is missing required README documentation, breaking the parity test, and incorrectly flags unpaginated endpoints such as listLanguages.

2 open issues
What changed in this PR

Adds a custom ESLint rule to help detect missing explicit page sizes in Octokit REST list calls used by gh-aw’s setup scripts.

Changes:

  • Detects rest.<namespace>.list*({...}) calls without per_page, skipping spreads and non-literal arguments.
  • Adds tests for reported calls, supported exclusions, and the documentation URL.
  • Registers the rule and enables it at warning level.
File Description
eslint-factory/​src/​rules/​require-per-page-on-github-list-call.ts Implements call matching and missing-page-size diagnostics.
eslint-factory/​src/​rules/​require-per-page-on-github-list-call.test.ts Adds valid and invalid rule cases and a documentation URL check.
eslint-factory/​src/​index.ts Registers the new rule in the plugin.
eslint-factory/​eslint.config.cjs Enables the rule as a warning.

Review effort: Balanced (auto)

"no-misplaced-error-code-definition": noMisplacedErrorCodeDefinitionRule,
"require-fs-chmod-try-catch": requireFsChmodTryCatchRule,
"no-single-char-string-replace": noSingleCharStringReplaceRule,
"require-per-page-on-github-list-call": requirePerPageOnGithubListCallRule,

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.

Added the missing rule table row and documentation section in eslint-factory/README.md. The fix is in commit f958219.


function isRestListCallee(callee: TSESTree.Expression): string | null {
// Matches <client>.rest.<namespace>.list*(...)
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier" || !callee.property.name.startsWith("list")) {

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.

Excluded repos.listLanguages, which does not support pagination, and added a regression test. The fix is in commit f958219.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-09T03:40:05Z
review_event: REQUEST_CHANGES
top_themes: [false-negative pagination validation]
files_reviewed: [eslint-factory/eslint.config.cjs, eslint-factory/src/index.ts, eslint-factory/src/rules/require-per-page-on-github-list-call.ts, eslint-factory/src/rules/require-per-page-on-github-list-call.test.ts]
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
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 · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@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.

Found one correctness issue: the rule treats per_page: undefined as compliant even though the parameter is omitted and the API still uses the default page size. Please address this false negative and add regression coverage. Other reviewed paths did not reveal additional merge-blocking issues.

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

if (arg.properties.some(p => p.type === "SpreadElement")) {
return;
}
const hasPerPage = arg.properties.some(p => p.type === "Property" && ((!p.computed && p.key.type === "Identifier" && p.key.name === "per_page") || (p.key.type === "Literal" && p.key.value === "per_page")));

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 only checks that the key exists, so per_page: undefined (and void 0) still passes lint and is omitted from the request, leaving Octokit at its default page size. That directly defeats the rule’s purpose of preventing silent truncation. Please reject statically undefined values (and add a regression test), while retaining dynamic variables that cannot be proven undefined.

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 rule now reports per_page: undefined and per_page: void 0, while still accepting dynamic values. Regression tests are included in commit f958219.

@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 /tdd and /diagnosing-bugs (regression-test check). Requesting changes: the new rule is not documented in the README, so an existing test will fail.

📋 Key Themes & Highlights

Key Themes

  • Blocking, documentation parity: src/index.ts registers require-per-page-on-github-list-call, but eslint-factory/README.md has no table row or ### section. src/index-readme-parity.test.ts asserts each exported rule is documented exactly once, so npm test will fail. I confirmed the mismatch statically by diffing the registered rules against README headers.
  • Test coverage gap: the quoted "per_page" key branch is untested.

Positive Highlights

  • ✅ Conservative design: spreads and non-literal arguments are skipped, which keeps false positives low.
  • ✅ The list* / .rest.<ns> callee matching is tight and computed-member access is excluded.
  • ✅ The PR body documents the local scan, so the low-noise claim is verifiable.

Validation note

I could not run npm ci here: the sandbox network presents a self-signed certificate. The README finding is therefore based on a static check, not a test run. The author should run npm test in eslint-factory/ to confirm.

@copilot please address the review comments above.

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

"no-misplaced-error-code-definition": noMisplacedErrorCodeDefinitionRule,
"require-fs-chmod-try-catch": requireFsChmodTryCatchRule,
"no-single-char-string-replace": noSingleCharStringReplaceRule,
"require-per-page-on-github-list-call": requirePerPageOnGithubListCallRule,

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] Blocking: this rule is registered here, but eslint-factory/README.md has no Rules table row and no ### require-per-page-on-github-list-call section. src/index-readme-parity.test.ts requires every exported rule to be documented exactly once, so that test will fail. The docs.url anchor asserted by the rule test (#require-per-page-on-github-list-call) will also not resolve.

💡 Suggested README addition

Add a row to the Rules table: | [require-per-page-on-github-list-call](#require-per-page-on-github-list-call) | Require an explicit per_page on Octokit REST list* calls, which otherwise return only the default 30 items |. Then add a section after the other rule sections showing the flagged form github.rest.issues.listComments({ owner, repo, issue_number: 1 }) and the safe alternative that passes per_page: 100 or uses github.paginate.

The PR validation only ran the rule test file, which is why this slipped through.

@copilot please address this.

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.

Added the README rules-table entry and documentation section; npm test now passes the rule documentation parity test. The fix is in commit f958219.

`async function f() { await github.rest.issues.listComments(params); }`,
`async function f() { await github.rest.issues.get({ owner, repo, issue_number: 1 }); }`,
`async function f() { await github.paginate(github.rest.issues.listComments, { owner, repo }); }`,
`async function f() { await list.listItems({ owner }); }`,

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 quoted "per_page" key branch in the rule (p.key.type === "Literal") has no test, so a regression there would pass silently. Add a valid case alongside the others.

💡 Suggested test

async function f() { await github.rest.issues.listComments({ owner, repo, "per_page": 100 }); }

Quoted keys are valid JavaScript, so covering them pins down the rule conservative handling.

@copilot please address this.

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.

Added a valid regression case for the quoted "per_page" key. The fix is in commit f958219.

@pelikhan

pelikhan commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Copilot AI requested a review from pelikhan November 9, 2026 04:11
@pelikhan
pelikhan merged commit e5ed03b into main Nov 9, 2026
48 checks passed
@pelikhan
pelikhan deleted the eslint-miner/require-per-page-on-github-list-call-c17fb85d505b9034 branch November 9, 2026 04:27
@github-actions

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v1.2.2

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! eslint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants