Skip to content

Clarify file-filtered empty state message#71

Merged
leynos merged 5 commits intomainfrom
codex/add-conditional-empty-state-message
Aug 13, 2025
Merged

Clarify file-filtered empty state message#71
leynos merged 5 commits intomainfrom
codex/add-conditional-empty-state-message

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Aug 13, 2025

Summary

  • Exit early when no threads remain after file filtering
  • Distinguish between global and per-file empty states

Testing

  • make fmt
  • make lint
  • make test

https://chatgpt.com/codex/tasks/task_e_689cceb8ec508322aafe3814033e05ab

Summary by Sourcery

Distinguish between global and file-specific empty states for unresolved comments and avoid unnecessary review fetching

Enhancements:

  • Exit early without fetching reviews when no unresolved threads remain
  • Print a specific empty state message when file filters are applied vs globally

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Aug 13, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR defers fetching reviews until after checking for unresolved threads and refines the empty-state message to distinguish between global and file-filtered contexts.

Sequence diagram for early exit and refined empty state messaging in PR review

sequenceDiagram
    participant User
    participant CLI
    participant GitHubAPI
    User->>CLI: Run PR review command (with optional file filter)
    CLI->>GitHubAPI: fetch_review_threads
    GitHubAPI-->>CLI: threads
    alt No unresolved threads
        alt No file filter
            CLI->>User: Print "No unresolved comments."
        else File filter applied
            CLI->>User: Print "No unresolved comments for the specified files."
        end
        CLI-->>User: Exit early
    else Unresolved threads exist
        CLI->>GitHubAPI: fetch_reviews
        GitHubAPI-->>CLI: reviews
        CLI->>User: Print summary
    end
Loading

File-Level Changes

Change Details Files
Introduce early exit before fetching reviews when no threads remain
  • Moved the fetch_reviews call below the threads emptiness check
  • Added an if threads.is_empty() guard to return early
src/main.rs
Differentiate empty-state messages for global vs file-filtered scenarios
  • Added conditional on args.files.is_empty()
  • Printed a specific message for filtered files
src/main.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 13, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Warning

Rate limit exceeded

@leynos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between b1bec89 and d1099b8.

📒 Files selected for processing (1)
  • tests/cli.rs (1 hunks)

Summary by CodeRabbit

  • New Features

    • Clearer messages when there are no unresolved comments, with tailored text for filtered files.
    • Always displays the end-of-review banner.
    • Gracefully handles broken pipe scenarios when output is piped.
  • Refactor

    • Skips unnecessary network calls when no unresolved threads, improving responsiveness.
  • Tests

    • Added integration tests covering no-unresolved-comments flows (global and file-filtered) and banner output.

Walkthrough

Move fetch_reviews to run only when unresolved review threads exist; add an early-return that prints either “No unresolved comments.” or “No unresolved comments for the specified files.” and still attempts to print the end-of-review banner, handling BrokenPipe errors and avoiding an unnecessary API call.

Changes

Cohort / File(s) Summary
run_pr control flow
src/main.rs
Check for unresolved review threads first; if none, print conditional message, attempt end-of-review banner (handle BrokenPipe) and return early. Call fetch_reviews only when unresolved threads exist. No public signatures changed.
integration tests (empty threads)
tests/cli.rs
Add two integration tests that run the CLI against a MITM GraphQL server returning empty reviewThreads.nodes to assert the new no-unresolved-comments messages (with and without file filter) and end-banner output.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI as run_pr
  participant GH as GitHub API

  User->>CLI: Invoke run_pr (optional file filters)
  CLI->>GH: fetch_review_threads()
  GH-->>CLI: reviewThreads (nodes empty or present)
  alt No unresolved threads
    CLI->>User: Print "No unresolved comments." or filtered message
    CLI->>CLI: Print end-of-review banner (handle BrokenPipe) and exit
  else Has unresolved threads
    CLI->>GH: fetch_reviews()
    GH-->>CLI: reviews
    CLI->>CLI: Summarise, print reviews, print end banner
    CLI->>User: Display reviews
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Poem

Skip the fetch when threads are clear,
Print the line and end with cheer.
If filters narrow what you see,
Say so plainly, then let it be.
Banner last — graceful, pipe-proof, and near.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-conditional-empty-state-message

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and found some issues that need to be addressed.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Aug 13, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 13, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0769aa and a2a3f86.

📒 Files selected for processing (1)
  • src/main.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

⚙️ CodeRabbit Configuration File

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.

Files:

  • src/main.rs
🧬 Code Graph Analysis (1)
src/main.rs (1)
src/reviews.rs (1)
  • fetch_reviews (87-93)
🔍 Additional research (Deepwiki)

Summary of relevant context for reviewing PR #71

  • Change intent: run_pr now checks for unresolved review threads after file-based filtering and returns early if none remain; fetch_reviews is only called when unresolved threads exist. User output distinguishes global vs file-filtered empty states ("No unresolved comments." vs "No unresolved comments for the specified files.") and avoids an unnecessary reviews API call. Affects src/main.rs.

  • Related behavior to validate:

    • fetch_review_threads already filters resolved threads and paginates comments; run_pr previously fetched reviews unconditionally (see pagination + fetch_reviews/fetch_review_threads flow). Verify new ordering still preserves needed review data when threads exist.
    • summarize_files, print_summary and print_reviews interactions (related PRs #21, #30, #65, #59, #18) — ensure early-return doesn't skip later intended summaries when files filter is absent/present.
  • Tests & CI expectations:

    • Repo has e2e tests using fixtures and asserts output contains "end of code review"; ensure tests updated or unaffected by new early-return messaging. Makefile targets: make fmt, make lint, make test listed for PR.
  • Files & modules to check during review: src/main.rs (run_pr, fetch_review_threads, fetch_reviews, summarize_files, print_summary, print_reviews), src/reviews.rs (fetch_reviews, latest_reviews), src/html.rs (collapse_details used in rendering). Confirm no behavioral regressions and messages match docs/tests.

🔇 Additional comments (1)
src/main.rs (1)

173-173: Defer reviews fetch until unresolved threads exist.

Reduce API calls by moving fetch_reviews after the unresolved-threads check. This aligns with the PR objective and improves performance in empty-state scenarios.

Comment thread src/main.rs
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/main.rs (1)

171-178: Preserve the end-of-review banner on the empty-state path.

Retain this banner emission and BrokenPipe handling to maintain the output contract even when no threads remain.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2a3f86 and ed4dee8.

📒 Files selected for processing (1)
  • src/main.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.rs: Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Place function attributes after doc comments.
Do not use return in single-line functions.
Use predicate functions for conditional criteria with more than two branches.
Prefer immutable data and avoid unnecessary mut bindings.
Handle errors with the Result type instead of panicking where feasible.
Prefer semantic error enums: Derive std::error::Error (via the thiserror crate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary: Use eyre::Report for human-readable logs; these should not be exposed in public APIs.
Never export the opaque type from a library: Convert to domain enums at API boundaries, and to eyre only in the main main() entrypoint or top-level async task.
Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
Where a function is too long, extract meaningfully named helper functions adhering to separation of concerns and CQRS.
Where a function has too many parameters, group related parameters in meaningfully named structs.
Where a function is returning a large error consider using Arc to reduce the amount of data returned.
Write unit and behavioural tests for new functionality. Run both before and after making any change.
Avoid unsafe code unless absolutely necessary and document any usage clearly.
Lints must not be silenced except as a last resort.
Lint rule suppressions must be tightly scoped and include a clear reason.
Prefer expect over allow.
Prefer .expect() over .unwrap().
Use concat!() to combine long string literals rather than escaping newlines with a backslash.

Files:

  • src/main.rs

⚙️ CodeRabbit Configuration File

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.

Files:

  • src/main.rs
🧬 Code Graph Analysis (1)
src/main.rs (2)
src/summary.rs (1)
  • print_end_banner (100-106)
src/reviews.rs (1)
  • fetch_reviews (87-93)
🔍 Additional research (Deepwiki)

Summary of relevant repository context for reviewing this PR

  • Core behavior and where the change applies

    • run_pr in src/main.rs orchestrates: parse ref → GraphQL client → fetch_review_threads() → fetch_reviews() → filter unresolved threads → summarize_files → print_summary/print_reviews → iterate threads → print_end_banner. The PR reorders fetch_reviews to occur only when unresolved threads remain and adds an early-return when none remain (with different messages depending on file filters) and end-banner/BrokenPipe handling.,
  • Data-fetching & pagination

    • fetch_review_threads and fetch_reviews both use cursor-based pagination via a shared paginate helper; fetch_review_threads filters out resolved threads (threads.retain(|t| !t.is_resolved)). Avoiding an unnecessary fetch_reviews call when threads are empty saves an API request.
  • Output flow & formatting

    • Summarization (summarize_files), review printing (latest_reviews, print_reviews/write_review), HTML collapse (collapse_details in src/html.rs), diff formatting (format_comment_diff) and final "end of code review" banner are all part of run_pr's output pipeline — the PR touches the point where the banner and exit path occur. Also special handling for BrokenPipe when printing the banner is already considered in code.
  • Related PRs / hotspots to check for conflicts

    • Multiple related PRs touch the same run_pr / fetch_reviews / printing flow: #30, #21, #27, #65, #18, #32, #59, #52. Review these for overlapping changes (ordering of fetches, printing refactors, printer module extraction, summarize_files insertion).,
  • Tests & contributor guidance

    • Repo expects make fmt / make lint / make test as pre-checks; CI enforces formatting, clippy (deny warnings) and coverage. Ensure unit/e2e tests (fixtures / mitm proxy) cover the early-return path and banner printing; update/add tests for file-filtered message and BrokenPipe path if missing.

Used sources

  • Repository docs/wiki (architecture, main flow, fetching/printing, tests):,
🔇 Additional comments (1)
src/main.rs (1)

180-180: Defer fetching reviews until unresolved threads remain.

Fetch reviews only after confirming non-empty threads to save an API call and latency.

Comment thread src/main.rs
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment thread tests/cli.rs Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed4dee8 and b1bec89.

📒 Files selected for processing (1)
  • tests/cli.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.rs: Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Place function attributes after doc comments.
Do not use return in single-line functions.
Use predicate functions for conditional criteria with more than two branches.
Prefer immutable data and avoid unnecessary mut bindings.
Handle errors with the Result type instead of panicking where feasible.
Prefer semantic error enums: Derive std::error::Error (via the thiserror crate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary: Use eyre::Report for human-readable logs; these should not be exposed in public APIs.
Never export the opaque type from a library: Convert to domain enums at API boundaries, and to eyre only in the main main() entrypoint or top-level async task.
Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
Where a function is too long, extract meaningfully named helper functions adhering to separation of concerns and CQRS.
Where a function has too many parameters, group related parameters in meaningfully named structs.
Where a function is returning a large error consider using Arc to reduce the amount of data returned.
Write unit and behavioural tests for new functionality. Run both before and after making any change.
Avoid unsafe code unless absolutely necessary and document any usage clearly.
Lints must not be silenced except as a last resort.
Lint rule suppressions must be tightly scoped and include a clear reason.
Prefer expect over allow.
Prefer .expect() over .unwrap().
Use concat!() to combine long string literals rather than escaping newlines with a backslash.

Files:

  • tests/cli.rs

⚙️ CodeRabbit Configuration File

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.

Files:

  • tests/cli.rs
🧬 Code Graph Analysis (1)
tests/cli.rs (2)
tests/utils.rs (2)
  • start_mitm (47-96)
  • shutdown (28-31)
src/api/mod.rs (1)
  • new (90-97)
🔍 Additional research (Context7, Deepwiki)

Summary of relevant context found

  • Core change: run_pr now checks for unresolved review threads (after fetch_review_threads) and returns early when none remain; fetch_reviews is moved to run only when unresolved threads exist. New messages: "No unresolved comments." or "No unresolved comments for the specified files." End-of-review banner printing is attempted in the early-return path and BrokenPipe is handled gracefully. (from repo docs/main code overview)

  • Tests added: two integration tests in tests/cli.rs spin up a local MITM GraphQL server returning an empty reviewThreads.nodes array and assert stdout equals the appropriate "No unresolved comments..." message followed by "========== end of code review ==========\n". They set GITHUB_GRAPHQL_URL to the MITM and use assert_cmd. (tests summary)

  • Related PRs/areas to review: multiple prior PRs touch run_pr, fetch_reviews/fetch_review_threads, print_end_banner and reviews module (#21, #27, #30, #32, #36, #59, #65). Verify interactions with those changes (ordering/pagination/print_end_banner). (related PRs list)

  • Review focal points:

    • Confirm moved fetch_reviews call doesn't change behavior for non-empty thread flows (ordering preserved after change).
    • Validate early-return path prints correct message variant when file filters are present, and still prints end banner (and handles BrokenPipe).
    • Ensure tests reliably simulate GraphQL responses (MITM server, pagination flags hasNextPage=false).
    • No public API/export changes; low-risk surface but exercise fetch/pagination interactions and banner printing in CI.

Tools used to gather context:

🔇 Additional comments (4)
tests/cli.rs (4)

1-4: LGTM! Excellent module documentation.

The module-level documentation clearly explains the purpose and utility of the test module, adhering to the coding guidelines requirement.


6-13: LGTM! Appropriate test dependencies and utilities.

The imports are well-organised and include the necessary dependencies for integration testing with HTTP mocking.


15-52: LGTM! Well-structured integration test for global empty state.

The test correctly:

  • Sets up a MITM server with an empty reviewThreads.nodes array
  • Uses proper GraphQL response structure with pagination metadata
  • Tests the CLI in a blocking spawn as required for async test context
  • Validates the exact expected output message
  • Properly shuts down the server

The test implementation aligns well with the PR objectives of distinguishing between global and file-specific empty states.


54-97: LGTM! Comprehensive test for file-filtered empty state.

The test properly validates the file-specific empty state message by:

  • Including a file filter argument (no_such_file.rs)
  • Expecting the correct contextual message: "No unresolved comments for the specified files."
  • Following the same robust test pattern as the global test

This test effectively covers the second branch of the early-return logic implemented in src/main.rs.

Comment thread tests/cli.rs Outdated
Comment thread tests/cli.rs Outdated
\n- extract shared handler for empty review threads\n- parameterise empty-state tests with rstest\n
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

Consolidate repeated review thread mock into a shared closure.

Reduces duplication and simplifies test setup.
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@leynos leynos merged commit 86c98aa into main Aug 13, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant