CLI: Throttle dependency update checks to once per 24h - #3100
Merged
Conversation
Collaborator
📊 Performance Test ResultsComparing e2426a9 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
…pendency-update-checks # Conflicts: # apps/cli/lib/cli-config/core.ts
sejas
approved these changes
Apr 16, 2026
sejas
left a comment
Member
There was a problem hiding this comment.
Works as expected! 👌
I left a suggestion but it's not a strong opinion.
Comment on lines
+266
to
+272
| * Fetches the latest WordPress version from the network. | ||
| * | ||
| * This performs a network request, so callers should gate it behind | ||
| * `shouldCheckDependencyUpdates()` and follow a successful call with | ||
| * `markDependencyCheckTime()` to avoid hitting the network on every | ||
| * invocation (see STU-1455). | ||
| */ |
Member
There was a problem hiding this comment.
I wonder if we could enforce this with code instead of a comment.
katinthehatsite
approved these changes
Apr 16, 2026
katinthehatsite
left a comment
Contributor
There was a problem hiding this comment.
The changes look good 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
Implementation drafted with Claude Code from the Linear issue. I reviewed the diff, ran the test suite, and validated the throttle logic (missing timestamp, stale timestamp, future/clock-skew timestamp, happy path) before pushing.
Proposed Changes
lastDependencyCheckTimefield to the CLI config schema (cli.json).shouldCheckDependencyUpdates()/markDependencyCheckTime()helpers independency-management/setup.ts. The throttle treats missing, >24h-old, and future (clock-skew) timestamps as stale, and swallows read/write errors so a brokencli.jsonnever blockssite create.updateServerFiles()call insite createbehind the throttle, so back-to-back site creations don't re-run the network check.Testing Instructions
npm run cli:buildnode apps/cli/dist/cli/main.mjs site create ~/Studio/throttle-test-1— should show "Checking for dependency updates…" and succeed.node apps/cli/dist/cli/main.mjs site create ~/Studio/throttle-test-2immediately after — should skip the dependency check entirely and feel faster.~/.studio/cli.jsonand setlastDependencyCheckTimeto1(or delete the field), then re-runsite create— the check should run again.npm test -- apps/cli/lib/dependency-management/tests/setup.test.tsnpm test -- apps/cli/commands/site/tests/create.test.tsPre-merge Checklist
npm run typecheckpasses