Skip to content

Add --global integration test for prompt value reuse #341

@bguidolim

Description

@bguidolim

Summary

GlobalSyncStrategy.makeConfigContext was updated in #339 to thread priorValues through, but no integration test runs the full prompt-reuse flow in global scope (mcs sync --global). Strategy symmetry with ProjectSyncStrategy gives high confidence the behavior is correct, but explicit coverage is worth having.

Why this matters

Two things interact that are both tested individually but not in combination:

  1. Global scope reads/writes ~/.claude/.mcs-global via ProjectState(stateFile:) — different path, same model.
  2. Global scope filters out fileDetect prompts in ExternalPackAdapter.declaredPrompts via context.isGlobalScope.

The partition logic already excludes fileDetect from answerable types, so the two filters compose correctly — but a regression in either filter could silently corrupt reuse in global scope without any test failing.

Proposed fix

Add one case to PromptValueReuseLifecycleTests (Tests/MCSTests/LifecycleIntegrationTests.swift) using LifecycleTestBed.makeGlobalSyncConfigurator() (already exists in TestHelpers.swift):

  1. Seed ~/.claude/.mcs-global's resolvedValues with a few input prompts.
  2. Run sync with a MockPromptTechPack in global scope.
  3. Verify the stored values are reused (not overwritten by the mock's defaultAnswer).

Bonus: assert that a fileDetect prompt declared by the same pack is correctly filtered out in global scope (not asked, not partitioned).

Scope

  • Tests/MCSTests/LifecycleIntegrationTests.swift — one new test, ~30 lines mirroring the existing project-scope cases

Related

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