Repository navigation
Follow GitHub repository and organization renames - #278
Open
ndbroadbent wants to merge 4 commits into
Open
ndbroadbent wants to merge 4 commits into
ndbroadbent wants to merge 4 commits into
Conversation
VisualCIdocspring/visualci · build #1452 · 4 changed, 574 unchanged · waiting for review This PR vs base: 54 changed, 17 added since #1157, across 8 builds · 4 not approved yet
docspring/visualci · journeys · build #1450 · 53 unchanged · no changes This PR vs base: 53 added, 50 removed since #1151, across 10 builds Updated as builds change. Agents can review with VisualCI's MCP tools. |
ndbroadbent
added a commit
that referenced
this pull request
Dec 5, 2026
…count renames change nothing Review fixes for #278: - reach: a repository whose collaborators answer 403 or 404 (a public repo transferred to an account the installation doesn't cover) is unseen, so its links are unlinked, instead of failing the hourly sync for everyone. A 403 with no calls left is still the rate limit's error. Its path is recorded for follow_renames only after collaborators succeeded, keyed by installation, so a project is only ever pointed at an owner its installation covers. - follow_renames is one statement (the picker cache in a data-modifying CTE), with a comment on the fixed github.com host. - installation_target renamed: GitHub is asked what the account is called now and only a rename to that name is applied (a late acme->beta after beta->acme can't be told apart by logins). The installation's login changes only from `from`; URLs move only when it did, when it already reads `to`, or when no installation row exists. The unguarded store in installations::from_webhook is gone, and an installation whose account login isn't a valid login isn't recorded. - repo_api's doc says which client refuses redirects. Tests: an unreadable repo doesn't stop the sync (others followed, it isn't renamed, it's unlinked), a GitLab project with the same ID and a 404 repo keep their URLs; stale and rejected-login renames change nothing; the existing check run is PATCHed and the comment edited by ID after a rename; linking's visibility/licence check is proven to use /repositories/42.
ndbroadbent
added a commit
that referenced
this pull request
Dec 5, 2026
…Hub's current login Review fixes for #278 (246d357): - collaborators returns None (unseen, so unlinked) only for a 404 or a 403 "Resource not accessible by integration" without retry-after. A rate limit's answer (429, or a 403 with no calls left, retry-after or a rate-limit message) is an error rate_limited() recognises, from get(), collaborators and installation_token alike, so the hourly sync defers with a healthy heartbeat. Any other 403 fails the run and unlinks nobody. - account_renamed: once GitHub confirms the delivery's new login, the installation's login is set to GitHub's whatever VisualCI had, and URLs and picker names move from both the delivery's `from` and the stored login, so acme->beta->gamma delivered after GitHub says gamma, or a lost delivery, ends at gamma. - follow_renames is compare-and-set: reach snapshots each link's URL before asking GitHub, and a URL a webhook changed meanwhile isn't overwritten. - A repository renamed/transferred delivery moves only links through the installation that sent it (a delivery without an installation is ignored). Tests: secondary-limit, primary-limit and 429 answers defer and leave the project linked; a bare 403 errors without unlinking; acme->beta->gamma and a lost delivery end at gamma; the sync doesn't undo a webhook's newer URL; a rename leaves another installation's link to the same repository alone.
ndbroadbent
added a commit
that referenced
this pull request
Dec 5, 2026
…count renames change nothing Review fixes for #278: - reach: a repository whose collaborators answer 403 or 404 (a public repo transferred to an account the installation doesn't cover) is unseen, so its links are unlinked, instead of failing the hourly sync for everyone. A 403 with no calls left is still the rate limit's error. Its path is recorded for follow_renames only after collaborators succeeded, keyed by installation, so a project is only ever pointed at an owner its installation covers. - follow_renames is one statement (the picker cache in a data-modifying CTE), with a comment on the fixed github.com host. - installation_target renamed: GitHub is asked what the account is called now and only a rename to that name is applied (a late acme->beta after beta->acme can't be told apart by logins). The installation's login changes only from `from`; URLs move only when it did, when it already reads `to`, or when no installation row exists. The unguarded store in installations::from_webhook is gone, and an installation whose account login isn't a valid login isn't recorded. - repo_api's doc says which client refuses redirects. Tests: an unreadable repo doesn't stop the sync (others followed, it isn't renamed, it's unlinked), a GitLab project with the same ID and a 404 repo keep their URLs; stale and rejected-login renames change nothing; the existing check run is PATCHed and the comment edited by ID after a rename; linking's visibility/licence check is proven to use /repositories/42.
ndbroadbent
added a commit
that referenced
this pull request
Dec 5, 2026
…Hub's current login Review fixes for #278 (246d357): - collaborators returns None (unseen, so unlinked) only for a 404 or a 403 "Resource not accessible by integration" without retry-after. A rate limit's answer (429, or a 403 with no calls left, retry-after or a rate-limit message) is an error rate_limited() recognises, from get(), collaborators and installation_token alike, so the hourly sync defers with a healthy heartbeat. Any other 403 fails the run and unlinks nobody. - account_renamed: once GitHub confirms the delivery's new login, the installation's login is set to GitHub's whatever VisualCI had, and URLs and picker names move from both the delivery's `from` and the stored login, so acme->beta->gamma delivered after GitHub says gamma, or a lost delivery, ends at gamma. - follow_renames is compare-and-set: reach snapshots each link's URL before asking GitHub, and a URL a webhook changed meanwhile isn't overwritten. - A repository renamed/transferred delivery moves only links through the installation that sent it (a delivery without an installation is ignored). Tests: secondary-limit, primary-limit and 429 answers defer and leave the project linked; a bare 403 errors without unlinking; acme->beta->gamma and a lost delivery end at gamma; the sync doesn't undo a webhook's newer URL; a rename leaves another installation's link to the same repository alone.
ndbroadbent
force-pushed
the
github-renames
branch
from
December 5, 2026 09:10
7c9e713 to
0c1079b
Compare
ndbroadbent
added a commit
that referenced
this pull request
Dec 5, 2026
…count renames change nothing Review fixes for #278: - reach: a repository whose collaborators answer 403 or 404 (a public repo transferred to an account the installation doesn't cover) is unseen, so its links are unlinked, instead of failing the hourly sync for everyone. A 403 with no calls left is still the rate limit's error. Its path is recorded for follow_renames only after collaborators succeeded, keyed by installation, so a project is only ever pointed at an owner its installation covers. - follow_renames is one statement (the picker cache in a data-modifying CTE), with a comment on the fixed github.com host. - installation_target renamed: GitHub is asked what the account is called now and only a rename to that name is applied (a late acme->beta after beta->acme can't be told apart by logins). The installation's login changes only from `from`; URLs move only when it did, when it already reads `to`, or when no installation row exists. The unguarded store in installations::from_webhook is gone, and an installation whose account login isn't a valid login isn't recorded. - repo_api's doc says which client refuses redirects. Tests: an unreadable repo doesn't stop the sync (others followed, it isn't renamed, it's unlinked), a GitLab project with the same ID and a 404 repo keep their URLs; stale and rejected-login renames change nothing; the existing check run is PATCHed and the comment edited by ID after a rename; linking's visibility/licence check is proven to use /repositories/42.
ndbroadbent
added a commit
that referenced
this pull request
Dec 5, 2026
…Hub's current login Review fixes for #278 (246d357): - collaborators returns None (unseen, so unlinked) only for a 404 or a 403 "Resource not accessible by integration" without retry-after. A rate limit's answer (429, or a 403 with no calls left, retry-after or a rate-limit message) is an error rate_limited() recognises, from get(), collaborators and installation_token alike, so the hourly sync defers with a healthy heartbeat. Any other 403 fails the run and unlinks nobody. - account_renamed: once GitHub confirms the delivery's new login, the installation's login is set to GitHub's whatever VisualCI had, and URLs and picker names move from both the delivery's `from` and the stored login, so acme->beta->gamma delivered after GitHub says gamma, or a lost delivery, ends at gamma. - follow_renames is compare-and-set: reach snapshots each link's URL before asking GitHub, and a URL a webhook changed meanwhile isn't overwritten. - A repository renamed/transferred delivery moves only links through the installation that sent it (a delivery without an installation is ignored). Tests: secondary-limit, primary-limit and 429 answers defer and leave the project linked; a bare 403 errors without unlinking; acme->beta->gamma and a lost delivery end at gamma; the sync doesn't undo a webhook's newer URL; a rename leaves another installation's link to the same repository alone.
ndbroadbent
force-pushed
the
github-renames
branch
3 times, most recently
from
December 5, 2026 14:57
195ece8 to
3d86791
Compare
GitHub answers a renamed repository's old /repos/{owner}/{name} path with a
301, which VisualCI's client doesn't follow, so a rename (on 5 Dec 2026 the
visualci-com organization became visualcihq) broke checks and PR comments.
- Calls about a linked repository go to /repositories/{id}/... when GitHub's
ID is known: check runs, PR comments, branch checks, collaborators and the
visibility/licence check (now one call instead of two). /repos/{path} stays
only for links without an ID and for linking by a typed URL.
- The hourly sync already reads each linked repository's name by ID; it now
gives projects (and the picker's user_repositories cache) the current
https://github.com/<full_name> where it differs.
- installation_target "renamed" updates github_installations.account_login and
rewrites the installation's project URLs and cached repository names under
the old login (case-insensitive) to the new one.
Tests: ID-based URLs (stale URL still posts by ID; no ID posts by name), the
sync following renames, an installation_target delivery; fakes moved to the
/repositories/{id} form.
…ry's ID path; the changelog line is an entry file
ndbroadbent
force-pushed
the
github-renames
branch
from
December 5, 2026 15:51
91f7610 to
41e57a3
Compare
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.
Why
On 5 Dec 2026 the GitHub organization
visualci-comwas renamed tovisualcihq. GitHub answers a renamed repository's old/repos/{owner}/{name}/...path with a 301, and VisualCI's outbound client follows no redirects, so every check run and PR comment for a project with a stalerepository_urlfailed. A coordinator fixedprojects.repository_urlby hand in production; this makes VisualCI handle it on its own.What changes
Calls by GitHub's permanent repository ID.
github_app::repo_api/Repository::github_api_pathgive/repositories/{id}when the numeric ID is known, and/repos/{owner}/{name}only when it isn't. Moved to it:forge/report.rs);sync::close_deleted_branches(one call fewer: no separate lookup of the path by ID);webhooks::reach;open_source(oneGET /repositories/{id}instead of looking up the path by ID and thenGET /repos/{path}).Still path-based, on purpose: linking a repository by the URL someone typed (
installation_for,permission,repository_id). The ID isn't known yet at that point, and the name is current.The hourly sync follows renames.
reachalready reads each linked repository'sfull_nameby ID. It now records that name (Reach::paths), andsync::follow_renamessetsprojects.repository_urltohttps://github.com/<full_name>where it differs. It also updates the repository picker'suser_repositories.full_namecache, so the picker doesn't try to link by a stale name. Both are one bulk query each.Syncedgains arenamedcount.installation_target/renamed.installations::from_webhooksetsgithub_installations.account_loginto the new login.webhooks::handle(ForgeEvent::AccountRenamed) rewrites therepository_urlof github projects on that installation whose owner segment is the old login (case-insensitive), and the installation'suser_repositories.full_name. Both logins are checked as GitHub logins before use.The
repositoryrenamed/transferredhandling (ForgeEvent::Moved) is unchanged; links still match by ID.docs/design.mddescribes this under "Keeping in step", and there's a changelog line under 2026-12-05.Tests
forge_reports::a_renamed_repository_still_gets_its_check_and_comment: the stored URL is stale,/repos/*answers 301, stray requests are refused, and the check and comment still go to/repositories/42/....forge_reports::a_link_without_its_repository_id_posts_by_name: a link with no ID falls back to/repos/acme/web/....forge_sync::a_renamed_repository_is_followed_within_the_hour: an organization rename and a repository rename are both followed, the picker cache is updated, and a second run changes nothing.webhooks::a_renamed_account_moves_its_installations_projects: aninstallation_targetdelivery updates the login, matches the old owner case-insensitively, and leaves another account's and another installation's projects alone./repositories/{id}.The full
cargo test --test apppassed (421 tests), andcargo clippy --all-targetsis clean.Outside the repo
The App's webhook event subscriptions are set in the GitHub App's settings, not in this repo. GitHub's docs say
installationis sent to every App automatically; they don't say whetherinstallation_targetis too. Check the App's settings or its delivery log after the next account rename. If the event isn't delivered, the hourly sync still follows the rename within an hour.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.