Skip to content

Hide unavailable New Version action - #37

Merged
NayanBhut merged 1 commit into
mainfrom
codex/guard-new-version-action
Oct 11, 2026
Merged

NayanBhut merged 1 commit into
mainfrom
codex/guard-new-version-action

Conversation

@NayanBhut

Copy link
Copy Markdown
Owner

📋 PR Description

Hide the App Store Versions toolbar action when the selected app is not eligible to create another version.

What changed?

  • Reuse ReviewsViewModel.canCreateAppStoreVersion to conditionally show the toolbar's New Version button.
  • Prevent apps with an existing draft or pending version from opening a form that cannot succeed.
  • Add the existing review.new-version accessibility identifier to the toolbar action for UI-test targeting.

Test Scenarios Covered

  • New feature added
  • Bug fix
  • UI changes
  • Swift build passes
  • Ollama Cloud PR Review passes

Ollama Cloud Review

Pending automated review after PR creation.

Checklist

  • Code compiles and builds successfully
  • No breaking changes
  • Self-reviewed my code

Verification

  • plutil -lint "App Store.xcodeproj/project.pbxproj"
  • xcodebuild test -project "App Store.xcodeproj" -scheme "App Store" -destination 'platform=macOS' -only-testing:"App Store Tests/ValidationTests/testVersionCaseStateUsesSpecifiedLivePendingAndIgnoredStates" CODE_SIGNING_ALLOWED=NO -skipMacroValidation
  • xcodebuild -project "App Store.xcodeproj" -scheme "App Store" -sdk macosx -configuration Debug CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY="" build -skipMacroValidation

🤖 Automated Review Notice

This PR triggers an automated Ollama Cloud review using kimi-k3:cloud.
The review posts as a comment on this PR and is updated in place on every push.

  • Add [skip-review] to your PR title to skip the LLM review
  • Add [smoke-test] to your PR title for a quick connectivity check only

@github-actions

Copy link
Copy Markdown

🤖 Ollama Cloud PR Review (Model: kimi-k3:cloud)

PR Review: AppDetailView.swift

Overall this is a small, safe change: the "New Version" button is now gated behind a capability check and gains a test hook. No crashes or logic errors introduced. A few low-severity notes:


  • [IMPROVEMENT]
  • Severity: [LOW]
  • File: AppDetailView.swift (line 123)
  • Description: The button is fully hidden when canCreateAppStoreVersion is false. Hiding is the right call if the restriction is state-based (e.g., an editable version already exists), but if it's permission-based (user role in App Store Connect), hiding removes discoverability — the user has no way to learn why the action is unavailable, and no else branch explains it.
  • Suggestion: If this is a permissions gate, consider rendering the button in a disabled state with a .help("...") tooltip or an explanatory label, e.g.:
    Button("New Version") { releaseSection.newVersionRequested = true }
        .buttonStyle(.launchPrimary)
        .controlSize(.small)
        .disabled(!reviewsVM.canCreateAppStoreVersion)
        .help(reviewsVM.canCreateAppStoreVersion ? "" : "Requires the App Manager or Admin role")
        .accessibilityIdentifier("review.new-version")

  • [BUG]
  • Severity: [LOW]
  • File: AppDetailView.swift (line 123)
  • Description: If canCreateAppStoreVersion is derived from asynchronously loaded data (roles/permissions fetched from the App Store Connect API), the button will pop into the layout after the view appears (causing a layout shift and potentially intercepting a tap), or — worse, if the default is true before the fetch completes — briefly appear for users who can't actually create a version. This is speculative since the VM isn't in the diff, but worth verifying.
  • Suggestion: Confirm the flag's initial value is false (fail-closed) and only flips to true after the capability data loads. If load order isn't guaranteed, gate the header controls on a loaded state to avoid flicker.

  • [BEST PRACTICE]
  • Severity: [LOW]
  • File: AppDetailView.swift (line 123)
  • Description: A release/release-train action ("New Version") is gated by a property living on reviewsVM, which appears to own a different feature (review submissions). This couples the release UI to an unrelated view model; if the release section is ever shown without reviewsVM being populated, the button silently disappears.
  • Suggestion: Consider exposing the capability from a shared permissions/entitlements object or the release section's own view model, so the gate's lifetime matches the UI it controls.

  • [SECURITY]
  • Severity: [LOW]
  • File: AppDetailView.swift (line 123)
  • Description: Hiding a button is a UX control, not a security boundary — the flag only stops the UI from setting newVersionRequested.
  • Suggestion: Ensure the actual version-creation path (the flow triggered by newVersionRequested / the API layer) also validates the capability server-side or before issuing the request, so a stale or bypassed UI state can't trigger creation for unauthorized users.

Positive notes: 👍 Adding accessibilityIdentifier("review.new-version") is great for UI test stability. Longer term, consider centralizing identifiers in a constants enum rather than string literals scattered through views. The conditional-wrapping itself is correct SwiftUI — modifiers are cleanly scoped inside the if block.

No blocking issues — safe to merge after considering the hidden-vs-disabled UX question above.


Automated review by Ollama Cloud. The diff is untrusted input; findings may be inaccurate. If this review seems wrong, please provide feedback.

@NayanBhut
NayanBhut merged commit aeb2ae0 into main Oct 11, 2026
4 checks passed
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