Skip to content

fix(projects): reclaim the last project rule after projects remove #802

Description

@jeff-r2026

Problem

After teamai projects remove <id>, a member whose only delivered team rule came from that project can retain the deployed rule after teamai pull --force. This violates the remove/reclaim acceptance criterion in #756 and the behavior documented in #774.

Evidence

Reproduction case

  1. In a team repo, define project alpha with one rule in its exclusive knowledge namespace. Keep that rule in the repo. Do not define any shared or role-delivered rule for the member.
  2. Activate alpha in a member directory and run teamai pull --force; confirm the rule is deployed locally.
  3. Remove alpha from manifest/projects.yaml using teamai projects remove alpha, merge the manifest change, then run teamai pull --force in the same member directory.
  4. The project rule is no longer selected, but pullAllRules() sees zero rules and returns before removing the local copy.

This is a code-path finding; the exact zero-rule scenario is not covered by the PR's real-CLI test.

Expected behavior

The next pull reclaims rules previously deployed by TeamAI for the removed project, including when the desired rule set is empty, while preserving user-authored or locally modified rules.

Suggested verification

Extend the real-CLI remove e2e in #774 with a case that has no shared or role rule. Assert that the project rule disappears after pull. Add a guard assertion that a personal rule in the same tool directory survives. Preserve the existing data-safety behavior rather than sweeping every file when the desired set is empty.

Related: #756, #774.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions