Skip to content

fix(import): prevent duplicate MRs from metadata-only diffs#190

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:worktree-fix-import-mr-dedup
Jul 17, 2026
Merged

fix(import): prevent duplicate MRs from metadata-only diffs#190
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:worktree-fix-import-mr-dedup

Conversation

@m0Nst3r873

Copy link
Copy Markdown
Contributor

Summary

  • Add isMetadataOnlyDiff() guard in pushRepoBranch — when all staged changes are just timestamp fields (lastUpdated, lastScan, syncedAt), skip branch creation and MR creation entirely
  • Fix test isolation: mock config.js in import-repo tests to prevent leaking writes to the real team-repo when ~/.teamai/config.yaml exists

Root Cause

teamai import --from-repo generates files with timestamp fields that change every run. This causes git diff to always report changes, so every execution creates a new MR — even when the actual codebase content hasn't changed. On the HyperAI/teamai TGit repo, this produced 17+ duplicate "Import codebase knowledge" MRs.

Test plan

  • npx tsc --noEmit — no type errors
  • npx vitest run src/__tests__/git.test.ts — 26 tests pass (including new metadata-only diff tests)
  • npx vitest run src/__tests__/import-repo-merge.test.ts — 3 tests pass (previously 1 failed due to missing config mock)
  • npx vitest run src/__tests__/import-repo-incremental.test.ts — passes with config isolation
  • npm run build — build success

🤖 Generated with Claude Code

Add isMetadataOnlyDiff() guard in pushRepoBranch — when all staged
changes are just timestamp fields (lastUpdated, lastScan, syncedAt),
skip branch creation and MR. Also fix test isolation: mock config.js
in import-repo tests to prevent leaking writes to the real team-repo.

--story=1032854480

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jeff-r2026
jeff-r2026 merged commit 815ff74 into Tencent:main Jul 17, 2026
6 checks passed
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.

2 participants