[GH-ISSUE #486] Assets: add screenshot size catalog command and local dimension validation #138

Closed
opened 2026-02-26 21:33:42 +03:00 by kerem · 3 comments
Owner

Originally created by @rudrankriyam on GitHub (Feb 10, 2026).
Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/486

Summary

Add asc assets screenshots sizes and local screenshot dimension validation so unsupported image sizes are caught before upload.

Why this matters

"Unsupported screenshot size" errors are high-frequency and currently appear after upload attempts.
We can fail fast locally with a clearer message and provide an always-current size catalog.

Current state (verified)

  • assets screenshots upload validates file safety and display-type enum only.
  • ValidateImageFile in internal/asc/assets_upload.go currently checks file existence/size, not pixel dimensions.
  • Valid display types are hardcoded in internal/asc/assets.go, which can drift from Apple schema updates.

Proposed UX

New command

asc assets screenshots sizes
asc assets screenshots sizes --output table
asc assets screenshots sizes --display-type APP_IPHONE_65

Output should include:

  • screenshot display type
  • accepted dimension pairs (width x height), including landscape/portrait
  • family/category (APP_* vs IMESSAGE_*)

Upload-time validation

Enhance asc assets screenshots upload to:

  • decode image dimensions before network calls
  • validate dimensions against selected display type
  • return a precise error with:
    • actual dimensions
    • allowed dimensions
    • command hint: asc assets screenshots sizes

Validation timing guarantee

Dimension validation must happen before any network side effects:

  • before CreateAppScreenshotSet / CreateAppScreenshot
  • before requesting upload operations
  • before uploading bytes to remote storage

Detailed implementation plan

  • Add AssetsScreenshotsSizesCommand() in internal/cli/assets/assets_screenshots.go.
  • Add screenshot size registry in internal/asc/screenshot_sizes.go.
  • Source display-type enum from docs/openapi/latest.json and add a test to detect drift.
  • Extend ValidateImageFile (or add a dedicated helper) to return dimensions using image config decode.
  • Wire dimension check into upload flow before CreateAppScreenshot and before any upload operation is requested.
  • Add table/markdown/json rendering for size catalog output.
  • Add tests:
    • size catalog command output
    • valid dimension pass
    • invalid dimension fail with actionable message
    • no network request is made when local dimension validation fails
    • schema drift detection test for display-type coverage
  • Update README.md assets documentation.

Acceptance criteria

  • asc assets screenshots sizes lists current supported display types and dimensions.
  • Upload fails locally on invalid dimensions before creating upload operations.
  • Invalid dimensions fail before any remote request is sent.
  • Error message includes actual size, expected sizes, and remediation hint.
  • Supported display type list stays synchronized with current API schema.
  • make test passes with new assets coverage.
Originally created by @rudrankriyam on GitHub (Feb 10, 2026). Original GitHub issue: https://github.com/rudrankriyam/App-Store-Connect-CLI/issues/486 ## Summary Add `asc assets screenshots sizes` and local screenshot dimension validation so unsupported image sizes are caught before upload. ## Why this matters "Unsupported screenshot size" errors are high-frequency and currently appear after upload attempts. We can fail fast locally with a clearer message and provide an always-current size catalog. ## Current state (verified) - `assets screenshots upload` validates file safety and display-type enum only. - `ValidateImageFile` in `internal/asc/assets_upload.go` currently checks file existence/size, not pixel dimensions. - Valid display types are hardcoded in `internal/asc/assets.go`, which can drift from Apple schema updates. ## Proposed UX ### New command ```bash asc assets screenshots sizes asc assets screenshots sizes --output table asc assets screenshots sizes --display-type APP_IPHONE_65 ``` Output should include: - screenshot display type - accepted dimension pairs (`width x height`), including landscape/portrait - family/category (`APP_*` vs `IMESSAGE_*`) ### Upload-time validation Enhance `asc assets screenshots upload` to: - decode image dimensions before network calls - validate dimensions against selected display type - return a precise error with: - actual dimensions - allowed dimensions - command hint: `asc assets screenshots sizes` ### Validation timing guarantee Dimension validation must happen before any network side effects: - before `CreateAppScreenshotSet` / `CreateAppScreenshot` - before requesting upload operations - before uploading bytes to remote storage ## Detailed implementation plan - [ ] Add `AssetsScreenshotsSizesCommand()` in `internal/cli/assets/assets_screenshots.go`. - [ ] Add screenshot size registry in `internal/asc/screenshot_sizes.go`. - [ ] Source display-type enum from `docs/openapi/latest.json` and add a test to detect drift. - [ ] Extend `ValidateImageFile` (or add a dedicated helper) to return dimensions using image config decode. - [ ] Wire dimension check into upload flow before `CreateAppScreenshot` and before any upload operation is requested. - [ ] Add table/markdown/json rendering for size catalog output. - [ ] Add tests: - [ ] size catalog command output - [ ] valid dimension pass - [ ] invalid dimension fail with actionable message - [ ] no network request is made when local dimension validation fails - [ ] schema drift detection test for display-type coverage - [ ] Update `README.md` assets documentation. ## Acceptance criteria - [ ] `asc assets screenshots sizes` lists current supported display types and dimensions. - [ ] Upload fails locally on invalid dimensions before creating upload operations. - [ ] Invalid dimensions fail before any remote request is sent. - [ ] Error message includes actual size, expected sizes, and remediation hint. - [ ] Supported display type list stays synchronized with current API schema. - [ ] `make test` passes with new assets coverage.
kerem 2026-02-26 21:33:42 +03:00
Author
Owner

@rudrankriyam commented on GitHub (Feb 11, 2026):

@cursor Please implement this issue end-to-end.

What to build

Add a screenshot size catalog command and local dimension validator for asc assets screenshots upload, with strict pre-network validation.

Implementation plan

  1. New sizes command
  • internal/cli/assets/assets_screenshots.go
    • Add sizes subcommand:
      • asc assets screenshots sizes
      • optional display-type filter
    • Include JSON/table/markdown output.
  1. Size registry + schema sync
  • Add internal/asc/screenshot_sizes.go with display-type -> valid dimensions mapping.
  • Add schema drift test that checks display types against docs/openapi/latest.json enum.
  1. Local image dimension validation
  • Extend ValidateImageFile (or add dedicated helper) to decode dimensions.
  • Validate image dimensions against selected display type.
  • Error must include actual size + allowed sizes + hint to asc assets screenshots sizes.
  1. Pre-network guarantee
  • Validation must occur before any remote side effects:
    • before CreateAppScreenshotSet
    • before CreateAppScreenshot
    • before requesting upload operations
    • before uploading bytes

New tests to write

A) Assets unit tests

  • valid dimensions pass
  • invalid dimensions fail with actionable error text
  • display-type filter output in sizes command

B) Command tests (internal/cli/cmdtest)

  • sizes command output coverage
  • upload rejects invalid dimensions before network path
  • assert no HTTP request is made when local validation fails

C) Schema drift tests

  • fail if supported display types diverge from openapi enum

How to test locally

Run exactly:

  • make format
  • make lint
  • make test

Targeted tests:

  • go test ./internal/asc -run 'Screenshot.*Size|ValidateImage'
  • go test ./internal/cli/cmdtest -run 'assets screenshots'

Done criteria

  • asc assets screenshots sizes lists valid sizes.
  • Upload invalid sizes fail locally before remote calls.
  • Error messaging is explicit and actionable.
  • Display types remain synchronized with API schema.
  • All checks pass (format, lint, test).
<!-- gh-comment-id:3881459265 --> @rudrankriyam commented on GitHub (Feb 11, 2026): @cursor Please implement this issue end-to-end. ## What to build Add a screenshot size catalog command and local dimension validator for `asc assets screenshots upload`, with strict pre-network validation. ## Implementation plan 1. **New sizes command** - `internal/cli/assets/assets_screenshots.go` - Add `sizes` subcommand: - `asc assets screenshots sizes` - optional display-type filter - Include JSON/table/markdown output. 2. **Size registry + schema sync** - Add `internal/asc/screenshot_sizes.go` with display-type -> valid dimensions mapping. - Add schema drift test that checks display types against `docs/openapi/latest.json` enum. 3. **Local image dimension validation** - Extend `ValidateImageFile` (or add dedicated helper) to decode dimensions. - Validate image dimensions against selected display type. - Error must include actual size + allowed sizes + hint to `asc assets screenshots sizes`. 4. **Pre-network guarantee** - Validation must occur before any remote side effects: - before `CreateAppScreenshotSet` - before `CreateAppScreenshot` - before requesting upload operations - before uploading bytes ## New tests to write ### A) Assets unit tests - valid dimensions pass - invalid dimensions fail with actionable error text - display-type filter output in sizes command ### B) Command tests (`internal/cli/cmdtest`) - `sizes` command output coverage - upload rejects invalid dimensions before network path - assert no HTTP request is made when local validation fails ### C) Schema drift tests - fail if supported display types diverge from openapi enum ## How to test locally Run exactly: - `make format` - `make lint` - `make test` Targeted tests: - `go test ./internal/asc -run 'Screenshot.*Size|ValidateImage'` - `go test ./internal/cli/cmdtest -run 'assets screenshots'` ## Done criteria - `asc assets screenshots sizes` lists valid sizes. - Upload invalid sizes fail locally before remote calls. - Error messaging is explicit and actionable. - Display types remain synchronized with API schema. - All checks pass (`format`, `lint`, `test`).
Author
Owner

@cursor[bot] commented on GitHub (Feb 11, 2026):

Summary:

  • I added a screenshot size registry + asc assets screenshots sizes command (JSON/table/markdown with optional display-type filter), wired local dimension validation ahead of any network calls for screenshot uploads, and added a schema drift test against the OpenAPI enum. I also updated README assets docs.
  • I added unit/cmd tests for sizes output, dimension validation (including the actionable error text), and “no network call on invalid size”.

Tests run:

  • go test ./internal/asc -run 'Screenshot.*Size|ValidateImage'
  • go test ./internal/cli/cmdtest -run 'assets screenshots' (no tests matched)
  • go test ./internal/cli/cmdtest -run 'AssetsScreenshots'
  • make tools
  • make format
  • make lint
  • make test

Walkthrough artifact:

  • screenshot_sizes_command_json_pretty_demo/recording_demo.mp4 (shows asc assets screenshots sizes --display-type APP_IPHONE_65 --output json --pretty and the expected JSON output)

View PR

Open in Cursor Open in Web

<!-- gh-comment-id:3881459549 --> @cursor[bot] commented on GitHub (Feb 11, 2026): Summary: - I added a screenshot size registry + `asc assets screenshots sizes` command (JSON/table/markdown with optional display-type filter), wired local dimension validation ahead of any network calls for screenshot uploads, and added a schema drift test against the OpenAPI enum. I also updated README assets docs. - I added unit/cmd tests for sizes output, dimension validation (including the actionable error text), and “no network call on invalid size”. Tests run: - `go test ./internal/asc -run 'Screenshot.*Size|ValidateImage'` - `go test ./internal/cli/cmdtest -run 'assets screenshots'` (no tests matched) - `go test ./internal/cli/cmdtest -run 'AssetsScreenshots'` - `make tools` - `make format` - `make lint` - `make test` Walkthrough artifact: - `screenshot_sizes_command_json_pretty_demo/recording_demo.mp4` (shows `asc assets screenshots sizes --display-type APP_IPHONE_65 --output json --pretty` and the expected JSON output) <p><a href="https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/490"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/view-pr-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/view-pr-light.png"><img alt="View PR" width="86" height="28" src="https://cursor.com/assets/images/view-pr-light.png"></picture></a></p> <p><a href="https://cursor.com/background-agent?bcId=bc-5c5bfa64-1e38-4601-b972-6cb7543feb93"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?id=bc-5c5bfa64-1e38-4601-b972-6cb7543feb93"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a></p>
Author
Owner

@rudrankriyam commented on GitHub (Feb 11, 2026):

Resolved by PR #490 (https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/490), which is merged into main.

<!-- gh-comment-id:3887482171 --> @rudrankriyam commented on GitHub (Feb 11, 2026): Resolved by PR #490 (https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/490), which is merged into main.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/App-Store-Connect-CLI#138
No description provided.