Skip to content

fix(yield): group attribution by canonical repo root, not path string#714

Open
ozymandiashh wants to merge 1 commit into
mainfrom
fix/713-yield-canonical-repo-grouping
Open

fix(yield): group attribution by canonical repo root, not path string#714
ozymandiashh wants to merge 1 commit into
mainfrom
fix/713-yield-canonical-repo-grouping

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

Closes #713.

Problem

The single-owner attribution from #692 enforces "one commit, one owner" per launch-directory string: repo groups are keyed by the raw projectPath while getCommitsInRange runs git log --all with no pathspec. Sessions launched from two subdirectories of one monorepo (or from linked worktrees) form independent groups that each pull the identical repo-wide history, and the same commit is credited once per group - one commit, two productive sessions, commitCount 2. Repro details in the issue; every pre-existing test stayed green because each used a single path per repo.

Fix

  • Repo groups key on the canonical root (git rev-parse --show-toplevel), resolved once per path and cached.
  • Linked worktrees unify via --git-common-dir, both sides realpath-canonicalized before comparison (symlinks, platform case-insensitivity). If git or realpath fails, the session degrades to the existing cwd fallback; a comment documents the accepted residual for a main repo moved after git worktree add (git's own metadata is stale in that state).
  • Non-git and missing paths keep the current behavior.

Verification

The single-owner attribution from #692 keyed repo groups by the raw
project.projectPath string while getCommitsInRange runs git log --all
repo-wide, so a monorepo (sessions launched from different subdirectories)
or linked worktrees formed multiple groups that each pulled the identical
history and the same commit was credited once per group.

- repo groups are keyed by git rev-parse --show-toplevel, resolved once per
  path and cached
- linked worktrees unify through --git-common-dir, with both sides realpath-
  canonicalized before comparison (symlinks, platform case); when git or
  realpath fails the session degrades to the existing cwd fallback, and a
  comment documents the accepted residual for repos moved after worktree add
- regression tests: two sessions from two subdirectories of one repo, and a
  linked-worktree pair - both mutation-checked to fail if the grouping or
  the common-dir merge is removed; exactly one productive owner and
  commitCount 1 in each

Closes #713
@iamtoruk

Copy link
Copy Markdown
Member

Apologies — this collided with a maintainer-side fix (#719) that was developed in parallel straight off your issue writeup, before we saw this PR; entirely our process miss for not checking the issue's linked PRs first. #719 landed on the same design you proposed (canonical grouping, worktrees unified via realpath'd common-dir, separate repos guarded), so the bug itself is fixed on main.

Two details in yours look potentially additive over #719: the explicit platform case-insensitivity handling in the canonical comparison, and the documented residual for a main repo moved after git worktree add. If either isn't fully covered by #719's realpath canonicalization, a focused follow-up PR for the delta would be very welcome — and either way, thank you for both the sharpest bug report this repo has received and a complete fix to go with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

yield: single-owner attribution double-credits commits across monorepo subdirs and worktrees (groups keyed by path string, not repo root)

2 participants