Skip to content

fix(validate-schema): reject platform-invalid Actor version formats - #1368

Open
kuntal1461 wants to merge 1 commit into
apify:masterfrom
kuntal1461:fix/validate-schema-actor-version-format
Open

fix(validate-schema): reject platform-invalid Actor version formats#1368
kuntal1461 wants to merge 1 commit into
apify:masterfrom
kuntal1461:fix/validate-schema-actor-version-format

Conversation

@kuntal1461

Copy link
Copy Markdown
Contributor

What changed and why

apify validate-schema accepted any version value in .actor/actor.json without checking it against the format the platform build API enforces. A user who wrote version: "1.0.0" (three-part SemVer) would get a clean local result, then hit a cryptic admission error after upload — consuming a build slot.

  • Add validateActorVersion() at the start of the all-schemas scan (validateAllSchemas); it is skipped when a path argument is given, so apify validate-schema ./INPUT_SCHEMA.json is unaffected.
  • Regex /^(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).
  • TODO comment references apify-shared-js chore(deps): lock file maintenance #655 where the shared constant will eventually land; the local definition will become a swap-in.
  • 100.0 and 1.100 deliberately pass — the platform accepts them; an earlier draft capped at 99, which was incorrect.

Fixes

Fixes #1364

Files changed

  • src/lib/input_schema.ts — adds ACTOR_VERSION_REGEX + validateActorVersion()
  • src/commands/validate-schema.ts — wires validateActorVersion into the all-schemas path
  • test/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) formats

Notes

  • No changes to apify push — push-side fail-fast is separate work.
  • No new dependencies; no install-size impact.

`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
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.

apify validate-schema passes schemas the platform build rejects

2 participants