Repository navigation
feat: check max extension size in publish before uploading - #2087
Merged
Merged
Conversation
Resolves #1953. `/api/version` already exposes maxExtensionSize (added for the unpublish version check); publish now checks the packaged extension's size against it before uploading, instead of failing only after the whole file has been transferred. The limit is looked up once per `publish()` call and shared across every target/package being published, to avoid a redundant /api/version request per artifact. The check is best-effort: a lookup failure or a registry that doesn't report a limit skips it silently, leaving the server to enforce its own limit as before. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Introduce a proper [next] (unreleased) section instead of stacking new entries onto the already-released v1.1.1 heading. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a client-side extension size check before ovsx publish authentication and upload.
Changes:
- Fetches and shares the registry size limit across publish targets.
- Rejects oversized packages locally.
- Adds formatting, tests, documentation, and changelog updates.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Review |
|---|---|
cli/test/unit/publish.spec.ts |
Adds size-limit and fail-open tests. |
cli/src/util.ts |
Adds byte-size formatting helper. Nit (4 votes): Formatting does not exactly match the server implementation. |
cli/src/publish.ts |
Enforces the registry size limit before upload. Moderate (4 votes): Preserve a reported limit of 0 instead of treating it as unset. |
cli/README.md |
Documents pre-upload validation. |
cli/CHANGELOG.md |
Records the new behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Thomas Neidhart <thomas.neidhart@gmail.com>
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.
What
Resolves #1953.
ovsx publishnow checks the packaged extension's size against the registry's configured limit before uploading, instead of only failing after the whole file has been transferred.The registry's limit is already exposed via
/api/version'smaxExtensionSizefield (added in #1937, and reused by theunpublishcommand's version check). This is the last consumer-side piece to make the setting actionable for CLI users.How
publish()looks upmaxExtensionSizeonce per invocation and shares it across every target/package being published, avoiding a redundant/api/versioncall per artifact for multi-target publishes.doPublish()right after the file is packaged/resolved, before requesting a PAT or exchanging a trusted-publishing token, so it fails before any unnecessary auth prompt too.FileUtils.byteCountToDisplaySize), via a new smallformatBytes()helper.Testing
cli/test/unit/publish.spec.tscovering: publish within limit, local rejection over limit (asserting the upload is never attempted), and two fail-open cases (no limit reported,/api/versionnot exposed).vitest,eslint, andtsc --noEmitall pass.🤖 Generated with Claude Code