Backlog cleanup: pagination, lint hook, dead code#6
Conversation
Legacy bootstrap script from the pre-Doghouse era. The sources it references (src/git_mind) were deleted during the reboot. The script generates a dead entry point and has no remaining purpose.
…moval - Implement GraphQL cursor pagination for review threads in GhCliAdapter. PRs with >100 threads now fetch all pages instead of silently truncating at the first 100. - Add markdownlint pre-commit hook (scripts/hooks/pre-commit) with .markdownlint-cli2.jsonc config. Skips docs/archive/ and docs/code-reviews/ by design. Gracefully skips if markdownlint-cli2 is not installed. - Remove dead tools/bootstrap-git-mind.sh (legacy artifact from pre-Doghouse era with no remaining purpose). - Configure core.hooksPath to scripts/hooks. - Update CHANGELOG.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 19 minutes and 42 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughImplements cursor-based GraphQL pagination for unresolved review threads in the GitHub adapter, adds markdownlint configuration and a pre-commit hook that lints staged Markdown (excluding archives and code-reviews), archives two code-review Markdown files, and removes an obsolete bootstrap script. Changes
Sequence Diagram(s)sequenceDiagram
participant Adapter as GitHub Adapter
participant GH as gh CLI
participant API as GitHub GraphQL API
Adapter->>GH: call graphql(query, variables[, cursor])
GH->>API: execute GraphQL request
API-->>GH: return { reviewThreads: { nodes, pageInfo } }
GH-->>Adapter: stdout JSON page
Adapter->>Adapter: extract unresolved threads, append nodes
alt pageInfo.hasNextPage == true
Adapter->>GH: loop with -F cursor=pageInfo.endCursor
else
Adapter-->>Adapter: finish accumulation
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 559f86606b
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/hooks/pre-commit`:
- Around line 12-19: The current pipeline splits filenames on whitespace because
it echoes STAGED_MD into xargs; replace that with a NUL-delimited pipeline so
filenames with spaces are preserved: produce the staged list as NUL-separated
entries (use git's NUL output and grep's NUL mode or otherwise emit STAGED_MD
with NUL separators) and invoke markdownlint-cli2 via xargs in NUL-safe mode (so
xargs receives the original filenames intact) instead of the current echo
"$STAGED_MD" | xargs markdownlint-cli2.
In `@src/doghouse/adapters/github/gh_cli_adapter.py`:
- Around line 120-124: The pagination loop uses page_info =
thread_data.get("pageInfo", {}) and sets cursor = page_info["endCursor"] when
hasNextPage is true, but it doesn't guard against a null or repeated endCursor;
update the loop in gh_cli_adapter.py (around the cursor/page_info handling) to
validate that page_info.get("endCursor") is non-null and different from the last
cursor before assigning and continuing, otherwise break (or raise) to avoid
refetching the same page indefinitely; you can implement this by tracking
previous_cursor and comparing it to page_info["endCursor"] and only updating
cursor and continuing when it changes.
- Around line 93-97: The code currently appends ["-F", "cursor="] when cursor is
falsy which sends an empty after parameter; change the logic around gql_args so
that when cursor is falsy you do not add any "-F", "cursor=..." entries (only
append the "-F", f"cursor={cursor}" pair when cursor is truthy), and when
reading the next cursor use page_info.get("endCursor") into cursor and validate
it (e.g., only set cursor for the next iteration if page_info.get("endCursor")
is not None) so you never pass a null/empty endCursor into the next request;
update the references to cursor, gql_args, page_info and endCursor accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: db83fbd2-9f1f-46ba-8481-89bab5427590
📒 Files selected for processing (6)
.markdownlint-cli2.jsoncCHANGELOG.mddocs/code-reviews/PR6/eb263486b01a8eb3844a6159788b646506475cfe.mdscripts/hooks/pre-commitsrc/doghouse/adapters/github/gh_cli_adapter.pytools/bootstrap-git-mind.sh
💤 Files with no reviewable changes (1)
- tools/bootstrap-git-mind.sh
- Omit cursor arg on first GraphQL page (was sending empty string, which GitHub rejects as invalid cursor) - Add cursor-progression guard to prevent infinite loop if endCursor is null or unchanged - Use NUL-delimited file handling in pre-commit hook to safely handle filenames with spaces
…e/backlog-cleanup
|
@coderabbitai review please 🥕 |
|
🧠 Learnings used✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/hooks/pre-commit`:
- Around line 13-17: The pre-commit hook builds STAGED_MD via a git diff
pipeline that then filters out docs/archive/ and docs/code-reviews/ with grep,
which duplicates ignores already declared in .markdownlint-cli2.jsonc; remove
the redundant exclusion filters by editing the STAGED_MD assignment to stop
piping to the two grep -v '^docs/archive/' and grep -v '^docs/code-reviews/'
commands so that markdownlint-cli2 receives all staged .md files and its
"ignores" configuration controls exclusions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: d72a94e9-16a9-4406-b406-e514ced05dbf
📒 Files selected for processing (3)
docs/code-reviews/PR6/2be9725f8f91d2df313e17e22bb1b403f88d6d1a.mdscripts/hooks/pre-commitsrc/doghouse/adapters/github/gh_cli_adapter.py
| STAGED_MD=$(git diff --cached --name-only -z --diff-filter=ACM -- '*.md' \ | ||
| | tr '\0' '\n' \ | ||
| | grep -v '^docs/archive/' \ | ||
| | grep -v '^docs/code-reviews/' \ | ||
| || true) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Redundant exclusion filters — the linter config already handles this.
Lines 15-16 manually exclude docs/archive/ and docs/code-reviews/, but .markdownlint-cli2.jsonc (lines 14-20) already declares identical ignores:
"ignores": [
"docs/archive/**",
"docs/code-reviews/**"
]This creates two sources of truth. When someone adds a third exclusion to the config, they'll forget to update the hook (or vice versa), and then you'll waste 20 minutes debugging why linting "works differently" locally vs in the hook.
The simpler approach: pass all staged .md files to markdownlint-cli2 and let its config handle exclusions.
♻️ Simplified hook without redundant grep filters
# Lint staged .md files only (skip archived docs and code-review worksheets)
# Use NUL-delimited output to handle filenames with spaces safely.
- STAGED_MD=$(git diff --cached --name-only -z --diff-filter=ACM -- '*.md' \
- | tr '\0' '\n' \
- | grep -v '^docs/archive/' \
- | grep -v '^docs/code-reviews/' \
- || true)
+ STAGED_MD=$(git diff --cached --name-only -z --diff-filter=ACM -- '*.md')
- if [ -n "$STAGED_MD" ]; then
- echo "$STAGED_MD" | tr '\n' '\0' | xargs -0 markdownlint-cli2
+ if [ -n "$STAGED_MD" ]; then
+ printf '%s' "$STAGED_MD" | xargs -0 markdownlint-cli2
echo "pre-commit: markdown lint passed."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/hooks/pre-commit` around lines 13 - 17, The pre-commit hook builds
STAGED_MD via a git diff pipeline that then filters out docs/archive/ and
docs/code-reviews/ with grep, which duplicates ignores already declared in
.markdownlint-cli2.jsonc; remove the redundant exclusion filters by editing the
STAGED_MD assignment to stop piping to the two grep -v '^docs/archive/' and grep
-v '^docs/code-reviews/' commands so that markdownlint-cli2 receives all staged
.md files and its "ignores" configuration controls exclusions.
Summary
Three items from the PR #5 retrospective backlog:
GhCliAdapternow pages past the 100-thread limit using cursor-based pagination. PRs with >100 threads (like Harden Doghouse trust, correctness, and character #5 itself with 104) no longer silently truncate, preventing false "merge ready" verdicts.scripts/hooks/pre-commitrunsmarkdownlint-cli2on staged.mdfiles. Excludesdocs/archive/anddocs/code-reviews/(bulk-formatted in Harden Doghouse trust, correctness, and character #5, but shouldn't gate commits). Gracefully skips ifmarkdownlint-cli2isn't installed. Config in.markdownlint-cli2.jsonc.tools/bootstrap-git-mind.sh— legacy script from the pre-Doghouse era that generates a dead entry point for sources that no longer exist.Test plan
pytest tests/doghouse -v— 48 passeddoghouse --help— CLI loads