Skip to content

fix(release-group): Enhance handling of yanked releases#6231

Open
prathameshkurunkar7 wants to merge 5 commits into
frappe:developfrom
prathameshkurunkar7:fix-if-not-first-deploy-show-last-stable-release-if-latest-was-yanked
Open

fix(release-group): Enhance handling of yanked releases#6231
prathameshkurunkar7 wants to merge 5 commits into
frappe:developfrom
prathameshkurunkar7:fix-if-not-first-deploy-show-last-stable-release-if-latest-was-yanked

Conversation

@prathameshkurunkar7

Copy link
Copy Markdown
Collaborator

No description provided.

@greptile-apps

greptile-apps Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR enhances the handling of yanked releases in get_next_apps by replacing the previous silent suppression behavior (setting latest_app_releases = []) with two distinct responses: throwing a user-facing error when all releases are yanked, and surfacing only the last stable release for apps with erroneous marketplace sources. It also introduces a is_first_deploy flag to avoid showing stale releases on a fresh bench.

Key changes:

  • frappe.throw is now raised when all releases of an app are yanked, prompting the user to remove the app from the bench.
  • For erroneous marketplace app sources, the last "Stable" release is shown on subsequent deploys and nothing is shown on first deploy.
  • is_first_deploy derived from self.last_dc_info is None is used to gate the fallback release behavior.

Issues found:

  • find() returns None when no "Stable" release exists; [None] is then passed as latest_app_releases, causing an AttributeError at release.creation in the filtering loop downstream.
  • When latest_app_releases is an empty list (app source has no releases), both len(yanked_releases) and len(latest_app_releases) are 0, so the 0 == 0 guard incorrectly triggers frappe.throw even though no releases are yanked.

Confidence Score: 3/5

Not safe to merge without fixing the two logic bugs that can cause AttributeError and spurious errors for apps with no releases.

The intent of the PR is sound, but there are two concrete bugs: (1) find() returning None leading to [None] in the releases list and an AttributeError downstream, and (2) frappe.throw firing when an app simply has zero releases (empty-list equality check). Both can surface in production and break normal deploy flows.

press/press/doctype/release_group/release_group.py — specifically the get_next_apps method around lines 1399–1410.

Important Files Changed

Filename Overview
press/press/doctype/release_group/release_group.py Modifies get_next_apps to throw when all releases are yanked and to show last stable release for erroneous marketplace sources; introduces two bugs: find() can return None producing [None] in the releases list causing AttributeError downstream, and frappe.throw fires incorrectly when latest_app_releases is an empty list.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[get_next_apps loop over apps] --> B{app in mandatory_upgrades?}
    B -- Yes --> C[Use mandatory release, continue]
    B -- No --> D[Fetch latest_app_releases for source]
    D --> E[Query yanked_releases hashes]
    E --> F{len yanked == len latest\nOR source is erroneous?}
    F -- No --> J[Use latest_app_releases as-is]
    F -- Yes --> G{len yanked == len latest?}
    G -- Yes --> H["frappe.throw ⚠️\n(BUG: also fires when both == 0)"]
    G -- No --> I["find Stable release\n(BUG: can be None → [None])"]
    I --> I2{is_first_deploy?}
    I2 -- Yes --> K[latest_app_releases = empty]
    I2 -- No --> L[latest_app_releases = last_stable_release]
    J --> M{latest_app_release exists?}
    K --> M
    L --> M
    M -- No --> N[skip app, continue]
    M -- Yes --> O[Filter upcoming_releases by creation date]
    O --> P[Append to next_apps]
Loading

Reviews (1): Last reviewed commit: "Merge branch 'develop' into fix-if-not-f..." | Re-trigger Greptile

Comment thread press/press/doctype/release_group/release_group.py Outdated
Comment thread press/press/doctype/release_group/release_group.py
@codecov

codecov Bot commented Apr 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.93%. Comparing base (1a00f0e) to head (243c7ee).
⚠️ Report is 43 commits behind head on develop.

Files with missing lines Patch % Lines
press/press/doctype/release_group/release_group.py 14.28% 6 Missing ⚠️

❌ Your patch check has failed because the patch coverage (14.28%) is below the target coverage (75.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6231      +/-   ##
===========================================
- Coverage    55.93%   55.93%   -0.01%     
===========================================
  Files          908      910       +2     
  Lines        75685    75845     +160     
  Branches       525      525              
===========================================
+ Hits         42334    42423      +89     
- Misses       33323    33394      +71     
  Partials        28       28              
Flag Coverage Δ
dashboard 90.75% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

# if the app source is erroneous, then we need to show the last stable release
# if it is not the first deploy, then we need to show last stable release and show no releases if it is the first deploy
last_stable_release = find(latest_app_releases, lambda x: x.status == "Stable")
if last_stable_release:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if a Stable status exists

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