fix(validate-schema): reject platform-invalid Actor version formats - #1368
Open
kuntal1461 wants to merge 1 commit into
Open
fix(validate-schema): reject platform-invalid Actor version formats#1368kuntal1461 wants to merge 1 commit into
kuntal1461 wants to merge 1 commit into
Conversation
`apify validate-schema` accepted any value in the `version` field of `.actor/actor.json` without checking it against the format the platform build API actually enforces: `MAJOR.MINOR` with non-negative integers and no leading zeros (e.g. `1.0`, `0.0`). Three-part SemVer like `1.0.0` is a build-number format the platform rejects at the admission step; users got no local signal before the upload and build slot were already consumed. - Add `validateActorVersion()` called at the start of the all-schemas scan path; skipped when a path argument is given. - Regex `/^(0|[1-9]\d*)\.(0|[1-9]\d*)$/` matches the confirmed platform rule; no artificial 0–99 cap. - TODO comment references apify-shared-js apify#655 where the shared regex will eventually live. Fixes apify#1364
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 changed and why
apify validate-schemaaccepted anyversionvalue in.actor/actor.jsonwithout checking it against the format the platform build API enforces. A user who wroteversion: "1.0.0"(three-part SemVer) would get a clean local result, then hit a cryptic admission error after upload — consuming a build slot.validateActorVersion()at the start of the all-schemas scan (validateAllSchemas); it is skipped when a path argument is given, soapify validate-schema ./INPUT_SCHEMA.jsonis unaffected./^(0|[1-9]\d*)\.(0|[1-9]\d*)$/:MAJOR.MINOR, non-negative integers, no leading zeros, no upper-bound cap. Derived from the confirmed platform constraint (same regex used in the sibling push-side guard).100.0and1.100deliberately pass — the platform accepts them; an earlier draft capped at 99, which was incorrect.Fixes
Fixes #1364
Files changed
src/lib/input_schema.ts— addsACTOR_VERSION_REGEX+validateActorVersion()src/commands/validate-schema.ts— wiresvalidateActorVersioninto the all-schemas pathtest/local/commands/validate-schema.test.ts— regression tests for confirmed invalid (1.0.0,01.0,1.01) and valid (0.0,1.0,99.99,100.0,1.100) formatsNotes
apify push— push-side fail-fast is separate work.