diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..90b076f --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,3 @@ +inheritance: true +reviews: + review_status: false diff --git a/.github/workflows/pr-lint.yaml b/.github/workflows/pr-lint.yaml index 4c12cc0..7ee35f9 100644 --- a/.github/workflows/pr-lint.yaml +++ b/.github/workflows/pr-lint.yaml @@ -57,6 +57,8 @@ jobs: ["review", "5319e7", "Summons the full ordered review sequence"], ["review:runeseer", "5319e7", "Summons the adjudicating correctness lane"], ["review:macroscope", "5319e7", "Summons the macroscope lane"], + ["review:cursor", "5319e7", "Summons a standalone Cursor round"], + ["review:coderabbit", "5319e7", "Summons a standalone CodeRabbit round"], ["review:autofix", "5319e7", "Summons a mechanical-fix suggestion patch"], ["skip:cursor", "b60205", "Owner override: the cursor lane never runs"], ["skip:macroscope", "b60205", "Owner override: the macroscope lane never runs"], diff --git a/.github/workflows/review-cascade.yaml b/.github/workflows/review-cascade.yaml index 7d8f6ac..afe8c32 100644 --- a/.github/workflows/review-cascade.yaml +++ b/.github/workflows/review-cascade.yaml @@ -9,19 +9,19 @@ on: types: [opened, labeled, unlabeled, ready_for_review] # The body uses the workflow token to read check runs, the live head, and -# review threads. issues: write lets it consume labels with the same token; -# those removals emit no events and cannot cancel a lane. +# review threads. PR label changes need pull-requests: write and issues: write. +# Workflow-token label removal emits no event and cannot cancel the lane. permissions: contents: read checks: read - pull-requests: read + pull-requests: write issues: write -# Applying or removing a fresh bare review label may cancel a cascade. Every -# other label re-enters this group without interrupting the active round. +# A fresh review request replaces the active cascade. +# Label removal cannot cancel a round after dispatch. concurrency: group: review-cascade-${{ github.event.pull_request.number }} - cancel-in-progress: ${{ contains(fromJSON('["labeled", "unlabeled"]'), github.event.action) && github.event.label.name == 'review' }} + cancel-in-progress: ${{ github.event.action == 'labeled' && github.event.label.name == 'review' }} jobs: # A queued ready event keeps its label payload after another round @@ -66,9 +66,8 @@ jobs: # same-repository heads, so a fork spends nothing unlabeled. if: '!cancelled() && github.event.pull_request.draft == false && ((github.event.action == ''opened'' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event.action == ''labeled'' && github.event.label.name == ''review'') || (github.event.action == ''ready_for_review'' && needs.release.outputs.summoned == ''true''))' uses: runedeck/seer/.github/workflows/review-cascade.yaml@main + with: + macroscope_correctness_check: ${{ vars.MACROSCOPE_CORRECTNESS_CHECK }} secrets: RUNEWRIGHT_APP_ID: ${{ secrets.RUNEWRIGHT_APP_ID }} RUNEWRIGHT_APP_KEY: ${{ secrets.RUNEWRIGHT_APP_KEY }} - # Cursor ignores bot-authored review comments; the cascade posts - # its trigger comment with this owner-minted token instead. - RUNEWRIGHT_GITHUB_TOKEN: ${{ secrets.RUNEWRIGHT_GITHUB_TOKEN }} diff --git a/.github/workflows/review-cursor.yaml b/.github/workflows/review-cursor.yaml new file mode 100644 index 0000000..1439bc1 --- /dev/null +++ b/.github/workflows/review-cursor.yaml @@ -0,0 +1,26 @@ +name: Review Cursor + +# This API-only caller requests optional Bugbot reviews through Seer. +# The reusable workflow checks the live head and labels before dispatch. +# Keep head-controlled code outside this trusted workflow. +on: + pull_request_target: + types: [labeled, ready_for_review] + +permissions: + contents: read + pull-requests: write + issues: write + +# Separate label groups preserve queued requests during unrelated label events. +concurrency: + group: review-cursor-${{ github.event.pull_request.number }}-${{ github.event.label.name || 'ready' }} + cancel-in-progress: false + +jobs: + summon: + if: github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'skip:cursor') && ((github.event.action == 'labeled' && github.event.label.name == 'review:cursor') || (github.event.action == 'ready_for_review' && contains(github.event.pull_request.labels.*.name, 'review:cursor'))) + uses: runedeck/seer/.github/workflows/review-cursor.yaml@main + secrets: + # Bugbot requires a human-authored summon. + RUNEWRIGHT_GITHUB_TOKEN: ${{ secrets.RUNEWRIGHT_GITHUB_TOKEN }} diff --git a/docs/openspec/specs/review-integration/spec.md b/docs/openspec/specs/review-integration/spec.md new file mode 100644 index 0000000..f899c6a --- /dev/null +++ b/docs/openspec/specs/review-integration/spec.md @@ -0,0 +1,64 @@ +# Review Integration Specification + +## Purpose + +This specification covers this repository's review callers. +The [upstream caller contract][caller-contract] defines Seer behavior. +The requirements below describe local configuration only. + +## Requirements + +### Requirement: Forward the correctness check name + +The cascade caller MUST pass `MACROSCOPE_CORRECTNESS_CHECK` to Seer through the `macroscope_correctness_check` input. + +#### Scenario: Cascade invocation + +- **WHEN** the cascade caller invokes Seer +- **THEN** `macroscope_correctness_check` equals the repository variable `MACROSCOPE_CORRECTNESS_CHECK` + +### Requirement: Preserve active rounds during label consumption + +The cascade caller MUST cancel an active round only for a new `review` label event on the same pull request. + +#### Scenario: Consumed request + +- **WHEN** an `unlabeled` event removes `review` during an active cascade +- **THEN** the caller preserves the active round + +#### Scenario: New request + +- **WHEN** a `labeled` event applies `review` during an active cascade on the same pull request +- **THEN** the caller requests that GitHub cancel the active round + +### Requirement: Dispatch optional Bugbot reviews separately + +The optional Bugbot caller MUST invoke Seer's `review-cursor.yaml` separately from the cascade. +The caller MUST require a non-draft pull request with `review:cursor` and without `skip:cursor`. +It MUST accept a matching label event or a transition from draft to ready. + +#### Scenario: Optional review request + +- **WHEN** a maintainer applies `review:cursor` to a non-draft pull request without `skip:cursor` +- **THEN** the optional caller invokes Seer's `review-cursor.yaml` + +#### Scenario: Pending draft request + +- **WHEN** a draft pull request with `review:cursor` and without `skip:cursor` becomes ready +- **THEN** the optional caller invokes Seer's `review-cursor.yaml` + +#### Scenario: Draft or skipped review + +- **WHEN** the pull request remains draft or carries `skip:cursor` +- **THEN** the optional caller starts no Bugbot job + +### Requirement: Preserve inherited CodeRabbit settings + +The CodeRabbit configuration MUST enable `inheritance` and set `reviews.review_status` to `false`. + +#### Scenario: Configuration inspection + +- **WHEN** CodeRabbit reads `.coderabbit.yaml` +- **THEN** `inheritance` equals `true` and `reviews.review_status` equals `false` + +[caller-contract]: https://github.com/runedeck/seer/blob/11f5eb5edfc1d20f32591e01bcc9cc1587c336c9/INSTALL.md