Skip to content

refactor(scripts): extract nitpick display logic into separate function - #30

Merged
NTCoding merged 2 commits into
mainfrom
fix-submit-pr-nitpicks
Jan 4, 2026
Merged

NTCoding merged 2 commits into
mainfrom
fix-submit-pr-nitpicks

Conversation

@NTCoding

@NTCoding NTCoding commented Jan 4, 2026 •

Copy link
Copy Markdown
Owner

Refactor submit-pr.sh to improve code organization by extracting nitpick handling into dedicated functions. This makes the script more maintainable and enables consistent nitpick display across different exit paths.

Summary by CodeRabbit

  • Chores

    • Improved PR feedback handling to consistently extract and display nitpick suggestions alongside CI and review status.
    • Reworked flow so nitpick content is shown for both success and failure outcomes.
  • Documentation

    • Updated submission step to capture and prompt for the complete raw script output for clearer diagnostics.

✏️ Tip: You can customize this high-level summary in your review settings.

Refactor submit-pr.sh to improve code organization by extracting nitpick
handling into dedicated functions. This makes the script more maintainable
and enables consistent nitpick display across different exit paths.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jan 4, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds two new functions to scripts/submit-pr.sh to extract and display "nitpick" content from CodeRabbit review bodies, wires their use into multiple submission outcomes, and updates a workflow doc to collect raw script output in both success and failure branches.

Changes

Cohort / File(s) Summary
Submit script updates
scripts/submit-pr.sh
Adds get_nitpick_content(pr_number) (extracts nitpick text via sed + HTML stripping) and show_nitpicks(pr_number) (formats/displays nitpicks). Adjusts get_coderabbit_feedback scope and replaces inline nitpick logic with the new functions across CI-pass, CodeRabbit review, and success/failure paths. Minor rearrangements to ensure consistent nitpick output placement.
Workflow directive update
.claude/commands/complete-task.md
Replaces placeholder script-output sections with a <raw-output> block and prompt to paste complete raw output for both FAIL and SUCCESS branches of the Submit PR step.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Two helpers hop into the script,
To catch each nitpick and grip,
With sed and with care,
They tidy and share,
So feedback bounces light on the ship! ✨

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: extracting nitpick display logic into separate functions (get_nitpick_content and show_nitpicks) to improve code organization and maintainability.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0e0137 and 54657fc.

📒 Files selected for processing (1)
  • .claude/commands/complete-task.md
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2026-01-03T11:38:30.208Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-03T11:38:30.208Z
Learning: After addressing issues from code review, complete the task by following @/docs/workflow/task-workflow.md → Completing Tasks

Applied to files:

  • .claude/commands/complete-task.md
📚 Learning: 2026-01-04T18:35:42.314Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-04T18:35:42.314Z
Learning: Follow the task workflow steps exactly in `docs/workflow/task-workflow.md` before making any changes or committing code

Applied to files:

  • .claude/commands/complete-task.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
.claude/commands/complete-task.md (1)

69-69: Clear structural improvements to capture raw script output consistently.

The changes add explicit guardrails (<raw-output> wrapper and "do not summarize" directive) to ensure complete raw output from submit-pr.sh is captured in both success and failure paths. This directly supports the PR's goal of preserving nitpick feedback and other details that would otherwise be lost through summarization.

The emphasis on "COMPLETE" output and consistent structure across both branches is a clear improvement over placeholder text.

Please verify that <raw-output> tags are the correct format for your workflow system. If these are custom markers processed by your agent framework or documentation tooling, ensure they're compatible with your existing infrastructure.

Also applies to: 72-81


Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 4, 2026 •

Copy link
Copy Markdown

Deploying living-architecture with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54657fc
Status: ✅  Deploy successful!
Preview URL: https://63b8ab88.living-architecture.pages.dev
Branch Preview URL: https://fix-submit-pr-nitpicks.living-architecture.pages.dev

View logs

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
scripts/submit-pr.sh (2)

141-155: Well-structured helper function.

The implementation is clean with proper null/zero checking and clear formatting. The advisory message at line 153 provides helpful guidance to users.

Minor note: There's potential for code sharing with check-coderabbit-review.sh, which has an identical get_latest_review_body function (lines 55-58). If these scripts evolve together, consider extracting shared functions to a common utilities file.


100-115: Expand HTML entity handling in the nitpick extraction function.

The sed-based parsing works with CodeRabbit's current format but relies on specific HTML structure. Consider extending entity handling beyond &nbsp; to cover other common HTML entities that may appear in review content:

🔎 Suggested improvements for HTML entity handling
     if [[ -n "$review_body" ]]; then
         # Extract content between 🧹 Nitpick comments section
         # The format is: <summary>🧹 Nitpick comments (N)</summary><blockquote>...content...</blockquote></details>
         echo "$review_body" | sed -n '/🧹 Nitpick comments/,/<\/details>/p' | \
             sed 's/<[^>]*>//g' | \
-            sed 's/&nbsp;/ /g' | \
+            sed 's/&nbsp;/ /g; s/&lt;/</g; s/&gt;/>/g; s/&amp;/\&/g; s/&quot;/"/g' | \
             grep -v "^$" | \
             grep -v "🧹 Nitpick comments"
     fi

This ensures code snippets, markdown, and other special characters in nitpick content are properly decoded.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33efddc and a0e0137.

📒 Files selected for processing (1)
  • scripts/submit-pr.sh
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/submit-pr.sh (1)
scripts/check-coderabbit-review.sh (1)
  • get_latest_review_body (56-59)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
scripts/submit-pr.sh (2)

117-139: Clean refactoring to single responsibility.

The function now focuses solely on inline comments and actionable count, with nitpick handling properly extracted to show_nitpicks. The early closure of the conditional at line 138 is correct.


243-243: Excellent integration across all code paths.

The show_nitpicks function is correctly wired into all three exit scenarios:

  • Changes requested (line 243)
  • Success with no changes requested (line 257)
  • CI failure (line 264)

This ensures consistent nitpick display regardless of the PR outcome, which improves the user experience and maintainability.

Also applies to: 257-257, 261-269

Sub-agent was summarizing script output instead of passing through
the raw output. This caused nitpicks and other details to be lost.
Made instructions explicit: use <raw-output> tags and "do not summarize".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@sonarqubecloud

sonarqubecloud Bot commented Jan 4, 2026

Copy link
Copy Markdown

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.

1 participant