fix(list): don't give a remote-only default-branch row a self-relation#3383
Merged
Conversation
JSON schema 2's `from_list_item` decides whether a row is the default
branch by comparing its name against the repo default. It compared the
raw `item.branch`, which for a remote row is remote-qualified
("origin/main"), so a remote-only row of the default branch failed the
name check and received a spurious self-referential `default_branch`
relation object (with all-null counts). Compare the remote-stripped
`branch` instead, matching the split performed just above.
Adds a regression test alongside the existing local default-branch case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 task
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.
Nightly sweep finding: a small correctness fix in the new JSON schema 2 output (#3357).
JsonItemV2::from_list_itemdecides whether a row is the repo's default branch (and therefore gets nodefault_branchrelation object) by comparing the row's name against the default branch name. It compared the rawitem.branch, but a remote-only row stores the remote-qualified name (origin/main) — which the split just above turns into the barebranch(main). So a remote-only row of the default branch failed the name check and was handed a spurious self-referentialdefault_branchrelation whose counts all degrade tonull, contradicting the documented schema-2 contract that the default branch's own row carries no relation.The fix compares the remote-stripped
branchlocal instead ofitem.branch. Local rows are unaffected (branch == item.branchthere).Test
Adds
test_remote_default_branch_row_has_no_relationnext to the existing local-case test. Verified it fails before the fix (the row gets adefault_branchobject) and passes after.Scope / impact
Low impact — this only affects a remote-only row that is exactly the default branch, which is rare (the default branch normally has a local worktree). It's a schema-contract correctness fix rather than a user-visible bug, surfaced by the nightly review of yesterday's commits.