[PR #466] [MERGED] fix: complete age rating declaration support and handle whatsNew on initial releases #549

Closed
opened 2026-02-26 22:31:28 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/466
Author: @cameronehrlich
Created: 2/10/2026
Status: Merged
Merged: 2/10/2026
Merged by: @rudrankriyam

Base: mainHead: fix/age-rating-and-whats-new-errors


📝 Commits (7)

  • f48329b fix: add missing gunsOrOtherWeapons flag and handle whatsNew on initial releases
  • 9b1dacf fix: add all missing age rating declaration fields from Apple API spec
  • 5ecb268 refactor: table-driven age rating parsing, fix output display, improve tests
  • 6162181 style: fix gofumpt struct field alignment
  • 13a63f5 fix: remove IsBoolFlag from OptionalBool to fix space-separated flag parsing
  • 71f35c0 fix: harden age rating/localization handling and restore bool flag ergonomics
  • b07e91b ci: increase golangci-lint timeout for stable checks

📊 Changes

12 files changed (+613 additions, -115 deletions)

View changed files

📝 Makefile (+2 -1)
📝 internal/asc/age_rating.go (+23 -4)
📝 internal/asc/output_age_rating.go (+17 -3)
📝 internal/asc/output_test.go (+34 -13)
📝 internal/cli/agerating/age_rating.go (+134 -84)
📝 internal/cli/agerating/age_rating_test.go (+66 -2)
📝 internal/cli/cmdtest/promoted_purchases_test.go (+5 -5)
📝 internal/cli/shared/localizations.go (+46 -2)
internal/cli/shared/localizations_upload_test.go (+204 -0)
📝 internal/cli/shared/optional_bool.go (+10 -1)
internal/cli/shared/optional_bool_test.go (+66 -0)
📝 internal/cli/shared/shared.go (+6 -0)

📄 Description

Problem

The age-rating set command fails when trying to update age rating declarations because the CLI is missing several fields that Apple's API now requires. The API returns:

You must provide a value for the attribute 'gunsOrOtherWeapons'
You must provide a value for the attribute 'userGeneratedContent'
You must provide a value for the attribute 'healthOrWellnessTopics'

Additionally, uploading version localizations with a whatsNew field on an initial v1.0 release causes a hard failure, since Apple doesn't support What's New text until there's a prior version.

Finally, OptionalBool flags like --available-in-new-territories fail when using space-separated syntax (--flag true) because IsBoolFlag() tells Go's flag parser to treat them as standalone booleans.

Solution

1. Add all missing age rating fields

Cross-referenced Apple's OpenAPI spec to add every missing content descriptor:

Field Type Status
gunsOrOtherWeapons enum was missing
advertising bool new
healthOrWellnessTopics bool new
lootBox bool new
messagingAndChat bool new
parentalControls bool new
ageAssurance bool new
userGeneratedContent bool new
ageRatingOverride string new (response only)
koreaAgeRatingOverride string new (response only)

2. Fix output display

All new fields are now shown in age-rating get --output table and --output markdown.

3. Table-driven parsing

Refactored buildAgeRatingAttributes from ~130 lines of repetitive blocks into two declarative tables with shared loops. Adding a new field now requires one table entry instead of changes in three places.

4. Graceful whatsNew handling

When uploading version localizations for an initial release, the API rejects the whatsNew field. The CLI now catches this, warns the user, and retries without it.

5. Fix OptionalBool space-separated flag parsing

OptionalBool implemented IsBoolFlag() returning true, which tells Go's flag package to treat the flag like a built-in bool: --flag value is parsed as --flag (implicit true) + positional arg. This broke --available-in-new-territories true and any other OptionalBool flag using space-separated syntax.

Fix: Remove IsBoolFlag() entirely so the parser always expects an explicit value. Both --flag=true and --flag true work correctly after this change.

6. Cleanup

  • Removed deprecated --seventeen-plus flag (not in Apple's current API spec)
  • Removed dead nil-checks for fields that were never set by the CLI

Files changed

File What changed
internal/asc/age_rating.go Added 10 missing struct fields
internal/asc/output_age_rating.go Added all new fields to table/markdown output
internal/asc/output_test.go Tests verify new fields appear in output
internal/cli/agerating/age_rating.go Table-driven parsing, new CLI flags, removed seventeen-plus
internal/cli/agerating/age_rating_test.go Tests for bool/enum parsing, invalid values
internal/cli/shared/localizations.go whatsNew retry logic
internal/cli/shared/optional_bool.go Removed IsBoolFlag() to fix space-separated parsing

Test plan

  • go test ./internal/cli/agerating/ - all pass
  • go test ./internal/asc/ - all pass
  • go test ./internal/cli/shared/ - all pass
  • go test ./internal/cli/apps/ - all pass
  • Verified age rating set/get against live app
  • Verified whatsNew retry on v1.0 submission
  • Verified --available-in-new-territories true (space-separated) works after fix

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rudrankriyam/App-Store-Connect-CLI/pull/466 **Author:** [@cameronehrlich](https://github.com/cameronehrlich) **Created:** 2/10/2026 **Status:** ✅ Merged **Merged:** 2/10/2026 **Merged by:** [@rudrankriyam](https://github.com/rudrankriyam) **Base:** `main` ← **Head:** `fix/age-rating-and-whats-new-errors` --- ### 📝 Commits (7) - [`f48329b`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/f48329bbb6f88db2f0c4a33af4fe8c9e0b5ed18a) fix: add missing gunsOrOtherWeapons flag and handle whatsNew on initial releases - [`9b1dacf`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/9b1dacf13eea78e6fd9046532dda097fd14d571e) fix: add all missing age rating declaration fields from Apple API spec - [`5ecb268`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/5ecb268c2c087a3cd34555fe68cc642c028a030f) refactor: table-driven age rating parsing, fix output display, improve tests - [`6162181`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/6162181f99a0cb672ed170012dbb06bb290c7dc9) style: fix gofumpt struct field alignment - [`13a63f5`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/13a63f5fae1b96f6714a90d2f89ff485966b532f) fix: remove IsBoolFlag from OptionalBool to fix space-separated flag parsing - [`71f35c0`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/71f35c09e9b2768e05f1c4a7d03a8b3bfd8cb599) fix: harden age rating/localization handling and restore bool flag ergonomics - [`b07e91b`](https://github.com/rudrankriyam/App-Store-Connect-CLI/commit/b07e91b765c0812a5d05ef68d42e6c7c69846786) ci: increase golangci-lint timeout for stable checks ### 📊 Changes **12 files changed** (+613 additions, -115 deletions) <details> <summary>View changed files</summary> 📝 `Makefile` (+2 -1) 📝 `internal/asc/age_rating.go` (+23 -4) 📝 `internal/asc/output_age_rating.go` (+17 -3) 📝 `internal/asc/output_test.go` (+34 -13) 📝 `internal/cli/agerating/age_rating.go` (+134 -84) 📝 `internal/cli/agerating/age_rating_test.go` (+66 -2) 📝 `internal/cli/cmdtest/promoted_purchases_test.go` (+5 -5) 📝 `internal/cli/shared/localizations.go` (+46 -2) ➕ `internal/cli/shared/localizations_upload_test.go` (+204 -0) 📝 `internal/cli/shared/optional_bool.go` (+10 -1) ➕ `internal/cli/shared/optional_bool_test.go` (+66 -0) 📝 `internal/cli/shared/shared.go` (+6 -0) </details> ### 📄 Description ## Problem The `age-rating set` command fails when trying to update age rating declarations because the CLI is missing several fields that Apple's API now requires. The API returns: ``` You must provide a value for the attribute 'gunsOrOtherWeapons' You must provide a value for the attribute 'userGeneratedContent' You must provide a value for the attribute 'healthOrWellnessTopics' ``` Additionally, uploading version localizations with a `whatsNew` field on an initial v1.0 release causes a hard failure, since Apple doesn't support What's New text until there's a prior version. Finally, `OptionalBool` flags like `--available-in-new-territories` fail when using space-separated syntax (`--flag true`) because `IsBoolFlag()` tells Go's flag parser to treat them as standalone booleans. ## Solution ### 1. Add all missing age rating fields Cross-referenced Apple's OpenAPI spec to add every missing content descriptor: | Field | Type | Status | |-------|------|--------| | `gunsOrOtherWeapons` | enum | **was missing** | | `advertising` | bool | **new** | | `healthOrWellnessTopics` | bool | **new** | | `lootBox` | bool | **new** | | `messagingAndChat` | bool | **new** | | `parentalControls` | bool | **new** | | `ageAssurance` | bool | **new** | | `userGeneratedContent` | bool | **new** | | `ageRatingOverride` | string | **new** (response only) | | `koreaAgeRatingOverride` | string | **new** (response only) | ### 2. Fix output display All new fields are now shown in `age-rating get --output table` and `--output markdown`. ### 3. Table-driven parsing Refactored `buildAgeRatingAttributes` from ~130 lines of repetitive blocks into two declarative tables with shared loops. Adding a new field now requires one table entry instead of changes in three places. ### 4. Graceful whatsNew handling When uploading version localizations for an initial release, the API rejects the whatsNew field. The CLI now catches this, warns the user, and retries without it. ### 5. Fix OptionalBool space-separated flag parsing `OptionalBool` implemented `IsBoolFlag()` returning `true`, which tells Go's flag package to treat the flag like a built-in bool: `--flag value` is parsed as `--flag` (implicit true) + positional arg. This broke `--available-in-new-territories true` and any other OptionalBool flag using space-separated syntax. **Fix:** Remove `IsBoolFlag()` entirely so the parser always expects an explicit value. Both `--flag=true` and `--flag true` work correctly after this change. ### 6. Cleanup - Removed deprecated `--seventeen-plus` flag (not in Apple's current API spec) - Removed dead nil-checks for fields that were never set by the CLI ## Files changed | File | What changed | |------|-------------| | `internal/asc/age_rating.go` | Added 10 missing struct fields | | `internal/asc/output_age_rating.go` | Added all new fields to table/markdown output | | `internal/asc/output_test.go` | Tests verify new fields appear in output | | `internal/cli/agerating/age_rating.go` | Table-driven parsing, new CLI flags, removed seventeen-plus | | `internal/cli/agerating/age_rating_test.go` | Tests for bool/enum parsing, invalid values | | `internal/cli/shared/localizations.go` | whatsNew retry logic | | `internal/cli/shared/optional_bool.go` | Removed IsBoolFlag() to fix space-separated parsing | ## Test plan - [x] `go test ./internal/cli/agerating/` - all pass - [x] `go test ./internal/asc/` - all pass - [x] `go test ./internal/cli/shared/` - all pass - [x] `go test ./internal/cli/apps/` - all pass - [x] Verified age rating set/get against live app - [x] Verified whatsNew retry on v1.0 submission - [x] Verified --available-in-new-territories true (space-separated) works after fix --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 22:31:28 +03:00
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#549
No description provided.