fix(gateway): handle bot review requests #60

Merged
jwilger merged 4 commits from fix/review-request-webhooks into main 2026-05-03 15:25:37 -07:00
Owner

Summary

  • Dispatch semantic reviews when Forgejo sends a pull_request.review_requested webhook targeting the configured bot login.
  • Ignore review requests for non-bot reviewers, draft PRs, and closed PRs.
  • Document the review-request trigger and add regression coverage for issue #49.

Validation

  • nix develop -c cargo test -p ar-gateway review_requested
  • nix develop -c cargo test -p ar-forgejo webhook
  • nix develop -c cargo fmt --all -- --check
  • nix develop -c cargo clippy -p ar-gateway -p ar-forgejo --all-targets -- -D warnings
  • nix develop -c cargo nextest run -p ar-gateway -p ar-forgejo

Closes #49.

## Summary - Dispatch semantic reviews when Forgejo sends a `pull_request.review_requested` webhook targeting the configured bot login. - Ignore review requests for non-bot reviewers, draft PRs, and closed PRs. - Document the review-request trigger and add regression coverage for issue #49. ## Validation - `nix develop -c cargo test -p ar-gateway review_requested` - `nix develop -c cargo test -p ar-forgejo webhook` - `nix develop -c cargo fmt --all -- --check` - `nix develop -c cargo clippy -p ar-gateway -p ar-forgejo --all-targets -- -D warnings` - `nix develop -c cargo nextest run -p ar-gateway -p ar-forgejo` Closes #49.
fix(gateway): handle bot review requests
All checks were successful
auto_review auto_review: no findings
CI / Nix flake check (pull_request) Successful in 1m55s
f4d56e1cf3
auto-review requested changes 2026-05-03 15:01:22 -07:00
Dismissed
auto-review left a comment

This PR enhances the handling of Forgejo pull_request.review_requested webhooks by dispatching reviews when the request targets the configured bot login, provided the PR is open and non-draft. It also introduces a new environment variable AR_FORGEJO_TOKEN for API authentication. The changes appear well-tested and documented, making the PR safe to merge.

Walkthrough

  • CHANGELOG.md:

    • Updated to reflect changes in handling pull_request.review_requested webhooks and the introduction of AR_FORGEJO_TOKEN.
  • crates/ar-forgejo/src/webhook.rs:

    • Added state and requested_reviewer fields to PullRequest and PullRequestEvent structs.
  • crates/ar-gateway/README.md:

    • Minor update to include review-request dispatch in the test coverage description.
  • crates/ar-gateway/src/webhook.rs:

    • Modified is_actionable function to include logic for ReviewRequested actions.
    • Added tests to ensure correct dispatch behavior for review requests targeting the bot.
  • docs/OPERATIONS.md:

    • Updated to document the new behavior for pull_request.review_requested webhooks and the AR_FORGEJO_TOKEN environment variable.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — source changed but no test file appears in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR enhances the handling of Forgejo `pull_request.review_requested` webhooks by dispatching reviews when the request targets the configured bot login, provided the PR is open and non-draft. It also introduces a new environment variable `AR_FORGEJO_TOKEN` for API authentication. The changes appear well-tested and documented, making the PR safe to merge. ## Walkthrough - **CHANGELOG.md**: - Updated to reflect changes in handling `pull_request.review_requested` webhooks and the introduction of `AR_FORGEJO_TOKEN`. - **crates/ar-forgejo/src/webhook.rs**: - Added `state` and `requested_reviewer` fields to `PullRequest` and `PullRequestEvent` structs. - **crates/ar-gateway/README.md**: - Minor update to include `review-request dispatch` in the test coverage description. - **crates/ar-gateway/src/webhook.rs**: - Modified `is_actionable` function to include logic for `ReviewRequested` actions. - Added tests to ensure correct dispatch behavior for review requests targeting the bot. - **docs/OPERATIONS.md**: - Updated to document the new behavior for `pull_request.review_requested` webhooks and the `AR_FORGEJO_TOKEN` environment variable. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [ ] Tests touched — source changed but no test file appears in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
fix(gateway): keep review request changelog scoped
All checks were successful
auto_review auto_review: no findings
CI / Nix flake check (pull_request) Successful in 5s
8501c99c3b
auto-review requested changes 2026-05-03 15:03:46 -07:00
Dismissed
auto-review left a comment

This PR enhances the gateway to handle pull_request.review_requested webhooks for bot users, ensuring semantic reviews are dispatched for open, non-draft PRs. The changes appear well-tested and documented, making it safe to merge.

Walkthrough

  • CHANGELOG.md: Updated to reflect the new feature of handling review_requested webhooks for bot users.
  • crates/ar-forgejo/src/webhook.rs: Added fields to the PullRequest and PullRequestEvent structs to support the new webhook handling.
  • crates/ar-gateway/README.md: Updated documentation to include the new review-request dispatch feature.
  • crates/ar-gateway/src/webhook.rs: Modified the is_actionable function to include logic for ReviewRequested actions, ensuring only relevant requests trigger a review.
  • docs/OPERATIONS.md: Added details on how the new webhook handling affects operations, particularly in relation to branch protection.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — source changed but no test file appears in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR enhances the gateway to handle `pull_request.review_requested` webhooks for bot users, ensuring semantic reviews are dispatched for open, non-draft PRs. The changes appear well-tested and documented, making it safe to merge. ## Walkthrough - **CHANGELOG.md**: Updated to reflect the new feature of handling `review_requested` webhooks for bot users. - **crates/ar-forgejo/src/webhook.rs**: Added fields to the `PullRequest` and `PullRequestEvent` structs to support the new webhook handling. - **crates/ar-gateway/README.md**: Updated documentation to include the new review-request dispatch feature. - **crates/ar-gateway/src/webhook.rs**: Modified the `is_actionable` function to include logic for `ReviewRequested` actions, ensuring only relevant requests trigger a review. - **docs/OPERATIONS.md**: Added details on how the new webhook handling affects operations, particularly in relation to branch protection. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [ ] Tests touched — source changed but no test file appears in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
Merge branch 'main' into fix/review-request-webhooks
All checks were successful
auto_review auto_review: no findings
CI / Nix flake check (pull_request) Successful in 1m55s
602257d42b
auto-review requested changes 2026-05-03 15:16:04 -07:00
Dismissed
auto-review left a comment

This PR introduces handling for pull_request.review_requested webhooks targeting the bot, ensuring semantic reviews are dispatched for open, non-draft PRs. It also changes the environment variable for the Forgejo token to AR_FORGEJO_TOKEN. The changes appear well-implemented with appropriate tests, but documentation updates should be clear to prevent user confusion.

Walkthrough

  • CHANGELOG.md: Updated to reflect the new webhook handling and token environment variable change.
  • QUICKSTART.md: Updated to use AR_FORGEJO_TOKEN instead of FORGEJO_TOKEN. This change is crucial for users setting up their environment.
  • crates/ar-gateway/src/main.rs: Introduced a new function forgejo_api_token_from_env_values to read the Forgejo token from AR_FORGEJO_TOKEN.
  • crates/ar-gateway/src/webhook.rs: Modified is_actionable to handle ReviewRequested actions specifically for the bot, ensuring the PR is open and the reviewer is the bot.
  • Tests: Added tests to ensure the new webhook handling logic works correctly and that the gateway requires AR_FORGEJO_TOKEN to start.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — source changed but no test file appears in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR introduces handling for `pull_request.review_requested` webhooks targeting the bot, ensuring semantic reviews are dispatched for open, non-draft PRs. It also changes the environment variable for the Forgejo token to `AR_FORGEJO_TOKEN`. The changes appear well-implemented with appropriate tests, but documentation updates should be clear to prevent user confusion. ## Walkthrough - **CHANGELOG.md**: Updated to reflect the new webhook handling and token environment variable change. - **QUICKSTART.md**: Updated to use `AR_FORGEJO_TOKEN` instead of `FORGEJO_TOKEN`. This change is crucial for users setting up their environment. - **crates/ar-gateway/src/main.rs**: Introduced a new function `forgejo_api_token_from_env_values` to read the Forgejo token from `AR_FORGEJO_TOKEN`. - **crates/ar-gateway/src/webhook.rs**: Modified `is_actionable` to handle `ReviewRequested` actions specifically for the bot, ensuring the PR is open and the reviewer is the bot. - **Tests**: Added tests to ensure the new webhook handling logic works correctly and that the gateway requires `AR_FORGEJO_TOKEN` to start. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [ ] Tests touched — source changed but no test file appears in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
test(gateway): cover review request webhooks
All checks were successful
auto_review auto_review: no findings
CI / Nix flake check (pull_request) Successful in 1m57s
4d016872c8
auto-review left a comment

This PR enhances the ar-gateway to handle pull_request.review_requested webhooks for bot logins, ensuring semantic reviews are dispatched for open, non-draft PRs. The changes include updates to the webhook handling logic, additional test cases, and documentation updates. The modifications appear well-tested and safe to merge.

Walkthrough

  • CHANGELOG.md: Updated to reflect the new feature of handling review_requested webhooks for bot logins.
  • crates/ar-forgejo/src/webhook.rs: Added state and requested_reviewer fields to PullRequest and PullRequestEvent structs to support the new webhook handling logic.
  • crates/ar-gateway/src/webhook.rs: Modified is_actionable function to include logic for handling review_requested actions for bot logins. Added test cases to ensure correct behavior.
  • crates/ar-gateway/tests/review_requested.rs: New test file added to cover scenarios for review_requested webhooks, ensuring that only valid requests trigger a review.
  • docs/OPERATIONS.md: Documentation updated to describe the new behavior for review_requested webhooks and the environment variable AR_FORGEJO_TOKEN. This ensures users are aware of the new functionality and configuration requirements.

Pre-merge checks

  • CHANGELOG updated — CHANGELOG.md is in the diff
  • Tests touched — test changes are in the diff
  • No new TODO/FIXME comments — no new TODO/FIXME markers
This PR enhances the `ar-gateway` to handle `pull_request.review_requested` webhooks for bot logins, ensuring semantic reviews are dispatched for open, non-draft PRs. The changes include updates to the webhook handling logic, additional test cases, and documentation updates. The modifications appear well-tested and safe to merge. ## Walkthrough - **CHANGELOG.md**: Updated to reflect the new feature of handling `review_requested` webhooks for bot logins. - **crates/ar-forgejo/src/webhook.rs**: Added `state` and `requested_reviewer` fields to `PullRequest` and `PullRequestEvent` structs to support the new webhook handling logic. - **crates/ar-gateway/src/webhook.rs**: Modified `is_actionable` function to include logic for handling `review_requested` actions for bot logins. Added test cases to ensure correct behavior. - **crates/ar-gateway/tests/review_requested.rs**: New test file added to cover scenarios for `review_requested` webhooks, ensuring that only valid requests trigger a review. - **docs/OPERATIONS.md**: Documentation updated to describe the new behavior for `review_requested` webhooks and the environment variable `AR_FORGEJO_TOKEN`. This ensures users are aware of the new functionality and configuration requirements. ## Pre-merge checks - [x] CHANGELOG updated — CHANGELOG.md is in the diff - [x] Tests touched — test changes are in the diff - [x] No new TODO/FIXME comments — no new TODO/FIXME markers
jwilger deleted branch fix/review-request-webhooks 2026-05-03 15:25:37 -07:00
jwilger referenced this pull request from a commit 2026-05-05 12:18:07 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/auto_review!60
No description provided.