forked from keithah/multi-provider-code-review
-
Notifications
You must be signed in to change notification settings - Fork 0
feat(review): dispatch revision-aware reviews by exact head #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import { | ||
| ControlPlaneManualReviewRequestClient, | ||
| ManualReviewRequestAvailability, | ||
| } from '../../../src/control-plane/review-request'; | ||
|
|
||
| const applied = { | ||
| status: 'applied' as const, | ||
| apiUrl: 'https://api.reviewrouter.site', | ||
| actionVersion: '1.0.0', | ||
| configVersion: 1, | ||
| sessionToken: 'session-token', | ||
| }; | ||
|
|
||
| describe('ControlPlaneManualReviewRequestClient', () => { | ||
| it('treats runtime-config fallback as unavailable rather than legacy-safe', () => { | ||
| const client = new ControlPlaneManualReviewRequestClient({ | ||
| status: 'fallback', | ||
| reason: 'network_error', | ||
| }); | ||
| expect(client.availability()).toBe( | ||
| ManualReviewRequestAvailability.Unavailable | ||
| ); | ||
| }); | ||
|
|
||
| it('does not treat repository_not_registered as an unsupported endpoint', async () => { | ||
| const client = new ControlPlaneManualReviewRequestClient( | ||
| applied, | ||
| jest.fn( | ||
| async () => | ||
| new Response( | ||
| JSON.stringify({ error: { code: 'repository_not_registered' } }), | ||
| { status: 404, headers: { 'content-type': 'application/json' } } | ||
| ) | ||
| ) as typeof fetch | ||
| ); | ||
|
|
||
| await expect(client.request(command())).rejects.toThrow( | ||
| 'manual_review_request_failed:404:repository_not_registered' | ||
| ); | ||
| }); | ||
|
|
||
| it.each([ | ||
| [{ error: { code: 'review_request_intent_disabled' } }], | ||
| [ | ||
| { | ||
| error: 'Not Found', | ||
| message: 'Route POST:/api/action/v1/review-requests/manual not found', | ||
| }, | ||
| ], | ||
| ])( | ||
| 'allows legacy fallback only for an explicitly unsupported endpoint', | ||
| async (body) => { | ||
| const client = new ControlPlaneManualReviewRequestClient( | ||
| applied, | ||
| jest.fn( | ||
| async () => | ||
| new Response(JSON.stringify(body), { | ||
| status: 404, | ||
| headers: { 'content-type': 'application/json' }, | ||
| }) | ||
| ) as typeof fetch | ||
| ); | ||
|
|
||
| await expect(client.request(command())).resolves.toEqual({ | ||
| status: 'unsupported', | ||
| }); | ||
| } | ||
| ); | ||
| }); | ||
|
|
||
| function command() { | ||
| return { | ||
| pullRequestNumber: 252, | ||
| expectedHeadSha: 'a'.repeat(40), | ||
| sourceId: 'manual-comment:1', | ||
| commandKind: 'review' as const, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: 777genius/review-router
Length of output: 5584
🏁 Script executed:
Repository: 777genius/review-router
Length of output: 16319
Use the same SHA for the T0 checkout and runtime input.
The T0 tree is checked out at
inputs.review_head_sha, but the runtime input prefers the livegithub.event.pull_request.head.sha. If a PR advances after the T0 workflow is queued,inputs.review_head_shastays at the older durable value while the runtime can receive/validate the newer head, breaking the exact-head durability guarantee. Align the checkout ref with the runtime input precedence, or passgithub.event.pull_request.head.shato both when operating on a live PR.🤖 Prompt for AI Agents