feat(push): validate .actor/actor.json version against MAJOR.MINOR before upload#1245
Draft
DaveHanns wants to merge 1 commit into
Draft
feat(push): validate .actor/actor.json version against MAJOR.MINOR before upload#1245DaveHanns wants to merge 1 commit into
DaveHanns wants to merge 1 commit into
Conversation
…load The platform's version field is MAJOR.MINOR (e.g. `0.0`, `1.2`) and rejects three-part SemVer like `1.0.0`. Today that mistake is only caught during the remote build admission step, after the source files are already uploaded and a build slot is spent — the error surface is cryptic and every retry burns a build. Add a small client-side guard in `apify push` that reads the effective `version` (flag override, then actor.json, then default) and fails fast with a clear message pointing at the field. Regex is defined locally as a TODO placeholder until the shared version in apify-shared-js #655 lands; the intent is to swap in the shared export in a follow-up. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.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.
Summary
apify pushnow validates.actor/actor.json'sversionfield againstMAJOR.MINORbefore uploading source files. Bad values like1.0.0fail with a clear pointer to the field, exit codeInvalidActorJson(5), and no source upload.Why
Today, three-part SemVer (
1.0.0) is only rejected at build admission on the platform — after upload, after a build slot has been allocated. The failure surface is a cryptic admission error, and each retry burns a build cycle. Every agent-authored Actor hits this at least once (14/14 CLI-based eval scenarios in our observations).This PR is the CLI-side enforcement half of the trio started by:
Regex is inlined here with a TODO comment; a follow-up will swap in
@apify/constsonce #655 merges.Test plan
MAJOR_MINOR_VERSION_REGEXaccepts0.0,1.2,12.34; rejects1.0.0,v1.2,1,1.,01.2, empty string.apify pushon a project with"version": "1.0.0"in.actor/actor.jsonfails before upload with exit 5 and error text mentioning the field.--version 1.0.0flag override also rejected before upload.0.0) still pushes.