Skip to content

fix(scope): close remaining #85 scope-isolation gaps - #97

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
jeff-r2026:fix-issue-85-scope-isolation
Jul 1, 2026
Merged

fix(scope): close remaining #85 scope-isolation gaps#97
jeff-r2026 merged 1 commit into
Tencent:mainfrom
jeff-r2026:fix-issue-85-scope-isolation

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Summary

#73/#77 fixed recall's dual-scope merge and #91 fixed auto-recall's upvote scope, but #85 flagged four more places where project vs user scope still leaked into each other. This closes the remaining gaps:

  • hooks-cmd.ts: hooks inject/hooks remove reconciled the user-home copy of team hooks using the project's manifest instead of the user's own, diverging from pull.ts's per-scope reconcile and risking duplicate injection / wrongful cleanup of shared tool settings files (e.g. ~/.cursor/hooks.json).
  • tags.ts: subscribe/unsubscribe/list/add/remove always read and wrote ~/.teamai/config.yaml, ignoring project-scope installs entirely.
  • contribute.ts: wrote new learnings to the team repo but never rebuilt the local search index, so recall couldn't see a fresh contribution until the next pull.
  • types.ts / config.ts: getTeamaiHome()/resolveBaseDir() silently fell back to the user home directory when a project LocalConfig was missing projectRoot (e.g. a pre-migration config.yaml). Now detectProjectConfig()/loadLocalConfigForScope() backfill projectRoot from the directory the config was actually loaded from, and the scope helpers throw instead of silently degrading if it's ever still missing.

Closes #85

Test plan

  • npx tsc --noEmit — zero errors
  • npx vitest run — 130 files / 1686 tests passed
  • New e2e suite (scope-isolation-e2e-issue85.test.ts) drives the built CLI against real git fixtures, covering all four fixes: hooks manifest scoping + inject idempotency + remove cleanup, tags scope isolation, contribute→recall immediacy, and the projectRoot backfill
  • Strengthened hooks-cmd.test.ts to assert the project/user manifest paths are distinct and correctly scoped
  • Updated the two scope.test.ts cases that previously asserted the old silent-fallback behavior to assert the new throw instead

🤖 Generated with Claude Code

Tencent#73/Tencent#77 fixed recall's dual-scope merge and Tencent#91 fixed auto-recall's
upvote scope, but issue Tencent#85 flagged four more spots where project vs
user scope still leaked into each other:

- hooks-cmd.ts: `hooks inject`/`hooks remove` reconciled the user-home
  copy of team hooks using the PROJECT's manifest instead of the
  user's own, diverging from pull.ts's per-scope reconcile and risking
  duplicate injection / wrongful cleanup of shared tool settings files.
- tags.ts: subscribe/unsubscribe (and list/add/remove) always read and
  wrote ~/.teamai/config.yaml, ignoring project-scope installs.
- contribute.ts: wrote new learnings to the team repo but never
  rebuilt the local search index, so `recall` couldn't see a
  contribution until the next `pull`.
- types.ts/config.ts: getTeamaiHome()/resolveBaseDir() silently fell
  back to the user home directory when a project LocalConfig was
  missing `projectRoot` (e.g. a pre-migration config.yaml). Now
  detectProjectConfig()/loadLocalConfigForScope() backfill projectRoot
  from the directory the config was actually loaded from, and the
  scope helpers throw instead of silently degrading if it's ever
  still missing.

Added an e2e suite (scope-isolation-e2e-issue85.test.ts) that drives
the built CLI against real git fixtures to cover all four fixes
end-to-end, plus unit coverage in hooks-cmd.test.ts/scope.test.ts.

Closes Tencent#85

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jeff-r2026
jeff-r2026 merged commit 1d4f356 into Tencent:main Jul 1, 2026
3 of 7 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.

[bug] project/user scope 隔离不完整:recall 仍双 scope、auto-recall upvote 落 user、hooks inject 与 pull manifest 不一致

1 participant