Skip to content

fix(list): don't give a remote-only default-branch row a self-relation#3383

Merged
max-sixty merged 1 commit into
mainfrom
nightly/clean-28849122595
Jul 8, 2026
Merged

fix(list): don't give a remote-only default-branch row a self-relation#3383
max-sixty merged 1 commit into
mainfrom
nightly/clean-28849122595

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Nightly sweep finding: a small correctness fix in the new JSON schema 2 output (#3357).

JsonItemV2::from_list_item decides whether a row is the repo's default branch (and therefore gets no default_branch relation object) by comparing the row's name against the default branch name. It compared the raw item.branch, but a remote-only row stores the remote-qualified name (origin/main) — which the split just above turns into the bare branch (main). So a remote-only row of the default branch failed the name check and was handed a spurious self-referential default_branch relation whose counts all degrade to null, contradicting the documented schema-2 contract that the default branch's own row carries no relation.

The fix compares the remote-stripped branch local instead of item.branch. Local rows are unaffected (branch == item.branch there).

Test

Adds test_remote_default_branch_row_has_no_relation next to the existing local-case test. Verified it fails before the fix (the row gets a default_branch object) 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.

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>
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Jul 7, 2026
@max-sixty
max-sixty merged commit 8614958 into main Jul 8, 2026
36 of 45 checks passed
@max-sixty
max-sixty deleted the nightly/clean-28849122595 branch July 8, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants