Repository navigation
fix(push): merge a self-mode teamai.yaml edit onto the default branch - #1837
Conversation
A self mode push wrote the member's whole working-tree `teamai.yaml` over the worktree's copy of the default branch, so a setting a teammate landed there since the member's HEAD was reverted by the pushed branch. The git-mode path merges the edit instead (Tencent#1831); self mode now does the same before it hands the config to `pushCore`. The base is the config committed at the member's HEAD, which is what the edit was made against, and the destination is the worktree's `origin/<default>`. Two edits of one key still refuse the push, with `mergeTeamConfig`'s message. Fixes Tencent#1835
|
No findings in the specified diff. The PR description documents sufficient testing, including representative real-CLI verification of both the successful merge and conflict refusal. No PR code was run, built, or installed. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Looks right. Merging the self-mode edit with mergeTeamConfig gives the same three-way merge git mode got in #1831:
- the base is the
teamai.yamlat the member'sHEAD; - the destination is the copy in the disposable worktree at
origin/<default>; pushCoreandpushTeamConfigOnlyreceive the merged text.
The before and after runs in the description match #1835's report, and the conflict case is refused with nothing pushed.
One thing before it can merge: #1836 landed on main after this branch was cut and also changes src/push.ts. Please merge main into the branch so CI runs on the combined code, and I'll take another look at the new head.
[P3 nit] Two small things:
- The new
Conflicting keysrefusal on a self-mode push deserves a CHANGELOG line. A push that used to succeed, while reverting a teammate's setting, now stops. - With
--branchonto an existing branch older than the default branch, the second merge inprepareExplicitBranchbrings the default branch's newer keys into that branch. Merging the branch into the default branch is harmless, but its diff shows them.
|
No findings in the specified diff. The earlier review reported no findings, so none require resolution. The PR description documents sufficient testing, including representative real-CLI verification of successful merging and conflict refusal. No PR code was run, built, or installed. |
A self-mode
teamai pushcarries the member's working-treeteamai.yamlinto the disposable worktree, which is checked out atorigin/<default>. It wrote the whole working file over that copy, so a setting a teammate had landed since the member'sHEADwas absent from the pushed branch — merging that branch reverted the teammate's setting. Git mode already merges the edit (#1831); self mode now merges it the same way, before handing the config topushCore.What changed
src/push.ts—pendingSelfTeamConfigkeeps its "is the working copy edited" check, and itsHEADread becomescommittedSelfTeamConfigso the merge below uses the same commit. In the self-mode worktree callback, the pending edit is merged onto the worktree'steamai.yamlwith thatHEADcopy as the base, and the merged text is what is written and whatpushCorereceives.src/__tests__/e2e/self-mode-push-behind.test.ts— two cases: the pushed branch holds the teammate'sautoUpdate: falseand the member'ssubmodules: false; and two different values for one key refuse the push (Conflicting keys: <key>), create no branch, and leave the member's edit in place.Tests
mainfor the reported reason:expected '<config>' to contain 'autoUpdate: false'/to contain 'Conflicting keys: submodules'.npm run test:e2e -- src/__tests__/e2e/self-mode-push-behind.test.ts: 28 passed.npm run typecheck,npm run lint,npx vitest run src/__tests__/yaml.test.ts: pass.Real CLI, in a verify world:
mainworld (Build 9ab114832433, teamai 0.22.0, sha256 02a1b9f0c4d0): teammate landsautoUpdate: falseonorigin/main; the member, not merged, appendssubmodules: falseand runsteamai push --all. The pushed.teamai/teamai.yamlholds onlysubmodules: false— the reported diff.Build 9ab114832433+dirty, teamai 0.22.0, sha256 7cc5358143af): same steps pushautoUpdate: falseandsubmodules: false;git diff main..teamai/push/...adds only+submodules: false. A second run, after the teammate setssubmodules: trueonorigin/main, exits 1 withPush failed: Conflicting keys: submodules., creates no branch, and leaves the member's file unchanged.sh <run> git fetch originpreceded both pushes, so the member's checkout was behindorigin/mainas in the report.teamai uninstallgap #1808 (project/.teamai,project/.claude, theteamai-reportsworktree and refs); the push writes none of them.Surfaces
teamai push, including--all,--dry-run(the merge runs against the disposable worktree, as the carry did before, and a conflict refuses the preview), and a config-only push (pushTeamConfigOnlyreceives the merged text).--branch: the merge runs beforepushCorefor every self-mode push, so an explicit branch receives merged content;prepareExplicitBranch's own merge then sees the edit relative to the sameHEADand is a no-op. A new--branchname is refused earlier onmainfor an unrelated reason, so it is not a separate test here.HEADread, unchanged by this fix. Windows: the merge is path/git showonly; CI runs the E2E subset.Fixes #1835.