Skip to content

feat(push): validate .actor/actor.json version against MAJOR.MINOR before upload#1245

Draft
DaveHanns wants to merge 1 commit into
masterfrom
push-validate-major-minor-version
Draft

feat(push): validate .actor/actor.json version against MAJOR.MINOR before upload#1245
DaveHanns wants to merge 1 commit into
masterfrom
push-validate-major-minor-version

Conversation

@DaveHanns

Copy link
Copy Markdown
Contributor

Summary

apify push now validates .actor/actor.json's version field against MAJOR.MINOR before uploading source files. Bad values like 1.0.0 fail with a clear pointer to the field, exit code InvalidActorJson (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/consts once #655 merges.

Test plan

  • Unit: MAJOR_MINOR_VERSION_REGEX accepts 0.0, 1.2, 12.34; rejects 1.0.0, v1.2, 1, 1., 01.2, empty string.
  • Integration: apify push on a project with "version": "1.0.0" in .actor/actor.json fails before upload with exit 5 and error text mentioning the field.
  • Integration: --version 1.0.0 flag override also rejected before upload.
  • Regression: default (no version set, defaults to 0.0) still pushes.

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants