Repository navigation
feat(project): pick the source link by account in project sync - #81
Conversation
project sync and the Bitbucket link commands asked for --link-id, an internal ID that users never see. GitHub had no command that lists it. The owner of each OWNER/REPOSITORY name now picks the GitHub organization or user, or the Bitbucket workspace, with that account. The match also picks the source. Names with two owners make one sync request per link, and the CLI resolves every name before the first write. A tenant with one link keeps working when the account name is missing or stale. --account names the link for the ID selectors, for --all and for the Bitbucket repository list, allowlist update and link delete commands. --link-id stays as a hidden flag for scripts. With a known source it lists no links. --all syncs every repository of one account in requests of 100. On Bitbucket it syncs only repositories with scan state enabled, because the server refuses the others. A failure after earlier requests wrote projects reports the synced count and says to rerun when the failure is temporary. Output and errors name accounts. JSON adds account and link_id to each project and keeps the top-level link_id when one link served the run. The selection rules live in internal/sourcelink, shared by both command trees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
A sync of names from several accounts sends one request per account. When a later request failed, the error said "Projects exist for the first N repositories", but the requests follow the accounts, not the argument order, and the error did not name the failed account. The error now names the accounts whose projects exist and the account whose request failed. An --all run keeps the count, worded "at least the first N", because the failed batch can be committed before the server times out. An Unauthenticated failure is returned as it is, so the entry point shows the login guidance. A Bitbucket name whose scan state is not enabled made the server refuse its request after the requests of other workspaces had written projects. The CLI now refuses the name before any write and gives the allowlist update command that enables it. Selection errors now say when a link has no account name, and point to the --source value under which a single link serves the name. Names given with --repository-id or --repository-uuid resolve through the link that the selection picks. One loop sends the requests of both sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep GitHub App |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…3x8any-sync-account
main now has internal/rpcerror, which finds the innermost gRPC status of a wrapped error. rpcMessage used its own copy of that lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f0d30780a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
GroupByOwner maps free-form OWNER/REPOSITORY names to links, and the table test covers only hand-picked names. The fuzz test checks, for any names, links and source: every name lands in exactly one group, each group has its own link of the allowed source, each name goes to the one link with its owner's account or to the only allowed link, and an unresolvable owner fails. With --account set, one group keeps every name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MhRi597EX9odoSDXbVBsxz



What was wrong
safedep project syncasked for--link-id, the internal id of a source integration row. Users never see that id, and no command lists it for GitHub. The only place it appeared was the error for a tenant with more than one GitHub link. A sync also needed every repository named, at most 100 per call, so a whole org took many calls.What changes
safedep project sync safedep/vet safedep/pmgmatches the owner against the account of each link, ignoring case: the GitHub login or the Bitbucket workspace slug. The match also picks the source.--account <name>picks the link by its account name. Every name resolves through it. You need it with--repository-idor--repository-uuidwhen the tenant has more than one link of that source.--link-idis hidden onproject syncand on the Bitbucket commandsrepository list,allowlist updateandlink delete. It still works, so scripts keep running. With both flags, they must name the same link.--allneeds--accountor--link-id.--allsays "at least the first N".allowlist updatecommand.internal/sourcelinkholds the account rules for GitHub and Bitbucket. Eachinternal/cmdpackage can use it without importing another.Compatibility
link_idfor a run through one link and addsaccount. A run through more than one link leaves the top-levellink_idandaccountout and sets them on each project.accountas the last column, so scripts that read the earlier columns keep working.--link-idalone still lists no links, so a repeatedlink delete --link-idstays idempotent.Tests
--all, which keeps the login guidance;--account.make build,make test,make lintandmake lint-conventionspass.The docs pages for
project syncand the four Bitbucket commands are updated.Generated by Claude Code
Summary by CodeRabbit
--allto sync eligible repositories across linked GitHub or Bitbucket accounts. Results are deduplicated and processed in batches; Bitbucket sync includes only repositories enabled for scanning.