perf(cli): overlap the API compatibility check with the install - #748
Merged
Conversation
The check costs a registry round trip (~110 ms) that every `mops install` serialized behind. It now runs concurrently with the install and is awaited after it, settled into a thunk so a rejection during the install cannot become an unhandled rejection. The outcome is unchanged - an incompatible CLI still errors and skips the toolchain install - but the error surfaces after the packages have installed, which #723 judged acceptable given build/test/sources never check at all. `mops publish` keeps its check serial: it writes immutable registry state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Cursor AI review👍 APPROVE — looks safe to merge
VerdictDecision: APPROVE Generated for commit 5c0cea5 |
automation-sa-sre
approved these changes
Aug 13, 2026
automation-sa-sre
left a comment
There was a problem hiding this comment.
Automated approval: the AI review verdict for 5c0cea5 is APPROVE. See the "Cursor AI review" comment for details.
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.
Every
mops installserialized behind the API compatibility check — a registry round trip worth ~110 ms — before downloading anything. The check now runs concurrently with the install and is awaited after it. Closes out item 31 of #723 together with #747.The outcome of the check is unchanged: an incompatible CLI still prints the same error and skips the toolchain install. What changes is ordering — the install completes before the version error surfaces, which #723 judged acceptable given the guard is already nominal (
build,check,test,bench,generate,sourcesandaddnever check at all). The promise is settled into a thunk immediately, so a check that rejects mid-install cannot surface as an unhandled rejection; awaiting the thunk rethrows exactly where the serial code used to throw (verified against a dead registry endpoint: exit 1, noUnhandledPromiseRejection).mops publishdeliberately keeps its check serial and now carries a comment saying so: publishing writes immutable registry state, so the version gate must hold it back.HTTP/2: measured, not adopted
The remaining strand of item 31 suggested an undici
Agent({ allowH2: true })so concurrency could rise while connection pressure falls, with the instruction to measure rather than assume. Measured (16 concurrent requests againsticp-api.io, cold pool, medians of repeated runs):connections: 1(multiplexed)connections: 1The boundary nodes do negotiate h2, but undici only multiplexes when the connection pool is capped, and capping is 2–3× slower on a healthy network — the cold-process TLS handshakes the idea meant to eliminate run in parallel, so 16 of them cost roughly one RTT of wall time, not 16. An uncapped h2 pool still opens one socket per in-flight request and gains nothing. The connection-pressure scenario h2 would help (low fd limits, constrained containers) is the one #747's fd-aware budget and halved-budget retry already cover. Against that, adopting it means bundling undici into the CLI (the bun bundle inlines dependencies) and taking on undici's h2 maturity risk. Not worth it on this evidence; the measurement script is small and rerunnable if boundary-node behavior changes.
🤖 Generated with Claude Code