Repository navigation
Add headCommitSha to waitForReview - #58
Open
canakyildz wants to merge 1 commit into
Open
canakyildz wants to merge 1 commit into
canakyildz wants to merge 1 commit into
Conversation
A review request targets a pull request, so the review runs on whatever the head is when the request lands. If the branch moves first, the wait can report COMPLETED for a commit that will never ship. With headCommitSha set, a read that shows a different commit stops polling and returns INCOMPLETE, and a finished review with no recorded head is never COMPLETED. The reason codes match the Python SDK's head_commit_sha from Suhas Guruprasad (prooflinedev/sdk-python#49). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Suhas Guruprasad added
head_commit_shato the Python SDK'swait_for_reviewin prooflinedev/sdk-python#49. This giveswaitForReviewthe matching option,headCommitSha, with the same reason codes: once it is set, a review of any other commit can't come backCOMPLETED.requestReviewtakes a pull request number, not a commit, and the review runs on whatever the head is when the request lands. A force-push or a bot commit in between can produceCOMPLETEDfor code you aren't shipping, with no sign of it in the outcome.ci reviewin the CLI already refuses that case. My work runs as parallel agent tasks, one worktree and branch each, and what matters is that the check I'm reading ran on that branch's commit.Where TypeScript makes its own call
TypeErrorbefore any request, astimeoutMsalready does here (Python raisesValueError). Only 40 or 64 hex characters pass, upper or lower case. The type is checked before the pattern, sinceRegExp.teststringifies its argument and aBufferholding the right text would get through.nullthrows,undefinedturns the check off.nullisn't in the option's type, and in practice it comes from data, a JSON field or a database column with no commit in it. That caller believes they have a commit and don't, so the call should fail loudly rather than run unchecked.undefined, like leaving the option out, matches Python'sNone, so the runtime and the type agree both ways.gaps. Python reports the head reason there. Statuses and reason codes are the same in both SDKs.Gap ordering. Both SDKs append the head gap after every other gap, but neither had a test for it. Test 3 now checks it: a review with an incomplete assessment history, pinned to another commit, must list
ASSESSMENT_HISTORY_UNAVAILABLEfirst andHEAD_COMMIT_MISMATCHlast. Moving the head gap to the front fails that check and nothing else.head_commit_shaheadCommitShasetINCOMPLETEon that read, even if the review is still running. Last gapHEAD_COMMIT_MISMATCHCOMPLETED, whileFAILEDandSTOPPEDstay. Last gapHEAD_COMMIT_UNAVAILABLETIMED_OUTwith the timeout reason, head gap ingapsA mismatch stops the wait straight away: a review's head never changes, so more polling would only use up the caller's timeout.
current_head_commit_shais left out. It asks whether the pull request has moved since, which is a separate question. #44 proposed two new methods to find and wait for a review by commit, and was closed as out of scope. This adds no method, only an optional field onwaitForReview, and callers who don't set it see no change. #33 and #35 also add a field toWaitOptions, and the overlap is adjacent lines.Checks. At a82cef8 I ran CI's steps in order on a clean install, with Node 22.23.5 where CI pins 22.23.2. All 109 tests pass, 104 of them from
main.pnpm generateleaves no diff, and lint, typecheck, the claims check, build andnpm packpass. Revertingsrc/index.tsalone fails all 5 new tests and nothing else. Each of 11 single-rule changes to the source fails at least one test. GitHub Actions hasn't run this yet, and I haven't called the live API.Tests and mutation runs
The tests port the five from prooflinedev/sdk-python#49 and run against a local HTTP server. A held clock records the wait's sleeps and skips them, so they assert the same schedule as Python: 5,000 then 10,000 ms before the third read, and 5,000 then 7,000 ms up to a 12-second timeout.
headCommitSha: undefinedchanges nothing.null, with aBufferin place of Python's bytes.COMPLETEDtypeofcheck on the optionnullturns the check offundefinedthrows🤖 Generated with Claude Code