feat: expose the extension package size in the API and web UI - #2168
Draft
netomi wants to merge 1 commit into
Draft
feat: expose the extension package size in the API and web UI#2168netomi wants to merge 1 commit into
netomi wants to merge 1 commit into
Conversation
netomi
force-pushed
the
feat/extension-download-size
branch
from
September 5, 2026 11:47
9df36d8 to
a98d4b1
Compare
netomi
marked this pull request as draft
September 5, 2026 12:33
file_resource.size has been recorded since V1_73, populated on publish and backfilled for older rows, but nothing ever read it back out: it reaches no API response and no page. Issue #367 asks to display it. Add ExtensionJson.downloadSize - the size in bytes of the file behind files.download - and a Size entry in the web UI's More Info box beside the unique identifier, where #367 suggested it belongs. The size is read from the download resource rather than summed over the version's files: readme, icon, changelog and license are rows of their own holding content that is already inside the package, so a sum counts it twice. It is null, and omitted from the JSON, for a package published before the column existed that the backfill has not reached - a client cannot tell a zero from an unknown, so it gets neither. Note this is the download size. The install size the issue asks about is larger by whatever the package's compression ratio happens to be, and is not something the registry stores; it would need its own column and a job that re-reads every existing .vsix. The detail endpoint now takes StorageUtilService.getFiles instead of getFileUrls so the size comes from the same query as the URLs rather than a second one, and builds its file map with the toFilesJson the other two builders already share - which also drops the duplicated public-key handling it had grown. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
netomi
force-pushed
the
feat/extension-download-size
branch
from
September 5, 2026 12:39
a98d4b1 to
bdc14f9
Compare
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.
Closes #367.
Context
The issue asks for the extension size to be displayed, packagephobia-style. Half of what that needs already exists:
file_resource.sizehas been recorded sinceV1_73__File_Resource_Size.sql(#2089, #2095), set on publish inPublishExtensionVersionServiceandStorageUtilService, and backfilled for older rows byFileResourceSizeJobRequestHandler. Nothing ever read it back out, though — it reached no API response and no page.Change
ExtensionJson.downloadSize— size in bytes of the file behindfiles.download, for this version and target platform. Set by all three JSON builders, so/api/{ns}/{ext}, the query API and v2 all carry it.Sizeentry in the More Info box, next to the unique identifier, which is where the issue suggested it. Rendered with the existingformatFileSizehelper.Two decisions worth calling out:
It reads the
downloadresource, not aSUMover the version's files. Readme, icon, changelog and license are stored as rows of their own but hold content that is already inside the.vsix, so summing counts it twice. (Web resources don't distort it either way — those are extracted to a cache on demand, not stored as rows.)Unknown is omitted, not zero. A package published before the column existed that the backfill hasn't reached has
size = null;ExtensionJsonis@JsonInclude(NON_NULL), so the field is simply absent, and the UI leaves the section out. A client has no way to tell a zero-byte file from an unknown one, so it gets neither.Download size, not install size
The issue asks about install size — the reporter's example is a ~110MB
.vsixthat's over 200MB on disk — and this is the download size. The two differ by the package's compression ratio, which is exactly the reporter's point about bundled.mapfiles and straynode_modules.Install size isn't stored and isn't cheaply derivable. It's computable at publish (the code already walks zip entries in
ArchiveUtilandSecretDetector, andExtensionVersionIntegrityServicesumsentry.getSize()into the signature manifest), but backfilling it means re-reading every existing.vsixout of storage — a much larger job than V1_73's was. That seems worth its own issue and its own decision, rather than holding up the number we already have.One query, not two
The detail path used
StorageUtilService.getFileUrls, which discards everything but the URL. Rather than add a second query for the size,getFilesnow returns the resources andgetFileUrlsis a shorthand over it, unchanged for its nine other callers. The detail builder then uses thetoFilesJsonmapping the other two builders already share, which also removes the duplicated public-key-alongside-signature handling it had grown.Testing
RegistryAPITest.testExtensionDownloadSize/testExtensionDownloadSizeUnknown— the value reaches the JSON; a null size leaves the field out.extension-detail-overview.spec.tsx(new) — the Size section renders, and is absent when the registry doesn't know the size.tsc --noEmitandyarn lintclean.Three existing tests stubbed
getFileUrlsfor the detail path and now stubgetFiles.🤖 Generated with Claude Code