Skip to content

Improve update checker: cache, parallelism, and credential suppression#286

Merged
bguidolim merged 1 commit intomainfrom
bruno/improve-update-checker
Mar 25, 2026
Merged

Improve update checker: cache, parallelism, and credential suppression#286
bguidolim merged 1 commit intomainfrom
bruno/improve-update-checker

Conversation

@bguidolim
Copy link
Copy Markdown
Collaborator

Context

Closes #275.

The update checker added in #273 always forces a live network check at the end of mcs sync and mcs doctor, making them slow. Additionally, git ls-remote can trigger macOS Keychain credential prompts, and pack checks run serially.

Changes

  • 24-hour cache for sync/doctor/hook: performCheck() now respects a 24-hour cache by default. Only mcs check-updates (explicit user invocation) forces a fresh network check via forceRefresh: true. Replaced the isHook parameter with forceRefresh to separate cache policy from output formatting.
  • Parallel pack checks: checkPackUpdates() uses DispatchQueue.concurrentPerform to run git ls-remote calls concurrently instead of serially. Uses nonisolated(unsafe) pre-sized array for Swift 6 strict concurrency compliance.
  • Credential suppression: All git ls-remote calls now pass GIT_TERMINAL_PROMPT=0 and GIT_ASKPASS="" to prevent Keychain/askpass popups during read-only checks.
  • Detailed output: Terminal output now lists each outdated pack by name with 7-char SHA diffs. mcs check-updates shows "Everything is up to date." when no updates are found. Hook output stays simple.
  • Documentation: Updated all references from 7-day to 24-hour cooldown across CLAUDE.md, docs/cli.md, and inline comments.

Test plan

  • swift test --filter MCSTests.UpdateChecker — 31 tests pass (1 new + 2 updated)
  • swift test — full suite (867 tests) passes
  • Run mcs sync twice — second run should be fast (cached)
  • Run mcs check-updates — should always show fresh results
  • Verify no Keychain prompts during update checks

)

- Respect 24-hour cache in sync/doctor/hook instead of always hitting network; check-updates (explicit) still forces fresh
- Parallelize git ls-remote calls with DispatchQueue.concurrentPerform
- Suppress keychain/credential prompts via GIT_TERMINAL_PROMPT=0 and GIT_ASKPASS=""
- Show detailed per-pack output with SHA diffs and "up to date" message
@bguidolim bguidolim merged commit 1e21f16 into main Mar 25, 2026
4 checks passed
@bguidolim bguidolim deleted the bruno/improve-update-checker branch March 25, 2026 13:02
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.

Parallelize git ls-remote calls in UpdateChecker

1 participant