Skip to content

fix(repo-fleet-hygiene): paginate PR evidence beyond silent 200 cap - #1869

Merged
kyle-sexton merged 4 commits into
mainfrom
fix/fleet-hygiene-pr-list-pagination
Aug 5, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
fix/fleet-hygiene-pr-list-pagination

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Summary

  • Paginate or otherwise expand repo-fleet-hygiene audit merged-PR evidence beyond the silent 200/repo cap, and disclose truncation when a bound still applies.

Closes #1795

Related

N/A

Test plan

  • audit-fleet.test.sh
  • Confirm truncation disclosure when cap binds

@claude

claude Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 3m 52s —— View job


Code review — repo-fleet-hygiene PR pagination fix

  • Gather context (diff, changed files)
  • Understand the request (code-review lane)
  • Review audit-fleet.sh changes for correctness/error handling
  • Review test coverage in audit-fleet.test.sh
  • Review CHANGELOG and security-review.md doc changes
  • Post findings

Scope: correctness, architecture, error handling, test coverage, maintainability, per REVIEW.md's code-review lane (this repo has a claude-security-review workflow, so security findings are excluded here).

Note: I could not execute shellcheck or the test suite (audit-fleet.test.sh) in this sandbox — Bash execution required approval that wasn't granted. Findings below are from static reading of the diff; if you'd like the test suite actually run, adjust --allowedTools to permit it.

🔴 Important — plugin.json version not bumped alongside the new CHANGELOG entry

CHANGELOG.md adds a ## [0.7.2] entry, but .claude-plugin/plugin.json still declares "version": "0.7.1". CLAUDE.md is explicit: "Versioned. Set an explicit semver version in each plugin.json so consumers update on bumps." The immediately-prior fix PR in this repo (fix(source-control)#1853) bumped its plugin's manifest version in the same commit as its CHANGELOG entry — this PR should do the same, or a consumer pinned to plugin.json's version will never see this fix as available.

🟡 Suggestion — evidence-window cap raised 5x with no corresponding change to the fixed 30s query timeout

audit-fleet.sh:190 keeps GH_TIMEOUT_SECONDS=30 unchanged, while MERGED_PR_BATCH_LIMIT jumps from 200 to 1000. gh pr list paginates GraphQL internally in pages well under 1000, so a 5x larger --limit means up to 5x more round trips inside the same fixed timeout budget. On a genuinely busy repo this risks the query timing out where it previously succeeded — and a timeout falls into the github-pr-evidence-unavailable branch (line 1050), discarding all merged-PR evidence for that repo with a "restore GitHub access/authentication" remediation that's misleading for what's actually a timeout, not an auth failure. This interaction isn't mentioned in the PR description, the CHANGELOG, or the security-review re-check, and the new tests use synthetic gh stubs that return instantly regardless of row count, so the timeout/large-window interaction is untested. Worth at least a comment acknowledging the tradeoff, if not scaling the timeout with the configured limit.

🟡 Suggestion — the finding's own remediation ("raise the shared MERGED_PR_BATCH_LIMIT") isn't achievable without hand-editing the installed plugin

The new merged-pr-evidence-window-truncated finding's Handoff text (line 1065) tells the operator to "raise the shared MERGED_PR_BATCH_LIMIT... then rerun." But the only override mechanism, REPO_FLEET_MERGED_PR_BATCH_LIMIT, is documented in-code as existing "for the regression harness only" (line 138) and isn't mentioned in the plugin's plugin.json (no userConfig entry), README, or SKILL.md. A real user acting on this advice has no supported path other than editing the installed plugin's script — which is exactly what CLAUDE.md's plugin design rules prohibit: "Configurable without editing the plugin... Never require a fork or a hand-edit of the installed plugin." Consider exposing this as a proper userConfig numeric key (the sibling source-control plugin has precedent for this shape, e.g. fetch_logs_max_bytes), or soften the Handoff text to only mention manual verification.

Strengths

  • The shared-constant design (MERGED_PR_BATCH_LIMIT/MERGED_PR_HEAD_LIMIT feeding both the call sites and the gh_probe_allowed allowlist) correctly prevents the exact drift bug the comment at line 137 calls out.
  • Test coverage is solid: it verifies the allowlist admits the live constant, rejects a drifted literal, greps the script for stray hardcoded 200/100 limits, and exercises both the at-cap (truncation emitted) and under-cap (no truncation) cases end-to-end through the collector.
  • The truncation disclosure itself (merged-pr-evidence-window-truncated) is exactly the right shape — never silent, correctly framed as a possible false negative rather than a false positive.

@claude

claude Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 42s —— View job


Security Review

  • Gather context (diff, changed files)
  • Review audit-fleet.sh for injection / logic / auth issues
  • Review audit-fleet.test.sh, CHANGELOG.md, security-review.md
  • Report findings

No security issues found.

Scope reviewed: plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh (+45/-14), its test harness, CHANGELOG.md, and security-review.md. No GitHub Actions workflow files are touched by this PR, so the zizmor advisory lane (unpinned actions, dangerous triggers, excessive permissions) doesn't apply here.

Specific things I checked and found sound:

  • New env-var overrides are safely bounded. REPO_FLEET_MERGED_PR_BATCH_LIMIT / REPO_FLEET_MERGED_PR_HEAD_LIMIT are validated with an anchored ^[1-9][0-9]{0,4}$ regex (no leading zero, so no accidental octal interpretation in later arithmetic; no shell metacharacters possible). The values only ever flow into gh/comparison argv positions as plain strings — never eval'd or interpolated into a command string — so there's no injection surface.
  • Allowlist/call-site coupling is maintained correctly. gh_probe_allowed now checks the --limit value against the same shared MERGED_PR_BATCH_LIMIT/MERGED_PR_HEAD_LIMIT variables used at the call sites, so the two can't silently drift (the failure mode the PR is fixing). The rest of the argv shape (repo pattern, --state merged, fixed --json/--template) is still pinned exactly as before — nothing new is admitted through the allowlist beyond the limit value itself.
  • No change to trust boundaries around branch names sent to GitHub. The --head "$branch" exact-fallback query (line ~1119) still only fires for branches already confirmed present in the local remote-tracking inventory (remote_branch_known == true), preserving the existing guard that a purely local (never-pushed) branch name is never transmitted to github.com.
  • Truncation-disclosure logic is read-only and doesn't widen egress. The new merged-pr-evidence-window-truncated finding only counts rows already returned by the existing bounded run_bounded_gh call and emits a report line; it doesn't trigger any additional network calls.
  • Test fixtures are self-contained. The new fake git/gh binaries in audit-fleet.test.sh operate only inside $TMP/$TEST_ROOT and don't touch real credentials or network state.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 871060bd26

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/repo-fleet-hygiene/CHANGELOG.md Resolved
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Claude has reviewed this PR 3 times. The lane skips further automatic reviews after 5; deleting this comment resets the count.

@claude

claude Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 47s —— View job


Code review — repo-fleet-hygiene PR pagination fix (update)

  • Gather context (diff since last review, new commit)
  • Understand the request (code-review lane, re-run on synchronize)
  • Review new commit 280bd63 (gh/git stub hardening)
  • Check whether prior findings were addressed
  • Post findings

Scope: correctness, architecture, error handling, test coverage, maintainability per REVIEW.md's code-review lane (security findings are handled by the separate security lane in this repo).

What changed since the last review

Only one new commit, 280bd63: it tightens the fake git/gh stubs in the #1795 evidence-window test (audit-fleet.test.sh:694-775) to also assert GIT_NO_LAZY_FETCH, GIT_OPTIONAL_LOCKS, GIT_CONFIG_COUNT, GIT_TERMINAL_PROMPT, GH_TELEMETRY, GH_NO_UPDATE_NOTIFIER, GH_NO_EXTENSION_UPDATE_NOTIFIER, and GH_SPINNER_DISABLED, and fixes the git remote stub to distinguish remote (no args, returns the remote name) from remote get-url. This correctly mirrors what the real script sets (audit-fleet.sh:133-134, audit-fleet.sh:233-234), so the test now fails if the script regresses on that hardening rather than passing regardless. Good, narrowly-scoped tightening.

🔴 Important — plugin.json still not bumped (unresolved from prior review)

.claude-plugin/plugin.json:4 still reads "version": "0.7.1" while CHANGELOG.md:6 declares ## [0.7.2]. This was flagged in the prior review round and independently by Codex on this PR, and the new commit didn't touch it. Per CLAUDE.md: "Versioned. Set an explicit semver version in each plugin.json so consumers update on bumps." Since plugin.json's version is the marketplace's update-detection key, an already-installed 0.7.1 consumer will not see this fix as available until the manifest is bumped. Fix this →

🟡 Suggestion — still unresolved: fixed 30s timeout vs. 5x larger evidence window

GH_TIMEOUT_SECONDS=30 is unchanged while MERGED_PR_BATCH_LIMIT jumped from 200 to 1000. On a busy repo, a timeout here still falls into the github-pr-evidence-unavailable branch and discards all merged-PR evidence with an auth-flavored remediation message, rather than surfacing as the new (and more accurate) merged-pr-evidence-window-truncated finding. Not addressed by the new commit; still untested by the (synthetic, instant-response) gh stubs.

🟡 Suggestion — still unresolved: Handoff text points to an unsupported override

audit-fleet.sh:1065 still tells the operator to "raise the shared MERGED_PR_BATCH_LIMIT... then rerun," but the only override, REPO_FLEET_MERGED_PR_BATCH_LIMIT, is documented in-code as "for the regression harness only" (line 138) and isn't exposed via userConfig, README, or SKILL.md — so a real user has no supported path to act on this advice without hand-editing the installed plugin, contrary to CLAUDE.md's "Configurable without editing the plugin... never require... a hand-edit of the installed plugin."

Strengths

  • The new stub-hardening commit is a solid, well-targeted test improvement — it closes a real gap where the fake gh/git binaries would pass even if the script silently dropped its hardening env vars.
  • The shared-constant design, allowlist coupling, and truncation-disclosure logic from the prior round remain sound (see previous review for details); no regressions introduced by this commit.

Note: I could not execute the test suite or shellcheck in this sandbox (no Bash execution approval for running scripts). Findings are from static reading of the diff between the previous review's HEAD and current HEAD.

@claude

claude Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 38s —— View job


Security Review

  • Gather context (diff, changed files)
  • Review audit-fleet.sh for injection / logic / auth issues
  • Review audit-fleet.test.sh, CHANGELOG.md, security-review.md
  • Report findings

No security issues found.

Scope reviewed: full diff of this PR against origin/main across all 4 changed files — plugins/repo-fleet-hygiene/skills/audit/scripts/audit-fleet.sh (+45/-14), audit-fleet.test.sh (+138/-0), CHANGELOG.md, and security-review.md. No GitHub Actions workflow files are touched, so the zizmor advisory lane doesn't apply here. This also confirms the prior automated security-review pass posted against commit 871060b; commit 280bd63 (the only change since that pass) touches only the test harness's fake gh/git stubs, with no production-code delta.

Specific things checked and found sound:

  • New env-var overrides are safely bounded. REPO_FLEET_MERGED_PR_BATCH_LIMIT / REPO_FLEET_MERGED_PR_HEAD_LIMIT are validated with an anchored ^[1-9][0-9]{0,4}$ regex — no leading zero (no accidental octal interpretation), no shell metacharacters possible, bounded to a 5-digit positive integer. The resulting values only ever flow into gh/comparison argv positions as discrete, unquoted-shell-safe strings — never eval'd or interpolated into a command string — so there's no injection surface.
  • Allowlist/call-site coupling is maintained correctly. gh_probe_allowed now checks --limit against the same shared MERGED_PR_BATCH_LIMIT/MERGED_PR_HEAD_LIMIT variables used at the call sites, so the two can't silently drift (the failure mode the PR is fixing). The rest of the argv shape (repo pattern, --state merged, fixed --json/--template) is still pinned exactly as before — nothing new is admitted through the allowlist beyond the limit value itself.
  • New truncation-disclosure logic introduces no new trust boundary. The row-counting loop and merged-pr-evidence-window-truncated finding only count rows already returned by the existing bounded run_bounded_gh call — no additional network calls, no new attacker-influenced data reaching emit_finding beyond what the pre-existing display_value control-character neutralization already handles. $github_repo and the row-count integer are not attacker-controlled by branch/PR content.
  • No change to trust boundaries around branch names sent to GitHub. The --head "$branch" exact-fallback query still only fires for branches already confirmed present in the local remote-tracking inventory (remote_branch_known == true), preserving the existing guard that a purely local (never-pushed) branch name is never transmitted to github.com.
  • Test fixtures remain self-contained. The hardened fake git/gh stubs added in 280bd63 (additional required env vars: GH_TELEMETRY, GH_NO_UPDATE_NOTIFIER, GH_NO_EXTENSION_UPDATE_NOTIFIER, GH_SPINNER_DISABLED; corrected git remote sub-dispatch) operate only inside $TMP/$TEST_ROOT and don't touch real credentials, network state, or paths outside the test sandbox.

Note: the outstanding plugin.json version-bump and evidence-window/timeout-interaction items are process/correctness concerns already raised in the prior code-review pass on this PR — out of scope for this security-only lane, not repeated here.

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@claude

claude Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 2m 30s —— View job


Code review — repo-fleet-hygiene PR pagination fix (update 2)

  • Gather context (diff since last review, new commits — branch was rebased/merged onto a newer origin/main)
  • Check whether prior findings were addressed
  • Post findings

Scope: git diff origin/main...HEAD — the 5 files listed in the PR. Per REVIEW.md's code-review lane, security findings are left to the dedicated security lane.

Prior findings — status

  • ✅ plugin.json version bump — resolved. The branch now sits on top of a newer main baseline (which already carries an earlier, independently-shaped fix for this same evidence-window problem), so the diff bumps 0.8.0 → 0.8.1, matching the new ## [0.8.1] CHANGELOG entry.
  • ✅ Handoff text pointing at an unsupported REPO_FLEET_MERGED_PR_BATCH_LIMIT override — moot. That env-var override and the MERGED_PR_BATCH_LIMIT naming no longer exist anywhere in the current diff; the rebase landed on a simpler shape (MERGED_PR_WINDOW / MERGED_PR_HEAD_LIMIT, no user-facing override, no Handoff text suggesting one).
  • 🟡 Still open: fixed 30s timeout vs. a 5x larger evidence window. audit-fleet.sh:229 keeps GH_TIMEOUT_SECONDS=30 unchanged while MERGED_PR_WINDOW jumps 200 → 1000. A timeout on a busy repo still falls into github-pr-evidence-unavailable and discards all merged-PR evidence with an auth-flavored remediation, rather than surfacing the more accurate merged-pr-window-truncated finding. Still untested — the fake gh stub returns instantly regardless of row count.

🟡 New — security-review.md's re-check note cites a constant name that doesn't exist in the code

security-review.md:4-7 says the fix raised the batch limit to "the shared MERGED_PR_BATCH_LIMIT / MERGED_PR_HEAD_LIMIT constants." MERGED_PR_BATCH_LIMIT doesn't exist anywhere in audit-fleet.sh — the actual constant is MERGED_PR_WINDOW. This looks like leftover text from an earlier revision of this PR (the prior review rounds on this thread did describe a MERGED_PR_BATCH_LIMIT shape) that wasn't updated when the branch rebased onto main's already-renamed implementation. Since this doc is the plugin's acceptance-review record, an inaccurate identifier in it undermines its value as a technical reference for future readers. Fix this →

Minor nit

audit-fleet.sh:1198's comment still reads it cannot distinguish "exactly 200" from "far more" — the illustrative number is stale now that the window is 1000. Low stakes (comment only), but worth a pass while touching this area.

Strengths

  • Extending the single-source-of-truth pattern to MERGED_PR_HEAD_LIMIT (audit-fleet.sh:189, used at both the allowlist and the call site) removes the last hardcoded "100" literal that could have drifted — a real improvement over the version reviewed earlier.
  • Test assertions were updated consistently for the new 1000 window in both the synthetic gh stub and the truncation-disclosure assertion (audit-fleet.test.sh:321, audit-fleet.test.sh:823).
  • CHANGELOG's [0.8.1] entry accurately reflects the current code behavior (unlike the security-review doc).

Note: I could not execute shellcheck or the test suite in this sandbox (no Bash execution approval for running scripts). Findings are from static reading of the diff.

@claude

claude Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 47s —— View job


Security Review — repo-fleet-hygiene PR pagination fix (re-run)

  • Gather context (diff origin/main...HEAD at 71d0694, changed files)
  • Review audit-fleet.sh for injection / logic / auth issues
  • Review audit-fleet.test.sh, CHANGELOG.md, security-review.md, plugin.json
  • Report findings

No security issues found.

Scope: full diff of this PR against origin/main across all 5 changed files — plugins/repo-fleet-hygiene/.claude-plugin/plugin.json, CHANGELOG.md, skills/audit/reference/security-review.md, skills/audit/scripts/audit-fleet.sh (+4/-3), and skills/audit/scripts/audit-fleet.test.sh (+2/-2). No GitHub Actions workflow files are touched, so the zizmor advisory lane doesn't apply.

This is a re-run triggered by the latest push. Two commits landed since the last automated security pass (against 280bd63):

  • 8207dc0 — bumps .claude-plugin/plugin.json version 0.7.1 → 0.7.2. Pure metadata; no security surface.
  • 71d0694 — a merge of origin/main into the branch to pick up unrelated upstream commits. git diff origin/main...HEAD confirms this introduces no new content beyond the 5 files already reviewed; the merge itself carries no independent diff against current origin/main.

I re-verified the production-code delta in audit-fleet.sh end-to-end rather than relying on the prior summary, since the finding name and constant names visible on disk now (MERGED_PR_WINDOW / MERGED_PR_HEAD_LIMIT, finding merged-pr-window-truncated) differ from what earlier review rounds described (MERGED_PR_BATCH_LIMIT, merged-pr-evidence-window-truncated, plus a REPO_FLEET_MERGED_PR_BATCH_LIMIT env override) — the code has evidently been simplified since. Specifically confirmed sound on the current head:

  • No attacker-reachable input into the new limits. MERGED_PR_WINDOW=1000 / MERGED_PR_HEAD_LIMIT=100 are plain script constants set before any argument or config is read — no environment-variable override exists anywhere in the current script (confirmed via full-file grep), so there's no way for a caller to widen the query window or the argv shape it drives.
  • Allowlist/call-site coupling still holds. gh_probe_allowed checks --limit against the same MERGED_PR_WINDOW / MERGED_PR_HEAD_LIMIT variables used at the two run_bounded_gh pr list call sites (L1191, L1265), so the two can't silently drift. The rest of the argv shape (repo pattern, --state merged, fixed --json/--template) remains pinned exactly as before.
  • No new trust-boundary crossing. The --head "$branch" exact-fallback query still only fires for branches already confirmed present in the local remote-tracking inventory (remote_branch_known == true), preserving the guard that a purely local (never-pushed) branch name is never transmitted to github.com.
  • Truncation-disclosure logic is read-only. merged-pr-window-truncated only counts rows already returned by the existing bounded run_bounded_gh call — no additional network calls, no new attacker-influenced data flowing into emit_finding.
  • Test and doc changes are inert. audit-fleet.test.sh only updates the fixture/assertion row counts (200→1000) to match; CHANGELOG.md and security-review.md are prose-only (note: security-review.md's re-check text names MERGED_PR_BATCH_LIMIT, which doesn't match the MERGED_PR_WINDOW constant actually in the script — a doc-accuracy point, not a security finding, so out of scope for this lane per its instructions).

@kyle-sexton
kyle-sexton merged commit bafbee0 into main Aug 5, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the fix/fleet-hygiene-pr-list-pagination branch August 5, 2026 19:18
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.

repo-fleet-hygiene:audit PR-list batch window caps merged-PR evidence at 200/repo and never discloses the truncation

1 participant