Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/uidrift-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ jobs:
# blob content. On a blobless clone a one-day window spent 82
# seconds lazy-fetching and then died on the promisor remote.
git -c "http.extraheader=${header}" clone --quiet \
--no-checkout --single-branch --branch master \
--no-checkout --single-branch \
https://github.com/wandb/core.git "$CORE_REPO"

git -C "$CORE_REPO" log -1 --format='wandb/core master at %h (%ci)' origin/master
git -C "$CORE_REPO" log -1 --format='wandb/core default branch at %h (%ci)' origin/HEAD

- name: Scan for label drift
id: scan
Expand Down
2 changes: 1 addition & 1 deletion scripts/uidrift/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def path(self) -> Path:
owner_repo="wandb/core",
local_path_env="CORE_REPO",
local_path_default="~/core",
default_head="origin/master",
default_head="origin/HEAD",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Local drift scans miss renamed branch

After core's branch rename, default_head can still select master in an existing checkout. origin/HEAD is a local symbolic ref that ordinary fetches do not retarget. Local scans then miss commits on main, or fail if master is pruned.

Learn more

A fresh CI clone sets origin/HEAD from the remote default. Existing local checkouts keep their own symbolic origin/HEAD, which a normal fetch does not retarget when the server renames its default branch. scan uses that symbolic ref to select the entire commit range; ownership also reads through it. If the old remote-tracking branch remains, local scans silently keep reporting against it; if it is removed, the scan cannot resolve its head.

Example: A local checkout has origin/HEAD -> origin/master. Core renames master to main and the user fetches origin/main. Running the default scan still selects origin/master, instead of the commits on origin/main.

Recommended fix: Resolve the source remote's advertised HEAD before selecting a default head in an existing checkout, or refresh origin/HEAD with git remote set-head origin -a after fetching the new branch. Ensure the default also handles checkouts where origin/HEAD was never initialized.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gap is real, but it only affects existing local clones of wandb/core after the rename, and this PR didn't introduce it. The old origin/master default breaks the same way once master is renamed away. CI isn't affected: uidrift-scan.yml makes a fresh --single-branch clone on every run, so origin/HEAD points at the current default branch. The core cutover runbook tells engineers to run git remote set-head origin -a, which fixes local clones. I left the code alone because refreshing origin/HEAD inside the scanner would add a network call to local runs. If a maintainer wants that, it can go in a follow-up PR.

token_env="WANDB_CORE_TOKEN",
ui_roots=("frontends/app/src",),
ui_exts=(".tsx", ".jsx"),
Expand Down
2 changes: 1 addition & 1 deletion scripts/uidrift/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def scan(
# Resolved once for the whole run rather than per finding; the caches are
# process-local, so a fresh run always re-reads them. `head` is passed so
# ownership reads the same ref the range came from -- a `--head` scan whose
# reviewers were ranked against `origin/master` names the wrong people.
# reviewers were ranked against `origin/HEAD` names the wrong people.
ownership.reset_caches(head=head)

raw: list = []
Expand Down
6 changes: 3 additions & 3 deletions scripts/uidrift/tests/test_ownership.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def setUpClass(cls) -> None:
(repo / ".github").mkdir(parents=True, exist_ok=True)
_commit(repo, ".github/CODEOWNERS", CODEOWNERS, "Ada Lovelace")

# config.SOURCE.default_head is origin/master, which a fresh repo lacks.
# config.SOURCE.default_head is origin/HEAD, which a fresh repo lacks.
_git(repo, "update-ref", f"refs/remotes/{config.SOURCE.default_head}", "HEAD")

@classmethod
Expand Down Expand Up @@ -306,14 +306,14 @@ class TestHeadSelection(OwnershipTestCase):
"""Ownership must read the ref `scan` actually scanned.

`scan` exposes `--head`, and both answers here come from git history, so a
scan of a non-default ref that ranked reviewers against `origin/master`
scan of a non-default ref that ranked reviewers against `origin/HEAD`
would name people who never touched the commits in the range.
"""

@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
# A ref origin/master does not contain: one more author on members.tsx
# A ref origin/HEAD does not contain: one more author on members.tsx
# and a CODEOWNERS that routes the app to a different team.
_git(cls.repo, "checkout", "-q", "-b", "feature")
_commit(cls.repo, f"{UI}/members.tsx", "linus", "Linus Torvalds")
Expand Down
Loading