Repository navigation
Follow up the engine fetch's review: a fetch time limit, a testable skip decision, sturdier tests - #22
Conversation
…kip decision, and sturdier tests A fetch that stalls now ends after three minutes with the fetch's own error, and a cleanup that fails because a killed git still holds the folder never hides it. The decision to skip an automatic review (a fork, a head already reviewed) is one tested function. New tests cover a commit no ref reaches any more and a remote that never answers; the header test polls for the server's output; the fork tests moved beside the other command tests; the README is re-wrapped.
There was a problem hiding this comment.
🤖 NCode Review at ab5859f: 6 new findings on the changed lines.
Not on a changed line:
- 🟠 F4 Should fix: Are
skipReasonandisFromForkstill tested? TheisFromForktests were deletedtest/fetch-head.test.ts:7. The PR removes theisFromForktests and importsskipReasonfrom./command.ts, but the diff contains no changes tocommand.tsand noskipReasontests. Fix: Confirm thatskipReasonexists incommand.tsand that its tests (fork, missing head repo, head already reviewed) live elsewhere. If not, add them and restore theisFromForkcases.
🤖 Review completeVerdict: 💬 Comment — This PR does three things. It puts a time limit on the engine's git fetches, with cleanup that retries and never hides the fetch's own error. It moves the fork and already-reviewed skip rules into 7 reviewers run — 6 findings (run details)
Skipped: api-compat, data-model, infrastructure, intent, performance, tests Findings
Trial: findings are posted as review threads and in the check run. $0.44 on Amazon Bedrock, 61s, at 3362a68. (how to interact) |
…decision in one place Second review of the follow-up (F1 to F7): the timeout test checks the error came from git's time limit and that it ended between the limit and a few seconds after; a time limit that isn't positive is refused before anything is touched; the cleanup's retries are named; the /review path and the automatic path both decide through skipReason, once each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
F4 (not on a changed line) is a false positive: this pull request does change |
|
/review |
There was a problem hiding this comment.
🤖 NCode Review at 271d154: 4 new findings on the changed lines.
2 more were already posted on this pull request.
Third review of the follow-up (F2, F3, F4, F6): git() takes its environment and time limit in one options object; the command tests (commandFromEvent, isFromFork, skipReason) move to test/command.test.ts with a static import, and skipReason has one test per rule; the timeout test no longer checks the folder's cleanup, which the 'leaves nothing behind' test covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/review |
There was a problem hiding this comment.
🤖 NCode Review at c314012: 2 new findings on the changed lines.
3 more were already posted on this pull request.
…leanup Fourth review of the follow-up (F2, F5): skipReason takes a lookup and calls it only for a pull request that isn't from a fork and has a head, so a fork costs no API call and the head rule lives in one place; a cleanup that fails after a failed fetch is logged to stderr, while the fetch's error stays the one thrown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/review |
There was a problem hiding this comment.
🤖 NCode Review at 5b64ebc: 1 new finding on the changed lines.
4 more were already posted on this pull request.
…lues past int32 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/review |
There was a problem hiding this comment.
🤖 NCode Review at bf333dd: 5 new findings on the changed lines.
1 more was already posted on this pull request.
… looks up the reviewed head Fifth review of the follow-up (F1 to F4, F6): the cleanup is an injectable removeFolder, so a test makes it fail and checks the fetch's error is kept and the cleanup's is logged; the timeout test waits for the killed fetch's folder to go (on Linux and macOS) and has no upper time bound; skipReasonFor decides per trigger whether the reviewed head is looked up, with a test for each; the skipReason tests are one behavior each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/review |
There was a problem hiding this comment.
🤖 NCode Review at cb5177b: 3 new findings on the changed lines.
2 more were already posted on this pull request.
Not on a changed line:
- 🟡 F4 Nit: No test covers the time limit on the fetch by name
src/fetch-head.ts:121. The never-answering server makes the first fetch hang, so the second fetch (by SHA) never runs under a time limit in any test. Fix: Add a case where the first fetch succeeds and the fetch by name hangs, then assert the ETIMEDOUT error. - 🟡 F7 Nit: Stray blank line at the end of the file
test/engine.test.ts:233. The diff adds a blank line after the final});. Fix: Delete the trailing blank line.
… line Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The two findings not on a changed line, from the review at cb5177b:
|
|
/review |
There was a problem hiding this comment.
🤖 NCode Review at 3362a68: 1 new finding on the changed lines.
5 more were already posted on this pull request.
| const pullRequest = (await response.json()) as { head?: { repo?: { full_name?: string } } }; | ||
| if (isFromFork(pullRequest, repository)) { | ||
| console.log(`#${request.number} comes from a fork, and forks aren't reviewed.`); | ||
| const pullRequest = (await response.json()) as { number?: number; head?: { sha?: string; repo?: { full_name?: string } | null } }; |
There was a problem hiding this comment.
🟡 Nit: Reviewed-head lookup closure passed on the /review path where it can never run F6 · hygiene
On the comment path, the arrow () => lastReviewedHead(...) is passed to skipReasonFor('comment', ...), which drops it (skipReason gets undefined for a comment trigger). The closure is dead code that makes the call look like it might fire for /review.
Consequence: No runtime effect; a reader has to trace skipReasonFor to learn that /review never looks up the reviewed head, and the dead argument invites someone to pass a real lookup later.
Fix: Pass the lookup only in the automatic branch, or document at the call site that the comment trigger ignores it.
Evidence
main.ts: const reason = await skipReasonFor('comment', pullRequest, repository, () => lastReviewedHead(repository, request.number, githubToken)); and command.ts skipReasonFor: return skipReason(pullRequest, repository, trigger === 'automatic' ? reviewedHead : undefined);
Confidence 0.30.
Follows #19, whose last bot review (at 1516681) landed after it merged. Seven findings, all addressed:
fetchTimeoutMs, overridable in the options) with the fetch's own error and the hint to comment/review. A cleanup that fails because a killed git still holds the folder (it happened on Windows) retries and never hides that error.uploadpack.allowAnySHA1InWant). Whether github.com serves a commit that no ref reaches is not tested here.skipReasonincommand.ts, with tests for a fork, a deleted fork, the same head, another head and a missing head.New: a test that a remote that never answers ends the fetch, and the cleanup after it.
43 tests and the typecheck pass.
🤖 Generated with Claude Code