Repository navigation
feat: pull request review adapters for GitLab, Azure DevOps and Bitbucket (increment 4b, ADR-0145) - #108
Conversation
A review workspace is its own control record with fixed preferences, a scratch-only write rule at the file layer, and a closing record that stops every later binding and dispatch. Session journals gain the review.* events. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eview into a folder Pure parsers for the PR URL, repository paths and unified diffs, the GitHub and GHES adapter with a paced request sender, the folder writer, and the fetch pipeline with per-version outcomes and a manifest. Tested against loopback fixtures only; no real host was contacted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…logic Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ions A review session's turns now offer two more tools, run under the review workspace's fixed rules, refuse once the review is closed, and check the review record under the control lock at turn start and every dispatch. Also applies cargo fmt to the earlier review commits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… list a review's actions start_review parses the address against the recorded hosts, fetches into a new review folder, records the review workspace, and creates the session, removing the folder and closing the record on any failure. Adds turn-level tests for the fixed rules, scratch-only writes, the close, and the draft tool, and the actions list --review filter. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Closing a review ends its turns, deletes its folder only while it is still the recorded directory, and leaves the folder for a retry when a turn does not end in time. The host removal path now closes its reviews through the same steps. Tool mode and skill loading resolve an open review's workspace. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds ADR-0144, the changelog entry, the review journal events in the session storage guide, the review rules in the security coding rules, the review session's tool list in the instructions guide, and an "Increment 4a as implemented" section in the reviews contract that lists where the implementation differs from it. The delivery list now splits increment 4 into 4a (GitHub and GitHub Enterprise Server) and 4b (the other adapters). AGENTS.md swaps three long ADR link targets for plain ids to stay under the 32 KiB project-instructions cap. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GitLab's text position takes both old_path and new_path even for an added or a deleted file, so the posting adapter of increment 5 needs the pair exactly as the host sent it. RawFile and ChangedFile gain an optional `reported` pair, kept apart from the normalised old_path and new_path and refused the same way when a path cannot be recorded. No adapter fills it yet. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reads a pull request from the Azure DevOps REST API (version 7.1) through the review request sender: the pull request, its latest iteration for the merge base and the head, the iteration's changes compared with the merge base, the head tree of the source repository, and one file per request. Wired into the adapter table for both Azure kinds. Tested against loopback fixtures only; nothing has contacted a real host (ADR-0145). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GitLabAdapter reads a merge request, its changed files, the head tree, and file versions from GitLab and self-managed GitLab through GET requests built from path segments and query pairs only. The project path and each file path are single segments (%2F). The merge request's diff_refs give the base and head commits, and every changed file keeps the old_path and new_path GitLab sent. Links and submodules are recognised from the diff modes and the tree listing, and a pagination link is read only for its page token or number. No host was contacted: the request shapes follow GitLab's REST documentation and run against loopback fixtures only. An existing start test used GitLab as a kind without an adapter; it now uses Bitbucket Cloud. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…host shares fetch_review checked both repository names with GitHub's owner/name rule, so a GitLab group path, an Azure DevOps project with a space, or a Data Center personal repository would have failed right after the pull request was read. The shared check is now a bound (1 to 1,024 bytes, one or more slashes, no control character, no outer space); each adapter checks its own host's form. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The shared repository check in fetch.rs now accepts group/sub/project, so the whole-fetch test uses the nested path the notes had to avoid. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Read-only GET adapters for pull request reviews on Bitbucket Cloud and Bitbucket Data Center, wired into supports, adapter_for and pull_request_of. They have not run against a real host (ADR-0145); tests use loopback fixtures only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # crates/omgcode-core/src/review/adapters.rs
Resolves the review.rs and adapters.rs wiring lines so Azure DevOps and the two Bitbucket kinds all stay, and adds an end-to-end test that a Data Center personal repository (~user/slug) passes fetch_review now that fetch.rs checks repository names by the shared bound. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…iew's summary Core and platform changes behind the review desktop (ADR-0144): - A host path is compared after a per-character simple uppercase and then lowercase fold, for `.git`, `.OMGCode` and the device names too (COM0 to COM9, LPT0 to LPT9). A name that the volume already holds, or that needs a directory where a file is, is an `unportable_path` collision, not a failed fetch (`CreateError::is_name_conflict` in the platform crate). A failed review folder create removes the folder. - A path over 256 bytes is unportable, including one given to the on-demand fetch tool, which refuses it before the host or the ledger is touched. - A review start is refused up front once 1,024 review records exist. - A review session refuses `workspace_git_read` with `git_read_disabled`. - `review::summary` reads the title, author, and state of an open review from `review.json`, through the recorded folders and only while the manifest has the digest that `review.started` recorded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds the Rust side of the review desktop (ADR-0144): - Six `main` commands: `review_skills`, `review_start`, `review_progress`, `review_cancel`, `review_info`, and `review_remove`. A start runs on its own thread, at most two at once, and answers with an operation identifier. No command takes a host, a token, or a path, and every failure text is fixed. - `session_tree` lists review sessions in a `reviews` list, each session carries `review` (`open`, `closed`, or null), `terminal_open` refuses a review session, and `workspace_entries` lists an open review's folder and refuses a closed one with `review_closed`. - Removing a review host, or replacing its token, cancels every start in flight. A host removal reports each review whose folder was left, in the CLI and the desktop (`review_removal_incomplete`). Shutdown cancels starts and reports one that stays as `review_starts_still_running`. - `review_info` reads the title, author, and state of an open review from `review.json` through core, and never from a journal. - The command count is 93 (43 `main`, 3 `approvals`, 47 `settings`). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the main window The UI side of the review desktop (ADR-0144). Every string from a host is a text node: a link or image in a pull request stays inert text. - **New Review** opens a dialog with the pull request address, a review skill, and the session's provider, model, and effort; it follows `review_progress` and can cancel. - The sidebar lists review sessions in a collapsible **Reviews** section, apart from the workspace groups, and a closed review's row says so. - A review session offers only Files, Context, and PR context. A header shows the pull request's title, author, and state and offers **Remove review...** with a retry when the folder was left; the transcript shows the `review.*` events as short text. - The mock backend answers the six commands so the interface runs without Rust, and the settings help no longer says that creating a review is not available. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Records what increment 4a does and does not do (ADR-0144, docs/reviews.md): the path and record limits, the known limits of the fetch, the desktop commands and panels, the journal events, the closing rules, and that no adapter has run against a real host and nothing posts. Bumps the workspace to 0.92.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every host kind has an adapter now, so the start test that expected `review_host_kind_unsupported` for a kind without one becomes a test that a Bitbucket Cloud and a GitLab host are asked and leave no folder on a 404. The review hosts page no longer says that only GitHub can be reviewed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds ADR-0145 and an "Increment 4b as implemented" section to the review contract: each adapter's requests, caps, and choices, the two new refusal codes, what was not built (GitLab pacing, links and submodules in an on-demand fetch), and each adapter's unverified assumptions. No adapter has run against a real host. Bumps the workspace to 0.93.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sixteen findings of a review of the review folders and sessions, each with a test (ADR-0144, Amendments): - The review header says "Partial: N of M changed files" and "Incomplete: K changed files without stored content", and a busy journal shows the loading line, not an error. - A start whose progress read answers busy no longer re-enables Start review, which could fetch the same review twice. - The PR context fences the description so it cannot forge a field. - review.json and pr/files.txt stay inside 1 MiB: the fetch counts the largest record of a file before it downloads the file. - The trusted CLI's review-host remove deletes no review folder, because it cannot see the desktop's turns. - Registering a workspace or granting a folder fails closed when the review folder root cannot be found. - review_fetch_file changes one ledger at a time, counts a file stored before a failed ledger save, and removes its temporary file; removal and the start sweep clear the ledger files. - A folder counts as deleted only when nothing is left at its place. - A path the review text escapes can no longer be stored; one predicate and an exhaustive code-point test keep the sets equal. - A request may have 48 path segments. - A draft body with a bidirectional override or isolate is refused, and a carriage return and line feed pair is a line feed. - A token change or host removal that will be refused cancels no start. - Remove review takes the settings-change flag after its confirmation. - Two different versions of more than 50,000 lines are not compared. No adapter has run against a real host. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The review bot opened 22 threads on the previous head. Two were already fixed by the previous commit, some read the code wrongly, and some are documented limits. These held up and are fixed, each with a test where one can reach it: - pr/ keeps 1 MiB of its 128 MiB free for pr/files.txt, which is written after the versions. - A start looks at a cancel once more before it records the review. - A rate-limit reset time from a host cannot overflow the wait. - The host help text no longer says that removing a host always deletes the folders. - A test pins that a rename, a delete, and an edit of a fetched file in pr/ are refused. - The contract says the PR context is recorded when the review starts, that four adapters (six kinds) remain, and three known limits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A start that failed before it had a session, and could not delete its folder, left a closed review record that no session could retry. The orphan sweep skipped it because a record named it, so the fetched pull request stayed on disk. A start now deletes the folder of a closed review a day after its last change, and only while it is still the folder the record names (the same identity check a removal makes). Tests: an old recorded folder goes, a young one stays, and a folder swapped for another directory stays. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…cked Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brings the fixes of the review of increment 4a into the adapters of increment 4b: the room budget, the metadata reserve, the fixed character sets, the ledger handling, the draft body checks and the removal rules. Where the two met: - The room budget now counts the paths a host reported, which the GitLab posting needs, as the fetch records them (a test pins it). - A Git LFS file is recorded as such (`review_host_lfs_unsupported`) and does not abort the fetch, and a local refusal of a request counts as no failure of the host (tests for 12 LFS files in a row and a path 30 components deep). - The review hosts help text of 4a replaces the older text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Takes the sweep of a closed review's folder and the pinned fragment cases of the pull request address. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 146 files, which is 46 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.
|
|
It won't be retried until the next push, or until someone asks for a review in the bot. |
Fixed: - A host's removal or a token's replacement cancels the review starts in flight once the change is recorded (or may be), not before: a change that core then refused, such as a revision another writer moved, had already cancelled starts that it did not need to. The shared removal calls `host_unbound` on the caller's `ReviewTurns`. - A review folder root that does not exist yet refuses a directory that contains the folder it will be created in, instead of passing it. A folder grant checks application storage first, so the data directory keeps the clearer `StorageOverlap` reason. - The review header drops the pull request's title the moment an open review is shown as closed, also when the read of the closed review fails. - The refusal for too many request path segments says 48, not 32. Contract: `review-host set-token` closes no review; a cancel is looked at for the last time just before the review is recorded and ends no start after it; a start that fails deletes the folder it created by name, without the record check; a summary read begun just before a closing may return once more. Pinned by new tests, because findings were wrong about the code or the behaviour was only implied: a path of control characters counts at its escaped size in the room budget, a second distinct file replaces the ledger that the first wrote, and a cancel from inside the session's preparation leaves the review open. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Takes the fixes of the second re-review of increment 4a: the starts end once a host change is recorded, a review root that is not there yet fails closed, the review header drops a closed review's title, and the contract text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d paths The merge of the review sessions branch brought in a test that builds a `RawFile` literal. This branch's `RawFile` has a `reported` field for the paths a host reports, so the literal did not compile. The test now sets `reported: None`, which is what a host that reports no paths gives. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Fixed: - A host removal that closes several reviews judges the turns of each on their own. `ReviewTurns::stop` returns the reviews whose turns ended, not one flag for the batch, so a turn that does not end within 60 seconds leaves only its own review's folder. One flag left every folder in place, against the contract that a review that cannot be finished does not stop the others. - The documents no longer say that a removal or a token replacement ends a review start. The start is asked to stop, a request already sent completes with the token it loaded, and the replaced token stays valid at the host until the operator revokes it there. They also say that a replacement whose journal write is uncertain cancels the starts and still reports the error. Contract: a start writes nothing into the review folder after the review is recorded (the files are written before), so a removal that deletes the folder meets no writer, and the removal does not join the starts. A new test deletes the folder from inside the session's preparation and checks that the start finishes and that nothing brings the folder back. Not changed: the finding that an ancestor of the review root is accepted before the root exists is wrong about the code. A directory that holds the folder the root will be created in, or any ancestor of it, is refused, and a sibling is allowed, which an existing test pins. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brings in the third re-review of increment 4a: a host removal judges the turns of each review on its own, and the documents say that a start is asked to stop and not ended. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… deletion The test added for the third re-review deleted the review folder from inside the session's preparation and asserted that the deletion worked. On Windows it does not: the start keeps its own handle on the folder until it ends, so the deletion fails, the removal reports `review_removal_incomplete` for that review, and a retry deletes it. The test failed on the Windows filesystem job and locally. The test now pins what holds on both systems: after the record the start writes nothing into the folder, so a folder that a removal deleted stays gone and one that it could not delete is left exactly as the removal found it. The contract says what happens on Windows. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brings in the test of the start's folder after the record, which now pins the folder by its contents because a Windows deletion of it fails while the start holds its handle. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|



Summary
Increment 4b of the pull request review contract: the GitLab, Azure DevOps, and Bitbucket fetch adapters (ADR-0145, version 0.93.0). Every host kind now has an adapter.
No adapter has run against a real host. Each was written from the host's documentation and runs against loopback fixtures only. Nothing here posts to a host, and the contract's list of unverified facts gains each adapter's assumptions.
This PR is stacked on #107 (increment 4a) and its base is
main, because the Rust, frontend, and Sonar workflows only run for pull requests intomain. Until #107 merges, the diff againstmainalso shows 4a's commits. The 4b change alone isdev/review-sessions...dev/review-sessions-4b(29 files). The branch already contains the fixes made after the review of 4a (merged up to22206f2, no rebase).What changed
diffs, the head tree, and raw files; the base and head come fromdiff_refs, and all three refs are recorded for posting.commonRefCommit.diffstat, the head tree, and each file withformat=meta.changes, the head tree, and raw files.review_host_merge_base_unavailable(Bitbucket Data Center before 8.16.0, or no common ancestor; there is no fallback to the target branch's tip) andreview_host_lfs_unsupported(a Git LFS file on Bitbucket Cloud, recorded as the outcomelfs).ReportedPathskeeps the old and new path pair as the host reported it, for GitLab's posting. The room budget counts those paths as the fetch records them.docs/reviews.md):lfs, notfetch_failed, so ten in a row no longer end the fetch.docs/reviews.md: an unpinned change list, unbounded path text, a quadratic Cloud prefix index, a raw path inreview.json, zero-width and tag characters, and redirects, hops, and any 2xx answer.200carries.docs/reviews.md,docs/desktop-interface.md,docs/security-coding-rules.md,AGENTS.md,CHANGELOG.md. The help text of Review hosts insettingsno longer says that only GitHub can be reviewed.Why it changed
The review feature could only fetch from GitHub. The other host kinds an operator can record a review host for had no adapter, so New Review could not open their pull requests. The adapters follow the 4a contract: core, never the model, fetches into an isolated review folder, with the same budgets, ledger, and refusals.
Tests
Not run: Linux (the Linux VM was unreachable, so the Linux jobs rely on CI), a release-build timing check, and any real host.
Run locally on the pushed head (Windows):
cargo fmt --all --check, andcargo clippy --workspace --all-targets -- -D warnings: cleancargo test --workspace --no-fail-fast: 3,377 passed, 0 failed, 10 ignoredbiome check,tsc --noEmit, Vitest 1,404 passed,test:dist9 passedUpdated
start_tests.rs: the test that a kind without an adapter is refused before a folder or a request becomesevery_host_kind_has_an_adapter_so_a_start_asks_its_host_and_leaves_nothing_on_a_failure, which starts a GitLab and a Bitbucket Cloud review against a host that answers 404 and checks that a request was sent and no folder is left.tools_tests.rs: three record literals gain the newreportedfield.settingschanges (it said that only GitHub could be reviewed); no test asserts it.New
many_git_lfs_files_in_a_row_are_recorded_as_lfs_and_do_not_abort_the_fetchanda_file_thirty_components_deep_is_requested_and_stored(Bitbucket Cloud).the_host_reported_paths_of_a_record_count_toward_the_room_it_needs(room budget).a_repository_name_of_any_host_form_is_plausible_and_a_hostile_one_is_not(the shared repository-name rule).🤖 Generated with Claude Code