refactor(eve): batch the registry catalog's title lookups - #1477
Closed
chadhietala wants to merge 1 commit into
Closed
refactor(eve): batch the registry catalog's title lookups#1477chadhietala wants to merge 1 commit into
chadhietala wants to merge 1 commit into
Conversation
#1436 replaced the hardcoded title map with real manifest titles, fetching one manifest per search result inside a `Promise.all` over the page. But `getRegistryItems` already takes an array: the vendored implementation is `Promise.all(items.map(...))` behind a shared source cache, returning manifests in input order. So the per-item fan-out wrapped an API that was already batched, and #1436's `CATALOG_PAGE_SIZE = 100` made that up to 100 independent calls — each with its own cache — for one browse. One call now fetches the page, and the index mapping the surrounding `result.items.map` already relies on is unchanged. `resolveOfficialRegistryUrl` from #1427 validated its URL with a try/catch around `new URL` plus a protocol check, repeating the same error message in both arms. `URL.parse` — already used in `cli/dev/url-target.ts` — collapses them into one condition. The one test that pinned the fan-out ("in parallel", two resolvers keyed by address) now pins the batch instead: same expected titles in the same order, plus an assertion that the whole page costs one call. Signed-off-by: Chad Hietala <chadhietala@gmail.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Found
cli/commands/registry.ts: fix(eve): preserve registry title casing #1436 fetches one manifest per search result inside aPromise.all, butgetRegistryItemsalready takes an array — the vendored implementation isPromise.all(items.map(...))behind a shared source cache, returning results in input order. With fix(eve): preserve registry title casing #1436'sCATALOG_PAGE_SIZE = 100, one browse made up to 100 separate calls.resolveOfficialRegistryUrl(from feat(eve): set up registry connections during add #1427) validates with a try/catch aroundnew URLplus a protocol check, repeating the same error message in both arms.Did
Batched the page into one
getRegistryItemscall (the index mapping the surroundingmapalready relies on is unchanged), and collapsed the URL validation withURL.parse, already used incli/dev/url-target.ts. −25/+16 across 2 files.Validated
1615 tests pass across
src/cli/andsrc/setup/. One test changed: the case pinning the per-item fan-out now pins the batch — same expected titles in the same order, plus an assertion that a page costs one call.tsc --noEmit, lint, fmt,guard:invariantsclean.