Skip to content

Add multi-project integration test for shared global packs #260

@bguidolim

Description

@bguidolim

Problem

Issue #121 added end-to-end lifecycle integration tests covering 9 scenarios, but no test exercises two projects sharing global packs with different per-project configurations. This is the last untested cross-component interaction path identified in #121.

What's missing

When two projects share global packs (brew packages, plugins, MCP servers with user scope), the reference counting system (ResourceRefCounter + ProjectIndex) must ensure:

  • Global resources are not removed when one project deselects a pack but another still uses it
  • mcs pack remove correctly discovers all affected scopes and unconfigures each
  • ProjectIndex accurately tracks which projects use which packs

No existing test exercises this multi-scope interaction end-to-end.

Proposed Solution

Add a multi-project integration test scenario:

Scenario: Two projects sharing a global pack

  1. Create two temp projects (A and B) under the same sandbox home
  2. Create a pack with a brew package, MCP server, and template
  3. Configure project A with the pack → verify artifacts installed, project index updated
  4. Configure project B with the same pack → verify project index has both entries
  5. Remove the pack from project A → verify:
    • Global resources (brew, plugins) are NOT removed (project B still uses them)
    • Project A's local artifacts (template sections, settings, hooks) ARE removed
    • Project index still has project B's entry
  6. Remove the pack from project B → verify:
    • Global resources are now removed (ref count = 0)
    • Project index has no entries for this pack

Implementation notes

  • Builds on the LifecycleTestBed infrastructure from Add end-to-end integration tests for full pack lifecycle #121
  • Needs two Configurator instances (one per project) sharing the same Environment(home:) and MockClaudeCLI
  • ResourceRefCounter reads ProjectIndex to decide whether to remove shared resources — this is the critical cross-project interaction to verify
  • Keep tests hermetic: sandbox home, no real ~/ paths

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttest-gapMissing test coverage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions