feat(provider-review): expose exact repositories and branches - #5705
Closed
iscekic wants to merge 9 commits into
Closed
feat(provider-review): expose exact repositories and branches#5705iscekic wants to merge 9 commits into
iscekic wants to merge 9 commits into
Conversation
This was referenced Aug 29, 2026
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (24 files)
Previous Review Summary (commit ea934a7)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ea934a7)Status: No Issues Found | Recommendation: Merge Files Reviewed (24 files)
Reviewed by grok-4.6 · Input: 80.4K · Output: 10.8K · Cached: 623.1K Review guidance: REVIEW.md from base branch |
This was referenced Aug 29, 2026
This was referenced Aug 30, 2026
This was referenced Aug 30, 2026
Contributor
Author
|
Closing: the owner stopped this workflow section. The branch is retained. |
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.
Summary
launchRepositoryReferenceSchemaseparates repository identity fromownerIntegrationauthorization, so a repository name alone cannot authorize a branch request.listRepositoryBranchesInputSchemaaccepts a bounded optional cursor;listRepositoryBranchesOutputSchemareturns branch names, default markers, nullabledefaultBranch, and nullablenextCursor.instanceUrlrequireshttps; references bind the provider, repository, owner, and integration, with workspace identifiers for Bitbucket.Files
apps/web/src/routers/cloud-agent-next-schemas.ts— Source, modified (66 changed lines). Adds strict repository and branch schemas plus provider-matched optional prepare selectors.listRepositoryBranchesauthorizes personal GitHub and GitLab access, plus organization access for all three providers; GitHub and GitLab reject cursors.listGitHubRepositoriesandlistGitLabRepositoriesadd optional identity/default fields while keeping legacy outputs; GitLab accepts an optionalintegrationId.Personal
listBitbucketRepositoriesand Bitbucket branch requests returnBAD_REQUEST; organization requests without producer identity return retryableSERVICE_UNAVAILABLEinstead of resolving another integration.Files
apps/web/src/routers/cloud-agent-next-router.ts— Source, modified (59 changed lines). Adds personal discovery fields and branch queries, rejects Bitbucket, and checks GitLab clone hosts.apps/web/src/routers/organizations/organization-cloud-agent-next-router.ts— Source, modified (106 changed lines). Matches owners and Bitbucket producer references, preserves discovery identity, and checks GitLab clone hosts.apps/web/src/routers/provider-repository-contract.test.ts— Test, added (772 changed lines). Covers legacy web, extension, bot, automation, and Worker payloads, branch results, and exact prepare forwarding.basePrepareSessionNextSchemakeeps old payloads valid and adds provider-matchedgitlabIntegrationId,gitlabInstanceUrl, andbitbucketIntegrationId.Both
prepareSessionroutes retain provider pins and the exactupstreamBranchthroughPrepareSessionInputandCloudAgentPrepareSessionInput; personal Bitbucket preparation remains rejected.getGitLabInstanceUrlForUserandgetGitLabInstanceUrlForOrganizationverify selected hosts; legacy fallbacks, includinggitlab.com, remain until old callers and records disappear and the 30-day ledger window expires.Files
apps/web/src/lib/cloud-agent-next/cloud-agent-client.ts— Source, modified (2 changed lines). Adds optional GitLab and Bitbucket integration selectors to the web client input.packages/worker-utils/src/cloud-agent-next-client.ts— Source, modified (2 changed lines). Adds optional GitHub and GitLab integration selectors to the Worker client input.packages/worker-utils/src/cloud-agent-next-client.test.ts— Test, modified (77 changed lines). Extends prepare serialization coverage for provider selectors, selected branches, and old payloads.GitHubRepositoriesResultadds integration/account identity,LaunchRepositoryReference, and default branches to cached and refreshed personal and organization discovery.listGitHubRepositoryBrancheschecks the owner, healthy integration, repository identifier, and case-insensitive name;fetchGitHubBranchesalso checks the live repository identifier.fetchGitHubRepositoriesretains provider defaults; old caches return an unknown default, and legacy name-only branch calls remain valid.Files
apps/web/src/lib/cloud-agent/github-integration-helpers.ts— Source, modified (107 changed lines). Attaches the producing owner and integration on every discovery path; validates exact branch references.apps/web/src/lib/integrations/platforms/github/adapter.ts— Source, modified (13 changed lines). Preserves default branches and rejects a changed live repository identifier before listing branches.apps/web/src/lib/cloud-agent/github-integration-helpers.test.ts— Test, modified (192 changed lines). Extends discovery identity, ownership, default-branch, and branch-result coverage.apps/web/src/lib/integrations/platforms/github/adapter.test.ts— Test, added (164 changed lines). Covers provider defaults and live identifier checks, including legacy name-only calls.GitLabRepositoriesResultnow returns normalized instance identity,LaunchRepositoryReference, and default branches through shared personal and organization discovery.getGitLabIntegrationaccepts an optionalintegrationId, enforces exact ownership, and returnsCONFLICTinstead of choosing among multiple integrations.listGitLabRepositoryBranchesandlistGitLabBranchesverify an active integration, instance, project identifier, and full path before identifier-based lookup; legacy path-only calls remain valid.Files
apps/web/src/lib/cloud-agent/gitlab-integration-helpers.ts— Source, modified (310 changed lines). Unifies discovery and identity mapping, validates clone-host selectors, and removes unused credential metadata fields.apps/web/src/lib/integrations/gitlab-service.ts— Source, modified (116 changed lines). Adds exact integration and branch selection; carries producer snapshots through refresh and personal access token reconnects.apps/web/src/lib/cloud-agent/gitlab-integration-helpers.test.ts— Test, modified (378 changed lines). Covers exact selectors, instance changes, old cache rows, legacy fallback, and branch authorization.updateRepositoriesForIntegrationaccepts an optionalexpectedIntegrationsnapshot and updates only whenupdated_atandmetadatastill match.GitLab discovery, refresh, and
connectWithPATpass their producing snapshot; reconnecting to another instance clearsrepositoriesandrepositories_synced_atinside the transaction.This protects reconnects that reuse an integration identifier, while legacy two-argument writers keep their previous behavior.
Files
apps/web/src/lib/integrations/db/platform-integrations.ts— Source, modified (23 changed lines). Adds timestamp and metadata conditions, including null metadata, without changing callers that omit the snapshot.apps/web/src/lib/integrations/db/platform-integrations.test.ts— Test, modified (265 changed lines). Extends regression coverage for snapshot guards and reconnects that reuse an integration identifier.BitbucketRepositorySchemakeeps identity fields optional for old responses, but rejects inconsistent provider, host, workspace, repository, default branch, or integration values.The Bitbucket cache producers use
withBitbucketRepositoryIdentityto retain their actual integration and owner; unknown defaults remainnull.listBitbucketRepositoriesretainsexpectedIntegrationIdwhen retrying a cache write, so a replacement connection cannot silently satisfy a pinned request.Files
apps/web/src/lib/integrations/platforms/bitbucket/token-service-client.ts— Source, modified (53 changed lines). Extends strict wire validation and constructs exact owner/integration references without guessing a default branch.apps/web/src/lib/integrations/platforms/bitbucket/repository-cache.ts— Source, modified (14 changed lines). Adds cached/fresh identities and preserves the selector during stale-write retries.apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-repository-cache.ts— Source, modified (31 changed lines). Adds producing identities to cached, refreshed, status, and readiness results.apps/web/src/lib/integrations/platforms/bitbucket/token-service-client.test.ts— Test, modified (137 changed lines). Covers legacy responses, identity additions, and inconsistent references.apps/web/src/lib/integrations/platforms/bitbucket/repository-cache.test.ts— Test, modified (6 changed lines). Updates repository projection expectations for the added identity fields.apps/web/src/lib/integrations/platforms/bitbucket/workspace-access-token-repository-cache.test.ts— Test, modified (14 changed lines). Updates cache projection expectations for the added identity fields.listBitbucketRepositoryBranchessends the authenticated actor and exact organization, integration, workspace, and repository identity through the existing interactive broker.The
branchesoperation returns up to 50 names per page and uses the selected repository's default with a broker-validatednextCursor.Access, identity, and cursor errors map to
FORBIDDEN,NOT_FOUND, andBAD_REQUEST; response mismatch returnsPRECONDITION_FAILED, and other failures returnSERVICE_UNAVAILABLE.Files
apps/web/src/lib/integrations/platforms/bitbucket/oauth-integration.ts— Source, modified (144 changed lines). Adds scoped branch pagination, response identity checks, and typed errors; attaches exact identity to the connection status cache.apps/web/src/lib/integrations/platforms/bitbucket/oauth-integration.test.ts— Test, added (487 changed lines). Covers scoped branch dispatch, trusted defaults, pagination, provider failures, and connection status projections.Tests: 10 files changed (3 added, 7 modified; 2,492 changed lines):
github-integration-helpers.test.ts,gitlab-integration-helpers.test.ts,platform-integrations.test.ts,oauth-integration.test.ts,repository-cache.test.ts,token-service-client.test.ts,workspace-access-token-repository-cache.test.ts,adapter.test.ts,provider-repository-contract.test.ts, andcloud-agent-next-client.test.ts.Generated: 0 files changed.
Visual Changes
Visual Changes: N/A
Verification
Reviewer Notes
Human steps
The bot owns remaining verification.
Check evidence
Scope
mobile-provider-parity-1d93-s5...mobile-provider-parity-1d93-s6.Kilo-Org/cloud; worktree:/Users/igor/Projects/.worktrees/mobile-provider-parity-1d93.Notes
Runtime verification is pending for the cumulative stack; this level adds no visual surface.
Stacked PRs — merge bottom to top. Each level shows only its own diff.
Runtime verification (E2E, user advocacy, simplify) runs on the tip PR over every level.
Every level keeps its own checks, its own bot review, and its own threads; each one is answered on its own PR.
Each level is its own deliverable: it builds and passes its own checks alone.
A finding on a level is repaired on that level, then carried upward with stack.sh forward.
mobile-provider-parity-1d93-s1— feat(provider-review): add shared identity and stack checks #5663mobile-provider-parity-1d93-s2— feat(provider-review): define review contracts and vocabulary #5665mobile-provider-parity-1d93-s3— feat(provider-review): add safe provider SDK boundaries #5689mobile-provider-parity-1d93-s4— feat(git-token): authorize exact provider review resources #5692mobile-provider-parity-1d93-s5— feat(cloud-agent): preserve provider identity through checkout #5700mobile-provider-parity-1d93-s6— feat(provider-review): expose exact repositories and branches #5705 ← this PRmobile-provider-parity-1d93-s7— feat(mobile): preserve provider launch and recent identity #5711mobile-provider-parity-1d93-s8— feat(mobile): select exact provider repositories and branches #5729mobile-provider-parity-1d93-s9— feat(provider-review): add authorized GitLab review reads #5738mobile-provider-parity-1d93-s10— feat(provider-review): add authorized Bitbucket review reads #5745mobile-provider-parity-1d93-s11— feat(provider-review): add reconciled GitLab review actions #5748mobile-provider-parity-1d93-s12— feat(provider-review): add Bitbucket review actions and recovery #5756mobile-provider-parity-1d93-s13— feat(provider-review): expose the neutral review facade #5763 (tip)