Skip to content

fix(hooks): sync after rebase and diagnose disabled git hooks - #983

Open
SaulMoro wants to merge 2 commits into
Tencent:mainfrom
SaulMoro:fix/git-hook-rebase-disabled-status
Open

SaulMoro wants to merge 2 commits into
Tencent:mainfrom
SaulMoro:fix/git-hook-rebase-disabled-status

Conversation

@SaulMoro

@SaulMoro SaulMoro commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

 git pull
   merge  -> post-merge -> sync
-  rebase -> no sync
+  rebase -> post-rewrite(rebase) -> sync

 doctor
-  registered hook -> pass
+  registered + enabled hook -> pass
+  disabled hook/event -> actionable failure

Rebase reuses the existing capped inline pull and detached retry. Amend does not sync; pull preserves explicit disable settings.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature
  • Breaking change
  • Documentation only
  • Refactor / internal cleanup

Evidence

  • Before: the built-CLI divergent-rebase regression exited 0 but failed with a missing delivered rule. A named hook set to enabled=false still returned installed: true.
    After: real Git/CLI checks deliver resources before merge and rebase return, deliver only after conflict resolution, ignore amend, and diagnose disabled hooks. Reactivation restores new-worktree delivery; pull keeps enabled=false.

Test Plan

  • npx tsc --noEmit
  • npm run lint
  • npx vitest run: 8,023 passed, 20 skipped; 387 test files passed, 1 skipped.
  • Added/updated public-interface regressions, including global/local disable settings and legacy hook-script ownership/removal.
  • npm run build
  • Real CLI: npx vitest run --config vitest.e2e.config.ts src/__tests__/e2e/git-hook-new-worktree.test.ts --retry 0: 32 passed with Git 2.55, local Git remotes and isolated HOME. Covers merge/rebase, configured rebase, conflict continuation, amend, disabled diagnostics/reactivation, lock failure records and uninstall. Detached children are joined before cleanup.
  • After the documentation/constant-name follow-up: 113 handler tests, typecheck/lint/build and six focused real-CLI rebase/doctor cases passed again at 9cdd4f28.
  • git diff --check

Extra providers and agent coverage are left to CI; one representative real-CLI run is sufficient. English/Chinese usage guides and affected skill-data are synchronized.

Related Issues

No linked issue.

Merge Danger

Door: two-way

Revert the code. For projects that already pulled this version, also remove hook.teamai-post-rewrite from local Git config; on older Git remove only its TeamAI-marked block from .git/hooks/post-rewrite. Preserve the owner's script. Normal uninstall removes the new hook too.

Blast Radius: hooks

Project Git synchronization and its doctor check. Named disable settings require Git 2.54+; event disable settings require Git 2.55+. Existing hook managers and explicit disable settings are preserved.

Notes for Reviewers

The new event uses existing install/remove loops and the same synchronization handler. Review the rebase-only guard, effective activation check and preservation of other hooks.

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.

1 participant