Skip to content

Add integration tests for 'mcs update' command #347

@bguidolim

Description

@bguidolim

Follow-up from #346.

The new mcs update command has resolver-level unit tests covering scope selection, pruning, and the dry-run guard, but no command-level integration tests exist. Adding them would prevent regressions around behaviors that the resolver tests can't reach end-to-end.

Coverage to add

  • --dry-run does not write the registry, project state, project index, or lockfile.
  • Lockfile gating: generate-lockfile=true writes; generate-lockfile=false is silent; unset emits a drift warning when a stale lockfile exists.
  • --all-projects fans out to every project tracked in the index after the confirmation gate; non-interactive runs proceed without prompting.
  • Trust-denied packs are skipped from re-apply for the run; the registry stays at the old SHA so the next mcs update re-prompts (already covered at the PackUpdater level, but the integration test would lock in the command-level behavior).
  • Refresh from outside a project surfaces the "only refreshing global scope" hint and refreshes only the global scope.
  • Skipped packs in one scope don't block other packs in the same scope from refreshing.
  • Packs tracked in state but missing from the registry emit a per-ID warning and don't abort the scope.
  • Per-scope re-apply failures don't abort sibling scopes; the command surfaces failed labels and exits non-zero.
  • Per-project lockfile failures don't suppress sibling drift warnings (reportDrift is diagnostic-only and must be best-effort).
  • Registry save failure surfaces an error listing the unpersisted updates and does not emit success messages for them.
  • --global / --all-projects warn when a positional path argument is provided (ignored).
  • --all-projects interactive prompt mentions both the global scope and the project list.

Configurator-internal: decideSeedStrategy table test

Adjacent gap surfaced by review: the new reusePriorValuesSilently branch in Configurator.decideSeedStrategy (silent reuse on TTY with optional "asking for N new" suffix) is not covered by any unit test. The function is private and reads output.hasInteractiveStdin, which is set from isatty() at CLIOutput init time. To enable a focused table test on the decision matrix (reusableEmpty, customize, isInteractive, silentFlag, hasNewKeys) -> Bool, the function needs to be either:

  • refactored to a static form taking isInteractive: Bool (and an output handle) as parameters, or
  • promoted from private to internal with CLIOutput gaining a way to inject hasInteractiveStdin for tests.

Either path is a small refactor of shared infrastructure; out of scope for the integration tests above but worth doing in the same followup since both touch testability of the mcs update reapply path.

Suggested home

Tests/MCSTests/LifecycleIntegrationTests.swift (sandbox setup via LifecycleTestBed) or a dedicated UpdateCommandIntegrationTests.swift next to it. The decideSeedStrategy table test belongs alongside Tests/MCSTests/ProjectSyncTests.swift once the testability refactor lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions